HP-UX C SIP Stack Programmer's Guide (Novembery 2007)
Working with the Mid-Layer 433
Mid-layer Select API
RvSipMidSelectEv()
When you register on a select()/poll() event, you provide the
RvSipMidSelectEv() callback. When the select()/poll() exits with the file
descriptor on which you registered, this callback will be called. This callback
will provide you with the file descriptor, the event(s) that occurred, and a
context.
S
AMPLE CODE The following sample code demonstrates how to register on a read event.
/* The callback when a read event was received on a file
descriptor */
static void HandleRead (
IN RvInt fd,
IN RvSipMidSelectEvent event,
IN RvBool error,
IN void* ctx)
{
printf("fd %d received a read event\n",fd);
}
void ReadRegister(RvSipMidMgrHandle hMidMgr,
RvInt fileDescriptor)
{
/* Register a given file descriptor with the
write event */
if (RV_OK != RvSipMidSelectCallOn(hMidMgr,
fileDescriptor,
RVSIP_MID_SELECT_READ,
HandleRead,NULL))
{
HandleError();
}
}
RUNNING THE SELECT()
LOOP AT APPLICATION
L
EVEL
The SIP Stack Mid-layer API enables you to run the select loop at the
application level. To do so you should: