26#ifndef SOPC_RAW_SOCKETS_H_
27#define SOPC_RAW_SOCKETS_H_
39#define SOPC_INVALID_SOCKET NULL
75 unsigned int firstProbeDelay,
76 unsigned int interval,
77 unsigned int counter);
enum _SOPC_ReturnStatus SOPC_ReturnStatus
Common enumerations for S2OPC.
SOPC_ReturnStatus SOPC_Socket_Connect(SOPC_Socket sock, SOPC_Socket_AddressInfo *addr)
Operation to establish a connection using the given socket and addressing information Connection esta...
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...
bool SOPC_Socket_Network_Initialize(void)
Initialize the network communication allowing to use sockets.
SOPC_Socket_Address * SOPC_Socket_GetPeerAddress(SOPC_Socket sock)
Given a socket get the address information associated to the peer connected to the socket.
SOPC_Socket_Impl * SOPC_Socket
Definition sopc_raw_sockets.h:38
SOPC_Socket_Address * SOPC_Socket_CopyAddress(SOPC_Socket_AddressInfo *addr)
Copy the socket address from a socket address information.
SOPC_ReturnStatus SOPC_Socket_BytesToRead(SOPC_Socket sock, uint32_t *bytesToRead)
Retrieve number of bytes available to read on the socket.
void SOPC_SocketSet_Delete(SOPC_SocketSet **set)
Delete the pointed socket set and set the pointer to NULL.
SOPC_ReturnStatus SOPC_Socket_Read(SOPC_Socket sock, uint8_t *data, uint32_t dataSize, uint32_t *readCount)
Read data through the socket.
void SOPC_SocketAddress_Delete(SOPC_Socket_Address **addr)
Deallocate a socket address obtained with SOPC_Socket_GetPeerAddress or SOPC_Socket_CopyAddress.
bool SOPC_Socket_Network_Clear(void)
Clear the network communication when sockets not used anymore.
SOPC_ReturnStatus SOPC_Socket_ConnectToLocal(SOPC_Socket from, SOPC_Socket to)
Operation to establish a connection using the given socket to the given local socket....
SOPC_ReturnStatus SOPC_Socket_Write(SOPC_Socket sock, const uint8_t *data, uint32_t count, uint32_t *sentBytes)
Write data through the socket.
SOPC_ReturnStatus SOPC_Socket_CheckAckConnect(SOPC_Socket sock)
Operation to check connection establishment result on a connecting socket After using SOPC_Socket_Con...
void SOPC_Socket_Clear(SOPC_Socket *sock)
Clear socket state to an invalid socket.
void SOPC_Socket_Close(SOPC_Socket *sock)
Close the socket connection and/or clear the socket.
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...
void SOPC_SocketSet_Clear(SOPC_SocketSet *sockSet)
Clear a socket set.
SOPC_ReturnStatus SOPC_Socket_Network_Enable_Keepalive(SOPC_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_ReturnStatus SOPC_Socket_Network_Disable_Keepalive(SOPC_Socket sock)
Deactivate the keep alive mechanism.
SOPC_ReturnStatus SOPC_Socket_AddrInfo_Get(const char *hostname, const char *port, SOPC_Socket_AddressInfo **addrs)
Provide a linked list of socket addressing information for establishing TCP connections over IPV4 and...
SOPC_ReturnStatus SOPC_Socket_Listen(SOPC_Socket sock, SOPC_Socket_AddressInfo *addr)
Configure the socket to listen connections using the given addressing information Connection on a lis...
SOPC_ReturnStatus SOPC_Socket_CreateNew(SOPC_Socket_AddressInfo *addr, bool setReuseAddr, bool setNonBlocking, SOPC_Socket *sock)
Create a new socket using the addressing information provided.
bool SOPC_SocketSet_IsPresent(SOPC_Socket sock, SOPC_SocketSet *sockSet)
Returns if a socket is present in the given socket set.
SOPC_ReturnStatus SOPC_Socket_Accept(SOPC_Socket listeningSock, bool setNonBlocking, SOPC_Socket *acceptedSock)
Operation to accept a connection on a listening socket Connection on a listening socket is detected w...
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....
void SOPC_Socket_AddrInfoDelete(SOPC_Socket_AddressInfo **addrs)
Deallocate a linked list of socket addressing information.
void SOPC_SocketSet_Add(SOPC_Socket sock, SOPC_SocketSet *sockSet)
Add a socket to the given socket set.
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_SocketSet * SOPC_SocketSet_Create(void)
Create a socket set.
Set of sockets type.
Definition p_sopc_sockets.h:63
fd_set set
Definition p_sopc_sockets.h:65
Socket addressing information for listening or connecting operation type.
Definition p_sopc_sockets.h:46
Socket address information on a connected socket.
Definition p_sopc_sockets.h:55
Socket base type.
Definition p_sopc_sockets.h:36