S2OPC OPCUA Toolkit
sopc_raw_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 
26 #ifndef SOPC_RAW_SOCKETS_H_
27 #define SOPC_RAW_SOCKETS_H_
28 
29 #include <stdbool.h>
30 #include <stdint.h>
31 #include "sopc_enums.h"
32 
33 // Platform dependent types
41 #include "p_sopc_sockets.h"
42 
59  unsigned int firstProbeDelay,
60  unsigned int interval,
61  unsigned int counter);
62 
73 
78 
83 
97 
107 
117 
126 
136 
146 
158 SOPC_ReturnStatus SOPC_SocketAddress_GetNameInfo(const SOPC_Socket_Address* addr, char** host, char** service);
159 
168 
175 
189  bool setReuseAddr,
190  bool setNonBlocking,
191  Socket* sock);
192 
204 
217 SOPC_ReturnStatus SOPC_Socket_Accept(Socket listeningSock, bool setNonBlocking, Socket* acceptedSock);
218 
232 
246 
260 
268 
284 
299  SOPC_SocketSet* writeSet,
300  SOPC_SocketSet* exceptSet,
301  uint32_t waitMs);
302 
317 SOPC_ReturnStatus SOPC_Socket_Write(Socket sock, const uint8_t* data, uint32_t count, uint32_t* sentBytes);
318 
333 SOPC_ReturnStatus SOPC_Socket_Read(Socket sock, uint8_t* data, uint32_t dataSize, uint32_t* readCount);
334 
345 SOPC_ReturnStatus SOPC_Socket_BytesToRead(Socket sock, uint32_t* bytesToRead);
346 
353 
354 #endif /* SOPC_RAW_SOCKETS_H_ */
SOPC_SocketSet_IsPresent
bool SOPC_SocketSet_IsPresent(Socket sock, SOPC_SocketSet *sockSet)
Returns if a socket is present in the given socket set.
SOPC_Socket_Address
struct addrinfo SOPC_Socket_Address
Socket address information on a connected socket.
Definition: p_sopc_sockets.h:50
SOPC_Socket_AddrInfo_IsIPV6
uint8_t SOPC_Socket_AddrInfo_IsIPV6(const SOPC_Socket_AddressInfo *addr)
Given a socket addressing information element, returns 0 if address is not IPV6 and not 0 value other...
SOPC_SocketAddress_Delete
void SOPC_SocketAddress_Delete(SOPC_Socket_Address **addr)
Deallocate a socket address obtained with SOPC_Socket_GetPeerAddress or SOPC_Socket_CopyAddress.
SOPC_Socket_WaitSocketEvents
int32_t SOPC_Socket_WaitSocketEvents(SOPC_SocketSet *readSet, SOPC_SocketSet *writeSet, SOPC_SocketSet *exceptSet, uint32_t waitMs)
Wait for events (read, write and exception) on the sockets in the given sets for a given duration....
SOPC_Socket_GetPeerAddress
SOPC_Socket_Address * SOPC_Socket_GetPeerAddress(Socket sock)
Given a socket get the address information associated to the peer connected to the socket.
SOPC_Socket_Listen
SOPC_ReturnStatus SOPC_Socket_Listen(Socket sock, SOPC_Socket_AddressInfo *addr)
Configure the socket to listen connections using the given addressing information Connection on a lis...
SOPC_SocketAddress_GetNameInfo
SOPC_ReturnStatus SOPC_SocketAddress_GetNameInfo(const SOPC_Socket_Address *addr, char **host, char **service)
Get address information as C strings from the given socket address.
SOPC_Socket_CreateNew
SOPC_ReturnStatus SOPC_Socket_CreateNew(SOPC_Socket_AddressInfo *addr, bool setReuseAddr, bool setNonBlocking, Socket *sock)
Create a new socket using the addressing information provided.
SOPC_Socket_AddrInfoDelete
void SOPC_Socket_AddrInfoDelete(SOPC_Socket_AddressInfo **addrs)
Deallocate a linked list of socket addressing information.
SOPC_Socket_Write
SOPC_ReturnStatus SOPC_Socket_Write(Socket sock, const uint8_t *data, uint32_t count, uint32_t *sentBytes)
Write data through the socket.
SOPC_Socket_AddrInfo_Get
SOPC_ReturnStatus SOPC_Socket_AddrInfo_Get(char *hostname, char *port, SOPC_Socket_AddressInfo **addrs)
Provide a linked list of socket addressing information for establishing TCP connections over IPV4 and...
SOPC_Socket_Network_Initialize
bool SOPC_Socket_Network_Initialize(void)
Initialize the network communication allowing to use sockets.
SOPC_Socket_CheckAckConnect
SOPC_ReturnStatus SOPC_Socket_CheckAckConnect(Socket sock)
Operation to check connection establishment result on a connecting socket After using SOPC_Socket_Con...
sopc_enums.h
SOPC_Socket_Connect
SOPC_ReturnStatus SOPC_Socket_Connect(Socket sock, SOPC_Socket_AddressInfo *addr)
Operation to establish a connection using the given socket and addressing information Connection esta...
SOPC_Socket_Clear
void SOPC_Socket_Clear(Socket *sock)
Clear socket state to an invalid socket.
SOPC_SocketSet_Add
void SOPC_SocketSet_Add(Socket sock, SOPC_SocketSet *sockSet)
Add a socket to the given socket set.
SOPC_SocketSet_Clear
void SOPC_SocketSet_Clear(SOPC_SocketSet *sockSet)
Clear a socket set.
SOPC_Socket_Network_Enable_Keepalive
SOPC_ReturnStatus SOPC_Socket_Network_Enable_Keepalive(Socket sock, unsigned int firstProbeDelay, unsigned int interval, unsigned int counter)
Activate the keep alive mechanism. According to RFC1122, this mechanism shall be used with care: deac...
SOPC_Socket_AddrInfo_IterNext
SOPC_Socket_AddressInfo * SOPC_Socket_AddrInfo_IterNext(SOPC_Socket_AddressInfo *addr)
Given a socket addressing information element of a linked list, provides the next addressing informat...
SOPC_Socket_Network_Disable_Keepalive
SOPC_ReturnStatus SOPC_Socket_Network_Disable_Keepalive(Socket sock)
Deactivate the keep alive mechanism.
SOPC_Socket_ConnectToLocal
SOPC_ReturnStatus SOPC_Socket_ConnectToLocal(Socket from, Socket to)
Operation to establish a connection using the given socket to the given local socket....
SOPC_Socket_Network_Clear
bool SOPC_Socket_Network_Clear(void)
Clear the network communication when sockets not used anymore.
SOPC_SocketSet
Set of sockets type.
Definition: p_sopc_sockets.h:56
SOPC_Socket_Read
SOPC_ReturnStatus SOPC_Socket_Read(Socket sock, uint8_t *data, uint32_t dataSize, uint32_t *readCount)
Read data through the socket.
SOPC_Socket_BytesToRead
SOPC_ReturnStatus SOPC_Socket_BytesToRead(Socket sock, uint32_t *bytesToRead)
Retrieve number of bytes available to read on the socket.
SOPC_Socket_Accept
SOPC_ReturnStatus SOPC_Socket_Accept(Socket listeningSock, bool setNonBlocking, Socket *acceptedSock)
Operation to accept a connection on a listening socket Connection on a listening socket is detected w...
SOPC_Socket_AddressInfo
struct addrinfo SOPC_Socket_AddressInfo
Socket addressing information for listening or connecting operation type.
Definition: p_sopc_sockets.h:45
SOPC_Socket_Close
void SOPC_Socket_Close(Socket *sock)
Close the socket connection and/or clear the socket.
Socket_t
Definition: p_sopc_sockets.h:30
SOPC_Socket_CopyAddress
SOPC_Socket_Address * SOPC_Socket_CopyAddress(SOPC_Socket_AddressInfo *addr)
Copy the socket address from a socket address information.
SOPC_ReturnStatus
SOPC_ReturnStatus
Definition: libs2opc_client.h:64