HP-UX C SIP Stack Programmer's Guide (Novembery 2007)
190 HP-UX C SIP Stack Programmer’s Guide
Client Authentication Implementation
/*Implements the MD5 algorithm.*/
MD5Init(&mdc);
MD5Update(&mdc, strInput,strlen(strInput));
MD5Final(digest, &mdc);
/*Changes the digest into a string format.*/
MD5toString(digest, strResponse);
/*Inserts the MD5 output to the page that is supplied in pRpoolMD5Output.*/
RPOOL_AppendFromExternalToPage(pRpoolMD5Output->hPool,
pRpoolMD5Output->hPage,
(void*)strResponse,
strlen(strResponse) + 1,
&(pRpoolMD5Output->offset));
}
/*==========================================================================*/
IMPLEMENTING THE SHARED SECRET CALLBACK FUNCTION
The following code demonstrates how to set the user name and password
defined by the Realm parameter in the authenticator using
RPOOL_AppendFromExternalToPage(). You can also use pRpoolRealm to
search for the relevant shared secret which includes the user name and
password.
Sample Code
The following code shows you how to implement the Shared Secret
authenticator callback function:
/*==========================================================================*/
RvChar * strAuthUserName = "bob";
RvChar * strAuthPassword = "bsg23hp";
void RVCALLCONV AuthenticationSharedSecretEv(
IN RvSipAuthenticatrHandle hAuthenticator,
IN RvSipAppAuthenticatorHandle hAppAuthenticator,
IN void* hObject,
IN void peObjectType,
IN RPOOL_Ptr *pRpoolRealm,
OUT RPOOL_Ptr *pRpoolUserName,
OUT RPOOL_Ptr *pRpoolPassword)
{
/*Appends the username to the given page.*/
RPOOL_AppendFromExternalToPage(