- 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)
1 | 1 |
deleted file mode 100644 |
... | ... |
@@ -1,183 +0,0 @@ |
1 |
-/* |
|
2 |
- * Copyright (C) 2001-2003 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 |
-/*! |
|
23 |
-* \file |
|
24 |
-* \brief Kamailio core :: Message translations |
|
25 |
-* \author jiri |
|
26 |
-* \ingroup core |
|
27 |
-* Module: \ref core |
|
28 |
-*/ |
|
29 |
- |
|
30 |
- |
|
31 |
-#ifndef _MSG_TRANSLATOR_H |
|
32 |
-#define _MSG_TRANSLATOR_H |
|
33 |
- |
|
34 |
-/* flags used for process_lumps flag parameter */ |
|
35 |
-#define FLAG_MSG_LUMPS_ONLY 0 /* copy just the lumps */ |
|
36 |
-#define FLAG_MSG_ALL 1 /* copy all the msg */ |
|
37 |
- |
|
38 |
-#define MY_HF_SEP ": " |
|
39 |
-#define MY_HF_SEP_LEN 2 |
|
40 |
- |
|
41 |
-#define BRANCH_SEPARATOR '.' |
|
42 |
-#define WARNING "Warning: 392 " |
|
43 |
-#define WARNING_LEN (sizeof(WARNING)-1) |
|
44 |
-#define WARNING_PHRASE " \"Noisy feedback tells: " |
|
45 |
-#define WARNING_PHRASE_LEN (sizeof(WARNING_PHRASE)-1) |
|
46 |
- |
|
47 |
-/*#define MAX_CONTENT_LEN_BUF INT2STR_MAX_LEN *//* see ut.h/int2str() */ |
|
48 |
- |
|
49 |
-#define BUILD_NO_LOCAL_VIA (1<<0) |
|
50 |
-#define BUILD_NO_VIA1_UPDATE (1<<1) |
|
51 |
-#define BUILD_NO_PATH (1<<2) |
|
52 |
-#define BUILD_IN_SHM (1<<7) |
|
53 |
- |
|
54 |
-#include "parser/msg_parser.h" |
|
55 |
-#include "ip_addr.h" |
|
56 |
- |
|
57 |
-/* point to some remarkable positions in a SIP message */ |
|
58 |
-struct bookmark { |
|
59 |
- str to_tag_val; |
|
60 |
-}; |
|
61 |
- |
|
62 |
-/* used by via_builder */ |
|
63 |
-struct hostport { |
|
64 |
- str* host; |
|
65 |
- str* port; |
|
66 |
-}; |
|
67 |
- |
|
68 |
- |
|
69 |
-#define set_hostport(hp, msg) \ |
|
70 |
- do{ \ |
|
71 |
- if ((msg) && ((struct sip_msg*)(msg))->set_global_address.len) \ |
|
72 |
- (hp)->host=&(((struct sip_msg*)(msg))->set_global_address); \ |
|
73 |
- else \ |
|
74 |
- (hp)->host=&default_global_address; \ |
|
75 |
- if ((msg) && ((struct sip_msg*)(msg))->set_global_port.len) \ |
|
76 |
- (hp)->port=&(((struct sip_msg*)(msg))->set_global_port); \ |
|
77 |
- else \ |
|
78 |
- (hp)->port=&default_global_port; \ |
|
79 |
- }while(0) |
|
80 |
- |
|
81 |
-char * build_req_buf_from_sip_req(struct sip_msg* msg, |
|
82 |
- unsigned int *returned_len, struct dest_info* send_info, |
|
83 |
- unsigned int mode); |
|
84 |
- |
|
85 |
-char * build_res_buf_from_sip_res(struct sip_msg* msg, |
|
86 |
- unsigned int *returned_len); |
|
87 |
- |
|
88 |
-char * generate_res_buf_from_sip_res(struct sip_msg* msg, |
|
89 |
- unsigned int *returned_len, unsigned int mode); |
|
90 |
- |
|
91 |
-char * build_res_buf_from_sip_req(unsigned int code, |
|
92 |
- str *text, |
|
93 |
- str *new_tag, |
|
94 |
- struct sip_msg* msg, |
|
95 |
- unsigned int *returned_len, |
|
96 |
- struct bookmark *bmark); |
|
97 |
-/* |
|
98 |
-char * build_res_buf_with_body_from_sip_req( unsigned int code , |
|
99 |
- char *text , |
|
100 |
- char *new_tag , |
|
101 |
- unsigned int new_tag_len , |
|
102 |
- char *body , |
|
103 |
- unsigned int body_len, |
|
104 |
- char *content_type, |
|
105 |
- unsigned int content_type_len, |
|
106 |
- struct sip_msg* msg, |
|
107 |
- unsigned int *returned_len, |
|
108 |
- struct bookmark *bmark); |
|
109 |
-*/ |
|
110 |
-char* via_builder( unsigned int *len, |
|
111 |
- struct dest_info* send_info, |
|
112 |
- str *branch, str* extra_params, struct hostport *hp ); |
|
113 |
- |
|
114 |
-/* creates a via header honoring the protocol of the incomming socket |
|
115 |
- * msg is an optional parameter */ |
|
116 |
-char* create_via_hf( unsigned int *len, |
|
117 |
- struct sip_msg *msg, |
|
118 |
- struct dest_info* send_info /* where to send the reply */, |
|
119 |
- str* branch); |
|
120 |
- |
|
121 |
-int branch_builder( unsigned int hash_index, |
|
122 |
- /* only either parameter useful */ |
|
123 |
- unsigned int label, char * char_v, |
|
124 |
- int branch, |
|
125 |
- /* output value: string and actual length */ |
|
126 |
- char *branch_str, int *len ); |
|
127 |
- |
|
128 |
-char* id_builder(struct sip_msg* msg, unsigned int *id_len); |
|
129 |
- |
|
130 |
-/* check if IP address in Via != source IP address of signaling, |
|
131 |
- * or the sender is asking to set the values for rport or received */ |
|
132 |
-int received_test( struct sip_msg *msg ); |
|
133 |
- |
|
134 |
-/* check if IP address in Via != source IP address of signaling */ |
|
135 |
-int received_via_test( struct sip_msg *msg ); |
|
136 |
- |
|
137 |
-/* builds a char* buffer from message headers without body |
|
138 |
- * first line is excluded in case of skip_first_line=1 |
|
139 |
- */ |
|
140 |
-char * build_only_headers( struct sip_msg* msg, int skip_first_line, |
|
141 |
- unsigned int *returned_len, |
|
142 |
- int *error, |
|
143 |
- struct dest_info* send_info); |
|
144 |
- |
|
145 |
-/* builds a char* buffer from message body |
|
146 |
- * error is set -1 if the memory allocation failes |
|
147 |
- */ |
|
148 |
-char * build_body( struct sip_msg* msg, |
|
149 |
- unsigned int *returned_len, |
|
150 |
- int *error, |
|
151 |
- struct dest_info* send_info); |
|
152 |
- |
|
153 |
-/* builds a char* buffer from SIP message including body |
|
154 |
- * The function adjusts the Content-Length HF according |
|
155 |
- * to body lumps in case of adjust_clen=1. |
|
156 |
- */ |
|
157 |
-char * build_all( struct sip_msg* msg, int adjust_clen, |
|
158 |
- unsigned int *returned_len, |
|
159 |
- int *error, |
|
160 |
- struct dest_info* send_info); |
|
161 |
- |
|
162 |
-/** cfg framework fixup */ |
|
163 |
-void fix_global_req_flags(str* gname, str* name); |
|
164 |
- |
|
165 |
-int build_sip_msg_from_buf(struct sip_msg *msg, char *buf, int len, |
|
166 |
- unsigned int id); |
|
167 |
- |
|
168 |
-/* returns a copy in private memory of the boundary in a multipart body */ |
|
169 |
-int get_boundary(struct sip_msg* msg, str* boundary); |
|
170 |
- |
|
171 |
- |
|
172 |
-/* process the lumps of a sip msg |
|
173 |
- * flags = => add also the existing header to new_buf |
|
174 |
- * flags = => add only the lumps (unapplied info) to new_buf |
|
175 |
- **/ |
|
176 |
-void process_lumps( struct sip_msg* msg, |
|
177 |
- struct lump* lumps, |
|
178 |
- char* new_buf, |
|
179 |
- unsigned int* new_buf_offs, |
|
180 |
- unsigned int* orig_offs, |
|
181 |
- struct dest_info* send_info, |
|
182 |
- int flag); |
|
183 |
-#endif |
Added a config function which prints how the sip message would look like
if it were to be sent out at that point in config. Displays how the message
looks after apllying all the lumps; but it is just printing, not actual
lump application. Updated doku.
... | ... |
@@ -31,6 +31,10 @@ |
31 | 31 |
#ifndef _MSG_TRANSLATOR_H |
32 | 32 |
#define _MSG_TRANSLATOR_H |
33 | 33 |
|
34 |
+/* flags used for process_lumps flag parameter */ |
|
35 |
+#define FLAG_MSG_LUMPS_ONLY 0 /* copy just the lumps */ |
|
36 |
+#define FLAG_MSG_ALL 1 /* copy all the msg */ |
|
37 |
+ |
|
34 | 38 |
#define MY_HF_SEP ": " |
35 | 39 |
#define MY_HF_SEP_LEN 2 |
36 | 40 |
|
... | ... |
@@ -163,4 +167,17 @@ int build_sip_msg_from_buf(struct sip_msg *msg, char *buf, int len, |
163 | 167 |
|
164 | 168 |
/* returns a copy in private memory of the boundary in a multipart body */ |
165 | 169 |
int get_boundary(struct sip_msg* msg, str* boundary); |
170 |
+ |
|
171 |
+ |
|
172 |
+/* process the lumps of a sip msg |
|
173 |
+ * flags = => add also the existing header to new_buf |
|
174 |
+ * flags = => add only the lumps (unapplied info) to new_buf |
|
175 |
+ **/ |
|
176 |
+void process_lumps( struct sip_msg* msg, |
|
177 |
+ struct lump* lumps, |
|
178 |
+ char* new_buf, |
|
179 |
+ unsigned int* new_buf_offs, |
|
180 |
+ unsigned int* orig_offs, |
|
181 |
+ struct dest_info* send_info, |
|
182 |
+ int flag); |
|
166 | 183 |
#endif |
... | ... |
@@ -1,21 +1,14 @@ |
1 |
-/*$Id$ |
|
2 |
- * |
|
3 |
- * |
|
1 |
+/* |
|
4 | 2 |
* Copyright (C) 2001-2003 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 |
- * 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 |
- * ser is distributed in the hope that it will be useful, |
|
11 |
+ * Kamailio is distributed in the hope that it will be useful, |
|
19 | 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
20 | 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
21 | 14 |
* GNU General Public License for more details. |
... | ... |
@@ -24,15 +17,16 @@ |
24 | 17 |
* along with this program; if not, write to the Free Software |
25 | 18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
26 | 19 |
* |
27 |
- * History: |
|
28 |
- * -------- |
|
29 |
- * 2003-03-06 totags in outgoing replies bookmarked to enable |
|
30 |
- * ACK/200 tag matching |
|
31 |
- * |
|
32 |
- * 2003-03-01 VOICE_MAIL defs removed (jiri) |
|
33 |
- * 2003-10-08 receive_test function-alized (jiri) |
|
34 | 20 |
*/ |
35 | 21 |
|
22 |
+/*! |
|
23 |
+* \file |
|
24 |
+* \brief Kamailio core :: Message translations |
|
25 |
+* \author jiri |
|
26 |
+* \ingroup core |
|
27 |
+* Module: \ref core |
|
28 |
+*/ |
|
29 |
+ |
|
36 | 30 |
|
37 | 31 |
#ifndef _MSG_TRANSLATOR_H |
38 | 32 |
#define _MSG_TRANSLATOR_H |
- received_via_test() as alternative to received_test() which looks also
for rport and received parameters, confusing nat detection tests
... | ... |
@@ -129,9 +129,13 @@ int branch_builder( unsigned int hash_index, |
129 | 129 |
|
130 | 130 |
char* id_builder(struct sip_msg* msg, unsigned int *id_len); |
131 | 131 |
|
132 |
-/* check if IP address in Via != source IP address of signaling */ |
|
132 |
+/* check if IP address in Via != source IP address of signaling, |
|
133 |
+ * or the sender is asking to set the values for rport or received */ |
|
133 | 134 |
int received_test( struct sip_msg *msg ); |
134 | 135 |
|
136 |
+/* check if IP address in Via != source IP address of signaling */ |
|
137 |
+int received_via_test( struct sip_msg *msg ); |
|
138 |
+ |
|
135 | 139 |
/* builds a char* buffer from message headers without body |
136 | 140 |
* first line is excluded in case of skip_first_line=1 |
137 | 141 |
*/ |
... | ... |
@@ -22,7 +22,7 @@ |
22 | 22 |
* |
23 | 23 |
* You should have received a copy of the GNU General Public License |
24 | 24 |
* along with this program; if not, write to the Free Software |
25 |
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
25 |
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
26 | 26 |
* |
27 | 27 |
* History: |
28 | 28 |
* -------- |
This checks and fixes the boundaries of a multipart body if the
FL_BODY_MULTIPART flag is set.
... | ... |
@@ -162,4 +162,7 @@ void fix_global_req_flags(str* gname, str* name); |
162 | 162 |
|
163 | 163 |
int build_sip_msg_from_buf(struct sip_msg *msg, char *buf, int len, |
164 | 164 |
unsigned int id); |
165 |
+ |
|
166 |
+/* returns a copy in private memory of the boundary in a multipart body */ |
|
167 |
+int get_boundary(struct sip_msg* msg, str* boundary); |
|
165 | 168 |
#endif |
... | ... |
@@ -87,6 +87,8 @@ char * build_req_buf_from_sip_req(struct sip_msg* msg, |
87 | 87 |
char * build_res_buf_from_sip_res(struct sip_msg* msg, |
88 | 88 |
unsigned int *returned_len); |
89 | 89 |
|
90 |
+char * generate_res_buf_from_sip_res(struct sip_msg* msg, |
|
91 |
+ unsigned int *returned_len, unsigned int mode); |
|
90 | 92 |
|
91 | 93 |
char * build_res_buf_from_sip_req(unsigned int code, |
92 | 94 |
str *text, |
- build_res_buf_from_sip_req() takes reply reason phrase parameter as
str*
- many calls of this function have already the reason length
... | ... |
@@ -80,17 +80,17 @@ struct hostport { |
80 | 80 |
(hp)->port=&default_global_port; \ |
81 | 81 |
}while(0) |
82 | 82 |
|
83 |
-char * build_req_buf_from_sip_req ( struct sip_msg* msg, |
|
83 |
+char * build_req_buf_from_sip_req(struct sip_msg* msg, |
|
84 | 84 |
unsigned int *returned_len, struct dest_info* send_info, |
85 | 85 |
unsigned int mode); |
86 | 86 |
|
87 |
-char * build_res_buf_from_sip_res( struct sip_msg* msg, |
|
87 |
+char * build_res_buf_from_sip_res(struct sip_msg* msg, |
|
88 | 88 |
unsigned int *returned_len); |
89 | 89 |
|
90 | 90 |
|
91 |
-char * build_res_buf_from_sip_req( unsigned int code , |
|
92 |
- char *text , |
|
93 |
- str *new_tag , |
|
91 |
+char * build_res_buf_from_sip_req(unsigned int code, |
|
92 |
+ str *text, |
|
93 |
+ str *new_tag, |
|
94 | 94 |
struct sip_msg* msg, |
95 | 95 |
unsigned int *returned_len, |
96 | 96 |
struct bookmark *bmark); |
Path support compatible with kamailio (although there might be
differences in the added Route header position).
- mode - a set of flags that define how the sip request is printed to buffer
- BUILD_NO_LOCAL_VIA (1<<0) - skip adding local via
- BUILD_NO_VIA1_UPDATE (1<<1) - skip updating top most via
- BUILD_IN_SHM (1<<2) - output buffer allocated in memory
- new function inc_msg_no() - increment and return msg_no
- new function build_sip_msg_from_buf(...) to parse and partially fill
sip_msg structure from a buffer
... | ... |
@@ -48,6 +48,10 @@ |
48 | 48 |
|
49 | 49 |
/*#define MAX_CONTENT_LEN_BUF INT2STR_MAX_LEN *//* see ut.h/int2str() */ |
50 | 50 |
|
51 |
+#define BUILD_NO_LOCAL_VIA (1<<0) |
|
52 |
+#define BUILD_NO_VIA1_UPDATE (1<<1) |
|
53 |
+#define BUILD_IN_SHM (1<<2) |
|
54 |
+ |
|
51 | 55 |
#include "parser/msg_parser.h" |
52 | 56 |
#include "ip_addr.h" |
53 | 57 |
|
... | ... |
@@ -76,7 +80,8 @@ struct hostport { |
76 | 80 |
}while(0) |
77 | 81 |
|
78 | 82 |
char * build_req_buf_from_sip_req ( struct sip_msg* msg, |
79 |
- unsigned int *returned_len, struct dest_info* send_info); |
|
83 |
+ unsigned int *returned_len, struct dest_info* send_info, |
|
84 |
+ unsigned int mode); |
|
80 | 85 |
|
81 | 86 |
char * build_res_buf_from_sip_res( struct sip_msg* msg, |
82 | 87 |
unsigned int *returned_len); |
... | ... |
@@ -152,4 +157,6 @@ char * build_all( struct sip_msg* msg, int adjust_clen, |
152 | 157 |
/** cfg framework fixup */ |
153 | 158 |
void fix_global_req_flags(str* gname, str* name); |
154 | 159 |
|
160 |
+int build_sip_msg_from_buf(struct sip_msg *msg, char *buf, int len, |
|
161 |
+ unsigned int id); |
|
155 | 162 |
#endif |
- support for tcp, tls or sctp fallback for udp forwarded requests
that end up bigger then udp_mtu (configurable, disabled by
default). For such messages only the Via is changed (for example
the original built for udp Record-Route is kept untouched so
that subsequent messages in the dialog will use udp if smaller
then udp_mtu).
- udp_mtu and udp_mtu_try_proto (fallback proto) can be changed at
runtime via the cfg framework
(e.g. sercmd cfg.set_now_int core udp_mtu 1300;
cfg.set_now_int core udp_mtu_try_proto 2 )
- force_rport can now be set globally using the config framework
(e.g. sercmd cfg.set_now_int core force_rport 1 )
Author: Andrei Pelinescu-Onciul <andrei@iptel.org>
... | ... |
@@ -105,6 +105,12 @@ char* via_builder( unsigned int *len, |
105 | 105 |
struct dest_info* send_info, |
106 | 106 |
str *branch, str* extra_params, struct hostport *hp ); |
107 | 107 |
|
108 |
+/* creates a via header honoring the protocol of the incomming socket |
|
109 |
+ * msg is an optional parameter */ |
|
110 |
+char* create_via_hf( unsigned int *len, |
|
111 |
+ struct sip_msg *msg, |
|
112 |
+ struct dest_info* send_info /* where to send the reply */, |
|
113 |
+ str* branch); |
|
108 | 114 |
|
109 | 115 |
int branch_builder( unsigned int hash_index, |
110 | 116 |
/* only either parameter useful */ |
... | ... |
@@ -113,6 +113,8 @@ int branch_builder( unsigned int hash_index, |
113 | 113 |
/* output value: string and actual length */ |
114 | 114 |
char *branch_str, int *len ); |
115 | 115 |
|
116 |
+char* id_builder(struct sip_msg* msg, unsigned int *id_len); |
|
117 |
+ |
|
116 | 118 |
/* check if IP address in Via != source IP address of signaling */ |
117 | 119 |
int received_test( struct sip_msg *msg ); |
118 | 120 |
|
WARNING: there are a lot of changes in tm
... | ... |
@@ -46,7 +46,7 @@ |
46 | 46 |
#define WARNING_PHRASE " \"Noisy feedback tells: " |
47 | 47 |
#define WARNING_PHRASE_LEN (sizeof(WARNING_PHRASE)-1) |
48 | 48 |
|
49 |
-//#define MAX_CONTENT_LEN_BUF INT2STR_MAX_LEN /* see ut.h/int2str() */ |
|
49 |
+/*#define MAX_CONTENT_LEN_BUF INT2STR_MAX_LEN *//* see ut.h/int2str() */ |
|
50 | 50 |
|
51 | 51 |
#include "parser/msg_parser.h" |
52 | 52 |
#include "ip_addr.h" |
... | ... |
@@ -116,4 +116,30 @@ int branch_builder( unsigned int hash_index, |
116 | 116 |
/* check if IP address in Via != source IP address of signaling */ |
117 | 117 |
int received_test( struct sip_msg *msg ); |
118 | 118 |
|
119 |
+/* builds a char* buffer from message headers without body |
|
120 |
+ * first line is excluded in case of skip_first_line=1 |
|
121 |
+ */ |
|
122 |
+char * build_only_headers( struct sip_msg* msg, int skip_first_line, |
|
123 |
+ unsigned int *returned_len, |
|
124 |
+ int *error, |
|
125 |
+ struct dest_info* send_info); |
|
126 |
+ |
|
127 |
+/* builds a char* buffer from message body |
|
128 |
+ * error is set -1 if the memory allocation failes |
|
129 |
+ */ |
|
130 |
+char * build_body( struct sip_msg* msg, |
|
131 |
+ unsigned int *returned_len, |
|
132 |
+ int *error, |
|
133 |
+ struct dest_info* send_info); |
|
134 |
+ |
|
135 |
+/* builds a char* buffer from SIP message including body |
|
136 |
+ * The function adjusts the Content-Length HF according |
|
137 |
+ * to body lumps in case of adjust_clen=1. |
|
138 |
+ */ |
|
139 |
+char * build_all( struct sip_msg* msg, int adjust_clen, |
|
140 |
+ unsigned int *returned_len, |
|
141 |
+ int *error, |
|
142 |
+ struct dest_info* send_info); |
|
143 |
+ |
|
144 |
+ |
|
119 | 145 |
#endif |
WARNING: lots of changes and very lightly tested
... | ... |
@@ -76,8 +76,7 @@ struct hostport { |
76 | 76 |
}while(0) |
77 | 77 |
|
78 | 78 |
char * build_req_buf_from_sip_req ( struct sip_msg* msg, |
79 |
- unsigned int *returned_len, struct socket_info* send_sock, |
|
80 |
- int proto); |
|
79 |
+ unsigned int *returned_len, struct dest_info* send_info); |
|
81 | 80 |
|
82 | 81 |
char * build_res_buf_from_sip_res( struct sip_msg* msg, |
83 | 82 |
unsigned int *returned_len); |
... | ... |
@@ -103,8 +102,8 @@ char * build_res_buf_with_body_from_sip_req( unsigned int code , |
103 | 102 |
struct bookmark *bmark); |
104 | 103 |
*/ |
105 | 104 |
char* via_builder( unsigned int *len, |
106 |
- struct socket_info* send_sock, |
|
107 |
- str *branch, str* extra_params, int proto, struct hostport *hp ); |
|
105 |
+ struct dest_info* send_info, |
|
106 |
+ str *branch, str* extra_params, struct hostport *hp ); |
|
108 | 107 |
|
109 | 108 |
|
110 | 109 |
int branch_builder( unsigned int hash_index, |
... | ... |
@@ -30,6 +30,7 @@ |
30 | 30 |
* ACK/200 tag matching |
31 | 31 |
* |
32 | 32 |
* 2003-03-01 VOICE_MAIL defs removed (jiri) |
33 |
+ * 2003-10-08 receive_test function-alized (jiri) |
|
33 | 34 |
*/ |
34 | 35 |
|
35 | 36 |
|
... | ... |
@@ -113,5 +114,7 @@ int branch_builder( unsigned int hash_index, |
113 | 114 |
/* output value: string and actual length */ |
114 | 115 |
char *branch_str, int *len ); |
115 | 116 |
|
117 |
+/* check if IP address in Via != source IP address of signaling */ |
|
118 |
+int received_test( struct sip_msg *msg ); |
|
116 | 119 |
|
117 | 120 |
#endif |
... | ... |
@@ -55,6 +55,25 @@ struct bookmark { |
55 | 55 |
str to_tag_val; |
56 | 56 |
}; |
57 | 57 |
|
58 |
+/* used by via_builder */ |
|
59 |
+struct hostport { |
|
60 |
+ str* host; |
|
61 |
+ str* port; |
|
62 |
+}; |
|
63 |
+ |
|
64 |
+ |
|
65 |
+#define set_hostport(hp, msg) \ |
|
66 |
+ do{ \ |
|
67 |
+ if ((msg) && ((struct sip_msg*)(msg))->set_global_address.len) \ |
|
68 |
+ (hp)->host=&(((struct sip_msg*)(msg))->set_global_address); \ |
|
69 |
+ else \ |
|
70 |
+ (hp)->host=&default_global_address; \ |
|
71 |
+ if ((msg) && ((struct sip_msg*)(msg))->set_global_port.len) \ |
|
72 |
+ (hp)->port=&(((struct sip_msg*)(msg))->set_global_port); \ |
|
73 |
+ else \ |
|
74 |
+ (hp)->port=&default_global_port; \ |
|
75 |
+ }while(0) |
|
76 |
+ |
|
58 | 77 |
char * build_req_buf_from_sip_req ( struct sip_msg* msg, |
59 | 78 |
unsigned int *returned_len, struct socket_info* send_sock, |
60 | 79 |
int proto); |
... | ... |
@@ -84,7 +103,7 @@ char * build_res_buf_with_body_from_sip_req( unsigned int code , |
84 | 103 |
*/ |
85 | 104 |
char* via_builder( unsigned int *len, |
86 | 105 |
struct socket_info* send_sock, |
87 |
- str *branch, str* extra_params, int proto ); |
|
106 |
+ str *branch, str* extra_params, int proto, struct hostport *hp ); |
|
88 | 107 |
|
89 | 108 |
|
90 | 109 |
int branch_builder( unsigned int hash_index, |
... | ... |
@@ -45,7 +45,7 @@ |
45 | 45 |
#define WARNING_PHRASE " \"Noisy feedback tells: " |
46 | 46 |
#define WARNING_PHRASE_LEN (sizeof(WARNING_PHRASE)-1) |
47 | 47 |
|
48 |
-#define MAX_CONTENT_LEN_BUF INT2STR_MAX_LEN /* see ut.h/int2str() */ |
|
48 |
+//#define MAX_CONTENT_LEN_BUF INT2STR_MAX_LEN /* see ut.h/int2str() */ |
|
49 | 49 |
|
50 | 50 |
#include "parser/msg_parser.h" |
51 | 51 |
#include "ip_addr.h" |
... | ... |
@@ -62,13 +62,14 @@ char * build_req_buf_from_sip_req ( struct sip_msg* msg, |
62 | 62 |
char * build_res_buf_from_sip_res( struct sip_msg* msg, |
63 | 63 |
unsigned int *returned_len); |
64 | 64 |
|
65 |
-char * build_res_buf_from_sip_req( unsigned int code , |
|
65 |
+ |
|
66 |
+char * build_res_buf_from_sip_req( unsigned int code , |
|
66 | 67 |
char *text , |
67 |
- char *new_tag , |
|
68 |
- unsigned int new_tag_len , |
|
68 |
+ str *new_tag , |
|
69 | 69 |
struct sip_msg* msg, |
70 | 70 |
unsigned int *returned_len, |
71 | 71 |
struct bookmark *bmark); |
72 |
+/* |
|
72 | 73 |
char * build_res_buf_with_body_from_sip_req( unsigned int code , |
73 | 74 |
char *text , |
74 | 75 |
char *new_tag , |
... | ... |
@@ -80,7 +81,7 @@ char * build_res_buf_with_body_from_sip_req( unsigned int code , |
80 | 81 |
struct sip_msg* msg, |
81 | 82 |
unsigned int *returned_len, |
82 | 83 |
struct bookmark *bmark); |
83 |
- |
|
84 |
+*/ |
|
84 | 85 |
char* via_builder( unsigned int *len, |
85 | 86 |
struct socket_info* send_sock, |
86 | 87 |
str *branch, str* extra_params, int proto ); |
... | ... |
@@ -45,6 +45,11 @@ |
45 | 45 |
#include "parser/msg_parser.h" |
46 | 46 |
#include "ip_addr.h" |
47 | 47 |
|
48 |
+/* point to some remarkable positions in a SIP message */ |
|
49 |
+struct bookmark { |
|
50 |
+ str to_tag_val; |
|
51 |
+}; |
|
52 |
+ |
|
48 | 53 |
char * build_req_buf_from_sip_req ( struct sip_msg* msg, |
49 | 54 |
unsigned int *returned_len, struct socket_info* send_sock, |
50 | 55 |
int proto); |
... | ... |
@@ -57,7 +62,8 @@ char * build_res_buf_from_sip_req( unsigned int code , |
57 | 62 |
char *new_tag , |
58 | 63 |
unsigned int new_tag_len , |
59 | 64 |
struct sip_msg* msg, |
60 |
- unsigned int *returned_len); |
|
65 |
+ unsigned int *returned_len, |
|
66 |
+ struct bookmark *bmark); |
|
61 | 67 |
char * build_res_buf_with_body_from_sip_req( unsigned int code , |
62 | 68 |
char *text , |
63 | 69 |
char *new_tag , |
... | ... |
@@ -67,7 +73,8 @@ char * build_res_buf_with_body_from_sip_req( unsigned int code , |
67 | 73 |
char *content_type, |
68 | 74 |
unsigned int content_type_len, |
69 | 75 |
struct sip_msg* msg, |
70 |
- unsigned int *returned_len); |
|
76 |
+ unsigned int *returned_len, |
|
77 |
+ struct bookmark *bmark); |
|
71 | 78 |
|
72 | 79 |
char* via_builder( unsigned int *len, |
73 | 80 |
struct socket_info* send_sock, |
... | ... |
@@ -23,6 +23,10 @@ |
23 | 23 |
* You should have received a copy of the GNU General Public License |
24 | 24 |
* along with this program; if not, write to the Free Software |
25 | 25 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
26 |
+ * |
|
27 |
+ * History: |
|
28 |
+ * -------- |
|
29 |
+ * 2003-03-01 VOICE_MAIL defs removed (jiri) |
|
26 | 30 |
*/ |
27 | 31 |
|
28 | 32 |
|
... | ... |
@@ -54,7 +58,6 @@ char * build_res_buf_from_sip_req( unsigned int code , |
54 | 58 |
unsigned int new_tag_len , |
55 | 59 |
struct sip_msg* msg, |
56 | 60 |
unsigned int *returned_len); |
57 |
-#ifdef VOICE_MAIL |
|
58 | 61 |
char * build_res_buf_with_body_from_sip_req( unsigned int code , |
59 | 62 |
char *text , |
60 | 63 |
char *new_tag , |
... | ... |
@@ -65,7 +68,6 @@ char * build_res_buf_with_body_from_sip_req( unsigned int code , |
65 | 68 |
unsigned int content_type_len, |
66 | 69 |
struct sip_msg* msg, |
67 | 70 |
unsigned int *returned_len); |
68 |
-#endif |
|
69 | 71 |
|
70 | 72 |
char* via_builder( unsigned int *len, |
71 | 73 |
struct socket_info* send_sock, |
... | ... |
@@ -54,6 +54,18 @@ char * build_res_buf_from_sip_req( unsigned int code , |
54 | 54 |
unsigned int new_tag_len , |
55 | 55 |
struct sip_msg* msg, |
56 | 56 |
unsigned int *returned_len); |
57 |
+#ifdef VOICE_MAIL |
|
58 |
+char * build_res_buf_with_body_from_sip_req( unsigned int code , |
|
59 |
+ char *text , |
|
60 |
+ char *new_tag , |
|
61 |
+ unsigned int new_tag_len , |
|
62 |
+ char *body , |
|
63 |
+ unsigned int body_len, |
|
64 |
+ char *content_type, |
|
65 |
+ unsigned int content_type_len, |
|
66 |
+ struct sip_msg* msg, |
|
67 |
+ unsigned int *returned_len); |
|
68 |
+#endif |
|
57 | 69 |
|
58 | 70 |
char* via_builder( unsigned int *len, |
59 | 71 |
struct socket_info* send_sock, |
... | ... |
@@ -57,12 +57,8 @@ char * build_res_buf_from_sip_req( unsigned int code , |
57 | 57 |
|
58 | 58 |
char* via_builder( unsigned int *len, |
59 | 59 |
struct socket_info* send_sock, |
60 |
- char *branch, int branch_len, int proto ); |
|
60 |
+ str *branch, str* extra_params, int proto ); |
|
61 | 61 |
|
62 |
-#ifdef _OBSOLETED |
|
63 |
-char* via_builder( struct sip_msg *msg , |
|
64 |
- unsigned int *len, struct socket_info* send_sock); |
|
65 |
-#endif |
|
66 | 62 |
|
67 | 63 |
int branch_builder( unsigned int hash_index, |
68 | 64 |
/* only either parameter useful */ |
... | ... |
@@ -33,6 +33,10 @@ |
33 | 33 |
#define MY_HF_SEP_LEN 2 |
34 | 34 |
|
35 | 35 |
#define BRANCH_SEPARATOR '.' |
36 |
+#define WARNING "Warning: 392 " |
|
37 |
+#define WARNING_LEN (sizeof(WARNING)-1) |
|
38 |
+#define WARNING_PHRASE " \"Noisy feedback tells: " |
|
39 |
+#define WARNING_PHRASE_LEN (sizeof(WARNING_PHRASE)-1) |
|
36 | 40 |
|
37 | 41 |
#include "parser/msg_parser.h" |
38 | 42 |
#include "ip_addr.h" |
... | ... |
@@ -38,7 +38,8 @@ |
38 | 38 |
#include "ip_addr.h" |
39 | 39 |
|
40 | 40 |
char * build_req_buf_from_sip_req ( struct sip_msg* msg, |
41 |
- unsigned int *returned_len, struct socket_info* send_sock); |
|
41 |
+ unsigned int *returned_len, struct socket_info* send_sock, |
|
42 |
+ int proto); |
|
42 | 43 |
|
43 | 44 |
char * build_res_buf_from_sip_res( struct sip_msg* msg, |
44 | 45 |
unsigned int *returned_len); |
... | ... |
@@ -52,7 +53,7 @@ char * build_res_buf_from_sip_req( unsigned int code , |
52 | 53 |
|
53 | 54 |
char* via_builder( unsigned int *len, |
54 | 55 |
struct socket_info* send_sock, |
55 |
- char *branch, int branch_len ); |
|
56 |
+ char *branch, int branch_len, int proto ); |
|
56 | 57 |
|
57 | 58 |
#ifdef _OBSOLETED |
58 | 59 |
char* via_builder( struct sip_msg *msg , |
... | ... |
@@ -1,7 +1,31 @@ |
1 | 1 |
/*$Id$ |
2 | 2 |
* |
3 |
+ * |
|
4 |
+ * Copyright (C) 2001-2003 Fhg Fokus |
|
5 |
+ * |
|
6 |
+ * This file is part of ser, a free SIP server. |
|
7 |
+ * |
|
8 |
+ * ser is free software; you can redistribute it and/or modify |
|
9 |
+ * it under the terms of the GNU General Public License as published by |
|
10 |
+ * the Free Software Foundation; either version 2 of the License, or |
|
11 |
+ * (at your option) any later version |
|
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 |
+ * ser is distributed in the hope that it will be useful, |
|
19 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
20 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
21 |
+ * GNU General Public License for more details. |
|
22 |
+ * |
|
23 |
+ * You should have received a copy of the GNU General Public License |
|
24 |
+ * along with this program; if not, write to the Free Software |
|
25 |
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
3 | 26 |
*/ |
4 | 27 |
|
28 |
+ |
|
5 | 29 |
#ifndef _MSG_TRANSLATOR_H |
6 | 30 |
#define _MSG_TRANSLATOR_H |
7 | 31 |
|
... | ... |
@@ -8,6 +8,8 @@ |
8 | 8 |
#define MY_HF_SEP ": " |
9 | 9 |
#define MY_HF_SEP_LEN 2 |
10 | 10 |
|
11 |
+#define BRANCH_SEPARATOR '.' |
|
12 |
+ |
|
11 | 13 |
#include "parser/msg_parser.h" |
12 | 14 |
#include "ip_addr.h" |
13 | 15 |
|
... | ... |
@@ -23,8 +25,22 @@ char * build_res_buf_from_sip_req( unsigned int code , |
23 | 25 |
unsigned int new_tag_len , |
24 | 26 |
struct sip_msg* msg, |
25 | 27 |
unsigned int *returned_len); |
26 |
-char* via_builder( struct sip_msg *msg , |
|
28 |
+ |
|
29 |
+char* via_builder( unsigned int *len, |
|
30 |
+ struct socket_info* send_sock, |
|
31 |
+ char *branch, int branch_len ); |
|
32 |
+ |
|
33 |
+#ifdef _OBSOLETED |
|
34 |
+char* via_builder( struct sip_msg *msg , |
|
27 | 35 |
unsigned int *len, struct socket_info* send_sock); |
36 |
+#endif |
|
37 |
+ |
|
38 |
+int branch_builder( unsigned int hash_index, |
|
39 |
+ /* only either parameter useful */ |
|
40 |
+ unsigned int label, char * char_v, |
|
41 |
+ int branch, |
|
42 |
+ /* output value: string and actual length */ |
|
43 |
+ char *branch_str, int *len ); |
|
28 | 44 |
|
29 | 45 |
|
30 | 46 |
#endif |
... | ... |
@@ -9,9 +9,10 @@ |
9 | 9 |
#define MY_HF_SEP_LEN 2 |
10 | 10 |
|
11 | 11 |
#include "parser/msg_parser.h" |
12 |
+#include "ip_addr.h" |
|
12 | 13 |
|
13 | 14 |
char * build_req_buf_from_sip_req ( struct sip_msg* msg, |
14 |
- unsigned int *returned_len); |
|
15 |
+ unsigned int *returned_len, struct socket_info* send_sock); |
|
15 | 16 |
|
16 | 17 |
char * build_res_buf_from_sip_res( struct sip_msg* msg, |
17 | 18 |
unsigned int *returned_len); |
... | ... |
@@ -23,7 +24,7 @@ char * build_res_buf_from_sip_req( unsigned int code , |
23 | 24 |
struct sip_msg* msg, |
24 | 25 |
unsigned int *returned_len); |
25 | 26 |
char* via_builder( struct sip_msg *msg , |
26 |
- unsigned int *len ); |
|
27 |
+ unsigned int *len, struct socket_info* send_sock); |
|
27 | 28 |
|
28 | 29 |
|
29 | 30 |
#endif |
... | ... |
@@ -16,8 +16,10 @@ char * build_req_buf_from_sip_req ( struct sip_msg* msg, |
16 | 16 |
char * build_res_buf_from_sip_res( struct sip_msg* msg, |
17 | 17 |
unsigned int *returned_len); |
18 | 18 |
|
19 |
-char * build_res_buf_from_sip_req( unsigned int code , |
|
19 |
+char * build_res_buf_from_sip_req( unsigned int code , |
|
20 | 20 |
char *text , |
21 |
+ char *new_tag , |
|
22 |
+ unsigned int new_tag_len , |
|
21 | 23 |
struct sip_msg* msg, |
22 | 24 |
unsigned int *returned_len); |
23 | 25 |
char* via_builder( struct sip_msg *msg , |
... | ... |
@@ -11,20 +11,17 @@ |
11 | 11 |
#include "msg_parser.h" |
12 | 12 |
|
13 | 13 |
char * build_req_buf_from_sip_req ( struct sip_msg* msg, |
14 |
- unsigned int *returned_len); |
|
14 |
+ unsigned int *returned_len); |
|
15 | 15 |
|
16 | 16 |
char * build_res_buf_from_sip_res( struct sip_msg* msg, |
17 |
- unsigned int *returned_len); |
|
17 |
+ unsigned int *returned_len); |
|
18 | 18 |
|
19 | 19 |
char * build_res_buf_from_sip_req( unsigned int code , |
20 |
- char *text , |
|
21 |
- struct sip_msg* msg, |
|
22 |
- unsigned int *returned_len); |
|
23 |
-char* via_builder( struct sip_msg *msg , |
|
24 |
- unsigned int *len ); |
|
25 |
- |
|
26 |
- |
|
27 |
-char* via_builder( struct sip_msg *msg , unsigned int *len ); |
|
20 |
+ char *text , |
|
21 |
+ struct sip_msg* msg, |
|
22 |
+ unsigned int *returned_len); |
|
23 |
+char* via_builder( struct sip_msg *msg , |
|
24 |
+ unsigned int *len ); |
|
28 | 25 |
|
29 | 26 |
|
30 | 27 |
#endif |