-
Notifications
You must be signed in to change notification settings - Fork 909
/
t_lookup.h
151 lines (114 loc) · 4.62 KB
/
t_lookup.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
/*
* Copyright (C) 2001-2003 FhG Fokus
*
* This file is part of Kamailio, a free SIP server.
*
* Kamailio is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version
*
* Kamailio is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _T_LOOKUP_H
#define _T_LOOKUP_H
#include "config.h"
#include "t_funcs.h"
#define T_UNDEFINED ((struct cell *)-1)
#define T_NULL_CELL ((struct cell *)0)
#define T_BR_UNDEFINED (-1)
extern msg_ctx_id_t tm_global_ctx_id;
void init_t(void);
int init_rb(struct retr_buf *rb, struct sip_msg *msg);
typedef struct cell *(*tlookup_original_f)(struct sip_msg *p_msg);
struct cell *t_lookupOriginalT(struct sip_msg *p_msg);
int t_reply_matching(struct sip_msg *, int *);
typedef int (*tlookup_request_f)(struct sip_msg *, int, int *);
int t_lookup_request(
struct sip_msg *p_msg, int leave_new_locked, int *canceled);
int t_newtran(struct sip_msg *p_msg);
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);
/* releases T-context */
int t_unref(struct sip_msg *p_msg);
typedef int (*tunref_f)(struct sip_msg *p_msg);
typedef int (*tcheck_f)(struct sip_msg *, int *);
/* old t_check version (no e2eack support) */
int t_check(struct sip_msg *, int *branch);
/* new version, e2eack and different return convention */
int t_check_msg(struct sip_msg *, int *branch);
typedef struct cell *(*tgett_f)(void);
struct cell *get_t(void);
typedef struct cell *(*tfind_f)(struct sip_msg *, int *, int *);
struct cell *t_find(struct sip_msg *msg, int *branch, int *vref);
typedef void (*tunset_f)(void);
void t_unset(void);
typedef int (*tgett_branch_f)(void);
int get_t_branch(void);
/* use carefully or better not at all -- current transaction is
* primarily set by lookup functions */
typedef void (*tsett_f)(struct cell *t, int branch);
void set_t(struct cell *t, int branch);
#define T_GET_TI "t_get_trans_ident"
#define T_LOOKUP_IDENT "t_lookup_ident"
#define T_IS_LOCAL "t_is_local"
typedef int (*tislocal_f)(struct sip_msg *);
typedef int (*tnewtran_f)(struct sip_msg *);
typedef int (*tget_ti_f)(struct sip_msg *, unsigned int *, unsigned int *);
typedef int (*tlookup_ident_f)(struct cell **, unsigned int, unsigned int);
typedef int (*trelease_f)(struct sip_msg *);
typedef int (*tlookup_callid_f)(struct cell **, str, str);
typedef int (*tset_fr_f)(struct sip_msg *, unsigned int, unsigned int);
int t_is_local(struct sip_msg *);
int t_get_trans_ident(
struct sip_msg *p_msg, unsigned int *hash_index, unsigned int *label);
int t_lookup_ident(
struct cell **trans, unsigned int hash_index, unsigned int label);
int t_lookup_ident_filter(struct cell **trans, unsigned int hash_index,
unsigned int label, int filter);
tm_cell_t *t_find_ident_filter(
unsigned int hash_index, unsigned int label, int filter);
/* lookup a transaction by callid and cseq */
int t_lookup_callid(struct cell **trans, str callid, str cseq);
int t_request_search(struct sip_msg *p_msg, struct cell **r_cell);
int t_reply_search(struct sip_msg *p_msg, struct cell **r_cell, int *r_branch);
int t_set_fr(struct sip_msg *msg, unsigned int fr_inv_to, unsigned int fr_to);
int t_reset_fr(void);
int t_set_retr(struct sip_msg *msg, unsigned int t1_to, unsigned int t2_to);
int t_reset_retr(void);
int t_set_max_lifetime(
struct sip_msg *msg, unsigned int eol_inv, unsigned int eol_noninv);
int t_reset_max_lifetime(void);
/**
* Returns the hash coordinates of the transaction current CANCEL is targeting.
*/
int t_get_canceled_ident(
struct sip_msg *msg, unsigned int *hash_index, unsigned int *label);
typedef int (*t_get_canceled_ident_f)(
struct sip_msg *msg, unsigned int *hash_index, unsigned int *label);
/**
* required by TMX (K/O extensions)
*/
#define WITH_TM_CTX
#ifdef WITH_TM_CTX
typedef struct _tm_ctx
{
int branch_index;
} tm_ctx_t;
typedef tm_ctx_t *(*tm_ctx_get_f)(void);
tm_ctx_t *tm_ctx_get(void);
void tm_ctx_init(void);
void tm_ctx_set_branch_index(int v);
#else
#define tm_ctx_get() NULL
#define tm_ctx_init()
#define tm_ctx_set_branch_index(v)
#endif /* WITH_TM_CTX */
#endif