69 #include <sys/types.h> 70 #include <sys/socket.h> 71 #include <netinet/in.h> 73 #include <arpa/inet.h> 120 return FD_ISSET(fd, pset);
132 return ntohs(huShort);
142 return htons(huShort);
170 for(sd=0, sdHighest=-1; sd <= pSockSet->
m_sdHighest; ++sd)
209 if( sd >= FD_SETSIZE )
211 LOGERROR(
"Socket '%s' descriptor %d > %d: too big",
252 if( pSockSet ==
NULL )
474 struct timeval tvSave = {0, 0};
481 if( pTimeOut !=
NULL )
507 if( pTimeOut !=
NULL )
532 LOGERROR(
"Failed %d times to select()", nTries);
594 for(sd = pIter->
m_sdCur + 1; sd <= pIter->m_pSockSet->m_sdHighest; ++sd)
#define SOCK_IO_READ
read index
#define SOCK_RC_EFAIL
general, unspecified error
int SocketAttrGetSd(Socket_T *pSocket)
Get Socket socket (file) descriptor.
int m_sdCur
current iterator position
#define SOCK_SET_CHK_SET(set,...)
Check socket set enum.
fd_set m_sdSetActive[SOCK_IO_NUMOF]
active socket descriptor set
#define CHKPTR(p,...)
Checks validity of pointer.
#define SOCK_RC_EBADSD
bad/closed socket descriptor
const char * SocketAttrGetLocalName(Socket_T *pSocket)
Get Socket local name.
int SockSetSelect(SockSet_T *pSockSet, struct timeval *pTimeOut)
Perform select() on SockSet's Active sets.
#define SOCK_SET_ACTIVE
active socket descriptor set
static int fdisset_nowarn(int fd, fd_set *pset)
FD_ISSET() wrapper with no annoying warnings.
Memory allocation and deallocation declarations.
Socket_T * SockSetIterNext(SockSetIter_T *pIter)
Next Socket in iteration over the initialized socket set of SockSet.
#define PRAGMA_IGNORED(filter)
Disable compiler warnings on the diagnostics filter.
Socket Sets services definitions.
#define LOGSYSERROR(fmt,...)
Standard System Error logging.
Socket_T * m_pSocket[FD_SETSIZE]
associated sockets
static void fdclr_nowarn(int fd, fd_set *pset)
FD_CLR() wrapper with no annoying warnings.
static int SockSetChkSd(Socket_T *pSocket)
Check if socket is open and within valid range.
#define LOGERROR(fmt,...)
Standard Error logging.
int SockSetActivate(SockSet_T *pSockSet, Socket_T *pSocket, bool_t bActivateRead, bool_t bActivateWrite)
Activate Socket read/write operations in SockSet.
static ushort_t ntohs_nowarn(ushort_t huShort)
ntohs() wrapper with no annoying warnings.
fd_set m_sdSetOnHold[SOCK_IO_NUMOF]
on-hold socket descriptor set
#define SOCK_SET_SELECTED
post select() selected socket desc. set
#define SOCK_SET_ONHOLD
on-hold socket descriptor set
bool_t SocketStateIsOpen(Socket_T *pSocket)
Check if Socket is open.
SockSet_T * m_pSockSet
socket set
int SockSetPutOnHold(SockSet_T *pSockSet, Socket_T *pSocket, bool_t bHoldRead, bool_t bHoldWrite)
Put Socket read/write operations in SockSet on hold.
#define NEW(T)
Allocate new type.
Socket services declarations.
SockSet_T * SockSetNew()
Allocate a new SockSet.
#define SOCK_RC_EBADSOCK
socket is bad
#define SOCK_CHK_IO(io,...)
Check I/O index.
int m_eIO
which read/write subset to iterate over
static ushort_t htons_nowarn(ushort_t huShort)
htons() wrapper with no annoying warnings.
fd_set m_sdSet
set to iterate over
RoadNarrows Robotics common configuration file.
#define _TBOOL(var)
boolean
int SockSetAdd(SockSet_T *pSockSet, Socket_T *pSocket, bool_t bActivateRead, bool_t bActivateWrite)
Add a Socket to a SockSet.
Socket_T * SockSetIterFirst(SockSet_T *pSockSet, int eSet, int eIO, SockSetIter_T *pIter)
Start iteration of Sockets in the given set in SockSet.
#define _TSTR(var)
string variable
#define SOCK_RC_ESYSERR
system error occurred
static void fdset_nowarn(int fd, fd_set *pset)
FD_SET() wrapper with no annoying warnings.
#define _TPTR(var)
pointer
#define LOGDIAG4CALL(...)
Standard Diagnostic Level 4 function call tracing.
#define PRAGMA_WARNING(filter)
Enable compiler warnings on the diagnostics filter.
fd_set m_sdSetSelect[SOCK_IO_NUMOF]
select socket descriptor set
u16_t ushort_t
16-bit unsigned integer
int SockSetRemove(SockSet_T *pSockSet, Socket_T *pSocket)
Remove Socket from SockSet.
int m_sdHighest
highest socket descriptor value
void SockSetDelete(SockSet_T *pSockSet)
Delete an allocated SockSet.
#define SOCK_IO_NUMOF
number of indices
#define SOCK_IO_WRITE
write index
int m_eSet
which socket set to iterate over
static int SockSetFindHighestSd(SockSet_T *pSockSet)
Find the highest socket descriptor number in the Active subset.