S2OPC OPCUA Toolkit
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 // Platform dependent types
36 #include "p_sopc_sockets.h"
37 
38 #include "sopc_buffer.h"
39 #include "sopc_enums.h"
40 
41 // Ethernet header size includes DMAC (6) + SMAC (6) + TYPE (2)
42 #define ETHERNET_HEADER_SIZE 14
43 
52 
69  const char* destMACaddr,
70  SOPC_ETH_Socket_SendAddressInfo** sendAddInfo);
71 
95  bool recvMulticast,
96  const char* destMACaddr,
97  const char* sourceMACaddr,
99 
115  bool setNonBlocking,
116  Socket* sock);
117 
129  bool setNonBlocking,
130  Socket* sock);
131 
146  const SOPC_ETH_Socket_SendAddressInfo* sendAddrInfo,
147  uint16_t etherType,
148  SOPC_Buffer* buffer);
149 
172  const SOPC_ETH_Socket_ReceiveAddressInfo* receiveAddrInfo,
173  bool checkEtherType,
174  uint16_t etherType,
175  SOPC_Buffer* buffer);
176 
183 
184 #endif /* SOPC_ETH_SOCKETS_H_ */
SOPC_ETH_Socket_Close
void SOPC_ETH_Socket_Close(Socket *sock)
Close the socket connection and/or clear the socket.
SOPC_ETH_Socket_CreateToSend
SOPC_ReturnStatus SOPC_ETH_Socket_CreateToSend(SOPC_ETH_Socket_SendAddressInfo *sendAddrInfo, bool setNonBlocking, Socket *sock)
Create a new ETH socket using sendAddrInfo properties.
SOPC_ETH_Socket_CreateSendAddressInfo
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.
SOPC_ETH_Socket_ReceiveFrom
SOPC_ReturnStatus SOPC_ETH_Socket_ReceiveFrom(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_Buffer
Bytes buffer structure.
Definition: sopc_buffer.h:38
sopc_enums.h
SOPC_ETH_Socket_SendAddressInfo
struct SOPC_ETH_Socket_SendAddressInfo SOPC_ETH_Socket_SendAddressInfo
Socket addressing information for sending operation type.
Definition: sopc_eth_sockets.h:47
SOPC_ETH_Socket_CreateToReceive
SOPC_ReturnStatus SOPC_ETH_Socket_CreateToReceive(SOPC_ETH_Socket_ReceiveAddressInfo *receiveAddrInfo, bool setNonBlocking, Socket *sock)
Create a new ETH socket, bind it using and add membership for multicast if active in receiveAddrInfo....
SOPC_ETH_Socket_SendTo
SOPC_ReturnStatus SOPC_ETH_Socket_SendTo(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.
Socket_t
Definition: p_sopc_sockets.h:30
SOPC_ETH_Socket_CreateReceiveAddressInfo
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_ETH_Socket_ReceiveAddressInfo
struct SOPC_ETH_Socket_ReceiveAddressInfo SOPC_ETH_Socket_ReceiveAddressInfo
Socket addressing information for listening operation type.
Definition: sopc_eth_sockets.h:51
sopc_buffer.h
A buffer of bytes with a maximum size, length and position.
SOPC_ReturnStatus
SOPC_ReturnStatus
Definition: libs2opc_client.h:64