Browse code

- adjusted compact headers. There were missing compact equivalents for Subject, Refer-To and completely missing Session-Expires, Accept-Contact, etc. support. Currently I've implemented both compact header and case switches to assign enumeration type. No next parsing is processed, but probably will be done, good candidate e.g. Session-Expires.

Now e.g. textops hf_value correctly recognizes "Session-Expires" and "x" as equal headers.

Tomas Mandys authored on 18/06/2006 23:15:22
Showing 12 changed files
... ...
@@ -1,7 +1,7 @@
1
-/* 
2
- * $Id$ 
1
+/*
2
+ * $Id$
3 3
  *
4
- * Accept and Accept-Language Header Field Name Parsing Macros
4
+ * Accept, Accept-Language, Accept-Contact, Accept-Disposition Header Field Name Parsing Macros
5 5
  *
6 6
  * Copyright (C) 2001-2003 FhG Fokus
7 7
  *
... ...
@@ -22,8 +22,8 @@
22 22
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23 23
  * GNU General Public License for more details.
24 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 
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 27
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
28 28
  */
29 29
 
... ...
@@ -85,8 +85,27 @@
85 85
                 goto other;        \
86 86
         }
87 87
 
88
+#define accept_contact_ct_CASE                             \
89
+        if (LOWER_BYTE(*p) == 'c') {                       \
90
+                p++;                                       \
91
+                if (LOWER_BYTE(*p) == 't') {               \
92
+                        hdr->type = HDR_ACCEPTCONTACT_T;   \
93
+                        p++;                               \
94
+                        goto dc_end;                       \
95
+                }                                          \
96
+        }
88 97
 
89
-#define ptld_CASE                  \
98
+#define accept_c_onta_CASE         \
99
+        switch(LOWER_DWORD(val)) { \
100
+        case _onta_:               \
101
+                p += 4;            \
102
+                val = READ(p);     \
103
+                accept_contact_ct_CASE;  \
104
+                goto other;        \
105
+        }
106
+
107
+
108
+#define ptldc_CASE                 \
90 109
         switch(LOWER_DWORD(val)) { \
91 110
         case _pt_l_:               \
92 111
 		p += 4;            \
... ...
@@ -99,13 +118,18 @@
99 118
                 val = READ(p);     \
100 119
                 ispo_CASE;         \
101 120
                 goto other;        \
121
+        case _pt_c_:               \
122
+                p += 4;            \
123
+                val = READ(p);     \
124
+                accept_c_onta_CASE;\
125
+                goto other;        \
102 126
 	}
103 127
 
104 128
 
105 129
 #define acce_CASE                           \
106 130
     p += 4;                                 \
107 131
     val = READ(p);                          \
108
-    ptld_CASE;                              \
132
+    ptldc_CASE;                             \
109 133
                                             \
110 134
     if (LOWER_BYTE(*p) == 'p') {            \
111 135
             p++;                            \
... ...
@@ -1,7 +1,7 @@
1
-/* 
2
- * $Id$ 
1
+/*
2
+ * $Id$
3 3
  *
4
- * Allow Header Field Name Parsing Macros
4
+ * Allow, Allow-Events Header Field Name Parsing Macros
5 5
  *
6 6
  * Copyright (C) 2001-2003 FhG Fokus
7 7
  *
... ...
@@ -22,21 +22,42 @@
22 22
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23 23
  * GNU General Public License for more details.
24 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 
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 27
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
28 28
  */
29 29
 
30 30
 #ifndef CASE_ALLO_H
31 31
 #define CASE_ALLO_H
32 32
 
33
+#define allow_ev_ents_CASE         \
34
+	switch(LOWER_DWORD(val)) { \
35
+	case _ents_:               \
36
+		p += 4;            \
37
+		hdr->type = HDR_ALLOWEVENTS_T; \
38
+		goto dc_end;       \
39
+	}
40
+
41
+
42
+
43
+#define allo_w_ev_CASE             \
44
+        switch(LOWER_DWORD(val)) { \
45
+        case _w_ev_:               \
46
+                p += 4;            \
47
+                val = READ(p);     \
48
+                allow_ev_ents_CASE;\
49
+                goto other;        \
50
+        }
51
+
33 52
 
34 53
 #define allo_CASE                  \
35 54
     p += 4;                        \
55
+    val = READ(p);                 \
56
+    allo_w_ev_CASE;                \
36 57
     if (LOWER_BYTE(*p) == 'w') {   \
37 58
             hdr->type = HDR_ALLOW_T; \
38 59
             p++;                   \
39
-	    goto dc_end;           \
60
+            goto dc_end;           \
40 61
     }                              \
41 62
     goto other;
42 63
 
... ...
@@ -1,7 +1,7 @@
1
-/* 
2
- * $Id$ 
1
+/*
2
+ * $Id$
3 3
  *
4
- * Contact, Content-Type, Content-Length, Content-Disposition
4
+ * Contact, Content-Type, Content-Length, Content-Disposition, Content-Encoding
5 5
  * Header Field Name Parsing Macros
6 6
  *
7 7
  * Copyright (C) 2001-2003 FhG Fokus
... ...
@@ -23,8 +23,8 @@
23 23
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24 24
  * GNU General Public License for more details.
25 25
  *
26
- * You should have received a copy of the GNU General Public License 
27
- * along with this program; if not, write to the Free Software 
26
+ * You should have received a copy of the GNU General Public License
27
+ * along with this program; if not, write to the Free Software
28 28
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
29 29
  *
30 30
  * History:
... ...
@@ -81,6 +81,14 @@
81 81
 	}
82 82
 
83 83
 
84
+#define ENCODING_CASE              \
85
+	switch(LOWER_DWORD(val)) { \
86
+	case _ding_:               \
87
+		p += 4;            \
88
+		hdr->type = HDR_CONTENTENCODING_T; \
89
+		goto dc_end;       \
90
+	}
91
+
84 92
 #define CONTENT_CASE                         \
85 93
         switch(LOWER_DWORD(val)) {           \
86 94
         case _leng_:                         \
... ...
@@ -99,6 +107,11 @@
99 107
 		val = READ(p);               \
100 108
 		DISPOSITION_CASE;            \
101 109
                 goto other;                  \
110
+        case _enco_:                         \
111
+                p += 4;                      \
112
+		val = READ(p);               \
113
+		ENCODING_CASE;               \
114
+                goto other;                  \
102 115
         }
103 116
 
104 117
 
... ...
@@ -119,7 +132,7 @@
119 132
                 val = READ(p);           \
120 133
                 CONTENT_CASE;            \
121 134
                 goto other;              \
122
-        }                         
135
+        }
123 136
 
124 137
 #define cont_CASE      \
125 138
      p += 4;           \
... ...
@@ -1,6 +1,8 @@
1
-/* 
1
+/*
2 2
  * Refer-To Header Field Name Parsing Macros
3 3
  *
4
+ * Refer-To, Referred-By Header Field Name Parsing Macros
5
+ *
4 6
  * Copyright (C) 2005 Juha Heinanen
5 7
  *
6 8
  * This file is part of ser, a free SIP server.
... ...
@@ -20,26 +22,44 @@
20 22
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21 23
  * GNU General Public License for more details.
22 24
  *
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
+ * You should have received a copy of the GNU General Public License
26
+ * along with this program; if not, write to the Free Software
25 27
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
26 28
  */
27 29
 
28 30
 #ifndef CASE_REFE_H
29 31
 #define CASE_REFE_H
30 32
 
31
-#define r_to_CASE                          \
32
-        if (LOWER_DWORD(val) == _r_to_) {  \
33
+#define REFERRED_BY_CASE                 \
34
+        switch(LOWER_DWORD(val)) {       \
35
+        case __by1_:                     \
36
+	        hdr->type = HDR_REFERREDBY_T; \
37
+	        hdr->name.len = 11;      \
38
+	        return (p + 4);          \
39
+        case __by2_:                      \
40
+	        hdr->type = HDR_REFERREDBY_T; \
41
+	        p += 4;                  \
42
+	        goto dc_end;             \
43
+	}
44
+
45
+#define r_to_CASE                        \
46
+        switch(LOWER_DWORD(val)) {       \
47
+        case _r_to_:  \
33 48
                 hdr->type = HDR_REFER_TO_T;  \
34
-                p += 4;                    \
35
-                goto dc_end;               \
49
+                p += 4;                  \
50
+                goto dc_end;             \
51
+        \
52
+        case _rred_:                     \
53
+                p += 4;                  \
54
+                val = READ(p);           \
55
+                REFERRED_BY_CASE;        \
56
+                goto other;              \
36 57
         }
37 58
 
38
-
39 59
 #define refe_CASE      \
40 60
      p += 4;           \
41 61
      val = READ(p);    \
42
-     r_to_CASE;         \
62
+     r_to_CASE;        \
43 63
      goto other;
44 64
 
45 65
 
46 66
new file mode 100644
... ...
@@ -0,0 +1,69 @@
1
+/*
2
+ * $Id$
3
+ *
4
+ * Reject-Contact 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
+#ifndef CASE_REJE_H
31
+#define CASE_REJE_H
32
+
33
+
34
+#define reject_conta_ct_CASE                            \
35
+        if (LOWER_BYTE(*p) == 'c') {                    \
36
+                p++;                                    \
37
+                if (LOWER_BYTE(*p) == 't') {            \
38
+                        hdr->type = HDR_REJECTCONTACT_T;\
39
+                        p++;                            \
40
+                        goto dc_end;                    \
41
+                }                                       \
42
+        }
43
+
44
+#define reject_c_onta_CASE                \
45
+        if (LOWER_DWORD(val) == _onta_) { \
46
+	        p += 4;                   \
47
+                val = READ(p);            \
48
+                reject_conta_ct_CASE;     \
49
+		goto other;               \
50
+	}
51
+
52
+
53
+#define reje_ct_c_CASE                 \
54
+        if (LOWER_DWORD(val) == _ct_c_) {  \
55
+                p += 4;                     \
56
+	        val = READ(p);              \
57
+	        reject_c_onta_CASE;         \
58
+                goto other;                 \
59
+        }
60
+
61
+
62
+#define reje_CASE      \
63
+     p += 4;           \
64
+     val = READ(p);    \
65
+     reje_ct_c_CASE;        \
66
+     goto other;
67
+
68
+
69
+#endif /* CASE_REJE_H */
... ...
@@ -1,7 +1,7 @@
1
-/* 
2
- * $Id$ 
1
+/*
2
+ * $Id$
3 3
  *
4
- * Require Header Field Name Parsing Macros
4
+ * Require, Request-Disposition Header Field Name Parsing Macros
5 5
  *
6 6
  * Copyright (C) 2001-2003 FhG Fokus
7 7
  *
... ...
@@ -22,8 +22,8 @@
22 22
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23 23
  * GNU General Public License for more details.
24 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 
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 27
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
28 28
  *
29 29
  * History:
... ...
@@ -38,6 +38,38 @@
38 38
 
39 39
 #include "../comp_defs.h"
40 40
 
41
+#define REQUESTDISPOSIT_ion_CASE                    \
42
+        switch(LOWER_DWORD(val)) {                  \
43
+        case _ion1_:                                \
44
+	        hdr->type = HDR_REQUESTDISPOSITION_T; \
45
+	        hdr->name.len = 19;                 \
46
+	        return (p + 4);                     \
47
+                                                    \
48
+        case _ion2_:                                \
49
+                hdr->type = HDR_REQUESTDISPOSITION_T; \
50
+                p += 4;                             \
51
+	        goto dc_end;                        \
52
+        }
53
+
54
+
55
+#define REQUESTDISP_OSITION_CASE   \
56
+        switch(LOWER_DWORD(val)) { \
57
+        case _osit_:               \
58
+		p += 4;            \
59
+		val = READ(p);     \
60
+		REQUESTDISPOSIT_ion_CASE;  \
61
+		goto other;        \
62
+	}
63
+
64
+#define REQUEST_DISPOSITION_CASE             \
65
+        switch(LOWER_DWORD(val)) {           \
66
+        case _disp_:                         \
67
+                p += 4;                      \
68
+		val = READ(p);               \
69
+		REQUESTDISP_OSITION_CASE;    \
70
+                goto other;                  \
71
+        }
72
+
41 73
 
42 74
 #define IRE_CASE                         \
43 75
         switch(LOWER_DWORD(val)) {       \
... ...
@@ -50,6 +82,11 @@
50 82
                 hdr->type = HDR_REQUIRE_T; \
51 83
                 p += 4;                  \
52 84
                 goto dc_end;             \
85
+        case _est__:                     \
86
+                p += 4;                  \
87
+                val = READ(p);           \
88
+                REQUEST_DISPOSITION_CASE;\
89
+                goto other;              \
53 90
         }
54 91
 
55 92
 
56 93
new file mode 100644
... ...
@@ -0,0 +1,72 @@
1
+/*
2
+ * $Id$
3
+ *
4
+ * Session-Expires 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
+#ifndef CASE_SESS_H
31
+#define CASE_SESS_H
32
+
33
+
34
+#define sessionexpi_res_CASE                         \
35
+	switch(LOWER_DWORD(val)) {       \
36
+	case _res1_:                     \
37
+		hdr->type = HDR_SESSIONEXPIRES_T;    \
38
+		hdr->name.len = 15;      \
39
+		return (p + 4);          \
40
+						\
41
+	case _res2_:                     \
42
+		hdr->type = HDR_SESSIONEXPIRES_T;    \
43
+		p += 4;                  \
44
+		goto dc_end;             \
45
+	}
46
+
47
+#define session_expi_CASE                         \
48
+        if (LOWER_DWORD(val) == _expi_) { \
49
+	        p += 4;                   \
50
+                val = READ(p);            \
51
+                sessionexpi_res_CASE;                 \
52
+		goto other;               \
53
+	}
54
+
55
+
56
+#define sess_ion__CASE                          \
57
+        if (LOWER_DWORD(val) == _ion__) {  \
58
+                p += 4;                    \
59
+	        val = READ(p);             \
60
+	        session_expi_CASE;                 \
61
+                goto other;                \
62
+        }
63
+
64
+
65
+#define sess_CASE      \
66
+     p += 4;           \
67
+     val = READ(p);    \
68
+     sess_ion__CASE;        \
69
+     goto other;
70
+
71
+
72
+#endif /* CASE_SESS_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:
... ...
@@ -49,7 +49,7 @@
49 49
 #include "../ut.h"
50 50
 
51 51
 
52
-/* 
52
+/*
53 53
  * Frees a hdr_field structure,
54 54
  * WARNING: it frees only parsed (and not name.s, body.s)
55 55
  */
... ...
@@ -135,10 +135,10 @@ void clean_hdr_field(struct hdr_field* hf)
135 135
 
136 136
 		case HDR_ACCEPTLANGUAGE_T:
137 137
 			break;
138
-			
138
+
139 139
 		case HDR_ORGANIZATION_T:
140 140
 			break;
141
-			
141
+
142 142
 		case HDR_PRIORITY_T:
143 143
 			break;
144 144
 
... ...
@@ -167,6 +167,14 @@ void clean_hdr_field(struct hdr_field* hf)
167 167
 			free_to(hf->parsed);
168 168
 			break;
169 169
 
170
+		case HDR_SESSIONEXPIRES_T:
171
+		case HDR_ACCEPTCONTACT_T:
172
+		case HDR_ALLOWEVENTS_T:
173
+		case HDR_CONTENTENCODING_T:
174
+		case HDR_REFERREDBY_T:
175
+		case HDR_REJECTCONTACT_T:
176
+		case HDR_REQUESTDISPOSITION_T:
177
+			break;
170 178
 		default:
171 179
 			LOG(L_CRIT, "BUG: clean_hdr_field: unknown header type %d\n",
172 180
 			    hf->type);
... ...
@@ -176,13 +184,13 @@ void clean_hdr_field(struct hdr_field* hf)
176 184
 }
177 185
 
178 186
 
179
-/* 
187
+/*
180 188
  * Frees a hdr_field list,
181 189
  * WARNING: frees only ->parsed and ->next*/
182 190
 void free_hdr_field_lst(struct hdr_field* hf)
183 191
 {
184 192
 	struct hdr_field* foo;
185
-	
193
+
186 194
 	while(hf) {
187 195
 		foo=hf;
188 196
 		hf=hf->next;
... ...
@@ -87,6 +87,14 @@ enum _hdr_types_t {
87 87
 	HDR_RPID_T					       /* Remote-Party-ID header field */,
88 88
 	HDR_REFER_TO_T				       /* Refer-To header fiels */,
89 89
 	HDR_SIPIFMATCH_T                   /* SIP-If-Match header field */,
90
+	HDR_SESSIONEXPIRES_T                           /* Session-Expires header */,
91
+	HDR_ACCEPTCONTACT_T                            /* Accept-Contact header */,
92
+	HDR_ALLOWEVENTS_T                              /* Allow-Events header */,
93
+	HDR_CONTENTENCODING_T                          /* Content-Encoding header */,
94
+	HDR_REFERREDBY_T                               /* Referred-By header */,
95
+	HDR_REJECTCONTACT_T                            /* Reject-Contact header */,
96
+	HDR_REQUESTDISPOSITION_T                       /* Request-Disposition header */,
97
+
90 98
 	HDR_EOH_T				       /* End of message header */
91 99
 };
92 100
 
... ...
@@ -137,6 +145,14 @@ typedef unsigned long long hdr_flags_t;
137 145
 #define HDR_RPID_F					HDR_F_DEF(RPID)
138 146
 #define HDR_REFER_TO_F				HDR_F_DEF(REFER_TO)
139 147
 #define HDR_SIPIFMATCH_F			HDR_F_DEF(SIPIFMATCH)
148
+#define HDR_SESSIONEXPIRES_F			HDR_F_DEF(SESSIONEXPIRES)
149
+#define HDR_ACCEPTCONTACT_F			HDR_F_DEF(HDR_ACCEPTCONTACT_T)
150
+#define HDR_ALLOWEVENTS_F			HDR_F_DEF(HDR_ALLOWEVENTS_T)
151
+#define HDR_CONTENTENCODING_F			HDR_F_DEF(HDR_CONTENTENCODING_T)
152
+#define HDR_REFERREDBY_F			HDR_F_DEF(HDR_REFERREDBY_T)
153
+#define HDR_REJECTCONTACT_F			HDR_F_DEF(HDR_REJECTCONTACT_T)
154
+#define HDR_REQUESTDISPOSITION_F		HDR_F_DEF(HDR_REQUESTDISPOSITION_T)
155
+
140 156
 #define HDR_OTHER_F					HDR_F_DEF(OTHER)
141 157
 
142 158
 typedef enum _hdr_types_t hdr_types_t;
... ...
@@ -1,5 +1,5 @@
1
-/* 
2
- * $Id$ 
1
+/*
2
+ * $Id$
3 3
  *
4 4
  * Fast 32-bit Header Field Name Parser -- keys
5 5
  *
... ...
@@ -22,8 +22,8 @@
22 22
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23 23
  * GNU General Public License for more details.
24 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 
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 27
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
28 28
  *
29 29
  * History:
... ...
@@ -39,6 +39,10 @@
39 39
 /*
40 40
  * a  b  c  d  e  f  g  h  i  j  k  l  m  n  o  p  q  r  s  t  u  v  w  x  y  z  :  ' ' -
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
+ *
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
45
+ *
42 46
  */
43 47
 
44 48
 #define _acce_ 0x65636361   /* "acce" */
... ...
@@ -115,7 +119,7 @@
115 119
 #define _ion2_ 0x206e6f69   /* "ion " */
116 120
 #define _ion1_ 0x3a6e6f69   /* "ion:" */
117 121
 
118
-#define _pt_d_ 0x64617470   /* "pt-d" */
122
+#define _pt_d_ 0x642d7470   /* "pt-d" */
119 123
 #define _ispo_ 0x6f707369   /* "ispo" */
120 124
 #define _siti_ 0x69746973   /* "siti" */
121 125
 
... ...
@@ -131,4 +135,27 @@
131 135
 #define _refe_ 0x65666572   /* "refe" */
132 136
 #define _r_to_ 0x6f742d72   /* "r-to" */
133 137
 
138
+#define _pt_c_ 0x632d7470   /* "pt-c" */
139
+#define _onta_ 0x61746e6f   /* "onta" */
140
+
141
+#define _sess_ 0x73736573   /* "sess" */
142
+#define _ion__ 0x2d6e6f69   /* "ion-" */
143
+#define _res2_ 0x20736572   /* "res " */
144
+#define _res1_ 0x3a736572   /* "res:" */
145
+
146
+#define _w_ev_ 0x76652d77   /* "w-ev" */
147
+#define _ents_ 0x73746e65   /* "ents" */
148
+
149
+#define _enco_ 0x6f636e65   /* "enco" */
150
+#define _ding_ 0x676e6964   /* "ding" */
151
+
152
+#define _rred_ 0x64657272   /* "rred" */
153
+#define __by2_ 0x2079622d   /* "-by " */
154
+#define __by1_ 0x3a79622d   /* "-by:" */
155
+
156
+#define _reje_ 0x656a6572   /* "reje" */
157
+#define _ct_c_ 0x632d7463   /* "ct-c" */
158
+
159
+#define _est__ 0x2d747365   /* "est-" */
160
+
134 161
 #endif /* KEYS_H */
... ...
@@ -1,7 +1,7 @@
1 1
 /*
2 2
  * $Id$
3 3
  *
4
- * sip msg. header proxy parser 
4
+ * sip msg. header proxy parser
5 5
  *
6 6
  *
7 7
  * Copyright (C) 2001-2003 FhG Fokus
... ...
@@ -23,8 +23,8 @@
23 23
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24 24
  * GNU General Public License for more details.
25 25
  *
26
- * You should have received a copy of the GNU General Public License 
27
- * along with this program; if not, write to the Free Software 
26
+ * You should have received a copy of the GNU General Public License
27
+ * along with this program; if not, write to the Free Software
28 28
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
29 29
  *
30 30
  * History:
... ...
@@ -93,7 +93,7 @@ char* get_hdr_field(char* buf, char* end, struct hdr_field* hdr)
93 93
 	}
94 94
 
95 95
 	/* eliminate leading whitespace */
96
-	tmp=eat_lws_end(tmp, end); 
96
+	tmp=eat_lws_end(tmp, end);
97 97
 	if (tmp>=end) {
98 98
 		LOG(L_ERR, "ERROR: get_hdr_field: HF empty\n");
99 99
 		goto error;
... ...
@@ -143,8 +143,8 @@ char* get_hdr_field(char* buf, char* end, struct hdr_field* hdr)
143 143
 			hdr->parsed=cseq_b;
144 144
 			hdr->body.len=tmp-hdr->body.s;
145 145
 			DBG("get_hdr_field: cseq <%.*s>: <%.*s> <%.*s>\n",
146
-					hdr->name.len, ZSW(hdr->name.s), 
147
-					cseq_b->number.len, ZSW(cseq_b->number.s), 
146
+					hdr->name.len, ZSW(hdr->name.s),
147
+					cseq_b->number.len, ZSW(cseq_b->number.s),
148 148
 					cseq_b->method.len, cseq_b->method.s);
149 149
 			break;
150 150
 		case HDR_TO_T:
... ...
@@ -164,7 +164,7 @@ char* get_hdr_field(char* buf, char* end, struct hdr_field* hdr)
164 164
 			hdr->parsed=to_b;
165 165
 			hdr->body.len=tmp-hdr->body.s;
166 166
 			DBG("DEBUG: get_hdr_field: <%.*s> [%d]; uri=[%.*s] \n",
167
-				hdr->name.len, ZSW(hdr->name.s), 
167
+				hdr->name.len, ZSW(hdr->name.s),
168 168
 				hdr->body.len, to_b->uri.len,ZSW(to_b->uri.s));
169 169
 			DBG("DEBUG: to body [%.*s]\n",to_b->body.len,
170 170
 				ZSW(to_b->body.s));
... ...
@@ -208,6 +208,13 @@ char* get_hdr_field(char* buf, char* end, struct hdr_field* hdr)
208 208
 		case HDR_RPID_T:
209 209
 		case HDR_SIPIFMATCH_T:
210 210
 		case HDR_REFER_TO_T:
211
+		case HDR_SESSIONEXPIRES_T:
212
+		case HDR_ACCEPTCONTACT_T:
213
+		case HDR_ALLOWEVENTS_T:
214
+		case HDR_CONTENTENCODING_T:
215
+		case HDR_REFERREDBY_T:
216
+		case HDR_REJECTCONTACT_T:
217
+		case HDR_REQUESTDISPOSITION_T:
211 218
 		case HDR_OTHER_T:
212 219
 			/* just skip over it */
213 220
 			hdr->body.s=tmp;
... ...
@@ -273,13 +280,13 @@ int parse_headers(struct sip_msg* msg, hdr_flags_t flags, int next)
273 280
 
274 281
 	end=msg->buf+msg->len;
275 282
 	tmp=msg->unparsed;
276
-	
283
+
277 284
 	if (next) {
278 285
 		orig_flag = msg->parsed_flag;
279 286
 		msg->parsed_flag &= ~flags;
280 287
 	}else
281
-		orig_flag=0; 
282
-	
288
+		orig_flag=0;
289
+
283 290
 	DBG("parse_headers: flags=%llx\n", (unsigned long long)flags);
284 291
 	while( tmp<end && (flags & msg->parsed_flag) != flags){
285 292
 		hf=pkg_malloc(sizeof(struct hdr_field));
... ...
@@ -300,6 +307,13 @@ int parse_headers(struct sip_msg* msg, hdr_flags_t flags, int next)
300 307
 				msg->parsed_flag|=HDR_EOH_F;
301 308
 				pkg_free(hf);
302 309
 				goto skip;
310
+			case HDR_SESSIONEXPIRES_T:
311
+			case HDR_ACCEPTCONTACT_T:
312
+			case HDR_ALLOWEVENTS_T:
313
+			case HDR_CONTENTENCODING_T:
314
+			case HDR_REFERREDBY_T:
315
+			case HDR_REJECTCONTACT_T:
316
+			case HDR_REQUESTDISPOSITION_T:
303 317
 			case HDR_OTHER_T: /*do nothing*/
304 318
 				break;
305 319
 			case HDR_CALLID_T:
... ...
@@ -456,8 +470,8 @@ int parse_headers(struct sip_msg* msg, hdr_flags_t flags, int next)
456 470
 		}
457 471
 #ifdef EXTRA_DEBUG
458 472
 		DBG("header field type %d, name=<%.*s>, body=<%.*s>\n",
459
-			hf->type, 
460
-			hf->name.len, ZSW(hf->name.s), 
473
+			hf->type,
474
+			hf->name.len, ZSW(hf->name.s),
461 475
 			hf->body.len, ZSW(hf->body.s));
462 476
 #endif
463 477
 		tmp=rest;
... ...
@@ -541,55 +555,55 @@ int parse_msg(char* buf, unsigned int len, struct sip_msg* msg)
541 555
 	/* dump parsed data */
542 556
 	if (msg->via1){
543 557
 		DBG(" first  via: <%.*s/%.*s/%.*s> <%.*s:%.*s(%d)>",
544
-			msg->via1->name.len, 
545
-			ZSW(msg->via1->name.s), 
558
+			msg->via1->name.len,
559
+			ZSW(msg->via1->name.s),
546 560
 			msg->via1->version.len,
547 561
 			ZSW(msg->via1->version.s),
548 562
 			msg->via1->transport.len,
549
-			ZSW(msg->via1->transport.s), 
563
+			ZSW(msg->via1->transport.s),
550 564
 			msg->via1->host.len,
551 565
 			ZSW(msg->via1->host.s),
552
-			msg->via1->port_str.len, 
553
-			ZSW(msg->via1->port_str.s), 
566
+			msg->via1->port_str.len,
567
+			ZSW(msg->via1->port_str.s),
554 568
 			msg->via1->port);
555
-		if (msg->via1->params.s)  DBG(";<%.*s>", 
569
+		if (msg->via1->params.s)  DBG(";<%.*s>",
556 570
 				msg->via1->params.len, ZSW(msg->via1->params.s));
557
-		if (msg->via1->comment.s) 
558
-				DBG(" <%.*s>", 
571
+		if (msg->via1->comment.s)
572
+				DBG(" <%.*s>",
559 573
 					msg->via1->comment.len, ZSW(msg->via1->comment.s));
560 574
 		DBG ("\n");
561 575
 	}
562 576
 	if (msg->via2){
563 577
 		DBG(" first  via: <%.*s/%.*s/%.*s> <%.*s:%.*s(%d)>",
564
-			msg->via2->name.len, 
565
-			ZSW(msg->via2->name.s), 
578
+			msg->via2->name.len,
579
+			ZSW(msg->via2->name.s),
566 580
 			msg->via2->version.len,
567 581
 			ZSW(msg->via2->version.s),
568
-			msg->via2->transport.len, 
569
-			ZSW(msg->via2->transport.s), 
582
+			msg->via2->transport.len,
583
+			ZSW(msg->via2->transport.s),
570 584
 			msg->via2->host.len,
571 585
 			ZSW(msg->via2->host.s),
572
-			msg->via2->port_str.len, 
573
-			ZSW(msg->via2->port_str.s), 
586
+			msg->via2->port_str.len,
587
+			ZSW(msg->via2->port_str.s),
574 588
 			msg->via2->port);
575
-		if (msg->via2->params.s)  DBG(";<%.*s>", 
589
+		if (msg->via2->params.s)  DBG(";<%.*s>",
576 590
 				msg->via2->params.len, ZSW(msg->via2->params.s));
577
-		if (msg->via2->comment.s) DBG(" <%.*s>", 
591
+		if (msg->via2->comment.s) DBG(" <%.*s>",
578 592
 				msg->via2->comment.len, ZSW(msg->via2->comment.s));
579 593
 		DBG ("\n");
580 594
 	}
581 595
 #endif
582
-	
596
+
583 597
 
584 598
 #ifdef EXTRA_DEBUG
585 599
 	DBG("exiting parse_msg\n");
586 600
 #endif
587 601
 
588 602
 	return 0;
589
-	
603
+
590 604
 error:
591 605
 	/* more debugging, msg->orig is/should be null terminated*/
592
-	LOG(L_ERR, "ERROR: parse_msg: message=<%.*s>\n", 
606
+	LOG(L_ERR, "ERROR: parse_msg: message=<%.*s>\n",
593 607
 			(int)msg->len, ZSW(msg->buf));
594 608
 	return -1;
595 609
 }
... ...
@@ -619,7 +633,7 @@ void free_sip_msg(struct sip_msg* msg)
619 633
 	if (msg->reply_lump)   free_reply_lump(msg->reply_lump);
620 634
 	/* don't free anymore -- now a pointer to a static buffer */
621 635
 #	ifdef DYN_BUF
622
-	pkg_free(msg->buf); 
636
+	pkg_free(msg->buf);
623 637
 #	endif
624 638
 }
625 639
 
... ...
@@ -1,5 +1,5 @@
1
-/* 
2
- * $Id$ 
1
+/*
2
+ * $Id$
3 3
  *
4 4
  * Fast 32-bit Header Field Name Parser
5 5
  *
... ...
@@ -22,8 +22,8 @@
22 22
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23 23
  * GNU General Public License for more details.
24 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 
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 27
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
28 28
  *
29 29
  * History:
... ...
@@ -49,14 +49,14 @@
49 49
 static inline char* skip_ws(char* p, unsigned int size)
50 50
 {
51 51
 	char* end;
52
-	
52
+
53 53
 	end = p + size;
54 54
 	for(; p < end; p++) {
55 55
 		if ((*p != ' ') && (*p != '\t')) return p;
56 56
 	}
57 57
 	return p;
58 58
 }
59
-	
59
+
60 60
 /*
61 61
  * Parser macros
62 62
  */
... ...
@@ -65,7 +65,7 @@ static inline char* skip_ws(char* p, unsigned int size)
65 65
 #include "case_to.h"       /* To */
66 66
 #include "case_cseq.h"     /* CSeq */
67 67
 #include "case_call.h"     /* Call-ID */
68
-#include "case_cont.h"     /* Contact, Content-Type, Content-Length, Content-Purpose, 
68
+#include "case_cont.h"     /* Contact, Content-Type, Content-Length, Content-Purpose,
69 69
 			    * Content-Action, Content-Disposition */
70 70
 #include "case_rout.h"     /* Route */
71 71
 #include "case_max.h"      /* Max-Forwards */
... ...
@@ -86,6 +86,8 @@ static inline char* skip_ws(char* p, unsigned int size)
86 86
 #include "case_dive.h"     /* Diversion */
87 87
 #include "case_remo.h"     /* Remote-Party-ID */
88 88
 #include "case_refe.h"     /* Refer-To */
89
+#include "case_sess.h"     /* Session-Expires */
90
+#include "case_reje.h"     /* Reject-Contact */
89 91
 
90 92
 
91 93
 #define READ(val) \
... ...
@@ -110,7 +112,7 @@ static inline char* skip_ws(char* p, unsigned int size)
110 112
 	case _allo_: allo_CASE; \
111 113
 	case _unsu_: unsu_CASE; \
112 114
         case _even_: even_CASE; \
113
-        case _sip_: sip_CASE; \
115
+        case _sip_ : sip_CASE;  \
114 116
         case _acce_: acce_CASE; \
115 117
         case _orga_: orga_CASE; \
116 118
         case _prio_: prio_CASE; \
... ...
@@ -118,7 +120,10 @@ static inline char* skip_ws(char* p, unsigned int size)
118 120
         case _user_: user_CASE; \
119 121
         case _dive_: dive_CASE; \
120 122
         case _remo_: remo_CASE; \
121
-        case _refe_: refe_CASE;
123
+        case _refe_: refe_CASE; \
124
+	case _sess_: sess_CASE; \
125
+	case _reje_: reje_CASE; \
126
+
122 127
 
123 128
 
124 129
 #define PARSE_COMPACT(id)          \
... ...
@@ -132,7 +137,7 @@ static inline char* skip_ws(char* p, unsigned int size)
132 137
 	        hdr->type = id;    \
133 138
 	        hdr->name.len = 1; \
134 139
 	        return (p + 2);    \
135
-        }                            
140
+        }
136 141
 
137 142
 
138 143
 char* parse_hname2(char* begin, char* end, struct hdr_field* hdr)
... ...
@@ -155,19 +160,19 @@ char* parse_hname2(char* begin, char* end, struct hdr_field* hdr)
155 160
 
156 161
 	default:
157 162
 		switch(LOWER_BYTE(*p)) {
158
-		case 't':                           
159
-			switch(LOWER_BYTE(*(p + 1))) {          
160
-			case 'o':                   
161
-			case ' ':                   
162
-				hdr->type = HDR_TO_T; 
163
-				p += 2;             
164
-				goto dc_end;        
165
-				
166
-			case ':':                   
167
-				hdr->type = HDR_TO_T; 
168
-				hdr->name.len = 1;  
169
-				return (p + 2);     
170
-			}                           
163
+		case 't':
164
+			switch(LOWER_BYTE(*(p + 1))) {
165
+			case 'o':
166
+			case ' ':
167
+				hdr->type = HDR_TO_T;
168
+				p += 2;
169
+				goto dc_end;
170
+
171
+			case ':':
172
+				hdr->type = HDR_TO_T;
173
+				hdr->name.len = 1;
174
+				return (p + 2);
175
+			}
171 176
 			break;
172 177
 
173 178
 		case 'v': PARSE_COMPACT(HDR_VIA_T);           break;
... ...
@@ -178,6 +183,15 @@ char* parse_hname2(char* begin, char* end, struct hdr_field* hdr)
178 183
 		case 'k': PARSE_COMPACT(HDR_SUPPORTED_T);     break;
179 184
 		case 'c': PARSE_COMPACT(HDR_CONTENTTYPE_T);   break;
180 185
 		case 'o': PARSE_COMPACT(HDR_EVENT_T);         break;
186
+		case 'x': PARSE_COMPACT(HDR_SESSIONEXPIRES_T);break;
187
+		case 'a': PARSE_COMPACT(HDR_ACCEPTCONTACT_T); break;
188
+		case 'u': PARSE_COMPACT(HDR_ALLOWEVENTS_T);   break;
189
+		case 'e': PARSE_COMPACT(HDR_CONTENTENCODING_T); break;
190
+		case 'b': PARSE_COMPACT(HDR_REFERREDBY_T);    break;
191
+		case 'j': PARSE_COMPACT(HDR_REJECTCONTACT_T); break;
192
+		case 'd': PARSE_COMPACT(HDR_REQUESTDISPOSITION_T); break;
193
+		case 's': PARSE_COMPACT(HDR_SUBJECT_T);       break;
194
+		case 'r': PARSE_COMPACT(HDR_REFER_TO_T);      break;
181 195
 		}
182 196
 		goto other;
183 197
         }
... ...
@@ -185,7 +199,7 @@ char* parse_hname2(char* begin, char* end, struct hdr_field* hdr)
185 199
 	     /* Double colon hasn't been found yet */
186 200
  dc_end:
187 201
        	p = skip_ws(p, end - p);
188
-	if (*p != ':') {   
202
+	if (*p != ':') {
189 203
 	        goto other;
190 204
 	} else {
191 205
 		hdr->name.len = p - hdr->name.s;
... ...
@@ -193,7 +207,7 @@ char* parse_hname2(char* begin, char* end, struct hdr_field* hdr)
193 207
 	}
194 208
 
195 209
 	     /* Unknown header type */
196
- other:    
210
+ other:
197 211
 	p = q_memchr(p, ':', end - p);
198 212
 	if (!p) {        /* No double colon found, error.. */
199 213
 		hdr->type = HDR_ERROR_T;