h_table.h File Reference

TM :: Hash tables. More...

#include <stdio.h>
#include <stdlib.h>
#include "../../parser/msg_parser.h"
#include "../../proxy.h"
#include "../../md5utils.h"
#include "../../usr_avp.h"
#include "config.h"
#include "../../mem/shm_mem.h"
#include "lock.h"
#include "sip_msg.h"
#include "t_reply.h"
#include "t_hooks.h"
#include "timer.h"
#include "timer.h"

Include dependency graph for h_table.h:

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

Go to the source code of this file.

Data Structures

struct  cell
 transaction context More...
struct  entry
 double-linked list of cells with hash synonyms More...
struct  retr_buf
struct  s_table
 transaction table More...
struct  totag_elem
struct  ua_client
 User Agent Client content. More...
struct  ua_server
 User Agent Server content. More...

Defines

#define EXTERNAL_CANCEL   ( (char*) -1)
#define get_dele_timer_payload(_tl_)   list_entry( _tl_, struct cell, dele_tl)
#define get_fr_timer_payload(_tl_)   list_entry( _tl_, struct retr_buf, fr_timer)
#define get_retr_timer_payload(_tl_)   list_entry( _tl_, struct retr_buf, retr_timer)
#define get_T_from_cancel_rb(_rb_, _br_)
#define get_T_from_reply_rb(_rb_)
#define get_T_from_request_rb(_rb_, _br_)
#define get_wait_timer_payload(_tl_)   list_entry( _tl_, struct cell, wait_tl)
#define is_hopbyhop_cancel(_t_)   ((_t_)->flags&T_HOPBYHOP_CANCEL_FLAG)
#define is_invite(_t_)   ((_t_)->flags&T_IS_INVITE_FLAG)
#define is_local(_t_)   ((_t_)->flags&T_IS_LOCAL_FLAG)
#define list_entry(ptr, type, member)   ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))
#define LOCK_HASH(_h)   lock_hash((_h))
#define no_autoack(_t_)   ((_t_)->flags&T_NO_AUTOACK_FLAG)
#define NO_CANCEL   ( (char*) 0 )
#define no_new_branches(_t_)   ((_t_)->flags&T_NO_NEW_BRANCHES_FLAG)
#define pass_provisional(_t_)   ((_t_)->flags&T_PASS_PROVISIONAL_FLAG)
#define TYPE_LOCAL_CANCEL   -1
#define TYPE_REQUEST   0
#define UNLOCK_HASH(_h)   unlock_hash((_h))
#define was_cancelled(_t_)   ((_t_)->flags&T_WAS_CANCELLED_FLAG)
transaction flags


#define T_BLIND_UAC   (1<<9)
#define T_HOPBYHOP_CANCEL_FLAG   (1<<4)
#define T_IS_INVITE_FLAG   (1<<0)
#define T_IS_LOCAL_FLAG   (1<<1)
#define T_NO_AUTOACK_FLAG   (1<<5)
#define T_NO_DNS_FAILOVER_FLAG   (1<<7)
#define T_NO_NEW_BRANCHES_FLAG   (1<<8)
#define T_PASS_PROVISIONAL_FLAG   (1<<6)
#define T_UAC_HAS_RECV_REPLY   (1<<1)
#define T_UAC_TO_CANCEL_FLAG   (1<<0)
#define T_WAS_CANCELLED_FLAG   (1<<3)

Typedefs

typedef struct cell cell_type
 transaction context
typedef struct entry entry_type
 double-linked list of cells with hash synonyms
typedef struct retr_buf retr_buf_type
typedef void(* setkr_f )(enum kill_reason mykr)
typedef struct ua_client ua_client_type
 User Agent Client content.
typedef struct ua_server ua_server_type
 User Agent Server content.

Enumerations

enum  kill_reason { REQ_FWDED = 1, REQ_RPLD = 2, REQ_RLSD = 4, REQ_EXIST = 8 }
 to be able to assess whether a script writer forgot to release a transaction and leave it for ever in memory, we mark it with operations done over it; if none of these flags is set and script is being left, it is a sign of script error and we need to release on writer's behalf More...

Functions

struct cellbuild_cell (struct sip_msg *p_msg)
void free_cell (struct cell *dead_cell)
void free_hash_table (void)
 Release all the data contained by the hash table. All the aux. structures as sems, lists, etc, are also released.
enum kill_reason get_kr (void)
struct s_tableget_tm_table (void)
struct s_tableinit_hash_table (void)
void insert_into_hash_table_unsafe (struct cell *p_cell, unsigned int _hash)
 Takes an already created cell and links it into hash table on the appropriate entry.
void lock_hash (int i)
void remove_from_hash_table_unsafe (struct cell *p_cell)
 Un-link a cell from hash_table, but the cell itself is not released.
void reset_kr (void)
void set_kr (enum kill_reason kr)
unsigned int transaction_count (void)
int unixsock_hash (str *msg)
void unlock_hash (int i)

Variables

int syn_branch


Detailed Description

TM :: Hash tables.

Definition in file h_table.h.


Define Documentation

#define EXTERNAL_CANCEL   ( (char*) -1)

Definition at line 76 of file h_table.h.

#define get_dele_timer_payload ( _tl_   )     list_entry( _tl_, struct cell, dele_tl)

Definition at line 303 of file h_table.h.

Referenced by delete_handler(), and unlink_timer_lists().

#define get_fr_timer_payload ( _tl_   )     list_entry( _tl_, struct retr_buf, fr_timer)

Definition at line 299 of file h_table.h.

Referenced by final_response_handler().

#define get_retr_timer_payload ( _tl_   )     list_entry( _tl_, struct retr_buf, retr_timer)

Definition at line 297 of file h_table.h.

Referenced by retransmission_handler().

#define get_T_from_cancel_rb ( _rb_,
_br_   ) 

Value:

list_entry( list_entry( (rb_, (struct ua_client), local_cancel) - \
      (_br_)*sizeof(struct retr_buf), struct cell, uas)

Definition at line 312 of file h_table.h.

#define get_T_from_reply_rb ( _rb_   ) 

Value:

list_entry( list_entry( _rb_, (struct ua_server), response),\
      struct cell, uas)

Definition at line 306 of file h_table.h.

#define get_T_from_request_rb ( _rb_,
_br_   ) 

Value:

list_entry( list_entry( (rb_, (struct ua_client), request) - \
      (_br_)*sizeof(struct retr_buf), struct cell, uas)

Definition at line 309 of file h_table.h.

#define get_wait_timer_payload ( _tl_   )     list_entry( _tl_, struct cell, wait_tl)

Definition at line 301 of file h_table.h.

Referenced by wait_handler().

#define is_hopbyhop_cancel ( _t_   )     ((_t_)->flags&T_HOPBYHOP_CANCEL_FLAG)

Definition at line 319 of file h_table.h.

Referenced by _reply_light(), and t_should_relay_response().

#define is_invite ( _t_   )     ((_t_)->flags&T_IS_INVITE_FLAG)

#define is_local ( _t_   )     ((_t_)->flags&T_IS_LOCAL_FLAG)

#define list_entry ( ptr,
type,
member   )     ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))

Definition at line 294 of file h_table.h.

#define LOCK_HASH ( _h   )     lock_hash((_h))

#define no_autoack ( _t_   )     ((_t_)->flags&T_NO_AUTOACK_FLAG)

Definition at line 320 of file h_table.h.

Referenced by reply_received().

#define NO_CANCEL   ( (char*) 0 )

Definition at line 75 of file h_table.h.

#define no_new_branches ( _t_   )     ((_t_)->flags&T_NO_NEW_BRANCHES_FLAG)

Definition at line 322 of file h_table.h.

Referenced by reply_callback(), and t_forward_nonack().

#define pass_provisional ( _t_   )     ((_t_)->flags&T_PASS_PROVISIONAL_FLAG)

Definition at line 321 of file h_table.h.

Referenced by t_uac().

#define T_BLIND_UAC   (1<<9)

transaction has a blind uac

Definition at line 187 of file h_table.h.

Referenced by add_blind_uac(), and t_lookup_request().

#define T_HOPBYHOP_CANCEL_FLAG   (1<<4)

transaction was cancelled hopbyhop

Definition at line 182 of file h_table.h.

#define T_IS_INVITE_FLAG   (1<<0)

is the transaction's request an INVITE?

Definition at line 178 of file h_table.h.

Referenced by init_new_t(), and t_uac().

#define T_IS_LOCAL_FLAG   (1<<1)

is this a transaction generated by local request?

Definition at line 179 of file h_table.h.

Referenced by ac_reply(), t_relay_to(), t_uac(), and t_uac_cancel().

#define T_NO_AUTOACK_FLAG   (1<<5)

ACK must not be auto generated for the local transaction

Definition at line 183 of file h_table.h.

Referenced by ac_uac_req().

#define T_NO_DNS_FAILOVER_FLAG   (1<<7)

do auto DNS failover

Definition at line 185 of file h_table.h.

Referenced by add_uac(), reply_received(), t_relay_to(), t_should_relay_response(), and w_t_relay().

#define T_NO_NEW_BRANCHES_FLAG   (1<<8)

transaction must not create new branches

Definition at line 186 of file h_table.h.

Referenced by t_should_relay_response().

#define T_PASS_PROVISIONAL_FLAG   (1<<6)

provisional replies must trigger callbacks for local transaction

Definition at line 184 of file h_table.h.

Referenced by ac_uac_req().

#define T_UAC_HAS_RECV_REPLY   (1<<1)

UAC :: have the UAC received any replies?

Definition at line 191 of file h_table.h.

Referenced by is_3263_failure(), reply_received(), and t_local_replied().

#define T_UAC_TO_CANCEL_FLAG   (1<<0)

UAC :: is the UAC pending for CANCEL ?

Definition at line 190 of file h_table.h.

Referenced by reply_received(), and should_cancel_branch().

#define T_WAS_CANCELLED_FLAG   (1<<3)

set to one if you want to disallow silent transaction dropping when C timer hits

Definition at line 180 of file h_table.h.

Referenced by t_forward_nonack().

#define TYPE_LOCAL_CANCEL   -1

Definition at line 78 of file h_table.h.

Referenced by cancel_branch(), final_response_handler(), and retransmission_handler().

#define TYPE_REQUEST   0

Definition at line 79 of file h_table.h.

Referenced by retransmission_handler().

#define UNLOCK_HASH ( _h   )     unlock_hash((_h))

#define was_cancelled ( _t_   )     ((_t_)->flags&T_WAS_CANCELLED_FLAG)

Definition at line 318 of file h_table.h.

Referenced by reply_callback(), t_forward_nonack(), t_pick_branch(), and t_was_cancelled().


Typedef Documentation

typedef struct cell cell_type

transaction context

typedef struct entry entry_type

double-linked list of cells with hash synonyms

typedef struct retr_buf retr_buf_type

typedef void(* setkr_f)(enum kill_reason mykr)

Definition at line 100 of file h_table.h.

typedef struct ua_client ua_client_type

User Agent Client content.

typedef struct ua_server ua_server_type

User Agent Server content.


Enumeration Type Documentation

to be able to assess whether a script writer forgot to release a transaction and leave it for ever in memory, we mark it with operations done over it; if none of these flags is set and script is being left, it is a sign of script error and we need to release on writer's behalf

  • REQ_FWDED means there is a UAC with final response timer ticking. If it hits, transaction will be completed.
  • REQ_RPLD means that a transaction has been replied -- either it implies going to wait state, or for invite transactions FR timer is ticking until ACK arrives
  • REQ_RLSD means that a transaction was put on wait explicitly from t_release_transaction
  • REQ_EXIST means that this request is a retransmission which does not affect transactional state
Enumerator:
REQ_FWDED 
REQ_RPLD 
REQ_RLSD 
REQ_EXIST 

Definition at line 98 of file h_table.h.


Function Documentation

struct cell* build_cell ( struct sip_msg p_msg  )  [read]

void free_cell ( struct cell dead_cell  ) 

void free_hash_table ( void   ) 

Release all the data contained by the hash table. All the aux. structures as sems, lists, etc, are also released.

Definition at line 329 of file h_table.c.

References s_table::entrys, entry::first_cell, free_cell(), cell::next_cell, shm_free, and TM_TABLE_ENTRIES.

enum kill_reason get_kr ( void   ) 

Definition at line 87 of file h_table.c.

References kr.

Referenced by t_unref().

struct s_table* get_tm_table ( void   )  [read]

struct s_table* init_hash_table ( void   )  [read]

void insert_into_hash_table_unsafe ( struct cell p_cell,
unsigned int  _hash 
)

Takes an already created cell and links it into hash table on the appropriate entry.

Definition at line 390 of file h_table.c.

References entry::acc_entries, entry::cur_entries, s_table::entrys, entry::first_cell, cell::hash_index, is_local, cell::label, entry::last_cell, cell::next_cell, entry::next_label, cell::prev_cell, and stats_trans_new.

Referenced by new_t(), t_uac(), and t_uac_cancel().

void lock_hash ( int  i  ) 

Definition at line 92 of file h_table.c.

References s_table::entrys, lock, and entry::mutex.

void remove_from_hash_table_unsafe ( struct cell p_cell  ) 

Un-link a cell from hash_table, but the cell itself is not released.

Definition at line 416 of file h_table.c.

References entry::cur_entries, s_table::entrys, entry::first_cell, cell::hash_index, if_update_stat, entry::last_cell, LM_CRIT, cell::next_cell, cell::prev_cell, tm_enable_stats, and tm_trans_inuse.

Referenced by t_uac(), t_uac_cancel(), and wait_handler().

void reset_kr ( void   ) 

Definition at line 76 of file h_table.c.

References kr.

Referenced by script_init().

void set_kr ( enum kill_reason  kr  ) 

unsigned int transaction_count ( void   ) 

Definition at line 110 of file h_table.c.

References entry::cur_entries, s_table::entrys, and TM_TABLE_ENTRIES.

int unixsock_hash ( str msg  ) 

void unlock_hash ( int  i  ) 

Definition at line 98 of file h_table.c.

References s_table::entrys, entry::mutex, and unlock.


Variable Documentation

Definition at line 73 of file h_table.c.

Referenced by init_synonym_id(), t_calc_branch(), and t_reply_matching().


Generated on Wed May 23 06:01:04 2012 for Kamailio - The Open Source SIP Server by  doxygen 1.5.6