Browse code

Kamailio compatibility: Privacy header field name parser

This patch adds support for the Privacy header field name parser.

Jan Janak authored on 27/03/2009 07:59:37
Showing 7 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,51 @@
1
+/* 
2
+ * $Id$ 
3
+ *
4
+ * Call-ID Header 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
+ * ser is distributed in the hope that it will be useful,
16
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
+ * GNU General Public License for more details.
19
+ *
20
+ * You should have received a copy of the GNU General Public License 
21
+ * along with this program; if not, write to the Free Software 
22
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
23
+ */
24
+
25
+#ifndef _CASE_PRIV_H
26
+#define _CASE_PRIV_H
27
+
28
+
29
+#define ACY_CASE					  \
30
+	switch(LOWER_DWORD(val)) {		  \
31
+	case _acy1_:					  \
32
+		hdr->type = HDR_PRIVACY_T;	  \
33
+		hdr->name.len = 7;			  \
34
+		return (p + 4);				  \
35
+									  \
36
+	case _acy2_:					  \
37
+		hdr->type = HDR_PRIVACY_T;	  \
38
+		p += 4;						  \
39
+		goto dc_end;				  \
40
+	}
41
+
42
+
43
+#define priv_CASE	   \
44
+	p += 4;			   \
45
+	val = READ(p);	   \
46
+	ACY_CASE;		   \
47
+	goto other;
48
+
49
+
50
+
51
+#endif /* _CASE_PRIV_H */
... ...
@@ -214,6 +214,7 @@ void clean_hdr_field(struct hdr_field* hf)
214 214
 		case HDR_WWW_AUTHENTICATE_T:
215 215
 		case HDR_PROXY_AUTHENTICATE_T:
216 216
 		case HDR_PATH_T:
217
+		case HDR_PRIVACY_T:
217 218
 			break;
218 219
 		default:
219 220
 			LOG(L_CRIT, "BUG: clean_hdr_field: unknown header type %d\n",
... ...
@@ -110,6 +110,7 @@ enum _hdr_types_t {
110 110
 	HDR_PPI_T                          /**< P-Preferred-Identity header field */,
111 111
 	HDR_PAI_T                          /**< P-Asserted-Identity header field */,
112 112
 	HDR_PATH_T                         /**< Path header field */,
113
+	HDR_PRIVACY_T				       /**< Privacy header field */,
113 114
 	HDR_EOH_T					       /* End of message header */
114 115
 };
115 116
 
... ...
@@ -180,6 +181,7 @@ typedef unsigned long long hdr_flags_t;
180 181
 #define HDR_PPI_F                   HDR_F_DEF(PPI)
181 182
 #define HDR_PAI_F                   HDR_F_DEF(PAI)
182 183
 #define HDR_PATH_F                  HDR_F_DEF(PATH)
184
+#define HDR_PRIVACY_F               HDR_F_DEF(PRIVACY)
183 185
 
184 186
 #define HDR_OTHER_F					HDR_F_DEF(OTHER)
185 187
 
... ...
@@ -181,4 +181,8 @@
181 181
 #define _ter1_ 0x3a726574   /* "ter:" */
182 182
 #define _ter2_ 0x20726574   /* "ter " */
183 183
 
184
+#define _priv_ 0x76697270   /* "priv" */
185
+#define _acy2_ 0x20796361   /* "acy " */
186
+#define _acy1_ 0x3a796361   /* "acy:" */
187
+
184 188
 #endif /* KEYS_H */
... ...
@@ -242,6 +242,7 @@ char* get_hdr_field(char* buf, char* end, struct hdr_field* hdr)
242 242
 		case HDR_WWW_AUTHENTICATE_T:
243 243
 		case HDR_PROXY_AUTHENTICATE_T:
244 244
 	    case HDR_PATH_T:
245
+	    case HDR_PRIVACY_T:
245 246
 		case HDR_OTHER_T:
246 247
 			/* just skip over it */
247 248
 			hdr->body.s=tmp;
... ...
@@ -521,6 +522,10 @@ int parse_headers(struct sip_msg* msg, hdr_flags_t flags, int next)
521 522
 				if (msg->path==0) msg->path=hf;
522 523
 				msg->parsed_flag|=HDR_PATH_F;
523 524
 				break;
525
+		    case HDR_PRIVACY_T:
526
+				if (msg->privacy==0) msg->privacy=hf;
527
+				msg->parsed_flag|=HDR_PRIVACY_F;
528
+				break;
524 529
 			default:
525 530
 				LOG(L_CRIT, "BUG: parse_headers: unknown header type %d\n",
526 531
 							hf->type);
... ...
@@ -278,6 +278,7 @@ typedef struct sip_msg {
278 278
 	struct hdr_field* pai;
279 279
 	struct hdr_field* ppi;
280 280
 	struct hdr_field* path;
281
+	struct hdr_field* privacy;
281 282
 
282 283
 	struct msg_body* body;
283 284
 
... ...
@@ -99,6 +99,7 @@ static inline char* skip_ws(char* p, unsigned int size)
99 99
 #include "case_iden.h"     /* Identity, Identity-info */
100 100
 #include "case_retr.h"     /* Retry-After */
101 101
 #include "case_path.h"     /* Path */
102
+#include "case_priv.h"
102 103
 
103 104
 
104 105
 #define READ(val) \
... ...
@@ -144,8 +145,8 @@ static inline char* skip_ws(char* p, unsigned int size)
144 145
 	case _date_: date_CASE; \
145 146
 	case _iden_: iden_CASE; \
146 147
 	case _retr_: retr_CASE; \
147
-    case _path_: path_CASE;
148
-
148
+    case _path_: path_CASE; \
149
+	case _priv_: priv_CASE;
149 150
 
150 151
 
151 152
 #define PARSE_COMPACT(id)          \