S2OPC OPCUA Toolkit
Loading...
Searching...
No Matches
sopc_eth_sockets.h
Go to the documentation of this file.
1/*
2 * Licensed to Systerel under one or more contributor license
3 * agreements. See the NOTICE file distributed with this work
4 * for additional information regarding copyright ownership.
5 * Systerel licenses this file to you under the Apache
6 * License, Version 2.0 (the "License"); you may not use this
7 * file except in compliance with the License. You may obtain
8 * a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19
28// TODO: only Linux implementation provided
29
30#ifndef SOPC_ETH_SOCKETS_H_
31#define SOPC_ETH_SOCKETS_H_
32
33#include <stdbool.h>
34
35#include "sopc_raw_sockets.h"
36
37#include "sopc_buffer.h"
38#include "sopc_enums.h"
39
40// Ethernet header size includes DMAC (6) + SMAC (6) + TYPE (2)
41#define ETHERNET_HEADER_SIZE 14
42
51
68 const char* destMACaddr,
70
94 bool recvMulticast,
95 const char* destMACaddr,
96 const char* sourceMACaddr,
98
114 bool setNonBlocking,
115 SOPC_Socket* sock);
116
128 bool setNonBlocking,
129 SOPC_Socket* sock);
130
145 const SOPC_ETH_Socket_SendAddressInfo* sendAddrInfo,
146 uint16_t etherType,
147 SOPC_Buffer* buffer);
148
171 const SOPC_ETH_Socket_ReceiveAddressInfo* receiveAddrInfo,
172 bool checkEtherType,
173 uint16_t etherType,
174 SOPC_Buffer* buffer);
175
182
183#endif /* SOPC_ETH_SOCKETS_H_ */
A buffer of bytes with a maximum size, length and position.
enum _SOPC_ReturnStatus SOPC_ReturnStatus
Common enumerations for S2OPC.
SOPC_ReturnStatus SOPC_ETH_Socket_SendTo(SOPC_Socket sock, const SOPC_ETH_Socket_SendAddressInfo *sendAddrInfo, uint16_t etherType, SOPC_Buffer *buffer)
Send data through the ETH socket to given IP address and port.
struct SOPC_ETH_Socket_SendAddressInfo SOPC_ETH_Socket_SendAddressInfo
Socket addressing information for sending operation type.
Definition sopc_eth_sockets.h:46
void SOPC_ETH_Socket_Close(SOPC_Socket *sock)
Close the socket connection and/or clear the socket.
SOPC_ReturnStatus SOPC_ETH_Socket_CreateToReceive(SOPC_ETH_Socket_ReceiveAddressInfo *receiveAddrInfo, bool setNonBlocking, SOPC_Socket *sock)
Create a new ETH socket, bind it using and add membership for multicast if active in receiveAddrInfo....
SOPC_ReturnStatus SOPC_ETH_Socket_ReceiveFrom(SOPC_Socket sock, const SOPC_ETH_Socket_ReceiveAddressInfo *receiveAddrInfo, bool checkEtherType, uint16_t etherType, SOPC_Buffer *buffer)
Receive data on the ETH socket from given address info.
SOPC_ReturnStatus SOPC_ETH_Socket_CreateReceiveAddressInfo(const char *interfaceName, bool recvMulticast, const char *destMACaddr, const char *sourceMACaddr, SOPC_ETH_Socket_ReceiveAddressInfo **recvAddInfo)
Create a new address information for packet reception.
SOPC_ReturnStatus SOPC_ETH_Socket_CreateSendAddressInfo(const char *interfaceName, const char *destMACaddr, SOPC_ETH_Socket_SendAddressInfo **sendAddInfo)
Create a new address information for packet sending.
struct SOPC_ETH_Socket_ReceiveAddressInfo SOPC_ETH_Socket_ReceiveAddressInfo
Socket addressing information for listening operation type.
Definition sopc_eth_sockets.h:50
SOPC_ReturnStatus SOPC_ETH_Socket_CreateToSend(SOPC_ETH_Socket_SendAddressInfo *sendAddrInfo, bool setNonBlocking, SOPC_Socket *sock)
Create a new ETH socket using sendAddrInfo properties.
A platform independent API to use sockets.
Bytes buffer structure.
Definition sopc_buffer.h:38
Socket base type.
Definition p_sopc_sockets.h:36