prime_hash.h 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 "../../parser/msg_parser.h"

Include dependency graph for prime_hash.h:

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

Go to the source code of this file.

Defines

#define PRIME_HASH_H   1

Typedefs

typedef int(* hash_func_t )(struct sip_msg *msg, enum hash_source source, int denominator)

Enumerations

enum  hash_source {
  shs_call_id = 1, shs_from_uri, shs_from_user, shs_to_uri,
  shs_to_user, shs_error
}
 Determines from which part of a message the hash shall be calculated. Possible values are:. More...

Functions

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.


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.h.


Define Documentation

#define PRIME_HASH_H   1

Definition at line 33 of file prime_hash.h.


Typedef Documentation

typedef int(* hash_func_t)(struct sip_msg *msg, enum hash_source source, int denominator)

generic interface for hash functions

Definition at line 60 of file prime_hash.h.


Enumeration Type Documentation

Determines from which part of a message the hash shall be calculated. Possible values are:.

  • shs_call_id the content of the Call-ID header field
  • shs_from_uri the entire URI in the From header field
  • shs_from_user the username part of the URI in the From header field
  • shs_to_uri the entire URI in the To header field
  • shs_to_user the username part of the URI in the To header field
  • shs_error no hash specified
Enumerator:
shs_call_id 
shs_from_uri 
shs_from_user 
shs_to_uri 
shs_to_user 
shs_error 

Definition at line 50 of file prime_hash.h.


Function Documentation

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().


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