librnr/sockset.c
Socket_T *SockSetIterFirst(SockSet_T     *pSockSet,
                           int            eSet,
                           int            eIO,
                           SockSetIter_T *pIter)
{
  CHKPTR(pSockSet, NULL);
  SOCK_SET_CHK_SET(eSet, NULL);
  SOCK_CHK_IO(eIO, NULL);
  CHKPTR(pIter, NULL);

  pIter->m_pSockSet = pSockSet;
  pIter->m_eSet     = eSet;
  pIter->m_eIO      = eIO;
  pIter->m_sdCur    = -1;

  switch(eSet)
  {
    case SOCK_SET_ONHOLD:
      pIter->m_sdSet = pSockSet->m_sdSetOnHold[eIO];
      break;
    case SOCK_SET_ACTIVE:
      pIter->m_sdSet = pSockSet->m_sdSetActive[eIO];
      break;
    case SOCK_SET_SELECTED:
    default:
      pIter->m_sdSet = pSockSet->m_sdSetSelect[eIO];
      break;
  }

  return SockSetIterNext(pIter);
}
/*!
 * \brief Start iteration of Sockets in the given set in SockSet.
 *
 * \param pSockSet  Pointer to SockSet.
 * \param eSet      One of: \ref SOCK_SET_ONHOLD \ref SOCK_SET_ACTIVE
 *                          \ref SOCK_SET_SELECTED.
 * \param eIO       One of: \ref SOCK_IO_READ \ref SOCK_IO_WRITE.
 * \param pIter     SockSet interator.
 *
 * \return Pointer to first Socket if found, else NULL.
 */
\brief Start iteration of Sockets in the given set in SockSet.

\return Pointer to first Socket if found, else NULL.
\ brief Start iteration of Sockets in the given set in SockSet . \ return Pointer to first Socket if found else NULL .
Socket_T *SockSetIterFirst(SockSet_T     *pSockSet,
                           int            eSet,
                           int            eIO,
                           SockSetIter_T *pIter)
{
  CHKPTR(pSockSet, NULL);
  SOCK_SET_CHK_SET(eSet, NULL);
  SOCK_CHK_IO(eIO, NULL);
  CHKPTR(pIter, NULL);
  pIter->m_pSockSet = pSockSet;
  pIter->m_eSet     = eSet;
  pIter->m_eIO      = eIO;
  pIter->m_sdCur    = -1;
  switch(eSet)
  {
    case SOCK_SET_ONHOLD:
      pIter->m_sdSet = pSockSet->m_sdSetOnHold[eIO];
      break;
    case SOCK_SET_ACTIVE:
      pIter->m_sdSet = pSockSet->m_sdSetActive[eIO];
      break;
    case SOCK_SET_SELECTED:
    default:
      pIter->m_sdSet = pSockSet->m_sdSetSelect[eIO];
      break;
  }
  return SockSetIterNext(pIter);
}
Socket_T * SockSetIterFirst ( SockSet_T * pSockSet , int eSet , int eIO , SockSetIter_T * pIter ) { CHKPTR ( pSockSet , NULL ) ; SOCK_SET_CHK_SET ( eSet , NULL ) ; SOCK_CHK_IO ( eIO , NULL ) ; CHKPTR ( pIter , NULL ) ; pIter -> m_pSockSet = pSockSet ; pIter -> m_eSet = eSet ; pIter -> m_eIO = eIO ; pIter -> m_sdCur = -1 ; switch ( eSet ) { case SOCK_SET_ONHOLD : pIter -> m_sdSet = pSockSet -> m_sdSetOnHold [ eIO ] ; break ; case SOCK_SET_ACTIVE : pIter -> m_sdSet = pSockSet -> m_sdSetActive [ eIO ] ; break ; case SOCK_SET_SELECTED : default : pIter -> m_sdSet = pSockSet -> m_sdSetSelect [ eIO ] ; break ; } return SockSetIterNext ( pIter ) ; }
\brief Start iteration of Sockets in the given set in SockSet.
\ brief Start iteration of Sockets in the given set in SockSet .