#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"


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 cell * | build_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_table * | get_tm_table (void) |
| struct s_table * | init_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 |
Definition in file h_table.h.
| #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_ | ) |
Value:
list_entry( list_entry( (rb_, (struct ua_client), local_cancel) - \ (_br_)*sizeof(struct retr_buf), struct cell, uas)
| #define get_T_from_reply_rb | ( | _rb_ | ) |
Value:
list_entry( list_entry( _rb_, (struct ua_server), response),\ struct cell, uas)
| #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)
| #define get_wait_timer_payload | ( | _tl_ | ) | list_entry( _tl_, struct cell, wait_tl) |
| #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) |
Definition at line 316 of file h_table.h.
Referenced by _reply_light(), ac_reply(), acc_onreply(), acc_onreply_in(), acc_onreq(), fake_reply(), local_reply(), relay_reply(), reply_received(), t_cancel_branches(), t_reply_matching(), t_should_relay_response(), and wait_handler().
| #define is_local | ( | _t_ | ) | ((_t_)->flags&T_IS_LOCAL_FLAG) |
Definition at line 317 of file h_table.h.
Referenced by _reply_light(), build_local(), fake_reply(), insert_into_hash_table_unsafe(), reply_received(), send_ack(), set_final_timer(), t_is_local(), t_reply_matching(), t_uac_cancel(), and uac_cb().
| #define list_entry | ( | ptr, | |||
| type, | |||||
| member | ) | ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member))) |
| #define LOCK_HASH | ( | _h | ) | lock_hash((_h)) |
Definition at line 68 of file h_table.h.
Referenced by t_lookup_callid(), t_lookup_ident(), t_lookup_request(), t_lookupOriginalT(), t_reply_matching(), t_uac(), t_uac_cancel(), and wait_handler().
| #define no_autoack | ( | _t_ | ) | ((_t_)->flags&T_NO_AUTOACK_FLAG) |
| #define no_new_branches | ( | _t_ | ) | ((_t_)->flags&T_NO_NEW_BRANCHES_FLAG) |
| #define pass_provisional | ( | _t_ | ) | ((_t_)->flags&T_PASS_PROVISIONAL_FLAG) |
| #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) |
| #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 |
| #define UNLOCK_HASH | ( | _h | ) | unlock_hash((_h)) |
Definition at line 69 of file h_table.h.
Referenced by delete_cell(), t_lookup_callid(), t_lookup_ident(), t_lookup_request(), t_lookupOriginalT(), t_newtran(), t_reply_matching(), t_uac(), and t_uac_cancel().
| #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 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.
| enum kill_reason |
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
Definition at line 243 of file h_table.c.
References sip_msg::add_rm, cell::dele_tl, destroy_avp_list(), E_OUT_OF_MEM, ua_server::end_request, tmcb_head_list::first, retr_buf::fr_timer, free_via_clen_lump(), has_reqin_tmcbs, sip_msg::id, init_branches(), init_cell_lock(), init_synonym_id(), retr_buf::my_T, tm_callback::next, NULL, cell::relayed_reply_branch, ua_server::request, reset_avps(), ua_server::response, retr_buf::retr_timer, run_reqin_callbacks(), ser_error, set_avp_list(), shm_free, shm_malloc(), sip_msg_cloner(), TG_DEL, TG_FR, TG_RT, TG_WT, cell::tmcb_hl, tmcb_pending_hl, tmcb_pending_id, cell::uas, cell::user_avps, and cell::wait_tl.
Referenced by new_t(), t_uac(), and t_uac_cancel().
| void free_cell | ( | struct cell * | dead_cell | ) |
Definition at line 123 of file h_table.c.
References retr_buf::buffer, BUSY_BUFFER, destroy_avp_list_unsafe(), proxy_l::dn, empty_tmcb_list(), FAKED_REPLY, FL_SHM_CLONE, cell::fwded_totags, has_tran_tmcbs, proxy_l::host, dns_node::kids, ua_client::local_cancel, sip_msg::msg_flags, totag_elem::next, cell::nr_of_outgoings, NULL, ua_client::path_vec, ua_client::proxy, ua_client::reply, ua_client::request, ua_server::request, ua_server::response, run_trans_callbacks(), _str::s, shm_free_unsafe, shm_lock, shm_unlock, sip_msg_free_unsafe, totag_elem::tag, cell::tmcb_hl, TMCB_TRANS_DELETED, cell::uac, cell::uas, and cell::user_avps.
Referenced by delete_cell(), free_hash_table(), t_uac(), t_uac_cancel(), and unlink_timer_lists().
| 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 | ) |
| struct s_table* get_tm_table | ( | void | ) | [read] |
Definition at line 104 of file h_table.c.
Referenced by matching_3261(), mi_tm_hash(), t_lookup_callid(), t_lookup_ident(), t_lookup_request(), t_lookupOriginalT(), and t_reply_matching().
| struct s_table* init_hash_table | ( | void | ) | [read] |
Definition at line 355 of file h_table.c.
References s_table::entrys, free_hash_table(), init_entry_lock(), LM_ERR, lock_initialize(), entry::next_label, shm_malloc(), and TM_TABLE_ENTRIES.
Referenced by mod_init().
| 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 | ) |
| 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 | ) |
| void set_kr | ( | enum kill_reason | kr | ) |
Definition at line 81 of file h_table.c.
References kr.
Referenced by _reply(), add_blind_uac(), load_tm(), t_forward_nonack(), t_lookup_request(), t_release_transaction(), and t_reply_with_body().
| 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 | ) |
| int syn_branch |
Definition at line 73 of file h_table.c.
Referenced by init_synonym_id(), t_calc_branch(), and t_reply_matching().
1.5.6