HP-UX C SIP Stack Programmer's Guide (Novembery 2007)
Advanced Features 391
ENUM Resolution Support
Sample Code
The following code sample illustrates an implementation of the ENUM callback
using an abstract function that which performs regular expression parsing, called
AppRegComp.
/*==========================================================================*/
RvStatus AppRegExpResolutionNeeded EvHandler (
IN RvSipTransmitterMgrHandle hTrxMgr,
IN void* pAppTrxMgr,
IN RvSipTransmitterHandle hTrx,
IN RvSipAppTransmitterHandle hAppTrx,
INOUT RvSipTransmitterRegExpResolutionParams* pRegExpParams)
{
RvStatus rv = RV_OK;
RvInt32 index;
RvSipTransmitterRegExpMatch *pCurrMatch;
rv = AppRegComp(
pRegexpParams->strRegExp, /* A regular expression from NAPTR query */
pRegexpParams->strString, /* The string to apply the regexp on */
pRegexpParams->matchSize, /* The size of the pMatches array */
pRegexpParams->eFlags, /* regexp parsing flags */
pRegexpParams->pMatches); /* Array of matching substrings offsets, any unused*/
/* array elements contain -1 offset */
for (index =0, pCurrMatch = pRegexpParams->pMatches;
index < pRegexpParams->matchSize && pCurrMatch-> startOffSet != -1;
index++, pCurrMatch++)
{
printf("Found match from %d to %d",
pCurrMatch-> startOffSet, pCurrMatch-> endOffSet);
}
return rv;
}
/*==========================================================================*/