![]() |
librnr
1.14.5
RoadNarrows Robotics Common Library 1
|
Socket Sets services definitions. More...
#include <sys/time.h>#include <sys/select.h>#include "rnr/rnrconfig.h"#include "rnr/log.h"#include "rnr/sock.h"Go to the source code of this file.
Classes | |
| struct | SockSetIter_T |
Macros | |
| #define | SOCK_SET_ONHOLD 0 |
| on-hold socket descriptor set | |
| #define | SOCK_SET_ACTIVE 1 |
| active socket descriptor set | |
| #define | SOCK_SET_SELECTED 2 |
| post select() selected socket desc. set | |
| #define | SOCK_SET_NUMOF 3 |
| number of managed socket descriptor sets | |
| #define | SOCK_SET_CHK_SET(set, ...) CHKEXPR_INT(set, ((set) >= 0) && ((set) < SOCK_SET_NUMOF), __VA_ARGS__) |
| Check socket set enum. More... | |
Typedefs | |
| typedef struct sockset_t | SockSet_T |
Functions | |
| SockSet_T * | SockSetNew () |
| Allocate a new SockSet. More... | |
| void | SockSetDelete (SockSet_T *pSockSet) |
| Delete an allocated SockSet. More... | |
| int | SockSetAdd (SockSet_T *pSockSet, Socket_T *pSocket, bool_t bActivateRead, bool_t bActivateWrite) |
| Add a Socket to a SockSet. More... | |
| int | SockSetRemove (SockSet_T *pSockSet, Socket_T *pSocket) |
| Remove Socket from SockSet. More... | |
| int | SockSetActivate (SockSet_T *pSockSet, Socket_T *pSocket, bool_t bActivateRead, bool_t bActivateWrite) |
| Activate Socket read/write operations in SockSet. More... | |
| int | SockSetPutOnHold (SockSet_T *pSockSet, Socket_T *pSocket, bool_t bHoldRead, bool_t bHoldWrite) |
| Put Socket read/write operations in SockSet on hold. More... | |
| int | SockSetSelect (SockSet_T *pSockSet, struct timeval *pTimeOut) |
| Perform select() on SockSet's Active sets. More... | |
| Socket_T * | SockSetIterFirst (SockSet_T *pSockSet, int eSet, int eIO, SockSetIter_T *pIter) |
| Start iteration of Sockets in the given set in SockSet. More... | |
| Socket_T * | SockSetIterNext (SockSetIter_T *pIter) |
| Next Socket in iteration over the initialized socket set of SockSet. More... | |
Socket Sets services definitions.
—
Definition in file sockset.h.
| #define SOCK_SET_CHK_SET | ( | set, | |
| ... | |||
| ) | CHKEXPR_INT(set, ((set) >= 0) && ((set) < SOCK_SET_NUMOF), __VA_ARGS__) |
Check socket set enum.
| set | Socket descriptor set enum. |
Definition at line 72 of file sockset.h.
Referenced by SockSetIterFirst().
| int SockSetActivate | ( | SockSet_T * | pSockSet, |
| Socket_T * | pSocket, | ||
| bool_t | bActivateRead, | ||
| bool_t | bActivateWrite | ||
| ) |
Activate Socket read/write operations in SockSet.
Socket is already part of the SockSet.
| pSockSet | Pointer to SockSet. |
| pSocket | Pointer to Socket. |
| bActivateRead | Do [not] add to active read set. |
| bActivateWrite | Do [not] add to active write set. |
Definition at line 377 of file sockset.c.
References CHKPTR, fdclr_nowarn(), fdset_nowarn(), sockset_t::m_sdHighest, sockset_t::m_sdSetActive, sockset_t::m_sdSetOnHold, OK, SOCK_IO_READ, SOCK_IO_WRITE, SOCK_RC_EBADSOCK, SockSetChkSd(), and SockSetFindHighestSd().
| int SockSetAdd | ( | SockSet_T * | pSockSet, |
| Socket_T * | pSocket, | ||
| bool_t | bActivateRead, | ||
| bool_t | bActivateWrite | ||
| ) |
Add a Socket to a SockSet.
Socket is added to either the on-hold or active socket set, depending on the given boolean value.
| pSockSet | Pointer to SockSet. |
| pSocket | Pointer to Socket. |
| bActivateRead | Do [not] add to active read set. |
| bActivateWrite | Do [not] add to active write set. |
Definition at line 272 of file sockset.c.
References _TBOOL, _TPTR, _TSTR, CHKPTR, fdset_nowarn(), LOGDIAG4CALL, sockset_t::m_pSocket, sockset_t::m_sdHighest, sockset_t::m_sdSetActive, sockset_t::m_sdSetOnHold, OK, SOCK_IO_READ, SOCK_IO_WRITE, SOCK_RC_EBADSOCK, SocketAttrGetLocalName(), and SockSetChkSd().
| void SockSetDelete | ( | SockSet_T * | pSockSet | ) |
| Socket_T* SockSetIterFirst | ( | SockSet_T * | pSockSet, |
| int | eSet, | ||
| int | eIO, | ||
| SockSetIter_T * | pIter | ||
| ) |
Start iteration of Sockets in the given set in SockSet.
| pSockSet | Pointer to SockSet. |
| eSet | One of: SOCK_SET_ONHOLD SOCK_SET_ACTIVE SOCK_SET_SELECTED. |
| eIO | One of: SOCK_IO_READ SOCK_IO_WRITE. |
| pIter | SockSet interator. |
Definition at line 548 of file sockset.c.
References CHKPTR, SockSetIter_T::m_eIO, SockSetIter_T::m_eSet, SockSetIter_T::m_pSockSet, SockSetIter_T::m_sdCur, SockSetIter_T::m_sdSet, sockset_t::m_sdSetActive, sockset_t::m_sdSetOnHold, sockset_t::m_sdSetSelect, NULL, SOCK_CHK_IO, SOCK_SET_ACTIVE, SOCK_SET_CHK_SET, SOCK_SET_ONHOLD, SOCK_SET_SELECTED, and SockSetIterNext().
| Socket_T* SockSetIterNext | ( | SockSetIter_T * | pIter | ) |
Next Socket in iteration over the initialized socket set of SockSet.
| pIter | SockSet interator. |
Definition at line 587 of file sockset.c.
References CHKPTR, fdisset_nowarn(), sockset_t::m_pSocket, SockSetIter_T::m_pSockSet, SockSetIter_T::m_sdCur, SockSetIter_T::m_sdSet, and NULL.
Referenced by SockSetIterFirst().
| SockSet_T* SockSetNew | ( | ) |
Allocate a new SockSet.
Definition at line 229 of file sockset.c.
References sockset_t::m_sdHighest, sockset_t::m_sdSetActive, sockset_t::m_sdSetOnHold, sockset_t::m_sdSetSelect, NEW, SOCK_IO_READ, and SOCK_IO_WRITE.
| int SockSetPutOnHold | ( | SockSet_T * | pSockSet, |
| Socket_T * | pSocket, | ||
| bool_t | bHoldRead, | ||
| bool_t | bHoldWrite | ||
| ) |
Put Socket read/write operations in SockSet on hold.
Socket is already part of the SockSet.
| pSockSet | Pointer to SockSet. |
| pSocket | Pointer to Socket. |
| bHoldRead | Do [not] add to hold read set. |
| bHoldWrite | Do [not] add to hold write set. |
Definition at line 429 of file sockset.c.
References CHKPTR, fdclr_nowarn(), fdset_nowarn(), sockset_t::m_sdHighest, sockset_t::m_sdSetActive, sockset_t::m_sdSetOnHold, OK, SOCK_IO_READ, SOCK_IO_WRITE, SOCK_RC_EBADSOCK, SockSetChkSd(), and SockSetFindHighestSd().
Remove Socket from SockSet.
| pSockSet | Pointer to SockSet. |
| pSocket | Pointer to Socket. |
Definition at line 336 of file sockset.c.
References _TPTR, _TSTR, CHKPTR, fdclr_nowarn(), LOGDIAG4CALL, sockset_t::m_pSocket, sockset_t::m_sdHighest, sockset_t::m_sdSetActive, sockset_t::m_sdSetOnHold, NULL, OK, SOCK_IO_READ, SOCK_IO_WRITE, SOCK_RC_EBADSOCK, SocketAttrGetLocalName(), SockSetChkSd(), and SockSetFindHighestSd().
| int SockSetSelect | ( | SockSet_T * | pSockSet, |
| struct timeval * | pTimeOut | ||
| ) |
Perform select() on SockSet's Active sets.
| pSockSet | Pointer to SockSet. |
| pTimeOut | Select time out. |
Definition at line 472 of file sockset.c.
References CHKPTR, LOGERROR, LOGSYSERROR, sockset_t::m_sdHighest, sockset_t::m_sdSetActive, sockset_t::m_sdSetSelect, NULL, SOCK_IO_READ, SOCK_IO_WRITE, SOCK_RC_EBADSOCK, SOCK_RC_EFAIL, and SOCK_RC_ESYSERR.