Macros | Functions
sbgInterfaceUdp.c File Reference
#include "sbgInterfaceUdp.h"
#include <arpa/inet.h>
#include <netinet/in.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <unistd.h>
#include <fcntl.h>
Include dependency graph for sbgInterfaceUdp.c:

Go to the source code of this file.

Macros

#define closesocket(socket)   close(socket);
 
#define INVALID_SOCKET   (SOCKET)(~0)
 
#define NO_ERROR   (0)
 
#define SD_BOTH   (2)
 
#define SOCKADDR   struct sockaddr
 
#define SOCKADDR_IN   struct sockaddr_in
 
#define SOCKET   int
 
#define SOCKET_ERROR   (-1)
 

Functions

SbgErrorCode sbgInterfaceUdpAllowBroadcast (SbgInterface *pHandle, bool allowBroadcast)
 
SbgErrorCode sbgInterfaceUdpCreate (SbgInterface *pHandle, sbgIpAddress remoteAddr, uint32 remotePort, uint32 localPort)
 
SbgErrorCode sbgInterfaceUdpDestroy (SbgInterface *pHandle)
 
SbgErrorCode sbgInterfaceUdpInitSockets (void)
 
SbgErrorCode sbgInterfaceUdpRead (SbgInterface *pHandle, void *pBuffer, size_t *pReadBytes, size_t bytesToRead)
 
SbgErrorCode sbgInterfaceUdpSetSocketBlocking (SOCKET socketHandle, bool blocking)
 
SbgErrorCode sbgInterfaceUdpWrite (SbgInterface *pHandle, const void *pBuffer, size_t bytesToWrite)
 
SbgErrorCode sbgInterfaceUpdateCloseSockets (void)
 

Macro Definition Documentation

#define closesocket (   socket)    close(socket);

Definition at line 24 of file sbgInterfaceUdp.c.

#define INVALID_SOCKET   (SOCKET)(~0)

Definition at line 19 of file sbgInterfaceUdp.c.

#define NO_ERROR   (0)

Definition at line 21 of file sbgInterfaceUdp.c.

#define SD_BOTH   (2)

Definition at line 22 of file sbgInterfaceUdp.c.

#define SOCKADDR   struct sockaddr

Definition at line 17 of file sbgInterfaceUdp.c.

#define SOCKADDR_IN   struct sockaddr_in

Definition at line 16 of file sbgInterfaceUdp.c.

#define SOCKET   int

Definition at line 18 of file sbgInterfaceUdp.c.

#define SOCKET_ERROR   (-1)

Definition at line 20 of file sbgInterfaceUdp.c.

Function Documentation

SbgErrorCode sbgInterfaceUdpAllowBroadcast ( SbgInterface pHandle,
bool  allowBroadcast 
)

Define if a socket can send broadcasted packets.

Parameters
[in]pInterfacePointer on a valid UDP interface created using sbgInterfaceUdpCreate.
[in]allowBroadcastSet to true to allow this socket to send broadcasted UDP packets.
Returns
SBG_NO_ERROR if the allow broadcast status has been changed.

Definition at line 376 of file sbgInterfaceUdp.c.

SbgErrorCode sbgInterfaceUdpCreate ( SbgInterface pHandle,
sbgIpAddress  remoteAddr,
uint32  remotePort,
uint32  localPort 
)

Initialize an unconnected UDP interface for read and write operations. An UDP interface can send some data to an output ip address and port and read all received data on a input port.

Parameters
[in]pHandlePointer on an allocated interface instance to initialize.
[in]remoteAddrIP address to send data to.
[in]remotePortEthernet port to send data to.
[in]localPortEhternet port on which the interface is listening.
Returns
SBG_NO_ERROR if the interface has been created.

Definition at line 158 of file sbgInterfaceUdp.c.

SbgErrorCode sbgInterfaceUdpDestroy ( SbgInterface pHandle)

Destroy an interface initialized using sbgInterfaceUdpCreate.

Parameters
[in]pInterfacePointer on a valid UDP interface created using sbgInterfaceUdpCreate.
Returns
SBG_NO_ERROR if the interface has been closed and released.

Definition at line 318 of file sbgInterfaceUdp.c.

SbgErrorCode sbgInterfaceUdpInitSockets ( void  )

Initialize the socket API.

Returns
SBG_NO_ERROR if the socket API has been correctly initialized.

Definition at line 36 of file sbgInterfaceUdp.c.

SbgErrorCode sbgInterfaceUdpRead ( SbgInterface pHandle,
void *  pBuffer,
size_t *  pReadBytes,
size_t  bytesToRead 
)

Try to read some data from an interface.

Parameters
[in]pHandleValid handle on an initialized interface.
[in]pBufferPointer on an allocated buffer that can hold at least bytesToRead bytes of data.
[out]pReadBytesPointer on an uint32 used to return the number of read bytes.
[in]bytesToReadNumber of bytes we would like to read.
Returns
SBG_NO_ERROR if no error occurs, please check the number of received bytes.

Definition at line 541 of file sbgInterfaceUdp.c.

SbgErrorCode sbgInterfaceUdpSetSocketBlocking ( SOCKET  socketHandle,
bool  blocking 
)

Define if a socket should block or not on receive and send calls.

Parameters
[in]socketHandleThe socket handle to change.
[in]blockingSet to true for a blocking socket or false for a non blocking socket.
Returns
SBG_NO_ERROR if the blocking status has been changed.

Definition at line 92 of file sbgInterfaceUdp.c.

SbgErrorCode sbgInterfaceUdpWrite ( SbgInterface pHandle,
const void *  pBuffer,
size_t  bytesToWrite 
)

Try to write some data to an interface.

Parameters
[in]pHandleValid handle on an initialized interface.
[in]pBufferPointer on an allocated buffer that contains the data to write
[in]bytesToWriteNumber of bytes we would like to write.
Returns
SBG_NO_ERROR if all bytes have been written successfully.

Definition at line 442 of file sbgInterfaceUdp.c.

SbgErrorCode sbgInterfaceUpdateCloseSockets ( void  )

Uninitialize the socket API.

Returns
SBG_NO_ERROR if the socket API has been uninitialized.

Definition at line 64 of file sbgInterfaceUdp.c.



sbg_driver
Author(s):
autogenerated on Sun Jan 27 2019 03:42:20