HP-UX C SIP Stack Programmer's Guide (Novembery 2007)
368 HP-UX C SIP Stack Programmer’s Guide
Multihomed Host
DYNAMIC LOCAL
A
DDRESSES (DLA)
The Dynamic Local Addresses (DLA) feature of the SIP Stack enables the
application to open and close local IP addresses at runtime. To enable the DLA
feature, you have to set the bDLAEnabled configuration parameter to
RV_TRUE. By default, the DLA feature is disabled since DLA consumes extra
resources such as memory and mutexes. The maxNumOfLocalAddresses
configuration parameter determines the maximum number of local addresses
that the SIP Stack will be able to open concurrently. You should set this number
upon initialization of the SIP Stack.
DLA API FUNCTIONS The following API functions are provided for DLA usage:
RvSipTransportMgrLocalAddressAdd()
RvSipTransportMgrLocalAddressRemove()
RvSipTransportMgrLocalAddressFind()
RvSipTransportMgrLocalAddressGetDetails()
RvSipTransportMgrLocalAddressGetFirst()
RvSipTransportMgrLocalAddressGetNext()
Sample Code
The following code configures two UDP addresses, removes the first UDP
address, and opens a new UDP address in the SIP Stack.
/*======================================================================================*/
RvSipStackInitCfg(sizeof(stackCfg),&stackCfg);
/*Configures the Stack to listen to two UDP addresses.*/
strcpy(stackCfg.localUdpAddress,"172.20.4.23");
stackCfg.localUdpPort = 5060;
stackCfg.numOfExtraUdpAddresses = 1;
stackCfg.localUdpAddresses = calloc(stackCfg.numOfExtraUdpAddresses,sizeof(RvChar*));
stackCfg.localUdpPorts = calloc(stackCfg.numOfExtraUdpAddresses,sizeof(RvUint16));
stackCfg.localUdpAddresses[0] = malloc(strlen("172.20.4.24")+1);
strcpy(stackCfg.localUdpAddresses[0],"172.20.4.24");
stackCfg.LocalUdpPorts[0] = 5061;
stackCfg.DLAEnabled=true
/*Calls the Stack initialization function.*/
RvSipStackConstruct(sizeof(stackCfg),&stackCfg,&hStackMgr);
.....
RvSipTransportLocalAddrHandle hLocalAddr = NULL;
RvSipTransportAddr addrDetails;
RvStatus rv;
/* Removes the first opened UDP address */