nonce.h File Reference

Nonce related functions

More...

#include "../../str.h"
#include <time.h>

Include dependency graph for nonce.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define NONCE_LEN   (16+32)

Functions

void calc_nonce (char *_nonce, int _expires, int _index, str *_secret)
 Calculate nonce value.
int check_nonce (str *_nonce, str *_secret)
 Check nonce value received from user agent.
int get_nonce_index (str *_nonce)
 Get index from nonce string.
int is_nonce_stale (str *_nonce)
 Check if a nonce is stale.


Detailed Description

Nonce related functions

Definition in file nonce.h.


Define Documentation

#define NONCE_LEN   (16+32)

Length of nonce string in bytes

Definition at line 38 of file nonce.h.

Referenced by build_auth_hf(), and check_nonce().


Function Documentation

void calc_nonce ( char *  _nonce,
int  _expires,
int  _index,
str _secret 
)

Calculate nonce value.

Calculate nonce value value. The nonce value consists of the expires time (in seconds since 1.1 1970) and a secret phrase.

Parameters:
_nonce nonce value
_expires expires value
_index nonce index
_secret secret phrase
Calculate nonce value value. The nonce value consists of the expires time (in seconds since 1.1 1970) and a secret phrase.
Parameters:
_nonce nonce value
_expires expires value
_index nonce index
_secret secret

Definition at line 110 of file nonce.c.

References integer2hex(), _str::len, MD5Init(), MD5Update(), nonce_reuse, _str::s, string2hex(), and U_MD5Final().

Referenced by build_auth_hf(), and check_nonce().

int check_nonce ( str _nonce,
str _secret 
)

Check nonce value received from user agent.

Parameters:
_nonce nonce value
_secret secret phrase
Returns:
0 when nonce is valid, -1 on errors, positive if nonce not valid

Definition at line 163 of file nonce.c.

References calc_nonce(), get_nonce_expires(), get_nonce_index(), _str::len, LM_DBG, NONCE_LEN, nonce_reuse, _str::s, and ZSW.

Referenced by pre_auth().

int get_nonce_index ( str _n  ) 

Get index from nonce string.

Parameters:
_n nonce string
Returns:
nonce index

Definition at line 140 of file nonce.c.

References hex2integer(), and _str::s.

Referenced by check_nonce(), and post_auth().

int is_nonce_stale ( str _n  ) 

Check if a nonce is stale.

Parameters:
_n nonce string
Returns:
1 if the nonce is stale, 0 otherwise

Definition at line 199 of file nonce.c.

References get_nonce_expires(), and _str::s.

Referenced by post_auth().


Generated on Wed May 23 20:00:41 2012 for Kamailio - The Open Source SIP Server by  doxygen 1.5.6