Browse code

- patch from Jan (for recognizing some extra headers) applyed. - interface for parse_content_type_hdr changed (separation between type and subtype inside a mime) - parse_accept_hdr added

Bogdan-Andrei Iancu authored on 05/08/2003 11:13:01
Showing 15 changed files
... ...
@@ -563,15 +563,9 @@ struct sip_msg*  sip_msg_cloner( struct sip_msg *org_msg )
563 563
 					new_hdr->parsed = auth_body_cloner(new_msg->buf , org_msg->buf , (struct auth_body*)hdr->parsed , &p);
564 564
 				}
565 565
 				break;
566
-			case HDR_WWWAUTH :
567
-				new_msg->www_auth = new_hdr;
568
-				break;
569 566
 			case HDR_SUPPORTED :
570 567
 				new_msg->supported = new_hdr;
571 568
 				break;
572
-			case HDR_REQUIRE :
573
-				new_msg->require = new_hdr;
574
-				break;
575 569
 			case HDR_PROXYREQUIRE :
576 570
 				new_msg->proxy_require = new_hdr;
577 571
 				break;
... ...
@@ -1,7 +1,7 @@
1 1
 /* 
2 2
  * $Id$ 
3 3
  *
4
- * Accept Header Field Name Parsing Macros
4
+ * Accept and Accept-Language Header Field Name Parsing Macros
5 5
  *
6 6
  * Copyright (C) 2001-2003 Fhg Fokus
7 7
  *
... ...
@@ -31,8 +31,45 @@
31 31
 #define CASE_ACCE_H
32 32
 
33 33
 
34
+#define age_CASE                                \
35
+        switch(LOWER_DWORD(val)) {              \
36
+        case _age1_:                            \
37
+	        hdr->type = HDR_ACCEPTLANGUAGE; \
38
+	        hdr->name.len = 15;             \
39
+	        return (p + 4);                 \
40
+                                                \
41
+        case _age2_:                            \
42
+                hdr->type = HDR_ACCEPTLANGUAGE; \
43
+                p += 4;                         \
44
+	        goto dc_end;                    \
45
+        }
46
+
47
+
48
+#define angu_CASE                  \
49
+        switch(LOWER_DWORD(val)) { \
50
+        case _angu_:               \
51
+		p += 4;            \
52
+		val = READ(p);     \
53
+		age_CASE;          \
54
+		goto other;        \
55
+	}
56
+
57
+
58
+#define ptl_CASE                   \
59
+        switch(LOWER_DWORD(val)) { \
60
+        case _pt_l_:               \
61
+		p += 4;            \
62
+		val = READ(p);     \
63
+		angu_CASE;         \
64
+		goto other;        \
65
+	}
66
+
67
+
34 68
 #define acce_CASE                           \
35 69
     p += 4;                                 \
70
+    val = READ(p);                          \
71
+    ptl_CASE;                               \
72
+                                            \
36 73
     if (LOWER_BYTE(*p) == 'p') {            \
37 74
             p++;                            \
38 75
             if (LOWER_BYTE(*p) == 't') {    \
... ...
@@ -1,7 +1,8 @@
1 1
 /* 
2 2
  * $Id$ 
3 3
  *
4
- * Contact, Content-Type, Content-Length Header Field Name Parsing Macros
4
+ * Contact, Content-Type, Content-Length, Content-Purpose,
5
+ * Content-Action, Content-Disposition  Header Field Name Parsing Macros
5 6
  *
6 7
  * Copyright (C) 2001-2003 Fhg Fokus
7 8
  *
... ...
@@ -56,8 +57,59 @@
56 57
         }
57 58
 
58 59
 
59
-#define LENG_TYPE_CASE                       \
60
-        switch(LOWER_DWORD(val)) {            \
60
+#define PURP_CASE                               \
61
+        switch(LOWER_DWORD(val)) {              \
62
+        case _ose1_:                            \
63
+	        hdr->type = HDR_CONTENTPURPOSE; \
64
+	        hdr->name.len = 15;             \
65
+	        return (p + 4);                 \
66
+                                                \
67
+        case _ose2_:                            \
68
+                hdr->type = HDR_CONTENTPURPOSE; \
69
+                p += 4;                         \
70
+	        goto dc_end;                    \
71
+        }
72
+
73
+
74
+#define ACTION_CASE                                \
75
+    p += 4;                                        \
76
+    if (LOWER_BYTE(*p) == 'o') {                   \
77
+            p++;                                   \
78
+            if (LOWER_BYTE(*p) == 'n') {           \
79
+                    hdr->type = HDR_CONTENTACTION; \
80
+                    p++;                           \
81
+                    goto dc_end;                   \
82
+            }                                      \
83
+    }                                              \
84
+    goto other;
85
+
86
+
87
+#define ion_CASE                                    \
88
+        switch(LOWER_DWORD(val)) {                  \
89
+        case _ion1_:                                \
90
+	        hdr->type = HDR_CONTENTDISPOSITION; \
91
+	        hdr->name.len = 19;                 \
92
+	        return (p + 4);                     \
93
+                                                    \
94
+        case _ion2_:                                \
95
+                hdr->type = HDR_CONTENTDISPOSITION; \
96
+                p += 4;                             \
97
+	        goto dc_end;                        \
98
+        }
99
+
100
+
101
+#define DISPOSITION_CASE           \
102
+        switch(LOWER_DWORD(val)) { \
103
+        case _osit_:               \
104
+		p += 4;            \
105
+		val = READ(p);     \
106
+		ion_CASE;          \
107
+		goto other;        \
108
+	}
109
+
110
+
111
+#define CONTENT_CASE                         \
112
+        switch(LOWER_DWORD(val)) {           \
61 113
         case _leng_:                         \
62 114
                 p += 4;                      \
63 115
                 val = READ(p);               \
... ...
@@ -68,6 +120,24 @@
68 120
                 hdr->type = HDR_CONTENTTYPE; \
69 121
                 p += 4;                      \
70 122
                 goto dc_end;                 \
123
+                                             \
124
+        case _purp_:                         \
125
+		p += 4;                      \
126
+		val = READ(p);               \
127
+		PURP_CASE;                   \
128
+		goto other;                  \
129
+                                             \
130
+        case _acti_:                         \
131
+                p += 4;                      \
132
+                val = READ(p);               \
133
+                ACTION_CASE;                 \
134
+                goto other;                  \
135
+                                             \
136
+        case _disp_:                         \
137
+                p += 4;                      \
138
+		val = READ(p);               \
139
+		DISPOSITION_CASE;            \
140
+                goto other;                  \
71 141
         }
72 142
 
73 143
 
... ...
@@ -86,7 +156,7 @@
86 156
         case _ent__:                     \
87 157
                 p += 4;                  \
88 158
                 val = READ(p);           \
89
-                LENG_TYPE_CASE;          \
159
+                CONTENT_CASE;            \
90 160
                 goto other;              \
91 161
         }                         
92 162
 
93 163
new file mode 100644
... ...
@@ -0,0 +1,60 @@
1
+/* 
2
+ * $Id$ 
3
+ *
4
+ * Organization 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_ORGA_H
32
+#define CASE_ORGA_H
33
+
34
+
35
+#define tion_CASE                             \
36
+        if (LOWER_DWORD(val) == _tion_) {     \
37
+	        hdr->type = HDR_ORGANIZATION; \
38
+		p += 4;                       \
39
+		goto dc_end;                  \
40
+	}                                     \
41
+
42
+
43
+#define niza_CASE                  \
44
+        switch(LOWER_DWORD(val)) { \
45
+        case _niza_:               \
46
+	        p += 4;            \
47
+	        val = READ(p);     \
48
+		tion_CASE;         \
49
+	        goto other;        \
50
+        }
51
+
52
+
53
+#define orga_CASE         \
54
+        p += 4;           \
55
+        val = READ(p);    \
56
+        niza_CASE;        \
57
+        goto other;
58
+
59
+
60
+#endif /* CASE_ORGA_H */
0 61
new file mode 100644
... ...
@@ -0,0 +1,50 @@
1
+/* 
2
+ * $Id$ 
3
+ *
4
+ * Priority 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_PRIO_H
32
+#define CASE_PRIO_H
33
+
34
+
35
+#define rity_CASE                             \
36
+        if (LOWER_DWORD(val) == _rity_) {     \
37
+	        hdr->type = HDR_PRIORITY;     \
38
+		p += 4;                       \
39
+		goto dc_end;                  \
40
+	}                                     \
41
+
42
+
43
+#define prio_CASE         \
44
+        p += 4;           \
45
+        val = READ(p);    \
46
+        rity_CASE;        \
47
+        goto other;
48
+
49
+
50
+#endif /* CASE_PRIO_H */
0 51
new file mode 100644
... ...
@@ -0,0 +1,56 @@
1
+/* 
2
+ * $Id$ 
3
+ *
4
+ * Subject 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_SUBJ_H
32
+#define CASE_SUBJ_H
33
+
34
+
35
+#define ect_CASE                         \
36
+        switch(LOWER_DWORD(val)) {       \
37
+        case _ect1_:                     \
38
+	        hdr->type = HDR_SUBJECT; \
39
+	        hdr->name.len = 7;       \
40
+	        return (p + 4);          \
41
+                                         \
42
+        case _ect2_:                     \
43
+                hdr->type = HDR_SUBJECT; \
44
+                p += 4;                  \
45
+	        goto dc_end;             \
46
+        }
47
+
48
+
49
+#define subj_CASE        \
50
+        p += 4;          \
51
+        val = READ(p);   \
52
+        ect_CASE;        \
53
+        goto other;
54
+
55
+
56
+#endif /* CASE_SUBJ_H */
0 57
new file mode 100644
... ...
@@ -0,0 +1,57 @@
1
+/* 
2
+ * $Id$ 
3
+ *
4
+ * User-Agent 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_USER_H
31
+#define CASE_USER_H
32
+
33
+
34
+#define nt_CASE                                \
35
+    if (LOWER_BYTE(*p) == 'n') {               \
36
+            p++;                               \
37
+            if (LOWER_BYTE(*p) == 't') {       \
38
+                    hdr->type = HDR_USERAGENT; \
39
+                    p++;                       \
40
+                    goto dc_end;               \
41
+            }                                  \
42
+    }                                          \
43
+    goto other;
44
+
45
+
46
+#define user_CASE              \
47
+    p += 4;                    \
48
+    val = READ(p);             \
49
+    switch(LOWER_DWORD(val)) { \
50
+    case __age_:               \
51
+	p += 4;                \
52
+	nt_CASE;               \
53
+    }                          \
54
+    goto other;
55
+
56
+
57
+#endif /* CASE_USER_H */
... ...
@@ -28,6 +28,7 @@
28 28
  * -------
29 29
  * 2003-03-26 Frees also hdr->parsed for Route & Record-Route (janakj)
30 30
  * 2003-04-26 ZSW (jiri)
31
+ * 2003-08-05 free the parsed part of Accept header (bogdan)
31 32
  */
32 33
 
33 34
 
... ...
@@ -96,6 +97,10 @@ void clean_hdr_field(struct hdr_field* hf)
96 97
 		case HDR_CONTENTTYPE:
97 98
 			break;
98 99
 
100
+		case HDR_ACCEPT:
101
+			pkg_free(hf->parsed);
102
+			break;
103
+
99 104
 		default:
100 105
 			LOG(L_CRIT, "BUG: clean_hdr_field: unknown header type %d\n",
101 106
 			    hf->type);
... ...
@@ -40,33 +40,39 @@
40 40
 
41 41
 
42 42
 /* Header types and flags */
43
-#define HDR_EOH         		-1   /* End of header found */
44
-#define HDR_ERROR                0   /* Error while parsing */
45
-#define HDR_VIA                  1   /* Via header field */
46
-#define HDR_VIA1                 1   /* First Via header field */
47
-#define HDR_VIA2          (1 <<  1)  /* only used as flag*/
48
-#define HDR_TO            (1 <<  2)  /* To header field */
49
-#define HDR_FROM          (1 <<  3)  /* From header field */
50
-#define HDR_CSEQ          (1 <<  4)  /* CSeq header field */
51
-#define HDR_CALLID        (1 <<  5)  /* Call-Id header field */
52
-#define HDR_CONTACT       (1 <<  6)  /* Contact header field */
53
-#define HDR_MAXFORWARDS   (1 <<  7)  /* MaxForwards header field */
54
-#define HDR_ROUTE         (1 <<  8)  /* Route header field */
55
-#define HDR_RECORDROUTE   (1 <<  9)  /* Record-Route header field */
56
-#define HDR_CONTENTTYPE   (1 << 10)  /* Content-Type header field */
57
-#define HDR_CONTENTLENGTH (1 << 11)  /* Content-Length header field */
58
-#define HDR_AUTHORIZATION (1 << 12)  /* Authorization header field */
59
-#define HDR_EXPIRES       (1 << 13)  /* Expires header field */
60
-#define HDR_PROXYAUTH     (1 << 14)  /* Proxy-Authorization header field */
61
-#define HDR_WWWAUTH       (1 << 15)  /* WWW-Authorization header field */
62
-#define HDR_SUPPORTED     (1 << 16)  /* Supported header field */
63
-#define HDR_REQUIRE       (1 << 17)  /* Require header field */
64
-#define HDR_PROXYREQUIRE  (1 << 18)  /* Proxy-Require header field */
65
-#define HDR_UNSUPPORTED   (1 << 19)  /* Unsupported header field */
66
-#define HDR_ALLOW         (1 << 20)  /* Allow header field */
67
-#define HDR_EVENT         (1 << 21)  /* Event header field */
68
-#define HDR_ACCEPT        (1 << 22)  /* Accept header field */
69
-#define HDR_OTHER         (1 << 23)  /* Some other header field */
43
+#define HDR_EOH         	     -1   /* End of header found */
44
+#define HDR_ERROR                     0   /* Error while parsing */
45
+#define HDR_VIA                       1   /* Via header field */
46
+#define HDR_VIA1                      1   /* First Via header field */
47
+#define HDR_VIA2               (1 <<  1)  /* only used as flag*/
48
+#define HDR_TO                 (1 <<  2)  /* To header field */
49
+#define HDR_FROM               (1 <<  3)  /* From header field */
50
+#define HDR_CSEQ               (1 <<  4)  /* CSeq header field */
51
+#define HDR_CALLID             (1 <<  5)  /* Call-Id header field */
52
+#define HDR_CONTACT            (1 <<  6)  /* Contact header field */
53
+#define HDR_MAXFORWARDS        (1 <<  7)  /* MaxForwards header field */
54
+#define HDR_ROUTE              (1 <<  8)  /* Route header field */
55
+#define HDR_RECORDROUTE        (1 <<  9)  /* Record-Route header field */
56
+#define HDR_CONTENTTYPE        (1 << 10)  /* Content-Type header field */
57
+#define HDR_CONTENTLENGTH      (1 << 11)  /* Content-Length header field */
58
+#define HDR_AUTHORIZATION      (1 << 12)  /* Authorization header field */
59
+#define HDR_EXPIRES            (1 << 13)  /* Expires header field */
60
+#define HDR_PROXYAUTH          (1 << 14)  /* Proxy-Authorization header field */
61
+#define HDR_SUPPORTED          (1 << 15)  /* Supported  header field */
62
+#define HDR_PROXYREQUIRE       (1 << 16)  /* Proxy-Require header field */
63
+#define HDR_UNSUPPORTED        (1 << 17)  /* Unsupported header field */
64
+#define HDR_ALLOW              (1 << 18)  /* Allow header field */
65
+#define HDR_EVENT              (1 << 19)  /* Event header field */
66
+#define HDR_ACCEPT             (1 << 20)  /* Accept header field */
67
+#define HDR_ACCEPTLANGUAGE     (1 << 21)  /* Accept-Language header field */
68
+#define HDR_ORGANIZATION       (1 << 22)  /* Organization header field */
69
+#define HDR_PRIORITY           (1 << 23)  /* Priority header field */
70
+#define HDR_SUBJECT            (1 << 24)  /* Subject header field */
71
+#define HDR_USERAGENT          (1 << 25)  /* User-Agent header field */
72
+#define HDR_CONTENTPURPOSE     (1 << 26)  /* Content-Purpose header field */
73
+#define HDR_CONTENTACTION      (1 << 27)  /* Content-Action header field */
74
+#define HDR_CONTENTDISPOSITION (1 << 28)  /* Content-Disposition header field */
75
+#define HDR_OTHER              (1 << 29)  /* Some other header field */
70 76
 
71 77
 
72 78
 /* 
... ...
@@ -34,6 +34,11 @@
34 34
 #ifndef KEYS_H
35 35
 #define KEYS_H
36 36
 
37
+/*
38
+ * 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  :  ' ' -
39
+ * 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
40
+ */
41
+
37 42
 #define _acce_ 0x65636361   /* "acce" */
38 43
 #define _allo_ 0x6f6c6c61   /* "allo" */
39 44
 #define _auth_ 0x68747561   /* "auth" */
... ...
@@ -86,4 +91,27 @@
86 91
 #define _cate_ 0x65746163   /* "cate" */
87 92
 #define _even_ 0x6e657665   /* "even" */
88 93
 
94
+#define _pt_l_ 0x6c2d7470   /* "pt-l" */
95
+#define _angu_ 0x75676e61   /* "angu" */
96
+#define _age2_ 0x20656761   /* "age " */
97
+#define _age1_ 0x3a656761   /* "age:" */
98
+#define _orga_ 0x6167726f   /* "orga" */
99
+#define _niza_ 0x617a696e   /* "niza" */
100
+#define _tion_ 0x6e6f6974   /* "tion" */
101
+#define _prio_ 0x6f697270   /* "prio" */
102
+#define _rity_ 0x79746972   /* "rity" */
103
+#define _subj_ 0x6a627573   /* "subj" */
104
+#define _ect2_ 0x20746365   /* "ect " */
105
+#define _ect1_ 0x3a746365   /* "ect:" */
106
+#define _user_ 0x72657375   /* "user" */
107
+#define __age_ 0x6567612d   /* "-age" */
108
+#define _purp_ 0x70727570   /* "purp" */
109
+#define _ose2_ 0x2065736f   /* "ose " */
110
+#define _ose1_ 0x3a65736f   /* "ose:" */
111
+#define _acti_ 0x69746361   /* "acti" */
112
+#define _disp_ 0x70736964   /* "disp" */
113
+#define _osit_ 0x7469736f   /* "osit" */
114
+#define _ion2_ 0x206e6f69   /* "ion " */
115
+#define _ion1_ 0x3a6e6f69   /* "ion:" */
116
+
89 117
 #endif /* KEYS_H */
... ...
@@ -179,6 +179,7 @@ char* get_hdr_field(char* buf, char* end, struct hdr_field* hdr)
179 179
 			DBG("DEBUG: get_hdr_body : content_length=%d\n",
180 180
 					(int)(long)hdr->parsed);
181 181
 			break;
182
+		case HDR_SUPPORTED:
182 183
 		case HDR_CONTENTTYPE:
183 184
 		case HDR_FROM:
184 185
 		case HDR_CALLID:
... ...
@@ -189,14 +190,19 @@ char* get_hdr_field(char* buf, char* end, struct hdr_field* hdr)
189 190
 		case HDR_AUTHORIZATION:
190 191
 		case HDR_EXPIRES:
191 192
 		case HDR_PROXYAUTH:
192
-		case HDR_WWWAUTH:
193
-		case HDR_SUPPORTED:
194
-		case HDR_REQUIRE:
195 193
 		case HDR_PROXYREQUIRE:
196 194
 		case HDR_UNSUPPORTED:
197 195
 		case HDR_ALLOW:
198 196
 		case HDR_EVENT:
199 197
 	        case HDR_ACCEPT:
198
+	        case HDR_ACCEPTLANGUAGE:
199
+	        case HDR_ORGANIZATION:
200
+	        case HDR_PRIORITY:
201
+	        case HDR_SUBJECT:
202
+	        case HDR_USERAGENT:
203
+	        case HDR_CONTENTPURPOSE:
204
+	        case HDR_CONTENTACTION:
205
+	        case HDR_CONTENTDISPOSITION:
200 206
 		case HDR_OTHER:
201 207
 			/* just skip over it */
202 208
 			hdr->body.s=tmp;
... ...
@@ -340,22 +346,14 @@ int parse_headers(struct sip_msg* msg, int flags, int next)
340 346
 				if (msg->proxy_auth==0) msg->proxy_auth = hf;
341 347
 				msg->parsed_flag|=HDR_PROXYAUTH;
342 348
 				break;
343
-			case HDR_WWWAUTH:
344
-				if (msg->www_auth==0) msg->www_auth = hf;
345
-				msg->parsed_flag|=HDR_WWWAUTH;
346
-				break;
347
-			case HDR_SUPPORTED:
348
-				if (msg->supported==0) msg->supported = hf;
349
-				msg->parsed_flag|=HDR_SUPPORTED;
350
-				break;
351
-			case HDR_REQUIRE:
352
-				if (msg->require==0) msg->require = hf;
353
-				msg->parsed_flag|=HDR_REQUIRE;
354
-				break;
355
-			case HDR_PROXYREQUIRE:
349
+		        case HDR_PROXYREQUIRE:
356 350
 				if (msg->proxy_require==0) msg->proxy_require = hf;
357 351
 				msg->parsed_flag|=HDR_PROXYREQUIRE;
358 352
 				break;
353
+	                case HDR_SUPPORTED:
354
+				if (msg->supported==0) msg->supported=hf;
355
+				msg->parsed_flag|=HDR_SUPPORTED;
356
+				break;
359 357
 			case HDR_UNSUPPORTED:
360 358
 				if (msg->unsupported==0) msg->unsupported=hf;
361 359
 				msg->parsed_flag|=HDR_UNSUPPORTED;
... ...
@@ -372,6 +370,38 @@ int parse_headers(struct sip_msg* msg, int flags, int next)
372 370
 				if (msg->accept==0) msg->accept = hf;
373 371
 				msg->parsed_flag|=HDR_ACCEPT;
374 372
 				break;
373
+		        case HDR_ACCEPTLANGUAGE:
374
+				if (msg->accept_language==0) msg->accept_language = hf;
375
+				msg->parsed_flag|=HDR_ACCEPTLANGUAGE;
376
+				break;
377
+		        case HDR_ORGANIZATION:
378
+				if (msg->organization==0) msg->organization = hf;
379
+				msg->parsed_flag|=HDR_ORGANIZATION;
380
+				break;
381
+		        case HDR_PRIORITY:
382
+				if (msg->priority==0) msg->priority = hf;
383
+				msg->parsed_flag|=HDR_PRIORITY;
384
+				break;
385
+		        case HDR_SUBJECT:
386
+				if (msg->subject==0) msg->subject = hf;
387
+				msg->parsed_flag|=HDR_SUBJECT;
388
+				break;
389
+		        case HDR_USERAGENT:
390
+				if (msg->user_agent==0) msg->user_agent = hf;
391
+				msg->parsed_flag|=HDR_USERAGENT;
392
+				break;
393
+		        case HDR_CONTENTPURPOSE:
394
+				if (msg->content_purpose==0) msg->content_purpose = hf;
395
+				msg->parsed_flag|=HDR_CONTENTPURPOSE;
396
+				break;
397
+		        case HDR_CONTENTACTION:
398
+				if (msg->content_action==0) msg->content_action = hf;
399
+				msg->parsed_flag|=HDR_CONTENTACTION;
400
+				break;
401
+		        case HDR_CONTENTDISPOSITION:
402
+				if (msg->content_disposition==0) msg->content_disposition = hf;
403
+				msg->parsed_flag|=HDR_CONTENTDISPOSITION;
404
+				break;
375 405
 			case HDR_VIA:
376 406
 				msg->parsed_flag|=HDR_VIA;
377 407
 				DBG("parse_headers: Via found, flags=%d\n", flags);
... ...
@@ -173,14 +173,20 @@ struct sip_msg {
173 173
 	struct hdr_field* authorization;
174 174
 	struct hdr_field* expires;
175 175
 	struct hdr_field* proxy_auth;
176
-	struct hdr_field* www_auth;
177 176
 	struct hdr_field* supported;
178
-	struct hdr_field* require;
179 177
 	struct hdr_field* proxy_require;
180 178
 	struct hdr_field* unsupported;
181 179
 	struct hdr_field* allow;
182 180
 	struct hdr_field* event;
183 181
 	struct hdr_field* accept;
182
+	struct hdr_field* accept_language;
183
+	struct hdr_field* organization;
184
+	struct hdr_field* priority;
185
+	struct hdr_field* subject;
186
+	struct hdr_field* user_agent;
187
+	struct hdr_field* content_purpose;
188
+	struct hdr_field* content_action;
189
+	struct hdr_field* content_disposition;
184 190
 
185 191
 	char* eoh;        /* pointer to the end of header (if found) or null */
186 192
 	char* unparsed;   /* here we stopped parsing*/
... ...
@@ -24,6 +24,12 @@
24 24
  * You should have received a copy of the GNU General Public License 
25 25
  * along with this program; if not, write to the Free Software 
26 26
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
27
+ *
28
+ * History:
29
+ * 2003-08-04 parse_content_type_hdr separates type from subtype inside
30
+ * the mime type (bogdan)
31
+ * 2003-08-04 CPL subtype added (bogdan)
32
+ * 2003-08-05 parse_accept_hdr function added (bogdan)
27 33
  */
28 34
 
29 35
 
... ...
@@ -31,26 +37,72 @@
31 37
 #include <stdlib.h>
32 38
 #include <sys/types.h>
33 39
 #include <unistd.h>
40
+#include "../mem/mem.h"
34 41
 #include "../dprint.h"
35 42
 #include "../str.h"
36 43
 #include "../ut.h"
37 44
 #include "parse_content.h"
38 45
 
46
+
47
+#define is_mime_char(_c_) \
48
+	(isalpha(_c_) || (_c_)=='-' || (_c_)=='+')
49
+#define is_char_equal(_c_,_cs_) \
50
+	( (isalpha(_c_)?(((_c_)|0x20)==(_cs_)):((_c_)==(_cs_)))==1 )
51
+
52
+
39 53
 /*
40 54
  * Node of the type's tree; this tree contains all the known types;
41 55
  */
42 56
 typedef struct type_node_s {
43 57
 	char c;                      /* char contained by this node */
44
-	char final;                 /* says what to be done if the matched string
45
-	                              * ends at this node: -1-> dead end (unknown
46
-	                              * type) or the index of the sub-type that
47
-	                              * follows (for types) or the  final type 
48
-	                              * (for sub-types)*/
58
+	unsigned char final;         /* says what mime type/subtype was detected
59
+	                              * if string ends at this node */
49 60
 	unsigned char nr_sons;       /* the number of sub-nodes */
50 61
 	int next;                    /* the next sibling node */
51 62
 }type_node_t;
52 63
 
53 64
 
65
+static type_node_t type_tree[] = {
66
+	{'t',TYPE_UNKNOWN,1,4},
67
+		{'e',TYPE_UNKNOWN,1,-1},
68
+			{'x',TYPE_UNKNOWN,1,-1},
69
+				{'t',TYPE_TEXT,0,-1},
70
+	{'m',TYPE_UNKNOWN,1,11},
71
+		{'e',TYPE_UNKNOWN,1,-1},
72
+			{'s',TYPE_UNKNOWN,1,-1},
73
+				{'s',TYPE_UNKNOWN,1,-1},
74
+					{'a',TYPE_UNKNOWN,1,-1},
75
+						{'g',TYPE_UNKNOWN,1,-1},
76
+							{'e',TYPE_MESSAGE,0,-1},
77
+	{'a',TYPE_UNKNOWN,1,-1},
78
+		{'p',TYPE_UNKNOWN,1,-1},
79
+			{'p',TYPE_UNKNOWN,1,-1},
80
+				{'l',TYPE_UNKNOWN,1,-1},
81
+					{'i',TYPE_UNKNOWN,1,-1},
82
+						{'c',TYPE_UNKNOWN,1,-1},
83
+							{'a',TYPE_UNKNOWN,1,-1},
84
+								{'t',TYPE_UNKNOWN,1,-1},
85
+									{'i',TYPE_UNKNOWN,1,-1},
86
+										{'o',TYPE_UNKNOWN,1,-1},
87
+											{'n',TYPE_APPLICATION,0,-1}
88
+	};
89
+
90
+static type_node_t subtype_tree[] = {
91
+		{'p',SUBTYPE_UNKNOWN,1,5},
92
+			{'l',SUBTYPE_UNKNOWN,1,-1},
93
+				{'a',SUBTYPE_UNKNOWN,1,-1},
94
+					{'i',SUBTYPE_UNKNOWN,1,-1},
95
+						{'n',SUBTYPE_PLAIN,0,-1},
96
+		{'c',SUBTYPE_UNKNOWN,1,10},
97
+			{'p',SUBTYPE_UNKNOWN,2,-1},
98
+				{'i',SUBTYPE_UNKNOWN,1,9},
99
+					{'m',SUBTYPE_CPIM,0,-1},
100
+				{'l',SUBTYPE_CPL,0,-1},
101
+		{'s',SUBTYPE_UNKNOWN,1,-1},
102
+			{'d',SUBTYPE_UNKNOWN,1,-1},
103
+				{'p',SUBTYPE_SDP,0,-1},
104
+	};
105
+
54 106
 
55 107
 
56 108
 char* parse_content_length( char* buffer, char* end, int* length)
... ...
@@ -96,51 +148,13 @@ error:
96 148
 
97 149
 
98 150
 
99
-
100
-
101
-int parse_content_type_hdr( struct sip_msg *msg )
151
+char* decode_mime_type(char *start, char *end, unsigned int *mime_type)
102 152
 {
103
-	static type_node_t type_tree[] = {
104
-		{'t',-1,1,4}, {'e',-1,1,-1}, {'x',-1,1,-1}, {'t',0,0,-1},
105
-		{'m',-1,1,11}, {'e',-1,1,-1}, {'s',-1,1,-1}, {'s',-1,1,-1},
106
-			{'a',-1,1,-1},{'g',-1,1,-1}, {'e',5,0,-1},
107
-		{'a',-1,1,-1}, {'p',-1,1,-1}, {'p',-1,1,-1}, {'l',-1,1,-1},
108
-			{'i',-1,1,-1},{'c',-1,1,-1},{'a',-1,1,-1},{'t',-1,1,-1},
109
-			{'i',-1,1,-1},{'o',-1,1,-1},{'n',9,0,-1}
110
-	};
111
-	static type_node_t subtype_tree[] = {
112
-		{'p',0,1,5}, {'l',0,1,-1}, {'a',0,1,-1}, {'i',0,1,-1},
113
-			{'n',CONTENT_TYPE_TEXT_PLAIN,0,-1},
114
-		{'c',0,1,9}, {'p',0,1,-1}, {'i',0,1,-1},
115
-			{'m',CONTENT_TYPE_MESSAGE_CPIM,0,-1},
116
-		{'s',0,1,-1}, {'d',0,1,-1},
117
-			{'p',CONTENT_TYPE_APPLICATION_SDP,0,-1},
118
-	};
119 153
 	int node;
120
-	long mime;
121 154
 	char *mark;
122
-	char *p, *end;
123
-
124
-	/* is the header already found? */
125
-	if ( msg->content_type==0 ) {
126
-		/* if not, found it */
127
-		if ( parse_headers(msg,HDR_CONTENTTYPE,0)==-1)
128
-			return -1;
129
-		if ( msg->content_type==0 ) {
130
-			LOG(L_ERR,"ERROR:parse_content_type_header: missing Content-Type"
131
-					"header\n");
132
-			return -1;
133
-		}
134
-	}
135
-
136
-	/* maybe the header is already parsed! */
137
-	if ( get_content_type(msg)!=CONTENT_TYPE_UNPARSED)
138
-		return get_content_type(msg);
155
+	char *p;
139 156
 
140
-	/* it seams we have to parse it! :-( */
141
-	p = msg->content_type->body.s;
142
-	end = p + msg->content_type->body.len;
143
-	mime = CONTENT_TYPE_UNKNOWN;
157
+	p = start;
144 158
 
145 159
 	/* search the begining of the type */
146 160
 	while ( p<end && (*p==' ' || *p=='\t' ||
... ...
@@ -150,20 +164,27 @@ int parse_content_type_hdr( struct sip_msg *msg )
150 164
 		goto error;
151 165
 
152 166
 	/* parse the type */
153
-	node = 0;
154
-	mark = p;
155
-	while (p<end && ((*p>='a' && *p<='z') || (*p>='A' && *p<='Z')) ) {
156
-		while ( node!=-1 && type_tree[node].c!=*p && type_tree[node].c+32!=*p){
157
-			node = type_tree[node].next;
158
-		}
159
-		if (node!=-1 && type_tree[node].nr_sons)
160
-			node++;
167
+	if (*p=='*') {
168
+		*mime_type = TYPE_ALL<<16;
161 169
 		p++;
170
+	} else {
171
+		node = 0;
172
+		mark = p;
173
+		while (p<end && is_mime_char(*p)  ) {
174
+			while ( node!=-1 && !is_char_equal(*p,type_tree[node].c) ){
175
+				node = type_tree[node].next;
176
+			}
177
+			if (node!=-1 && type_tree[node].nr_sons)
178
+				node++;
179
+			p++;
180
+		}
181
+		if (p==end || mark==p)
182
+			goto error;
183
+		if (node!=-1)
184
+			*mime_type = type_tree[node].final<<16;
185
+		else
186
+			*mime_type = TYPE_UNKNOWN<<16;
162 187
 	}
163
-	if (p==end || mark==p)
164
-		goto error;
165
-	if (node!=-1)
166
-		node = type_tree[node].final;
167 188
 
168 189
 	/* search the '/' separator */
169 190
 	while ( p<end && (*p==' ' || *p=='\t' ||
... ...
@@ -180,36 +201,175 @@ int parse_content_type_hdr( struct sip_msg *msg )
180 201
 		goto error;
181 202
 
182 203
 	/* parse the sub-type */
183
-	mark = p;
184
-	while (p<end && ((*p>='a' && *p<='z') || (*p>='A' && *p<='Z')) ) {
185
-		while(node!=-1&&subtype_tree[node].c!=*p&&subtype_tree[node].c+32!=*p)
186
-			node = subtype_tree[node].next;
187
-		if (node!=-1 && subtype_tree[node].nr_sons)
188
-			node++;
204
+	if (*p=='*') {
205
+		*mime_type |= SUBTYPE_ALL;
189 206
 		p++;
207
+	} else {
208
+		node = 0;
209
+		mark = p;
210
+		while (p<end && is_mime_char(*p) ) {
211
+			while(node!=-1 && !is_char_equal(*p,subtype_tree[node].c) )
212
+				node = subtype_tree[node].next;
213
+			if (node!=-1 && subtype_tree[node].nr_sons)
214
+				node++;
215
+			p++;
216
+		}
217
+		if (p==mark)
218
+			goto error;
219
+		if (node!=-1)
220
+			*mime_type |= subtype_tree[node].final;
221
+		else
222
+			*mime_type |= SUBTYPE_UNKNOWN;
190 223
 	}
191
-	if (p==mark)
192
-		goto error;
193
-	if (node!=-1)
194
-		mime = subtype_tree[node].final;
195 224
 
196 225
 	/* now its possible to have some spaces */
197 226
 	while ( p<end && (*p==' ' || *p=='\t' ||
198 227
 	(*p=='\n' && (*(p+1)==' '||*(p+1)=='\t')) ))
199 228
 		p++;
200 229
 
201
-	/* is this the end? if there are params, ignore them!! */
202
-	if ( *p!=';' && p!=end )
230
+	/* if there are params, ignore them!! -> eat everything to
231
+	 * the end or to the first ',' */
232
+	if ( p<end && *p==';' )
233
+		for(p++; p<end && *p!=','; p++);
234
+
235
+	/* is this the correct end? */
236
+	if (p!=end && *p!=',' )
237
+		goto error;
238
+
239
+	/* check the format of the decoded mime */
240
+	if ((*mime_type)>>16==TYPE_ALL && ((*mime_type)&0x00ff)!=SUBTYPE_ALL) {
241
+		LOG(L_ERR,"ERROR:decode_mine_type: invalid mime format found "
242
+			" <*/submime> in [%.*s]!!\n", end-start,start);
243
+		return 0;
244
+	}
245
+
246
+	return p;
247
+error:
248
+	LOG(L_ERR,"ERROR:decode_mine_type: parse error near in [%.*s] char"
249
+		"[%d][%c] offset=%d\n", end-start,start,*p,*p,(int)(p-start));
250
+	return 0;
251
+}
252
+
253
+
254
+
255
+/* returns: > 0 mime found
256
+ *          = 0 hdr not found
257
+ *          =-1 error */
258
+int parse_content_type_hdr( struct sip_msg *msg )
259
+{
260
+	char *end;
261
+	char *ret;
262
+	int  mime;
263
+
264
+	/* is the header already found? */
265
+	if ( msg->content_type==0 ) {
266
+		/* if not, found it */
267
+		if ( parse_headers(msg,HDR_CONTENTTYPE,0)==-1)
268
+			goto error;
269
+		if ( msg->content_type==0 ) {
270
+			DBG("DEBUG:parse_content_type_hdr: missing Content-Type"
271
+				"header\n");
272
+			return 0;
273
+		}
274
+	}
275
+
276
+	/* maybe the header is already parsed! */
277
+	if ( msg->content_type->parsed!=0)
278
+		return get_content_type(msg);
279
+
280
+	/* it seams we have to parse it! :-( */
281
+	end = msg->content_type->body.s + msg->content_type->body.len;
282
+	ret = decode_mime_type(msg->content_type->body.s, end , &mime);
283
+	if (ret==0)
203 284
 		goto error;
285
+	if (ret!=end) {
286
+		LOG(L_ERR,"ERROR:parse_content_type_hdr: CONTENT_TYPE hdr containes "
287
+			"more then one mime type :-(!\n");
288
+		goto error;
289
+	}
290
+	if ((mime&0x00ff)==SUBTYPE_ALL || (mime>>16)==TYPE_ALL) {
291
+		LOG(L_ERR,"ERROR:parse_content_type_hdr: invalid mime with wildcard "
292
+			"'*' in Content-Type hdr!\n");
293
+		goto error;
294
+	}
204 295
 
205
-	mime = ((mime==-1)?CONTENT_TYPE_UNKNOWN:mime);
206 296
 	msg->content_type->parsed = (void*)mime;
207 297
 	return mime;
298
+
208 299
 error:
209
-	LOG(L_ERR,"ERROR:parse_content_type: parse error near char [%d][%c] "
210
-		"offset=%d\n",*p,*p,(int)(p-msg->content_type->body.s));
211 300
 	return -1;
212 301
 }
213 302
 
214 303
 
215 304
 
305
+/* returns: > 0 ok
306
+ *          = 0 hdr not found
307
+ *          = -1 error */
308
+int parse_accept_hdr( struct sip_msg *msg )
309
+{
310
+	static int mimes[MAX_MIMES_NR];
311
+	int nr_mimes;
312
+	int mime;
313
+	char *end;
314
+	char *ret;
315
+
316
+	/* is the header already found? */
317
+	if ( msg->accept==0 ) {
318
+		/* if not, found it */
319
+		if ( parse_headers(msg,HDR_ACCEPT,0)==-1)
320
+			goto error;
321
+		if ( msg->accept==0 ) {
322
+			DBG("DEBUG:parse_accept_hdr: missing Accept header\n");
323
+			return 0;
324
+		}
325
+	}
326
+
327
+	/* maybe the header is already parsed! */
328
+	if ( msg->accept->parsed!=0)
329
+		return 1;
330
+
331
+	/* it seams we have to parse it! :-( */
332
+	ret = msg->accept->body.s;
333
+	end = ret + msg->accept->body.len;
334
+	nr_mimes = 0;
335
+	while (1){
336
+		ret = decode_mime_type(ret, end , &mime);
337
+		if (ret==0)
338
+			goto error;
339
+		/* a new mime was found  -> put it into array */
340
+		if (nr_mimes==MAX_MIMES_NR) {
341
+			LOG(L_ERR,"ERROR:parse_accept_hdr: Accept hdr contains more than"
342
+				" %d mime type -> buffer ovrflow!!\n",MAX_MIMES_NR);
343
+			goto error;
344
+		}
345
+		mimes[nr_mimes++] = mime;
346
+		/* is another mime following? */
347
+		if (ret==end )
348
+			break;
349
+		/* parse the mime separator ',' */
350
+		if (*ret!=',' || ret+1==end) {
351
+			LOG(L_ERR,"ERROR:parse_accept_hdr: parse error between mimes at "
352
+				"char <%x> (offset=%d) in <%.*s>!\n",
353
+				*ret,ret-msg->accept->body.s,
354
+				msg->accept->body.len,msg->accept->body.s);
355
+			goto error;
356
+		}
357
+		/* skip the ',' */
358
+		ret++;
359
+	}
360
+
361
+	/* copy and link the mime buffer into the message */
362
+	msg->accept->parsed = (void*)pkg_malloc((nr_mimes+1)*sizeof(int));
363
+	if (msg->accept->parsed==0) {
364
+		LOG(L_ERR,"ERROR:parse_accept_hdr: no more pkg memory\n");
365
+		goto error;
366
+	}
367
+	memcpy(msg->accept->parsed,mimes,nr_mimes*sizeof(int));
368
+	/* make the buffer null terminated */
369
+	((int*)msg->accept->parsed)[nr_mimes] = 0;
370
+
371
+	return 1;
372
+error:
373
+	return -1;
374
+}
375
+
... ...
@@ -31,16 +31,35 @@
31 31
 
32 32
 #include "msg_parser.h"
33 33
 
34
+
35
+struct mime_type {
36
+	unsigned short type;
37
+	unsigned short subtype;
38
+};
39
+
40
+
41
+
34 42
 /*
35
- * Types for Content-Type header that are recognize
43
+ * Mimes types/subtypes that are recognize
36 44
  */
37
-#define CONTENT_TYPE_UNPARSED        0
38
-#define CONTENT_TYPE_TEXT_PLAIN      1
39
-#define CONTENT_TYPE_MESSAGE_CPIM    2
40
-#define CONTENT_TYPE_APPLICATION_SDP 3
41
-#define CONTENT_TYPE_UNKNOWN         0x7fff
45
+#define TYPE_TEXT            1
46
+#define TYPE_MESSAGE         2
47
+#define TYPE_APPLICATION     3
48
+#define TYPE_ALL             0xfe
49
+#define TYPE_UNKNOWN         0xff
50
+
51
+#define SUBTYPE_PLAIN        1
52
+#define SUBTYPE_CPIM         2
53
+#define SUBTYPE_SDP          3
54
+#define SUBTYPE_CPL          4
55
+#define SUBTYPE_ALL          0xfe
56
+#define SUBTYPE_UNKNOWN      0xff
42 57
 
43 58
 
59
+/*
60
+ * Maximum number of mimes allowed in Accept header 
61
+ */
62
+#define MAX_MIMES_NR         128
44 63
 
45 64
 /*
46 65
  * returns the content-length value of a sip_msg as an integer
... ...
@@ -54,15 +73,30 @@
54 73
 #define get_content_type(_msg_)   ((int)(long)((_msg_)->content_type->parsed))
55 74
 
56 75
 
76
+/*
77
+ * returns the accept values of a sip_msg as an null-terminated array
78
+ * of integer
79
+ */
80
+#define get_accept(_msg_) ((int*)((_msg_)->accept->parsed))
57 81
 
58 82
 /*
59 83
  * parse the the body of the Content-Type header. It's value is also converted
60 84
  * as int.
61 85
  * Returns:   n (n>0)  : the found type
62
- *           -1        : error (parse error or hdr not found)
86
+ *            0        : hdr not found
87
+ *           -1        : error (parse error )
63 88
  */
64 89
 int parse_content_type_hdr( struct sip_msg *msg);
65 90
 
91
+/*
92
+ * parse the the body of the Accept header. It's values are also converted
93
+ * as an null-terminated array of ints.
94
+ * Returns:   1 : OK
95
+ *            0 : hdr not found
96
+ *           -1 : error (parse error)
97
+ */
98
+int parse_accept_hdr( struct sip_msg *msg );
99
+
66 100
 
67 101
 /*
68 102
  *  parse the body of a Content_-Length header. Also tryes to recognize the
... ...
@@ -65,7 +65,8 @@ 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 */
68
+#include "case_cont.h"     /* Contact, Content-Type, Content-Length, Content-Purpose, 
69
+			    * Content-Action, Content-Disposition */
69 70
 #include "case_rout.h"     /* Route */
70 71
 #include "case_max.h"      /* Max-Forwards */
71 72
 #include "case_reco.h"     /* Record-Route */
... ...
@@ -74,11 +75,13 @@ static inline char* skip_ws(char* p, unsigned int size)
74 75
 #include "case_prox.h"     /* Proxy-Authorization, Proxy-Require */
75 76
 #include "case_allo.h"     /* Allow */
76 77
 #include "case_unsu.h"     /* Unsupported */
77
-#include "case_requ.h"     /* Require */
78
-#include "case_supp.h"     /* Supported */
79
-#include "case_www.h"      /* WWW-Authenticate */
80 78
 #include "case_even.h"     /* Event */
81
-#include "case_acce.h"     /* Accept */
79
+#include "case_acce.h"     /* Accept, Accept-Language */
80
+#include "case_orga.h"     /* Organization */
81
+#include "case_prio.h"     /* Priority */
82
+#include "case_subj.h"     /* Subject */
83
+#include "case_user.h"     /* User-Agent */
84
+#include "case_supp.h"     /* Supported */
82 85
 
83 86
 
84 87
 #define READ(val) \
... ...
@@ -97,15 +100,17 @@ static inline char* skip_ws(char* p, unsigned int size)
97 100
 	case _reco_: reco_CASE; \
98 101
 	case _via2_: via2_CASE; \
99 102
 	case _auth_: auth_CASE; \
103
+	case _supp_: supp_CASE; \
100 104
 	case _expi_: expi_CASE; \
101 105
 	case _prox_: prox_CASE; \
102 106
 	case _allo_: allo_CASE; \
103 107
 	case _unsu_: unsu_CASE; \
104
-	case _requ_: requ_CASE; \
105
-	case _supp_: supp_CASE; \
106
-        case _www__: www_CASE;  \
107 108
         case _even_: even_CASE; \
108
-        case _acce_: acce_CASE;
109
+        case _acce_: acce_CASE; \
110
+        case _orga_: orga_CASE; \
111
+        case _prio_: prio_CASE; \
112
+        case _subj_: subj_CASE; \
113
+        case _user_: user_CASE;
109 114
 
110 115
 
111 116
 #define PARSE_COMPACT(id)          \
... ...
@@ -162,8 +167,8 @@ char* parse_hname2(char* begin, char* end, struct hdr_field* hdr)
162 167
 		case 'i': PARSE_COMPACT(HDR_CALLID);        break;
163 168
 		case 'm': PARSE_COMPACT(HDR_CONTACT);       break;
164 169
 		case 'l': PARSE_COMPACT(HDR_CONTENTLENGTH); break;
165
-		case 'c': PARSE_COMPACT(HDR_CONTENTTYPE);   break;
166 170
 		case 'k': PARSE_COMPACT(HDR_SUPPORTED);     break;
171
+		case 'c': PARSE_COMPACT(HDR_CONTENTTYPE);   break;
167 172
 		case 'o': PARSE_COMPACT(HDR_EVENT);         break;
168 173
 		}
169 174
 		goto other;