t_lookup.h File Reference

TM :: Hash lookups. More...

#include "config.h"
#include "t_funcs.h"

Include dependency graph for t_lookup.h:

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

Go to the source code of this file.

Defines

#define T_GET_TI   "t_get_trans_ident"
#define T_IS_LOCAL   "t_is_local"
#define T_LOOKUP_IDENT   "t_lookup_ident"
#define T_NULL_CELL   ( (struct cell*) 0 )
#define T_UNDEFINED   ( (struct cell*) -1 )

Typedefs

typedef int(* tget_ti_f )(struct sip_msg *, unsigned int *, unsigned int *)
typedef struct cell *(* tgett_f )(void)
typedef int(* tislocal_f )(struct sip_msg *)
typedef int(* tlookup_ident_f )(struct cell **, unsigned int, unsigned int)
typedef struct cell *(* tlookuporiginalt_f )(struct sip_msg *)
typedef int(* tnewtran_f )(struct sip_msg *)
typedef void(* tunrefcell_f )(struct cell *)

Functions

int _add_branch_label (struct cell *trans, char *str, int *len, int branch)
int add_branch_label (struct cell *trans, struct sip_msg *p_msg, int branch)
struct cellget_cancelled_t (void)
struct cellget_e2eack_t (void)
struct cellget_t (void)
int init_rb (struct retr_buf *rb, struct sip_msg *msg)
void init_t (void)
void reset_cancelled_t (void)
void reset_e2eack_t (void)
void set_t (struct cell *t)
int t_check (struct sip_msg *, int *branch)
 Determine current transaction.
int t_get_trans_ident (struct sip_msg *p_msg, unsigned int *hash_index, unsigned int *label)
 Get transaction identifier.
int t_is_local (struct sip_msg *)
 Small wrapper around is_local.
int t_lookup_callid (struct cell **trans, str callid, str cseq)
 Lookup a transaction by callid and cseq.
int t_lookup_ident (struct cell **trans, unsigned int hash_index, unsigned int label)
 Lookup a transaction from a hash identifier.
int t_lookup_request (struct sip_msg *p_msg, int leave_new_locked)
 Lookup request.
struct cellt_lookupOriginalT (struct sip_msg *p_msg)
 Lookups transaction being canceled by CANCEL in p_msg.
int t_newtran (struct sip_msg *p_msg)
 Atomic "new_tran" construct.
int t_reply_matching (struct sip_msg *, int *)
 Reply matching.
int t_unref (struct sip_msg *p_msg)
 Unreference a transaction, release it if necessary.
void t_unref_cell (struct cell *)

Variables

unsigned int global_msg_id
int ruri_matching
int via1_matching


Detailed Description

TM :: Hash lookups.

Definition in file t_lookup.h.


Define Documentation

#define T_GET_TI   "t_get_trans_ident"

Definition at line 90 of file t_lookup.h.

#define T_IS_LOCAL   "t_is_local"

Definition at line 92 of file t_lookup.h.

#define T_LOOKUP_IDENT   "t_lookup_ident"

Definition at line 91 of file t_lookup.h.

#define T_NULL_CELL   ( (struct cell*) 0 )

Definition at line 43 of file t_lookup.h.

Referenced by get_redirect(), t_forward_nonack(), t_unref(), and uac_auth().

#define T_UNDEFINED   ( (struct cell*) -1 )


Typedef Documentation

typedef int(* tget_ti_f)(struct sip_msg *, unsigned int *, unsigned int *)

Definition at line 96 of file t_lookup.h.

typedef struct cell*(* tgett_f)(void)

Definition at line 75 of file t_lookup.h.

typedef int(* tislocal_f)(struct sip_msg *)

Definition at line 94 of file t_lookup.h.

typedef int(* tlookup_ident_f)(struct cell **, unsigned int, unsigned int)

Definition at line 97 of file t_lookup.h.

typedef struct cell*(* tlookuporiginalt_f)(struct sip_msg *)

Definition at line 73 of file t_lookup.h.

typedef int(* tnewtran_f)(struct sip_msg *)

Definition at line 95 of file t_lookup.h.

typedef void(* tunrefcell_f)(struct cell *)

Definition at line 64 of file t_lookup.h.


Function Documentation

int _add_branch_label ( struct cell trans,
char *  str,
int *  len,
int  branch 
)

int add_branch_label ( struct cell trans,
struct sip_msg p_msg,
int  branch 
)

struct cell* get_cancelled_t ( void   )  [read]

Definition at line 166 of file t_lookup.c.

Referenced by do_t_unref().

struct cell* get_e2eack_t ( void   )  [read]

Definition at line 169 of file t_lookup.c.

Referenced by do_t_unref().

struct cell* get_t ( void   )  [read]

int init_rb ( struct retr_buf rb,
struct sip_msg msg 
)

void init_t ( void   ) 

Definition at line 164 of file t_lookup.c.

References set_t(), and T_UNDEFINED.

Referenced by mod_init().

void reset_cancelled_t ( void   ) 

Definition at line 167 of file t_lookup.c.

References T_UNDEFINED.

Referenced by script_init().

void reset_e2eack_t ( void   ) 

Definition at line 170 of file t_lookup.c.

References T_UNDEFINED.

Referenced by script_init().

void set_t ( struct cell t  ) 

int t_check ( struct sip_msg p_msg,
int *  param_branch 
)

Determine current transaction.

Determine current transaction for SIP message. Set T to a ptr if the transaction could be found, to 0 if not found, and to T_UNDEFINED on errors: Found Not Found Error (e.g. parsing) Return Value 1 0 -1 T ptr 0 T_UNDEFINED

Returns:
1 if transaction found, 0 if not found, -1 on errors (e.g. parsing)

Definition at line 919 of file t_lookup.c.

References sip_msg::cseq, sip_msg::first_line, get_cseq, HDR_CSEQ_F, HDR_EOH_F, HDR_TO_F, HDR_VIA1_F, LM_DBG, LM_ERR, cseq_body::method_id, METHOD_INVITE, parse_from_header(), parse_headers(), SIP_REQUEST, t_lookup_request(), t_reply_matching(), T_UNDEFINED, sip_msg::to, msg_start::type, and sip_msg::via1.

Referenced by pv_get_tm_reply_code(), pv_t_update_req(), reply_received(), t_check_trans(), t_get_trans_ident(), and t_is_local().

int t_get_trans_ident ( struct sip_msg p_msg,
unsigned int *  hash_index,
unsigned int *  label 
)

Get transaction identifier.

Returns:
1 on success, -1 if not found and on errors

Definition at line 1244 of file t_lookup.c.

References get_t(), cell::hash_index, cell::label, LM_ERR, and t_check().

Referenced by assemble_msg(), and load_tm().

int t_is_local ( struct sip_msg p_msg  ) 

Small wrapper around is_local.

Returns:
1 on success, -1 if transaction not found and on errors

Definition at line 1308 of file t_lookup.c.

References get_t(), is_local, LM_ERR, and t_check().

Referenced by load_tm().

int t_lookup_callid ( struct cell **  trans,
str  callid,
str  cseq 
)

Lookup a transaction by callid and cseq.

Lookup a transaction by callid and cseq, parameters are pure header field content only, e.g. "123@10.0.0.1" and "11"

Parameters:
trans transaction
callid Call-Id value
cseq CSEQ value
Returns:
1 if transaction was found, -1 when not found and on errors

Definition at line 1336 of file t_lookup.c.

References cell::callid, cell::cseq_n, s_table::entrys, entry::first_cell, get_tm_table(), cell::hash_index, INVITE, INVITE_LEN, _str::len, LM_DBG, LM_ERR, LOCK_HASH, MAX_HEADER, cell::next_cell, print_callid_mini(), print_cseq_mini(), REF_UNSAFE, _str::s, set_t(), tm_hash, TM_TABLE_ENTRIES, and UNLOCK_HASH.

Referenced by mi_tm_cancel().

int t_lookup_ident ( struct cell **  trans,
unsigned int  hash_index,
unsigned int  label 
)

Lookup a transaction from a hash identifier.

Returns:
1 on success, -1 if not found, and on errors

Definition at line 1269 of file t_lookup.c.

References get_tm_table(), cell::label, LM_DBG, LM_ERR, LOCK_HASH, cell::next_cell, REF_UNSAFE, set_t(), TM_TABLE_ENTRIES, and UNLOCK_HASH.

Referenced by load_tm(), mi_tm_reply(), and t_uac_cancel().

int t_lookup_request ( struct sip_msg p_msg,
int  leave_new_locked 
)

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

Lookups transaction being canceled by CANCEL in p_msg.

Lookups transaction from hash table that is being canceled by the CANCEL in the message.

Parameters:
p_msg SIP message with CANCEL
Returns:
0 - transaction wasn't found, T - transaction found

Definition at line 628 of file t_lookup.c.

References via_body::branch, EQ_LEN, EQ_REQ_URI_LEN, EQ_REQ_URI_STR, EQ_STR, EQ_VIA_LEN, EQ_VIA_STR, get_cseq, get_tm_table(), get_to, sip_msg::hash_index, cell::hash_index, _str::len, LM_DBG, LM_ERR, LOCK_HASH, matching_3261(), MCOOKIE, MCOOKIE_LEN, METHOD_CANCEL, cell::next_cell, NULL, REF_UNSAFE, ua_server::request, ruri_matching, _str::s, T_UNDEFINED, cell::uas, UNLOCK_HASH, via_param::value, sip_msg::via1, and via1_matching.

Referenced by load_tm(), t_check_trans(), and t_forward_nonack().

int t_newtran ( struct sip_msg p_msg  ) 

Atomic "new_tran" construct.

Returns:
negative on error, 1 if a request did not match a transaction
  • it that was an ack, the calling function shall forward statelessly
  • otherwise it means, a new transaction was introduced and the calling function shall reply/relay/whatever_appropriate 0 on retransmission

Definition at line 1088 of file t_lookup.c.

References sip_msg::add_to_branch_len, sip_msg::add_to_branch_s, check_hdrs_changes(), E_BAD_REQ, E_BAD_TUPEL, E_BAD_VIA, E_OUT_OF_MEM, E_SCRIPT, has_tran_tmcbs, sip_msg::hash_index, HDR_EOH_F, init_rb(), LM_DBG, LM_ERR, METHOD_ACK, new_t(), cell::nr_of_outgoings, parse_headers(), sip_msg::parsed_flag, put_on_wait(), ua_server::response, run_trans_callbacks(), t_calc_branch(), t_lookup_request(), t_release_transaction(), t_retransmit_reply(), T_UNDEFINED, t_unref(), TMCB_E2EACK_IN, cell::uas, UNLOCK_HASH, and unmatched_totag().

Referenced by load_tm(), t_relay_to(), and w_t_newtran().

int t_reply_matching ( struct sip_msg p_msg,
int *  p_branch 
)

int t_unref ( struct sip_msg p_msg  ) 

Unreference a transaction, release it if necessary.

Returns:
1 on success, -1 on errors

Definition at line 1212 of file t_lookup.c.

References sip_msg::first_line, get_kr(), kr, LM_WARN, METHOD_ACK, REQ_RLSD, set_t(), SIP_REQUEST, T_NULL_CELL, t_release_transaction(), T_UNDEFINED, msg_start::type, and UNREF.

Referenced by do_t_unref(), reply_received(), and t_newtran().

void t_unref_cell ( struct cell  ) 

Definition at line 1234 of file t_lookup.c.

References UNREF.

Referenced by do_t_unref(), and load_tm().


Variable Documentation

unsigned int global_msg_id

Should be request-uri matching used as a part of pre-3261 transaction matching, as the standard wants us to do so (and is reasonable to do so, to be able to distinguish spirals)? Turn only off for better interaction with devices that are broken and send different r-uri in CANCEL/ACK than in original INVITE

Definition at line 135 of file t_lookup.c.

Referenced by t_lookup_request(), and t_lookupOriginalT().

Definition at line 136 of file t_lookup.c.

Referenced by t_lookup_request(), and t_lookupOriginalT().


Generated on Thu May 24 20:00:44 2012 for Kamailio - The Open Source SIP Server by  doxygen 1.5.6