HP-UX C SIP Stack Programmer's Guide (Novembery 2007)
Authentication 195
Client Authentication Implementation
Sample Code
The following code demonstrates how to set the Proxy-Authenticate header for
authenticating messages in advance.
/*==========================================================================*/
RvStatus SetProxyAuthenticateHeader (
RvSipAuthenticatorHandle hAuthenticator,
HRPOOL hPool,
HPAGE hPage)
{
RvStatus status;
RvSipAuthenticationHeaderHandle hProxyAuth;
/*----------------------------------------
Constructs the Proxy-Authenticate header.
------------------------------------------*/
status = RvSipAuthenticationHeaderConstruct(hPool,
hPage, &hProxyAuth);
if (status != RV_OK)
{
return status;
}
/*---------------------------------------------------
Sets parameters to the header. (You can set more parameters).
----------------------------------------------------*/
/*Sets the nonce.*/
RvSipAuthenticationHeaderSetNonce(hProxyAuth,
"\"1234abab\"");
/*Sets the realm.*/
RvSipAuthenticationHeaderSetRealm(hProxyAuth,
"\"hp.com\"");
/*Sets the opaque.*/
RvSipAuthenticationHeaderSetOpaque(hProxyAuth,
"\"abcdef1234\"");
/*Set authentication scheme.*/
RvSipAuthenticationHeaderSetAuthScheme
(hProxyAuth,
RVSIP_AUTH_SCHEME_DIGEST,NULL);
/* Sets the algorithm.*/
RvSipAuthenticationHeaderSetAuthAlgorithm
(hProxyAuth,