prime_hash.c File Reference

Functions for determinung a pseudo random number over a message's header field, based on CRC32 or a prime number algorithm. More...

#include "../../sr_module.h"
#include "../../parser/parse_uri.h"
#include "../../parser/parse_to.h"
#include "../../parser/parse_from.h"
#include "../../crc.h"
#include <ctype.h>
#include "prime_hash.h"

Include dependency graph for prime_hash.c:

Go to the source code of this file.

Functions

static int determine_call_id (struct sip_msg *msg, str *source_string)
static int determine_fromto_uri (struct to_body *fromto, str *source_string)
static int determine_fromto_user (struct to_body *fromto, str *source_string)
static int determine_source (struct sip_msg *msg, enum hash_source source, str *source_string)
static int first_token (str *source_string)
int hash_func (struct sip_msg *msg, enum hash_source source, int denominator)
 CRC32 hash function Returns an integer number between 0 and denominator - 1 based on the hash source from the msg. The hash algorith is CRC32.
int prime_hash_func (struct sip_msg *msg, enum hash_source source, int denominator)
 prime hash function Returns an integer number between 0 and denominator - 1 based on the hash source from the msg. Use the prime number algorithm.
static int validate_msg (struct sip_msg *msg)


Detailed Description

Functions for determinung a pseudo random number over a message's header field, based on CRC32 or a prime number algorithm.

Definition in file prime_hash.c.


Function Documentation

static int determine_call_id ( struct sip_msg msg,
str source_string 
) [static]

Definition at line 160 of file prime_hash.c.

References hdr_field::body, sip_msg::callid, first_token(), _str::len, and _str::s.

Referenced by determine_source().

static int determine_fromto_uri ( struct to_body fromto,
str source_string 
) [static]

Definition at line 167 of file prime_hash.c.

References _str::len, LM_ERR, NULL, _str::s, and to_body::uri.

Referenced by determine_source().

static int determine_fromto_user ( struct to_body fromto,
str source_string 
) [static]

Definition at line 177 of file prime_hash.c.

References _str::len, LM_ERR, NULL, parse_uri(), _str::s, to_body::uri, and sip_uri::user.

Referenced by determine_source().

static int determine_source ( struct sip_msg msg,
enum hash_source  source,
str source_string 
) [static]

static int first_token ( str source_string  )  [static]

Definition at line 193 of file prime_hash.c.

References _str::len, len, NULL, and _str::s.

Referenced by determine_call_id().

int hash_func ( struct sip_msg msg,
enum hash_source  source,
int  denominator 
)

CRC32 hash function Returns an integer number between 0 and denominator - 1 based on the hash source from the msg. The hash algorith is CRC32.

Definition at line 50 of file prime_hash.c.

References crc32_uint(), determine_source(), hash, and LM_DBG.

Referenced by rewrite_on_rule().

int prime_hash_func ( struct sip_msg msg,
enum hash_source  source,
int  denominator 
)

prime hash function Returns an integer number between 0 and denominator - 1 based on the hash source from the msg. Use the prime number algorithm.

Definition at line 66 of file prime_hash.c.

References determine_source(), _str::len, LM_DBG, LM_ERR, _str::s, shs_from_user, and shs_to_user.

Referenced by rewrite_on_rule().

static int validate_msg ( struct sip_msg msg  )  [static]


Generated on Thu May 24 08:01:15 2012 for Kamailio - The Open Source SIP Server by  doxygen 1.5.6