... | ... |
@@ -155,7 +155,7 @@ inline struct via_body* via_body_cloner( char* new_buf, |
155 | 155 |
case PARAM_ALIAS: |
156 | 156 |
new_via->alias = new_vp; |
157 | 157 |
break; |
158 |
- |
|
158 |
+ |
|
159 | 159 |
#ifdef USE_COMP |
160 | 160 |
case PARAM_COMP: |
161 | 161 |
new_via->comp = new_vp; |
... | ... |
@@ -318,7 +318,7 @@ struct sip_msg* sip_msg_cloner( struct sip_msg *org_msg, int *sip_msg_len ) |
318 | 318 |
case HDR_VIA2_T: |
319 | 319 |
case HDR_EOH_T: |
320 | 320 |
break; |
321 |
- |
|
321 |
+ |
|
322 | 322 |
case HDR_VIA_T: |
323 | 323 |
for (via=(struct via_body*)hdr->parsed;via;via=via->next) { |
324 | 324 |
len+=ROUND4(sizeof(struct via_body)); |
... | ... |
@@ -327,7 +327,7 @@ struct sip_msg* sip_msg_cloner( struct sip_msg *org_msg, int *sip_msg_len ) |
327 | 327 |
len+=ROUND4(sizeof(struct via_param )); |
328 | 328 |
} |
329 | 329 |
break; |
330 |
- |
|
330 |
+ |
|
331 | 331 |
case HDR_TO_T: |
332 | 332 |
case HDR_FROM_T: |
333 | 333 |
/* From header might be unparsed */ |
... | ... |
@@ -343,7 +343,7 @@ struct sip_msg* sip_msg_cloner( struct sip_msg *org_msg, int *sip_msg_len ) |
343 | 343 |
case HDR_CSEQ_T: |
344 | 344 |
len+=ROUND4(sizeof(struct cseq_body)); |
345 | 345 |
break; |
346 |
- |
|
346 |
+ |
|
347 | 347 |
|
348 | 348 |
case HDR_AUTHORIZATION_T: |
349 | 349 |
case HDR_PROXYAUTH_T: |
... | ... |
@@ -377,7 +377,15 @@ struct sip_msg* sip_msg_cloner( struct sip_msg *org_msg, int *sip_msg_len ) |
377 | 377 |
case HDR_RPID_T: |
378 | 378 |
case HDR_REFER_TO_T: |
379 | 379 |
case HDR_SIPIFMATCH_T: |
380 |
- /* we ignore them for now even if they have something parsed*/ |
|
380 |
+ case HDR_SESSIONEXPIRES_T: |
|
381 |
+ case HDR_MIN_SE_T: |
|
382 |
+ case HDR_ACCEPTCONTACT_T: |
|
383 |
+ case HDR_ALLOWEVENTS_T: |
|
384 |
+ case HDR_CONTENTENCODING_T: |
|
385 |
+ case HDR_REFERREDBY_T: |
|
386 |
+ case HDR_REJECTCONTACT_T: |
|
387 |
+ case HDR_REQUESTDISPOSITION_T: |
|
388 |
+/* we ignore them for now even if they have something parsed*/ |
|
381 | 389 |
break; |
382 | 390 |
}/*switch*/ |
383 | 391 |
}/*for all headers*/ |
... | ... |
@@ -509,6 +517,12 @@ do { \ |
509 | 517 |
case HDR_OTHER_T: |
510 | 518 |
case HDR_VIA2_T: |
511 | 519 |
case HDR_EOH_T: |
520 |
+ case HDR_ACCEPTCONTACT_T: |
|
521 |
+ case HDR_ALLOWEVENTS_T: |
|
522 |
+ case HDR_CONTENTENCODING_T: |
|
523 |
+ case HDR_REFERREDBY_T: |
|
524 |
+ case HDR_REJECTCONTACT_T: |
|
525 |
+ case HDR_REQUESTDISPOSITION_T: |
|
512 | 526 |
break; |
513 | 527 |
|
514 | 528 |
case HDR_VIA_T: |
... | ... |
@@ -561,7 +575,7 @@ do { \ |
561 | 575 |
((struct to_body*)new_hdr->parsed)->body.s = |
562 | 576 |
translate_pointer( new_msg->buf , org_msg->buf , |
563 | 577 |
((struct to_body*)hdr->parsed)->body.s ); |
564 |
- ((struct to_body*)new_hdr->parsed)->display.s = |
|
578 |
+ ((struct to_body*)new_hdr->parsed)->display.s = |
|
565 | 579 |
translate_pointer( new_msg->buf, org_msg->buf, |
566 | 580 |
((struct to_body*)hdr->parsed)->display.s); |
567 | 581 |
((struct to_body*)new_hdr->parsed)->uri.s = |
... | ... |
@@ -735,6 +749,16 @@ do { \ |
735 | 749 |
new_msg->refer_to = new_hdr; |
736 | 750 |
} |
737 | 751 |
break; |
752 |
+ case HDR_SESSIONEXPIRES_T: |
|
753 |
+ if (!HOOK_SET(session_expires)) { |
|
754 |
+ new_msg->session_expires = new_hdr; |
|
755 |
+ } |
|
756 |
+ break; |
|
757 |
+ case HDR_MIN_SE_T: |
|
758 |
+ if (!HOOK_SET(min_se)) { |
|
759 |
+ new_msg->min_se = new_hdr; |
|
760 |
+ } |
|
761 |
+ break; |
|
738 | 762 |
case HDR_SIPIFMATCH_T: |
739 | 763 |
if (!HOOK_SET(sipifmatch)) { |
740 | 764 |
new_msg->sipifmatch = new_hdr; |
741 | 765 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,53 @@ |
1 |
+/* |
|
2 |
+ * $Id$ |
|
3 |
+ * |
|
4 |
+ * Min-SE Header Field Name Parsing Macros |
|
5 |
+ * |
|
6 |
+ * Copyright (C) 2001-2003 FhG Fokus |
|
7 |
+ * |
|
8 |
+ * This file is part of ser, a free SIP server. |
|
9 |
+ * |
|
10 |
+ * ser is free software; you can redistribute it and/or modify |
|
11 |
+ * it under the terms of the GNU General Public License as published by |
|
12 |
+ * the Free Software Foundation; either version 2 of the License, or |
|
13 |
+ * (at your option) any later version |
|
14 |
+ * |
|
15 |
+ * For a license to use the ser software under conditions |
|
16 |
+ * other than those described here, or to purchase support for this |
|
17 |
+ * software, please contact iptel.org by e-mail at the following addresses: |
|
18 |
+ * info@iptel.org |
|
19 |
+ * |
|
20 |
+ * ser is distributed in the hope that it will be useful, |
|
21 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
22 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
23 |
+ * GNU General Public License for more details. |
|
24 |
+ * |
|
25 |
+ * You should have received a copy of the GNU General Public License |
|
26 |
+ * along with this program; if not, write to the Free Software |
|
27 |
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
28 |
+ */ |
|
29 |
+ |
|
30 |
+ |
|
31 |
+#ifndef CASE_MIN_H |
|
32 |
+#define CASE_MIN_H |
|
33 |
+ |
|
34 |
+ |
|
35 |
+#define min_se_CASE \ |
|
36 |
+ if (LOWER_BYTE(*p) == 's') { \ |
|
37 |
+ p++; \ |
|
38 |
+ if (LOWER_BYTE(*p) == 'e') { \ |
|
39 |
+ hdr->type = HDR_MIN_SE_T; \ |
|
40 |
+ p++; \ |
|
41 |
+ goto dc_end; \ |
|
42 |
+ } \ |
|
43 |
+ } |
|
44 |
+ |
|
45 |
+ |
|
46 |
+#define min_CASE \ |
|
47 |
+ p += 4; \ |
|
48 |
+ val = READ(p); \ |
|
49 |
+ min_se_CASE; \ |
|
50 |
+ goto other; \ |
|
51 |
+ |
|
52 |
+ |
|
53 |
+#endif /* CASE_MIN_H */ |
... | ... |
@@ -1,5 +1,5 @@ |
1 |
-/* |
|
2 |
- * $Id$ |
|
1 |
+/* |
|
2 |
+ * $Id$ |
|
3 | 3 |
* |
4 | 4 |
* Copyright (C) 2001-2003 FhG Fokus |
5 | 5 |
* |
... | ... |
@@ -20,8 +20,8 @@ |
20 | 20 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
21 | 21 |
* GNU General Public License for more details. |
22 | 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 |
|
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 | 25 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
26 | 26 |
* |
27 | 27 |
* History: |
... | ... |
@@ -88,6 +88,7 @@ enum _hdr_types_t { |
88 | 88 |
HDR_REFER_TO_T /* Refer-To header fiels */, |
89 | 89 |
HDR_SIPIFMATCH_T /* SIP-If-Match header field */, |
90 | 90 |
HDR_SESSIONEXPIRES_T /* Session-Expires header */, |
91 |
+ HDR_MIN_SE_T /* Min-SE */, |
|
91 | 92 |
HDR_ACCEPTCONTACT_T /* Accept-Contact header */, |
92 | 93 |
HDR_ALLOWEVENTS_T /* Allow-Events header */, |
93 | 94 |
HDR_CONTENTENCODING_T /* Content-Encoding header */, |
... | ... |
@@ -146,6 +147,7 @@ typedef unsigned long long hdr_flags_t; |
146 | 147 |
#define HDR_REFER_TO_F HDR_F_DEF(REFER_TO) |
147 | 148 |
#define HDR_SIPIFMATCH_F HDR_F_DEF(SIPIFMATCH) |
148 | 149 |
#define HDR_SESSIONEXPIRES_F HDR_F_DEF(SESSIONEXPIRES) |
150 |
+#define HDR_MIN_SE_F HDR_F_DEF(MIN_SE) |
|
149 | 151 |
#define HDR_ACCEPTCONTACT_F HDR_F_DEF(HDR_ACCEPTCONTACT_T) |
150 | 152 |
#define HDR_ALLOWEVENTS_F HDR_F_DEF(HDR_ALLOWEVENTS_T) |
151 | 153 |
#define HDR_CONTENTENCODING_F HDR_F_DEF(HDR_CONTENTENCODING_T) |
... | ... |
@@ -157,10 +159,10 @@ typedef unsigned long long hdr_flags_t; |
157 | 159 |
|
158 | 160 |
typedef enum _hdr_types_t hdr_types_t; |
159 | 161 |
|
160 |
-/* |
|
161 |
- * Format: name':' body |
|
162 |
+/* |
|
163 |
+ * Format: name':' body |
|
162 | 164 |
*/ |
163 |
-struct hdr_field { |
|
165 |
+struct hdr_field { |
|
164 | 166 |
hdr_types_t type; /* Header field type */ |
165 | 167 |
str name; /* Header field name */ |
166 | 168 |
str body; /* Header field body (may not include CRLF) */ |
... | ... |
@@ -41,7 +41,7 @@ |
41 | 41 |
* 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f 70 71 72 73 74 75 76 77 78 79 7a 3a 20 2d |
42 | 42 |
* |
43 | 43 |
* Test manually/visually if dword is intended string using: |
44 |
- * awk '/^#define/ {printf("%s \"%x%x%x%x\" ... %s \n", $3,strtonum("0x" substr($3,9,2)),strtonum("0x" substr($3,7,2)),strtonum("0x" substr($3,5,2)),strtonum("0x" substr($3,3,2)),$5)}' keys.h |
|
44 |
+ * awk '/^#define/ {printf("%s \"%c%c%c%c\" ... %s \n", $3,strtonum("0x" substr($3,9,2)),strtonum("0x" substr($3,7,2)),strtonum("0x" substr($3,5,2)),strtonum("0x" substr($3,3,2)),$5)}' keys.h |
|
45 | 45 |
* |
46 | 46 |
*/ |
47 | 47 |
|
... | ... |
@@ -158,4 +158,6 @@ |
158 | 158 |
|
159 | 159 |
#define _est__ 0x2d747365 /* "est-" */ |
160 | 160 |
|
161 |
+#define _min__ 0x2d6e696d /* "min-" */ |
|
162 |
+ |
|
161 | 163 |
#endif /* KEYS_H */ |
... | ... |
@@ -209,6 +209,7 @@ char* get_hdr_field(char* buf, char* end, struct hdr_field* hdr) |
209 | 209 |
case HDR_SIPIFMATCH_T: |
210 | 210 |
case HDR_REFER_TO_T: |
211 | 211 |
case HDR_SESSIONEXPIRES_T: |
212 |
+ case HDR_MIN_SE_T: |
|
212 | 213 |
case HDR_ACCEPTCONTACT_T: |
213 | 214 |
case HDR_ALLOWEVENTS_T: |
214 | 215 |
case HDR_CONTENTENCODING_T: |
... | ... |
@@ -307,7 +308,6 @@ int parse_headers(struct sip_msg* msg, hdr_flags_t flags, int next) |
307 | 308 |
msg->parsed_flag|=HDR_EOH_F; |
308 | 309 |
pkg_free(hf); |
309 | 310 |
goto skip; |
310 |
- case HDR_SESSIONEXPIRES_T: |
|
311 | 311 |
case HDR_ACCEPTCONTACT_T: |
312 | 312 |
case HDR_ALLOWEVENTS_T: |
313 | 313 |
case HDR_CONTENTENCODING_T: |
... | ... |
@@ -436,6 +436,14 @@ int parse_headers(struct sip_msg* msg, hdr_flags_t flags, int next) |
436 | 436 |
if (msg->refer_to==0) msg->refer_to = hf; |
437 | 437 |
msg->parsed_flag|=HDR_REFER_TO_F; |
438 | 438 |
break; |
439 |
+ case HDR_SESSIONEXPIRES_T: |
|
440 |
+ if (msg->session_expires==0) msg->session_expires = hf; |
|
441 |
+ msg->parsed_flag|=HDR_SESSIONEXPIRES_F; |
|
442 |
+ break; |
|
443 |
+ case HDR_MIN_SE_T: |
|
444 |
+ if (msg->min_se==0) msg->min_se = hf; |
|
445 |
+ msg->parsed_flag|=HDR_MIN_SE_F; |
|
446 |
+ break; |
|
439 | 447 |
case HDR_VIA_T: |
440 | 448 |
msg->parsed_flag|=HDR_VIA_F; |
441 | 449 |
DBG("parse_headers: Via found, flags=%llx\n", |
... | ... |
@@ -20,8 +20,8 @@ |
20 | 20 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
21 | 21 |
* GNU General Public License for more details. |
22 | 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 |
|
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 | 25 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
26 | 26 |
* |
27 | 27 |
* History |
... | ... |
@@ -67,7 +67,7 @@ |
67 | 67 |
#define REPLY_CLASS(_reply) ((_reply)->REPLY_STATUS/100) |
68 | 68 |
|
69 | 69 |
/* number methods as power of two to allow bitmap matching */ |
70 |
-enum request_method { METHOD_UNDEF=0, METHOD_INVITE=1, METHOD_CANCEL=2, METHOD_ACK=4, |
|
70 |
+enum request_method { METHOD_UNDEF=0, METHOD_INVITE=1, METHOD_CANCEL=2, METHOD_ACK=4, |
|
71 | 71 |
METHOD_BYE=8, METHOD_INFO=16, METHOD_REGISTER=32, METHOD_SUBSCRIBE=64, |
72 | 72 |
METHOD_NOTIFY=128, METHOD_OTHER=256 }; |
73 | 73 |
|
... | ... |
@@ -123,7 +123,7 @@ struct sip_uri { |
123 | 123 |
str host; /* Host name */ |
124 | 124 |
str port; /* Port number */ |
125 | 125 |
str params; /* Parameters */ |
126 |
- str headers; |
|
126 |
+ str headers; |
|
127 | 127 |
unsigned short port_no; |
128 | 128 |
}; |
129 | 129 |
#endif |
... | ... |
@@ -137,7 +137,7 @@ struct sip_uri { |
137 | 137 |
str host; /* Host name */ |
138 | 138 |
str port; /* Port number */ |
139 | 139 |
str params; /* Parameters */ |
140 |
- str headers; |
|
140 |
+ str headers; |
|
141 | 141 |
unsigned short port_no; |
142 | 142 |
unsigned short proto; /* from transport */ |
143 | 143 |
uri_type type; /* uri scheme */ |
... | ... |
@@ -207,12 +207,14 @@ struct sip_msg { |
207 | 207 |
struct hdr_field* accept_disposition; |
208 | 208 |
struct hdr_field* diversion; |
209 | 209 |
struct hdr_field* rpid; |
210 |
- struct hdr_field* refer_to; |
|
210 |
+ struct hdr_field* refer_to; |
|
211 |
+ struct hdr_field* session_expires; |
|
212 |
+ struct hdr_field* min_se; |
|
211 | 213 |
struct hdr_field* sipifmatch; |
212 | 214 |
|
213 | 215 |
char* eoh; /* pointer to the end of header (if found) or null */ |
214 | 216 |
char* unparsed; /* here we stopped parsing*/ |
215 |
- |
|
217 |
+ |
|
216 | 218 |
struct receive_info rcv; /* source & dest ip, ports, proto a.s.o*/ |
217 | 219 |
|
218 | 220 |
char* buf; /* scratch pad, holds a modified message, |
... | ... |
@@ -220,7 +222,7 @@ struct sip_msg { |
220 | 222 |
unsigned int len; /* message len (orig) */ |
221 | 223 |
|
222 | 224 |
/* modifications */ |
223 |
- |
|
225 |
+ |
|
224 | 226 |
str new_uri; /* changed first line uri, when you change this |
225 | 227 |
don't forget to set parsed_uri_ok to 0*/ |
226 | 228 |
|
... | ... |
@@ -233,25 +235,25 @@ struct sip_msg { |
233 | 235 |
/* the same for original uri */ |
234 | 236 |
int parsed_orig_ruri_ok; |
235 | 237 |
struct sip_uri parsed_orig_ruri; |
236 |
- |
|
238 |
+ |
|
237 | 239 |
struct lump* add_rm; /* used for all the forwarded requests/replies */ |
238 | 240 |
struct lump* body_lumps; /* Lumps that update Content-Length */ |
239 | 241 |
struct lump_rpl *reply_lump; /* only for localy generated replies !!!*/ |
240 | 242 |
|
241 |
- /* str add_to_branch; |
|
242 |
- whatever whoever want to append to branch comes here |
|
243 |
+ /* str add_to_branch; |
|
244 |
+ whatever whoever want to append to branch comes here |
|
243 | 245 |
*/ |
244 | 246 |
char add_to_branch_s[MAX_BRANCH_PARAM_LEN]; |
245 | 247 |
int add_to_branch_len; |
246 |
- |
|
248 |
+ |
|
247 | 249 |
/* index to TM hash table; stored in core to avoid unnecessary calculations */ |
248 | 250 |
unsigned int hash_index; |
249 | 251 |
unsigned int msg_flags; /* flags used by core */ |
250 |
- /* allows to set various flags on the message; may be used for |
|
252 |
+ /* allows to set various flags on the message; may be used for |
|
251 | 253 |
* simple inter-module communication or remembering processing state |
252 |
- * reached |
|
254 |
+ * reached |
|
253 | 255 |
*/ |
254 |
- flag_t flags; |
|
256 |
+ flag_t flags; |
|
255 | 257 |
str set_global_address; |
256 | 258 |
str set_global_port; |
257 | 259 |
struct socket_info* force_send_socket; /* force sending on this socket, |
... | ... |
@@ -300,7 +302,7 @@ inline static int char_msg_val( struct sip_msg *msg, char *cv ) |
300 | 302 |
src[2]= msg->callid->body; |
301 | 303 |
src[3]= msg->first_line.u.request.uri; |
302 | 304 |
src[4]= get_cseq( msg )->number; |
303 |
- |
|
305 |
+ |
|
304 | 306 |
/* topmost Via is part of transaction key as well ! */ |
305 | 307 |
src[5]= msg->via1->host; |
306 | 308 |
src[6]= msg->via1->port_str; |
... | ... |
@@ -88,6 +88,7 @@ static inline char* skip_ws(char* p, unsigned int size) |
88 | 88 |
#include "case_refe.h" /* Refer-To */ |
89 | 89 |
#include "case_sess.h" /* Session-Expires */ |
90 | 90 |
#include "case_reje.h" /* Reject-Contact */ |
91 |
+#include "case_min.h" /* Min-SE */ |
|
91 | 92 |
|
92 | 93 |
|
93 | 94 |
#define READ(val) \ |
... | ... |
@@ -123,6 +124,7 @@ static inline char* skip_ws(char* p, unsigned int size) |
123 | 124 |
case _refe_: refe_CASE; \ |
124 | 125 |
case _sess_: sess_CASE; \ |
125 | 126 |
case _reje_: reje_CASE; \ |
127 |
+ case _min__: min_CASE; \ |
|
126 | 128 |
|
127 | 129 |
|
128 | 130 |
|