Browse code

core, lib, modules: restructured source code tree

- new folder src/ to hold the source code for main project applications
- main.c is in src/
- all core files are subfolder are in src/core/
- modules are in src/modules/
- libs are in src/lib/
- application Makefiles are in src/
- application binary is built in src/ (src/kamailio)

Daniel-Constantin Mierla authored on 07/12/2016 11:03:51
Showing 1 changed files
1 1
deleted file mode 100644
... ...
@@ -1,265 +0,0 @@
1
-/*
2
- * Copyright (C) 2001-2004 FhG FOKUS
3
- *
4
- * This file is part of Kamailio, a free SIP server.
5
- *
6
- * Kamailio is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation; either version 2 of the License, or
9
- * (at your option) any later version
10
- *
11
- * Kamailio is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
- * GNU General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU General Public License 
17
- * along with this program; if not, write to the Free Software 
18
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
19
- */
20
-
21
-/*!
22
- * \file
23
- * \brief Kamailio core :: Destination set handling
24
- * \ingroup core
25
- * Module: \ref core
26
- */
27
-
28
-#ifndef _DSET_H
29
-#define _DSET_H
30
-
31
-#include "ip_addr.h"
32
-#include "qvalue.h"
33
-#include "flags.h"
34
-#include "parser/msg_parser.h"
35
-
36
-
37
-extern unsigned int nr_branches;
38
-extern int ruri_is_new;
39
-
40
-/*! \brief
41
- * Structure for storing branch attributes
42
- */
43
-struct branch
44
-{
45
-    char uri[MAX_URI_SIZE];
46
-    unsigned int len;
47
-
48
-         /* Real destination of the request */
49
-    char dst_uri[MAX_URI_SIZE];
50
-    unsigned int dst_uri_len;
51
-
52
-    /* Path set */
53
-    char path[MAX_PATH_SIZE];
54
-    unsigned int path_len;
55
-
56
-    int q; /* Preference of the contact among
57
-        * contact within the array */
58
-    struct socket_info* force_send_socket;
59
-
60
-    /* +sip.instance contact header param value */
61
-    char instance[MAX_INSTANCE_SIZE];
62
-    unsigned int instance_len;
63
-
64
-    /* reg-id contact header param value */
65
-    unsigned int reg_id;
66
-
67
-    /* ruid value from usrloc */
68
-    char ruid[MAX_RUID_SIZE];
69
-    unsigned int ruid_len;
70
-
71
-    char location_ua[MAX_UA_SIZE + 1];
72
-    unsigned int location_ua_len;
73
-
74
-    /* Branch flags */
75
-    flag_t flags;
76
-};
77
-
78
-typedef struct branch branch_t;
79
-
80
-/*! \brief
81
- * Return pointer to branch[idx] structure
82
- */
83
-branch_t *get_sip_branch(int idx);
84
-
85
-/*! \brief
86
- * Drop branch[idx]
87
- */
88
-int drop_sip_branch(int idx);
89
-
90
-/*! \brief
91
- * Add a new branch to current transaction 
92
- */
93
-int append_branch(struct sip_msg* msg, str* uri, str* dst_uri, str* path,
94
-		  qvalue_t q, unsigned int flags,
95
-		  struct socket_info* force_socket,
96
-		  str* instance, unsigned int reg_id,
97
-		  str* ruid, str* location_ua);
98
-
99
-/*! \brief kamailio compatible version */
100
-#define km_append_branch(msg, uri, dst_uri, path, q, flags, force_socket) \
101
-    append_branch(msg, uri, dst_uri, path, q, flags, force_socket, 0, 0, 0, 0)
102
-
103
-/*! \brief ser compatible append_branch version.
104
- *  append_branch version compatible with ser: no path or branch flags support
105
- *  and no str parameters.
106
- */
107
-static inline int ser_append_branch(struct sip_msg* msg,
108
-				    char* uri, int uri_len,
109
-				    char* dst_uri, int dst_uri_len,
110
-				    qvalue_t q,
111
-				    struct socket_info* force_socket)
112
-{
113
-    str s_uri, s_dst_uri;
114
-    s_uri.s=uri;
115
-    s_uri.len=uri_len;
116
-    s_dst_uri.s=dst_uri;
117
-    s_dst_uri.len=dst_uri_len;
118
-    return append_branch(msg, &s_uri, &s_dst_uri, 0, q, 0, force_socket, 0, 0, 0, 0);
119
-}
120
-
121
-
122
-
123
-/*! \brief
124
- * Init the index to iterate through the list of transaction branches
125
- */
126
-void init_branch_iterator(void);
127
-
128
-/*! \brief
129
- * Return branch iterator position
130
- */
131
-int get_branch_iterator(void);
132
-
133
-/*! \brief
134
- * Set branch iterator position
135
- */
136
-void set_branch_iterator(int n);
137
-
138
-/*! \brief Get the next branch in the current transaction.
139
- * @return pointer to the uri of the next branch (which the length written in
140
- *  *len) or 0 if there are no more branches.
141
- */
142
-char* next_branch(int* len, qvalue_t* q, str* dst_uri, str* path,
143
-		  unsigned int* flags, struct socket_info** force_socket,
144
-		  str *ruid, str *instance, str *location_ua);
145
-
146
-char* get_branch( unsigned int i, int* len, qvalue_t* q, str* dst_uri,
147
-		  str* path, unsigned int *flags,
148
-		  struct socket_info** force_socket,
149
-		  str* ruid, str *instance, str *location_ua);
150
-
151
-/*! \brief
152
- * Empty the array of branches
153
- */
154
-void clear_branches(void);
155
-
156
-
157
-/*! \brief
158
- * Create a Contact header field from the
159
- * list of current branches
160
- */
161
-char* print_dset(struct sip_msg* msg, int* len);
162
-
163
-
164
-/*! \brief
165
- * Set the q value of the Request-URI
166
- */
167
-void set_ruri_q(qvalue_t q);
168
-
169
-
170
-/*! \brief
171
- * Get src ip, port and proto as SIP uri or proxy address
172
- */
173
-int msg_get_src_addr(sip_msg_t *msg, str *uri, int mode);
174
-
175
-/*! \brief
176
- * Get the q value of the Request-URI
177
- */
178
-qvalue_t get_ruri_q(void);
179
-
180
-
181
-
182
-/*
183
- * Get actual Request-URI
184
- */
185
-inline static int get_request_uri(struct sip_msg* _m, str* _u)
186
-{
187
-	*_u=*GET_RURI(_m);
188
-	return 0;
189
-}
190
-
191
-
192
-#define ruri_mark_new() (ruri_is_new = 1)
193
-
194
-#define ruri_mark_consumed()  (ruri_is_new = 0)
195
-
196
-/** returns whether or not ruri should be used when forking.
197
-  * (usefull for serial forking)
198
-  * @return 0 if already marked as consumed, 1 if not.
199
- */
200
-#define ruri_get_forking_state() (ruri_is_new)
201
-
202
-int rewrite_uri(struct sip_msg* _m, str* _s);
203
-
204
-/*! \brief
205
- * Set a per-branch flag to 1.
206
- *
207
- * This function sets the value of one particular branch flag to 1.
208
- * @param branch Number of the branch (0 for the main Request-URI branch)
209
- * @param flag Number of the flag to be set (starting with 0)
210
- * @return 1 on success, -1 on failure.
211
- */
212
-int setbflag(unsigned int branch, flag_t flag);
213
-
214
-/*! \brief
215
- * Reset a per-branch flag value to 0.
216
- *
217
- * This function resets the value of one particular branch flag to 0.
218
- * @param branch Number of the branch (0 for the main Request-URI branch)
219
- * @param flag Number of the flag to be reset (starting with 0)
220
- * @return 1 on success, -1 on failure.
221
- */
222
-int resetbflag(unsigned int branch, flag_t flag);
223
-
224
-/*! \brief
225
- * Determine if a branch flag is set.
226
- *
227
- * This function tests the value of one particular per-branch flag.
228
- * @param branch Number of the branch (0 for the main Request-URI branch)
229
- * @param flag Number of the flag to be tested (starting with 0)
230
- * @return 1 if the branch flag is set, -1 if not or on failure.
231
- */
232
-int isbflagset(unsigned int branch, flag_t flag);
233
-
234
-/*! \brief
235
- * Get the value of all branch flags for a branch
236
- *
237
- * This function returns the value of all branch flags
238
- * combined in a single variable.
239
- * @param branch Number of the branch (0 for the main Request-URI branch)
240
- * @param res A pointer to a variable to store the result
241
- * @return 1 on success, -1 on failure
242
- */
243
-int getbflagsval(unsigned int branch, flag_t* res);
244
-
245
-/*! \brief
246
- * Set the value of all branch flags at once for a given branch.
247
- *
248
- * This function sets the value of all branch flags for a given
249
- * branch at once.
250
- * @param branch Number of the branch (0 for the main Request-URI branch)
251
- * @param val All branch flags combined into a single variable
252
- * @return 1 on success, -1 on failure
253
- */
254
-int setbflagsval(unsigned int branch, flag_t val);
255
-
256
-int uri_add_rcv_alias(sip_msg_t *msg, str *uri, str *nuri);
257
-int uri_restore_rcv_alias(str *uri, str *nuri, str *suri);
258
-
259
-int init_dst_set(void);
260
-
261
-int set_aor_case_sensitive(int mode);
262
-
263
-int get_aor_case_sensitive(void);
264
-
265
-#endif /* _DSET_H */
Browse code

core: keep info about aor being considered case sensitive or not

Daniel-Constantin Mierla authored on 26/08/2015 11:47:13
Showing 1 changed files
... ...
@@ -258,4 +258,8 @@ int uri_restore_rcv_alias(str *uri, str *nuri, str *suri);
258 258
 
259 259
 int init_dst_set(void);
260 260
 
261
+int set_aor_case_sensitive(int mode);
262
+
263
+int get_aor_case_sensitive(void);
264
+
261 265
 #endif /* _DSET_H */
Browse code

core: Modify doxygen, remove history, remove SVN IDs, change "ser" and "sip-router" to "KAMAILIO"

Olle E. Johansson authored on 16/01/2015 16:38:46
Showing 1 changed files
... ...
@@ -20,7 +20,7 @@
20 20
 
21 21
 /*!
22 22
  * \file
23
- * \brief SIP-router core :: Destination set handling
23
+ * \brief Kamailio core :: Destination set handling
24 24
  * \ingroup core
25 25
  * Module: \ref core
26 26
  */
Browse code

core : Update include files - delete IDs, update doxygen, delete history

Olle E. Johansson authored on 03/01/2015 10:55:48
Showing 1 changed files
... ...
@@ -1,16 +1,14 @@
1 1
 /*
2
- * $Id$
3
- *
4 2
  * Copyright (C) 2001-2004 FhG FOKUS
5 3
  *
6
- * This file is part of ser, a free SIP server.
4
+ * This file is part of Kamailio, a free SIP server.
7 5
  *
8
- * ser is free software; you can redistribute it and/or modify
6
+ * Kamailio is free software; you can redistribute it and/or modify
9 7
  * it under the terms of the GNU General Public License as published by
10 8
  * the Free Software Foundation; either version 2 of the License, or
11 9
  * (at your option) any later version
12 10
  *
13
- * ser is distributed in the hope that it will be useful,
11
+ * Kamailio is distributed in the hope that it will be useful,
14 12
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 13
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 14
  * GNU General Public License for more details.
Browse code

core: new parameter - max_branches

- the maximum number of uac branches can be set via config
- default value is 12 (old static value for MAX_BRNACHES)
- the upper limit is 31, it has to be at least 1
- example:
max_branches=16

Daniel-Constantin Mierla authored on 17/10/2014 09:04:23
Showing 1 changed files
... ...
@@ -258,4 +258,6 @@ int setbflagsval(unsigned int branch, flag_t val);
258 258
 int uri_add_rcv_alias(sip_msg_t *msg, str *uri, str *nuri);
259 259
 int uri_restore_rcv_alias(str *uri, str *nuri, str *suri);
260 260
 
261
+int init_dst_set(void);
262
+
261 263
 #endif /* _DSET_H */
Browse code

all: updated FSF address in GPL text

Anthony Messina authored on 04/07/2014 09:36:37 • Daniel-Constantin Mierla committed on 04/07/2014 09:37:36
Showing 1 changed files
... ...
@@ -17,7 +17,7 @@
17 17
  *
18 18
  * You should have received a copy of the GNU General Public License 
19 19
  * along with this program; if not, write to the Free Software 
20
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21 21
  */
22 22
 
23 23
 /*!
Browse code

core: helper functions to add or restore alias parameter to an uri

Daniel-Constantin Mierla authored on 03/10/2013 07:13:39
Showing 1 changed files
... ...
@@ -255,4 +255,7 @@ int getbflagsval(unsigned int branch, flag_t* res);
255 255
  */
256 256
 int setbflagsval(unsigned int branch, flag_t val);
257 257
 
258
+int uri_add_rcv_alias(sip_msg_t *msg, str *uri, str *nuri);
259
+int uri_restore_rcv_alias(str *uri, str *nuri, str *suri);
260
+
258 261
 #endif /* _DSET_H */
Browse code

core: helper function to get source address as uri or proxy format

Daniel-Constantin Mierla authored on 02/10/2013 12:23:53
Showing 1 changed files
... ...
@@ -169,6 +169,11 @@ char* print_dset(struct sip_msg* msg, int* len);
169 169
 void set_ruri_q(qvalue_t q);
170 170
 
171 171
 
172
+/*! \brief
173
+ * Get src ip, port and proto as SIP uri or proxy address
174
+ */
175
+int msg_get_src_addr(sip_msg_t *msg, str *uri, int mode);
176
+
172 177
 /*! \brief
173 178
  * Get the q value of the Request-URI
174 179
  */
Browse code

core: added fields to message structure and branch structure to hold user-agent string retrieved from usrloc

Peter Dunkley authored on 17/05/2013 23:13:11
Showing 1 changed files
... ...
@@ -70,6 +70,9 @@ struct branch
70 70
     char ruid[MAX_RUID_SIZE];
71 71
     unsigned int ruid_len;
72 72
 
73
+    char location_ua[MAX_UA_SIZE + 1];
74
+    unsigned int location_ua_len;
75
+
73 76
     /* Branch flags */
74 77
     flag_t flags;
75 78
 };
... ...
@@ -93,11 +96,11 @@ int append_branch(struct sip_msg* msg, str* uri, str* dst_uri, str* path,
93 96
 		  qvalue_t q, unsigned int flags,
94 97
 		  struct socket_info* force_socket,
95 98
 		  str* instance, unsigned int reg_id,
96
-		  str* ruid);
99
+		  str* ruid, str* location_ua);
97 100
 
98 101
 /*! \brief kamailio compatible version */
99 102
 #define km_append_branch(msg, uri, dst_uri, path, q, flags, force_socket) \
100
-    append_branch(msg, uri, dst_uri, path, q, flags, force_socket, 0, 0, 0)
103
+    append_branch(msg, uri, dst_uri, path, q, flags, force_socket, 0, 0, 0, 0)
101 104
 
102 105
 /*! \brief ser compatible append_branch version.
103 106
  *  append_branch version compatible with ser: no path or branch flags support
... ...
@@ -114,7 +117,7 @@ static inline int ser_append_branch(struct sip_msg* msg,
114 117
     s_uri.len=uri_len;
115 118
     s_dst_uri.s=dst_uri;
116 119
     s_dst_uri.len=dst_uri_len;
117
-    return append_branch(msg, &s_uri, &s_dst_uri, 0, q, 0, force_socket, 0, 0, 0);
120
+    return append_branch(msg, &s_uri, &s_dst_uri, 0, q, 0, force_socket, 0, 0, 0, 0);
118 121
 }
119 122
 
120 123
 
... ...
@@ -140,12 +143,12 @@ void set_branch_iterator(int n);
140 143
  */
141 144
 char* next_branch(int* len, qvalue_t* q, str* dst_uri, str* path,
142 145
 		  unsigned int* flags, struct socket_info** force_socket,
143
-		  str *ruid, str *instance);
146
+		  str *ruid, str *instance, str *location_ua);
144 147
 
145 148
 char* get_branch( unsigned int i, int* len, qvalue_t* q, str* dst_uri,
146 149
 		  str* path, unsigned int *flags,
147 150
 		  struct socket_info** force_socket,
148
-		  str* ruid, str *instance);
151
+		  str* ruid, str *instance, str *location_ua);
149 152
 
150 153
 /*! \brief
151 154
  * Empty the array of branches
Browse code

core: Update get_branch() to return instance from appended branches

- get_branch() and next_branch() updated
- modified select_core.c to use new function definition

Hugh Waite authored on 27/03/2013 11:44:08
Showing 1 changed files
... ...
@@ -140,12 +140,12 @@ void set_branch_iterator(int n);
140 140
  */
141 141
 char* next_branch(int* len, qvalue_t* q, str* dst_uri, str* path,
142 142
 		  unsigned int* flags, struct socket_info** force_socket,
143
-		  str *ruid);
143
+		  str *ruid, str *instance);
144 144
 
145 145
 char* get_branch( unsigned int i, int* len, qvalue_t* q, str* dst_uri,
146 146
 		  str* path, unsigned int *flags,
147 147
 		  struct socket_info** force_socket,
148
-		  str* ruid);
148
+		  str* ruid, str *instance);
149 149
 
150 150
 /*! \brief
151 151
  * Empty the array of branches
Browse code

core: updated get_branch() and next_branch() to return ruid (if set)

Peter Dunkley authored on 14/03/2013 23:32:42
Showing 1 changed files
... ...
@@ -139,11 +139,13 @@ void set_branch_iterator(int n);
139 139
  *  *len) or 0 if there are no more branches.
140 140
  */
141 141
 char* next_branch(int* len, qvalue_t* q, str* dst_uri, str* path,
142
-		  unsigned int* flags, struct socket_info** force_socket);
142
+		  unsigned int* flags, struct socket_info** force_socket,
143
+		  str *ruid);
143 144
 
144 145
 char* get_branch( unsigned int i, int* len, qvalue_t* q, str* dst_uri,
145 146
 		  str* path, unsigned int *flags,
146
-		  struct socket_info** force_socket);
147
+		  struct socket_info** force_socket,
148
+		  str* ruid);
147 149
 
148 150
 /*! \brief
149 151
  * Empty the array of branches
Browse code

core: added ruid to msg and branch structures

Peter Dunkley authored on 14/03/2013 22:42:16
Showing 1 changed files
... ...
@@ -66,6 +66,10 @@ struct branch
66 66
     /* reg-id contact header param value */
67 67
     unsigned int reg_id;
68 68
 
69
+    /* ruid value from usrloc */
70
+    char ruid[MAX_RUID_SIZE];
71
+    unsigned int ruid_len;
72
+
69 73
     /* Branch flags */
70 74
     flag_t flags;
71 75
 };
... ...
@@ -88,11 +92,12 @@ int drop_sip_branch(int idx);
88 92
 int append_branch(struct sip_msg* msg, str* uri, str* dst_uri, str* path,
89 93
 		  qvalue_t q, unsigned int flags,
90 94
 		  struct socket_info* force_socket,
91
-		  str* instance, unsigned int reg_id);
95
+		  str* instance, unsigned int reg_id,
96
+		  str* ruid);
92 97
 
93 98
 /*! \brief kamailio compatible version */
94 99
 #define km_append_branch(msg, uri, dst_uri, path, q, flags, force_socket) \
95
-    append_branch(msg, uri, dst_uri, path, q, flags, force_socket, 0, 0)
100
+    append_branch(msg, uri, dst_uri, path, q, flags, force_socket, 0, 0, 0)
96 101
 
97 102
 /*! \brief ser compatible append_branch version.
98 103
  *  append_branch version compatible with ser: no path or branch flags support
... ...
@@ -109,7 +114,7 @@ static inline int ser_append_branch(struct sip_msg* msg,
109 114
     s_uri.len=uri_len;
110 115
     s_dst_uri.s=dst_uri;
111 116
     s_dst_uri.len=dst_uri_len;
112
-    return append_branch(msg, &s_uri, &s_dst_uri, 0, q, 0, force_socket, 0, 0);
117
+    return append_branch(msg, &s_uri, &s_dst_uri, 0, q, 0, force_socket, 0, 0, 0);
113 118
 }
114 119
 
115 120
 
Browse code

modules_k/pv: fixed compilation error in define

- removed extra ';' from km_append_branch define
- thanks to Daniel-Constantin Mierla for reporting

Juha Heinanen authored on 08/12/2012 14:00:34
Showing 1 changed files
... ...
@@ -92,7 +92,7 @@ int append_branch(struct sip_msg* msg, str* uri, str* dst_uri, str* path,
92 92
 
93 93
 /*! \brief kamailio compatible version */
94 94
 #define km_append_branch(msg, uri, dst_uri, path, q, flags, force_socket) \
95
-    append_branch(msg, uri, dst_uri, path, q, flags, force_socket, 0, 0);
95
+    append_branch(msg, uri, dst_uri, path, q, flags, force_socket, 0, 0)
96 96
 
97 97
 /*! \brief ser compatible append_branch version.
98 98
  *  append_branch version compatible with ser: no path or branch flags support
Browse code

core and several modules: instance and reg_id in branch_t

- added instance and reg_id fields to branch_t
- added instance and reg_id arguments to append_branch function
- modified append_branch calls in core and several modules
- did not touch obsolete or modules_s modules (which are to be
removed from next release)

Juha Heinanen authored on 08/12/2012 12:17:46
Showing 1 changed files
... ...
@@ -59,6 +59,13 @@ struct branch
59 59
         * contact within the array */
60 60
     struct socket_info* force_send_socket;
61 61
 
62
+    /* +sip.instance contact header param value */
63
+    char instance[MAX_INSTANCE_SIZE];
64
+    unsigned int instance_len;
65
+
66
+    /* reg-id contact header param value */
67
+    unsigned int reg_id;
68
+
62 69
     /* Branch flags */
63 70
     flag_t flags;
64 71
 };
... ...
@@ -79,29 +86,30 @@ int drop_sip_branch(int idx);
79 86
  * Add a new branch to current transaction 
80 87
  */
81 88
 int append_branch(struct sip_msg* msg, str* uri, str* dst_uri, str* path,
82
-					 qvalue_t q, unsigned int flags,
83
-					 struct socket_info* force_socket);
89
+		  qvalue_t q, unsigned int flags,
90
+		  struct socket_info* force_socket,
91
+		  str* instance, unsigned int reg_id);
84 92
 
85 93
 /*! \brief kamailio compatible version */
86 94
 #define km_append_branch(msg, uri, dst_uri, path, q, flags, force_socket) \
87
-	append_branch(msg, uri, dst_uri, path, q, flags, force_socket)
95
+    append_branch(msg, uri, dst_uri, path, q, flags, force_socket, 0, 0);
88 96
 
89 97
 /*! \brief ser compatible append_branch version.
90 98
  *  append_branch version compatible with ser: no path or branch flags support
91 99
  *  and no str parameters.
92 100
  */
93 101
 static inline int ser_append_branch(struct sip_msg* msg,
94
-									char* uri, int uri_len,
95
-									char* dst_uri, int dst_uri_len,
96
-									qvalue_t q,
97
-									struct socket_info* force_socket)
102
+				    char* uri, int uri_len,
103
+				    char* dst_uri, int dst_uri_len,
104
+				    qvalue_t q,
105
+				    struct socket_info* force_socket)
98 106
 {
99
-	str s_uri, s_dst_uri;
100
-	s_uri.s=uri;
101
-	s_uri.len=uri_len;
102
-	s_dst_uri.s=dst_uri;
103
-	s_dst_uri.len=dst_uri_len;
104
-	return append_branch(msg, &s_uri, &s_dst_uri, 0, q, 0, force_socket);
107
+    str s_uri, s_dst_uri;
108
+    s_uri.s=uri;
109
+    s_uri.len=uri_len;
110
+    s_dst_uri.s=dst_uri;
111
+    s_dst_uri.len=dst_uri_len;
112
+    return append_branch(msg, &s_uri, &s_dst_uri, 0, q, 0, force_socket, 0, 0);
105 113
 }
106 114
 
107 115
 
... ...
@@ -126,14 +134,11 @@ void set_branch_iterator(int n);
126 134
  *  *len) or 0 if there are no more branches.
127 135
  */
128 136
 char* next_branch(int* len, qvalue_t* q, str* dst_uri, str* path,
129
-					unsigned int* flags, struct socket_info** force_socket);
130
-
137
+		  unsigned int* flags, struct socket_info** force_socket);
131 138
 
132 139
 char* get_branch( unsigned int i, int* len, qvalue_t* q, str* dst_uri,
133
-				  str* path, unsigned int *flags,
134
-				  struct socket_info** force_socket);
135
-
136
-
140
+		  str* path, unsigned int *flags,
141
+		  struct socket_info** force_socket);
137 142
 
138 143
 /*! \brief
139 144
  * Empty the array of branches
Browse code

core: save and restore branch_iterator in print_dset

- safe usage in branch_route where branch_interator is used to add the
new brnaches, but some variables can change it if used in config
branch_route
- closes FS#182, reported by Pawel Sternal

Daniel-Constantin Mierla authored on 24/11/2011 11:56:28
Showing 1 changed files
... ...
@@ -107,15 +107,19 @@ static inline int ser_append_branch(struct sip_msg* msg,
107 107
 
108 108
 
109 109
 /*! \brief
110
- * Iterate through the list of transaction branches 
110
+ * Init the index to iterate through the list of transaction branches
111 111
  */
112 112
 void init_branch_iterator(void);
113 113
 
114 114
 /*! \brief
115
- * Return branch iterator position 
115
+ * Return branch iterator position
116 116
  */
117 117
 int get_branch_iterator(void);
118 118
 
119
+/*! \brief
120
+ * Set branch iterator position
121
+ */
122
+void set_branch_iterator(int n);
119 123
 
120 124
 /*! \brief Get the next branch in the current transaction.
121 125
  * @return pointer to the uri of the next branch (which the length written in
Browse code

core: support for marking a "consumed" r-uri

The main/message r-uri can now be marked as "consumed" during
forking or as "new".
New function introduced (dset.h): ruri_mark_new(),
ruri_mark_consumed(), ruri_get_forking_state().
rewrite_uri() will now automatically mark the uri as "new".

Andrei Pelinescu-Onciul authored on 27/05/2010 08:51:51
Showing 1 changed files
... ...
@@ -37,6 +37,7 @@
37 37
 
38 38
 
39 39
 extern unsigned int nr_branches;
40
+extern int ruri_is_new;
40 41
 
41 42
 /*! \brief
42 43
  * Structure for storing branch attributes
... ...
@@ -166,6 +167,15 @@ inline static int get_request_uri(struct sip_msg* _m, str* _u)
166 167
 }
167 168
 
168 169
 
170
+#define ruri_mark_new() (ruri_is_new = 1)
171
+
172
+#define ruri_mark_consumed()  (ruri_is_new = 0)
173
+
174
+/** returns whether or not ruri should be used when forking.
175
+  * (usefull for serial forking)
176
+  * @return 0 if already marked as consumed, 1 if not.
177
+ */
178
+#define ruri_get_forking_state() (ruri_is_new)
169 179
 
170 180
 int rewrite_uri(struct sip_msg* _m, str* _s);
171 181
 
Browse code

dset: exposed branch structure

- added helper functions to allow branch attributes updates via PVs
- related to FS#8

Daniel-Constantin Mierla authored on 21/04/2010 10:53:03
Showing 1 changed files
... ...
@@ -38,6 +38,42 @@
38 38
 
39 39
 extern unsigned int nr_branches;
40 40
 
41
+/*! \brief
42
+ * Structure for storing branch attributes
43
+ */
44
+struct branch
45
+{
46
+    char uri[MAX_URI_SIZE];
47
+    unsigned int len;
48
+
49
+         /* Real destination of the request */
50
+    char dst_uri[MAX_URI_SIZE];
51
+    unsigned int dst_uri_len;
52
+
53
+    /* Path set */
54
+    char path[MAX_PATH_SIZE];
55
+    unsigned int path_len;
56
+
57
+    int q; /* Preference of the contact among
58
+        * contact within the array */
59
+    struct socket_info* force_send_socket;
60
+
61
+    /* Branch flags */
62
+    flag_t flags;
63
+};
64
+
65
+typedef struct branch branch_t;
66
+
67
+/*! \brief
68
+ * Return pointer to branch[idx] structure
69
+ */
70
+branch_t *get_sip_branch(int idx);
71
+
72
+/*! \brief
73
+ * Drop branch[idx]
74
+ */
75
+int drop_sip_branch(int idx);
76
+
41 77
 /*! \brief
42 78
  * Add a new branch to current transaction 
43 79
  */
Browse code

Merge remote branch 'origin/sr_3.0'

latest sr_3.0 fixes.

* origin/sr_3.0: (36 commits)
core: added id to every field of gw table schema
tcp: use the forced socket ip as source
tmx: pv_t_copy_msg: copy also the send flags
textops(k): msg_apply_changes: preserve the send flags
seas: use set_force_socket()
rr(k): use set_force_socket()
registrar(k): use set_force_socket()
pv: use set_force_socket()
kex: use set_force_socket()
domainpolicy: use set_force_socket()
rr(s): use set_force_socket()
registrar(s): use set_force_socket()
tm: use set_force_socket() instead of msg->force_send_socket
tm: preserve forced sockets and send flags during dns failover
core: extra flag when forcing a socket
core: kamailio mode config parser fix
core: PAI and PPI parsing support fixed
core: dset minor cleanups
core: append_branch() sets also the send_socket, path & flags
remove extra backslash in make modules-doc action
...

Andrei Pelinescu-Onciul authored on 06/11/2009 07:56:40
Showing 0 changed files
Browse code

core: dset minor cleanups

- get_request_uri() is now inline and uses GET_RURI
- DBG msg removed

Andrei Pelinescu-Onciul authored on 31/10/2009 09:31:18
Showing 1 changed files
... ...
@@ -31,8 +31,8 @@
31 31
 #include "ip_addr.h"
32 32
 #include "qvalue.h"
33 33
 #include "flags.h"
34
+#include "parser/msg_parser.h"
34 35
 
35
-struct sip_msg;
36 36
 
37 37
 extern unsigned int nr_branches;
38 38
 
... ...
@@ -118,7 +118,19 @@ void set_ruri_q(qvalue_t q);
118 118
  */
119 119
 qvalue_t get_ruri_q(void);
120 120
 
121
-int get_request_uri(struct sip_msg* _m, str* _u);
121
+
122
+
123
+/*
124
+ * Get actual Request-URI
125
+ */
126
+inline static int get_request_uri(struct sip_msg* _m, str* _u)
127
+{
128
+	*_u=*GET_RURI(_m);
129
+	return 0;
130
+}
131
+
132
+
133
+
122 134
 int rewrite_uri(struct sip_msg* _m, str* _s);
123 135
 
124 136
 /**
Browse code

Documentation and doxygen updates

oej authored on 25/10/2009 19:49:25
Showing 1 changed files
... ...
@@ -10,11 +10,6 @@
10 10
  * the Free Software Foundation; either version 2 of the License, or
11 11
  * (at your option) any later version
12 12
  *
13
- * For a license to use the ser software under conditions
14
- * other than those described here, or to purchase support for this
15
- * software, please contact iptel.org by e-mail at the following addresses:
16
- *    info@iptel.org
17
- *
18 13
  * ser is distributed in the hope that it will be useful,
19 14
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 15
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
... ...
@@ -25,6 +20,13 @@
25 20
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
26 21
  */
27 22
 
23
+/*!
24
+ * \file
25
+ * \brief SIP-router core :: Destination set handling
26
+ * \ingroup core
27
+ * Module: \ref core
28
+ */
29
+
28 30
 #ifndef _DSET_H
29 31
 #define _DSET_H
30 32
 
... ...
@@ -36,20 +38,18 @@ struct sip_msg;
36 38
 
37 39
 extern unsigned int nr_branches;
38 40
 
39
-
40
-
41
-/*
41
+/*! \brief
42 42
  * Add a new branch to current transaction 
43 43
  */
44 44
 int append_branch(struct sip_msg* msg, str* uri, str* dst_uri, str* path,
45 45
 					 qvalue_t q, unsigned int flags,
46 46
 					 struct socket_info* force_socket);
47 47
 
48
-/* kamailio compatible version */
48
+/*! \brief kamailio compatible version */
49 49
 #define km_append_branch(msg, uri, dst_uri, path, q, flags, force_socket) \
50 50
 	append_branch(msg, uri, dst_uri, path, q, flags, force_socket)
51 51
 
52
-/** ser compatible append_branch version.
52
+/*! \brief ser compatible append_branch version.
53 53
  *  append_branch version compatible with ser: no path or branch flags support
54 54
  *  and no str parameters.
55 55
  */
... ...
@@ -69,18 +69,18 @@ static inline int ser_append_branch(struct sip_msg* msg,
69 69
 
70 70
 
71 71
 
72
-/*
72
+/*! \brief
73 73
  * Iterate through the list of transaction branches 
74 74
  */
75 75
 void init_branch_iterator(void);
76 76
 
77
-/* 
77
+/*! \brief
78 78
  * Return branch iterator position 
79 79
  */
80 80
 int get_branch_iterator(void);
81 81
 
82 82
 
83
-/** Get the next branch in the current transaction.
83
+/*! \brief Get the next branch in the current transaction.
84 84
  * @return pointer to the uri of the next branch (which the length written in
85 85
  *  *len) or 0 if there are no more branches.
86 86
  */
... ...
@@ -94,26 +94,26 @@ char* get_branch( unsigned int i, int* len, qvalue_t* q, str* dst_uri,
94 94
 
95 95
 
96 96
 
97
-/*
97
+/*! \brief
98 98
  * Empty the array of branches
99 99
  */
100 100
 void clear_branches(void);
101 101
 
102 102
 
103
-/*
103
+/*! \brief
104 104
  * Create a Contact header field from the
105 105
  * list of current branches
106 106
  */
107 107
 char* print_dset(struct sip_msg* msg, int* len);
108 108
 
109 109
 
110
-/* 
110
+/*! \brief
111 111
  * Set the q value of the Request-URI
112 112
  */
113 113
 void set_ruri_q(qvalue_t q);
114 114
 
115 115
 
116
-/* 
116
+/*! \brief
117 117
  * Get the q value of the Request-URI
118 118
  */
119 119
 qvalue_t get_ruri_q(void);
... ...
@@ -121,7 +121,7 @@ qvalue_t get_ruri_q(void);
121 121
 int get_request_uri(struct sip_msg* _m, str* _u);
122 122
 int rewrite_uri(struct sip_msg* _m, str* _s);
123 123
 
124
-/**
124
+/*! \brief
125 125
  * Set a per-branch flag to 1.
126 126
  *
127 127
  * This function sets the value of one particular branch flag to 1.
... ...
@@ -131,7 +131,7 @@ int rewrite_uri(struct sip_msg* _m, str* _s);
131 131
  */
132 132
 int setbflag(unsigned int branch, flag_t flag);
133 133
 
134
-/**
134
+/*! \brief
135 135
  * Reset a per-branch flag value to 0.
136 136
  *
137 137
  * This function resets the value of one particular branch flag to 0.
... ...
@@ -141,7 +141,7 @@ int setbflag(unsigned int branch, flag_t flag);
141 141
  */
142 142
 int resetbflag(unsigned int branch, flag_t flag);
143 143
 
144
-/**
144
+/*! \brief
145 145
  * Determine if a branch flag is set.
146 146
  *
147 147
  * This function tests the value of one particular per-branch flag.
... ...
@@ -151,7 +151,7 @@ int resetbflag(unsigned int branch, flag_t flag);
151 151
  */
152 152
 int isbflagset(unsigned int branch, flag_t flag);
153 153
 
154
-/**
154
+/*! \brief
155 155
  * Get the value of all branch flags for a branch
156 156
  *
157 157
  * This function returns the value of all branch flags
... ...
@@ -162,7 +162,7 @@ int isbflagset(unsigned int branch, flag_t flag);
162 162
  */
163 163
 int getbflagsval(unsigned int branch, flag_t* res);
164 164
 
165
-/**
165
+/*! \brief
166 166
  * Set the value of all branch flags at once for a given branch.
167 167
  *
168 168
  * This function sets the value of all branch flags for a given
Browse code

core: append_branch & next_branch api changes

- added path, branch flags support and switched the parameters to
str for append_branch and next_branch. append_branch is now
exactly the same as km_append_branch.
- added ser_append_branch for compatibility with ser modules which
don't need the extra parameters.
- updated core code to use the modified api.

Andrei Pelinescu-Onciul authored on 04/09/2009 13:09:08
Showing 1 changed files
... ...
@@ -37,18 +37,39 @@ struct sip_msg;
37 37
 extern unsigned int nr_branches;
38 38
 
39 39
 
40
-/* 
40
+
41
+/*
41 42
  * Add a new branch to current transaction 
42 43
  */
43
-int append_branch(struct sip_msg* msg, char* uri, int uri_len, char* dst_uri, int dst_uri_len, 
44
-		  qvalue_t q, struct socket_info* force_socket);
44
+int append_branch(struct sip_msg* msg, str* uri, str* dst_uri, str* path,
45
+					 qvalue_t q, unsigned int flags,
46
+					 struct socket_info* force_socket);
45 47
 
48
+/* kamailio compatible version */
49
+#define km_append_branch(msg, uri, dst_uri, path, q, flags, force_socket) \
50
+	append_branch(msg, uri, dst_uri, path, q, flags, force_socket)
46 51
 
47
-int km_append_branch(struct sip_msg* msg, str* uri, str* dst_uri, str* path,
48
-					 qvalue_t q, unsigned int flags, struct socket_info* force_socket);
52
+/** ser compatible append_branch version.
53
+ *  append_branch version compatible with ser: no path or branch flags support
54
+ *  and no str parameters.
55
+ */
56
+static inline int ser_append_branch(struct sip_msg* msg,
57
+									char* uri, int uri_len,
58
+									char* dst_uri, int dst_uri_len,
59
+									qvalue_t q,
60
+									struct socket_info* force_socket)
61
+{
62
+	str s_uri, s_dst_uri;
63
+	s_uri.s=uri;
64
+	s_uri.len=uri_len;
65
+	s_dst_uri.s=dst_uri;
66
+	s_dst_uri.len=dst_uri_len;
67
+	return append_branch(msg, &s_uri, &s_dst_uri, 0, q, 0, force_socket);
68
+}
49 69
 
50 70
 
51
-/* 
71
+
72
+/*
52 73
  * Iterate through the list of transaction branches 
53 74
  */
54 75
 void init_branch_iterator(void);
... ...
@@ -58,14 +79,19 @@ void init_branch_iterator(void);
58 79
  */
59 80
 int get_branch_iterator(void);
60 81
 
61
-/*
62
- * Get the next branch in the current transaction
82
+
83
+/** Get the next branch in the current transaction.
84
+ * @return pointer to the uri of the next branch (which the length written in
85
+ *  *len) or 0 if there are no more branches.
63 86
  */
64
-char* next_branch(int* len, qvalue_t* q, char** dst_uri, int* dst_len, struct socket_info** force_socket);
87
+char* next_branch(int* len, qvalue_t* q, str* dst_uri, str* path,
88
+					unsigned int* flags, struct socket_info** force_socket);
65 89
 
66 90
 
67 91
 char* get_branch( unsigned int i, int* len, qvalue_t* q, str* dst_uri,
68
-				  str* path, unsigned int *flags, struct socket_info** force_socket);
92
+				  str* path, unsigned int *flags,
93
+				  struct socket_info** force_socket);
94
+
69 95
 
70 96
 
71 97
 /*
Browse code

core: wrapper to return branch iterator position

Daniel-Constantin Mierla authored on 28/04/2009 18:38:09
Showing 1 changed files
... ...
@@ -53,6 +53,10 @@ int km_append_branch(struct sip_msg* msg, str* uri, str* dst_uri, str* path,
53 53
  */
54 54
 void init_branch_iterator(void);
55 55
 
56
+/* 
57
+ * Return branch iterator position 
58
+ */
59
+int get_branch_iterator(void);
56 60
 
57 61
 /*
58 62
  * Get the next branch in the current transaction
Browse code

core: renamed getbflsgs to getblagsval

- match the template of counterpart setblagsval
- swapped the parameters

Daniel-Constantin Mierla authored on 28/04/2009 17:21:04
Showing 1 changed files
... ...
@@ -126,11 +126,11 @@ int isbflagset(unsigned int branch, flag_t flag);
126 126
  *
127 127
  * This function returns the value of all branch flags