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 56
         }
57 57
 
58 58
 
59
-#define LENG_TYPE_CASE                       \
60
-        switch(LOWER_DWORD(val)) {            \
59
+#define PURP_CASE                               \
60
+        switch(LOWER_DWORD(val)) {              \
61
+        case _ose1_:                            \
62
+	        hdr->type = HDR_CONTENTPURPOSE; \
63
+	        hdr->name.len = 15;             \
64
+	        return (p + 4);                 \
65
+                                                \
66
+        case _ose2_:                            \
67
+                hdr->type = HDR_CONTENTPURPOSE; \
68
+                p += 4;                         \
69
+	        goto dc_end;                    \
70
+        }
71
+
72
+
73
+#define ACTION_CASE                                \
74
+    p += 4;                                        \
75
+    if (LOWER_BYTE(*p) == 'o') {                   \
76
+            p++;                                   \
77
+            if (LOWER_BYTE(*p) == 'n') {           \
78
+                    hdr->type = HDR_CONTENTACTION; \
79
+                    p++;                           \
80
+                    goto dc_end;                   \
81
+            }                                      \
82
+    }                                              \
83
+    goto other;
84
+
85
+
86
+#define ion_CASE                                    \
87
+        switch(LOWER_DWORD(val)) {                  \
88
+        case _ion1_:                                \
89
+	        hdr->type = HDR_CONTENTDISPOSITION; \
90
+	        hdr->name.len = 19;                 \
91
+	        return (p + 4);                     \
92
+                                                    \
93
+        case _ion2_:                                \
94
+                hdr->type = HDR_CONTENTDISPOSITION; \
95
+                p += 4;                             \
96
+	        goto dc_end;                        \
97
+        }
98
+
99
+
100
+#define DISPOSITION_CASE           \
101
+        switch(LOWER_DWORD(val)) { \
102
+        case _osit_:               \
103
+		p += 4;            \
104
+		val = READ(p);     \
105
+		ion_CASE;          \
106
+		goto other;        \
107
+	}
108
+
109
+
110
+#define CONTENT_CASE                         \
111
+        switch(LOWER_DWORD(val)) {           \
61 112
         case _leng_:                         \
62 113
                 p += 4;                      \
63 114
                 val = READ(p);               \
... ...
@@ -68,6 +120,24 @@
68 68
                 hdr->type = HDR_CONTENTTYPE; \
69 69
                 p += 4;                      \
70 70
                 goto dc_end;                 \
71
+                                             \
72
+        case _purp_:                         \
73
+		p += 4;                      \
74
+		val = READ(p);               \
75
+		PURP_CASE;                   \
76
+		goto other;                  \
77
+                                             \
78
+        case _acti_:                         \
79
+                p += 4;                      \
80
+                val = READ(p);               \
81
+                ACTION_CASE;                 \
82
+                goto other;                  \
83
+                                             \
84
+        case _disp_:                         \
85
+                p += 4;                      \
86
+		val = READ(p);               \
87
+		DISPOSITION_CASE;            \
88
+                goto other;                  \
71 89
         }
72 90
 
73 91
 
... ...
@@ -86,7 +156,7 @@
86 86
         case _ent__:                     \
87 87
                 p += 4;                  \
88 88
                 val = READ(p);           \
89
-                LENG_TYPE_CASE;          \
89
+                CONTENT_CASE;            \
90 90
                 goto other;              \
91 91
         }                         
92 92
 
93 93
new file mode 100644
... ...
@@ -0,0 +1,60 @@
0
+/* 
1
+ * $Id$ 
2
+ *
3
+ * Organization Header Field Name Parsing Macros
4
+ *
5
+ * Copyright (C) 2001-2003 Fhg Fokus
6
+ *
7
+ * This file is part of ser, a free SIP server.
8
+ *
9
+ * ser is free software; you can redistribute it and/or modify
10
+ * it under the terms of the GNU General Public License as published by
11
+ * the Free Software Foundation; either version 2 of the License, or
12
+ * (at your option) any later version
13
+ *
14
+ * For a license to use the ser software under conditions
15
+ * other than those described here, or to purchase support for this
16
+ * software, please contact iptel.org by e-mail at the following addresses:
17
+ *    info@iptel.org
18
+ *
19
+ * ser is distributed in the hope that it will be useful,
20
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
21
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22
+ * GNU General Public License for more details.
23
+ *
24
+ * You should have received a copy of the GNU General Public License 
25
+ * along with this program; if not, write to the Free Software 
26
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
27
+ */
28
+
29
+
30
+#ifndef CASE_ORGA_H
31
+#define CASE_ORGA_H
32
+
33
+
34
+#define tion_CASE                             \
35
+        if (LOWER_DWORD(val) == _tion_) {     \
36
+	        hdr->type = HDR_ORGANIZATION; \
37
+		p += 4;                       \
38
+		goto dc_end;                  \
39
+	}                                     \
40
+
41
+
42
+#define niza_CASE                  \
43
+        switch(LOWER_DWORD(val)) { \
44
+        case _niza_:               \
45
+	        p += 4;            \
46
+	        val = READ(p);     \
47
+		tion_CASE;         \
48
+	        goto other;        \
49
+        }
50
+
51
+
52
+#define orga_CASE         \
53
+        p += 4;           \
54
+        val = READ(p);    \
55
+        niza_CASE;        \
56
+        goto other;
57
+
58
+
59
+#endif /* CASE_ORGA_H */
0 60
new file mode 100644
... ...
@@ -0,0 +1,50 @@
0
+/* 
1
+ * $Id$ 
2
+ *
3
+ * Priority Header Field Name Parsing Macros
4
+ *
5
+ * Copyright (C) 2001-2003 Fhg Fokus
6
+ *
7
+ * This file is part of ser, a free SIP server.
8
+ *
9
+ * ser is free software; you can redistribute it and/or modify
10
+ * it under the terms of the GNU General Public License as published by
11
+ * the Free Software Foundation; either version 2 of the License, or
12
+ * (at your option) any later version
13
+ *
14
+ * For a license to use the ser software under conditions
15
+ * other than those described here, or to purchase support for this
16
+ * software, please contact iptel.org by e-mail at the following addresses:
17
+ *    info@iptel.org
18
+ *
19
+ * ser is distributed in the hope that it will be useful,
20
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
21
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22
+ * GNU General Public License for more details.
23
+ *
24
+ * You should have received a copy of the GNU General Public License 
25
+ * along with this program; if not, write to the Free Software 
26
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
27
+ */
28
+
29
+
30
+#ifndef CASE_PRIO_H
31
+#define CASE_PRIO_H
32
+
33
+
34
+#define rity_CASE                             \
35
+        if (LOWER_DWORD(val) == _rity_) {     \
36
+	        hdr->type = HDR_PRIORITY;     \
37
+		p += 4;                       \
38
+		goto dc_end;                  \
39
+	}                                     \
40
+
41
+
42
+#define prio_CASE         \
43
+        p += 4;           \
44
+        val = READ(p);    \
45
+        rity_CASE;        \
46
+        goto other;
47
+
48
+
49
+#endif /* CASE_PRIO_H */
0 50
new file mode 100644
... ...
@@ -0,0 +1,56 @@
0
+/* 
1
+ * $Id$ 
2
+ *
3
+ * Subject Header Field Name Parsing Macros
4
+ *
5
+ * Copyright (C) 2001-2003 Fhg Fokus
6
+ *
7
+ * This file is part of ser, a free SIP server.
8
+ *
9
+ * ser is free software; you can redistribute it and/or modify
10
+ * it under the terms of the GNU General Public License as published by
11
+ * the Free Software Foundation; either version 2 of the License, or
12
+ * (at your option) any later version
13
+ *
14
+ * For a license to use the ser software under conditions
15
+ * other than those described here, or to purchase support for this
16
+ * software, please contact iptel.org by e-mail at the following addresses:
17
+ *    info@iptel.org
18
+ *
19
+ * ser is distributed in the hope that it will be useful,
20
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
21
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22
+ * GNU General Public License for more details.
23
+ *
24
+ * You should have received a copy of the GNU General Public License 
25
+ * along with this program; if not, write to the Free Software 
26
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
27
+ */
28
+
29
+
30
+#ifndef CASE_SUBJ_H
31
+#define CASE_SUBJ_H
32
+
33
+
34
+#define ect_CASE                         \
35
+        switch(LOWER_DWORD(val)) {       \
36
+        case _ect1_:                     \
37
+	        hdr->type = HDR_SUBJECT; \
38
+	        hdr->name.len = 7;       \
39
+	        return (p + 4);          \
40
+                                         \
41
+        case _ect2_:                     \
42
+                hdr->type = HDR_SUBJECT; \
43
+                p += 4;                  \
44
+	        goto dc_end;             \
45
+        }
46
+
47
+
48
+#define subj_CASE        \
49
+        p += 4;          \
50
+        val = READ(p);   \
51
+        ect_CASE;        \
52
+        goto other;
53
+
54
+
55
+#endif /* CASE_SUBJ_H */
0 56
new file mode 100644
... ...
@@ -0,0 +1,57 @@
0
+/* 
1
+ * $Id$ 
2
+ *
3
+ * User-Agent Header Field Name Parsing Macros
4
+ *
5
+ * Copyright (C) 2001-2003 Fhg Fokus
6
+ *
7
+ * This file is part of ser, a free SIP server.
8
+ *
9
+ * ser is free software; you can redistribute it and/or modify
10
+ * it under the terms of the GNU General Public License as published by
11
+ * the Free Software Foundation; either version 2 of the License, or
12
+ * (at your option) any later version
13
+ *
14
+ * For a license to use the ser software under conditions
15
+ * other than those described here, or to purchase support for this
16
+ * software, please contact iptel.org by e-mail at the following addresses:
17
+ *    info@iptel.org
18
+ *
19
+ * ser is distributed in the hope that it will be useful,
20
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
21
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22
+ * GNU General Public License for more details.
23
+ *
24
+ * You should have received a copy of the GNU General Public License 
25
+ * along with this program; if not, write to the Free Software 
26
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
27
+ */
28
+
29
+#ifndef CASE_USER_H
30
+#define CASE_USER_H
31
+
32
+
33
+#define nt_CASE                                \
34
+    if (LOWER_BYTE(*p) == 'n') {               \
35
+            p++;                               \
36
+            if (LOWER_BYTE(*p) == 't') {       \
37
+                    hdr->type = HDR_USERAGENT; \
38
+                    p++;                       \
39
+                    goto dc_end;               \
40
+            }                                  \
41
+    }                                          \
42
+    goto other;
43
+
44
+
45
+#define user_CASE              \
46
+    p += 4;                    \
47
+    val = READ(p);             \
48
+    switch(LOWER_DWORD(val)) { \
49
+    case __age_:               \
50
+	p += 4;                \
51
+	nt_CASE;               \
52
+    }                          \
53
+    goto other;
54
+
55
+
56
+#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 96
 		case HDR_CONTENTTYPE:
97 97
 			break;
98 98
 
99
+		case HDR_ACCEPT:
100
+			pkg_free(hf->parsed);
101
+			break;
102
+
99 103
 		default:
100 104
 			LOG(L_CRIT, "BUG: clean_hdr_field: unknown header type %d\n",
101 105
 			    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 86
 #define _cate_ 0x65746163   /* "cate" */
87 87
 #define _even_ 0x6e657665   /* "even" */
88 88
 
89
+#define _pt_l_ 0x6c2d7470   /* "pt-l" */
90
+#define _angu_ 0x75676e61   /* "angu" */
91
+#define _age2_ 0x20656761   /* "age " */
92
+#define _age1_ 0x3a656761   /* "age:" */
93
+#define _orga_ 0x6167726f   /* "orga" */
94
+#define _niza_ 0x617a696e   /* "niza" */
95
+#define _tion_ 0x6e6f6974   /* "tion" */
96
+#define _prio_ 0x6f697270   /* "prio" */
97
+#define _rity_ 0x79746972   /* "rity" */
98
+#define _subj_ 0x6a627573   /* "subj" */
99
+#define _ect2_ 0x20746365   /* "ect " */
100
+#define _ect1_ 0x3a746365   /* "ect:" */
101
+#define _user_ 0x72657375   /* "user" */
102
+#define __age_ 0x6567612d   /* "-age" */
103
+#define _purp_ 0x70727570   /* "purp" */
104
+#define _ose2_ 0x2065736f   /* "ose " */
105
+#define _ose1_ 0x3a65736f   /* "ose:" */
106
+#define _acti_ 0x69746361   /* "acti" */
107
+#define _disp_ 0x70736964   /* "disp" */
108
+#define _osit_ 0x7469736f   /* "osit" */
109
+#define _ion2_ 0x206e6f69   /* "ion " */
110
+#define _ion1_ 0x3a6e6f69   /* "ion:" */
111
+
89 112
 #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 189
 		case HDR_AUTHORIZATION:
190 190
 		case HDR_EXPIRES:
191 191
 		case HDR_PROXYAUTH:
192
-		case HDR_WWWAUTH:
193
-		case HDR_SUPPORTED:
194
-		case HDR_REQUIRE:
195 192
 		case HDR_PROXYREQUIRE:
196 193
 		case HDR_UNSUPPORTED:
197 194
 		case HDR_ALLOW:
198 195
 		case HDR_EVENT:
199 196
 	        case HDR_ACCEPT:
197
+	        case HDR_ACCEPTLANGUAGE:
198
+	        case HDR_ORGANIZATION:
199
+	        case HDR_PRIORITY:
200
+	        case HDR_SUBJECT:
201
+	        case HDR_USERAGENT:
202
+	        case HDR_CONTENTPURPOSE:
203
+	        case HDR_CONTENTACTION:
204
+	        case HDR_CONTENTDISPOSITION:
200 205
 		case HDR_OTHER:
201 206
 			/* just skip over it */
202 207
 			hdr->body.s=tmp;
... ...
@@ -340,22 +346,14 @@ int parse_headers(struct sip_msg* msg, int flags, int next)
340 340
 				if (msg->proxy_auth==0) msg->proxy_auth = hf;
341 341
 				msg->parsed_flag|=HDR_PROXYAUTH;
342 342
 				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:
343
+		        case HDR_PROXYREQUIRE:
356 344
 				if (msg->proxy_require==0) msg->proxy_require = hf;
357 345
 				msg->parsed_flag|=HDR_PROXYREQUIRE;
358 346
 				break;
347
+	                case HDR_SUPPORTED:
348
+				if (msg->supported==0) msg->supported=hf;
349
+				msg->parsed_flag|=HDR_SUPPORTED;
350
+				break;
359 351
 			case HDR_UNSUPPORTED:
360 352
 				if (msg->unsupported==0) msg->unsupported=hf;
361 353
 				msg->parsed_flag|=HDR_UNSUPPORTED;
... ...
@@ -372,6 +370,38 @@ int parse_headers(struct sip_msg* msg, int flags, int next)
372 372
 				if (msg->accept==0) msg->accept = hf;
373 373
 				msg->parsed_flag|=HDR_ACCEPT;
374 374
 				break;
375
+		        case HDR_ACCEPTLANGUAGE:
376
+				if (msg->accept_language==0) msg->accept_language = hf;
377
+				msg->parsed_flag|=HDR_ACCEPTLANGUAGE;
378
+				break;
379
+		        case HDR_ORGANIZATION:
380
+				if (msg->organization==0) msg->organization = hf;
381
+				msg->parsed_flag|=HDR_ORGANIZATION;
382
+				break;
383
+		        case HDR_PRIORITY:
384
+				if (msg->priority==0) msg->priority = hf;
385
+				msg->parsed_flag|=HDR_PRIORITY;
386
+				break;
387
+		        case HDR_SUBJECT:
388
+				if (msg->subject==0) msg->subject = hf;
389
+				msg->parsed_flag|=HDR_SUBJECT;
390
+				break;
391
+		        case HDR_USERAGENT:
392
+				if (msg->user_agent==0) msg->user_agent = hf;
393
+				msg->parsed_flag|=HDR_USERAGENT;
394
+				break;
395
+		        case HDR_CONTENTPURPOSE:
396
+				if (msg->content_purpose==0) msg->content_purpose = hf;
397
+				msg->parsed_flag|=HDR_CONTENTPURPOSE;
398
+				break;
399
+		        case HDR_CONTENTACTION:
400
+				if (msg->content_action==0) msg->content_action = hf;
401
+				msg->parsed_flag|=HDR_CONTENTACTION;
402
+				break;
403
+		        case HDR_CONTENTDISPOSITION:
404
+				if (msg->content_disposition==0) msg->content_disposition = hf;
405
+				msg->parsed_flag|=HDR_CONTENTDISPOSITION;
406
+				break;
375 407
 			case HDR_VIA:
376 408
 				msg->parsed_flag|=HDR_VIA;
377 409
 				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 31
 #include <stdlib.h>
32 32
 #include <sys/types.h>
33 33
 #include <unistd.h>
34
+#include "../mem/mem.h"
34 35
 #include "../dprint.h"
35 36
 #include "../str.h"
36 37
 #include "../ut.h"
37 38
 #include "parse_content.h"
38 39
 
40
+
41
+#define is_mime_char(_c_) \
42
+	(isalpha(_c_) || (_c_)=='-' || (_c_)=='+')
43
+#define is_char_equal(_c_,_cs_) \
44
+	( (isalpha(_c_)?(((_c_)|0x20)==(_cs_)):((_c_)==(_cs_)))==1 )
45
+
46
+
39 47
 /*
40 48
  * Node of the type's tree; this tree contains all the known types;
41 49
  */
42 50
 typedef struct type_node_s {
43 51
 	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)*/
52
+	unsigned char final;         /* says what mime type/subtype was detected
53
+	                              * if string ends at this node */
49 54
 	unsigned char nr_sons;       /* the number of sub-nodes */
50 55
 	int next;                    /* the next sibling node */
51 56
 }type_node_t;
52 57
 
53 58
 
59
+static type_node_t type_tree[] = {
60
+	{'t',TYPE_UNKNOWN,1,4},
61
+		{'e',TYPE_UNKNOWN,1,-1},
62
+			{'x',TYPE_UNKNOWN,1,-1},
63
+				{'t',TYPE_TEXT,0,-1},
64
+	{'m',TYPE_UNKNOWN,1,11},
65
+		{'e',TYPE_UNKNOWN,1,-1},
66
+			{'s',TYPE_UNKNOWN,1,-1},
67
+				{'s',TYPE_UNKNOWN,1,-1},
68
+					{'a',TYPE_UNKNOWN,1,-1},
69
+						{'g',TYPE_UNKNOWN,1,-1},
70
+							{'e',TYPE_MESSAGE,0,-1},
71
+	{'a',TYPE_UNKNOWN,1,-1},
72
+		{'p',TYPE_UNKNOWN,1,-1},
73
+			{'p',TYPE_UNKNOWN,1,-1},
74
+				{'l',TYPE_UNKNOWN,1,-1},
75
+					{'i',TYPE_UNKNOWN,1,-1},
76
+						{'c',TYPE_UNKNOWN,1,-1},
77
+							{'a',TYPE_UNKNOWN,1,-1},
78
+								{'t',TYPE_UNKNOWN,1,-1},
79
+									{'i',TYPE_UNKNOWN,1,-1},
80
+										{'o',TYPE_UNKNOWN,1,-1},
81
+											{'n',TYPE_APPLICATION,0,-1}
82
+	};
83
+
84
+static type_node_t subtype_tree[] = {
85
+		{'p',SUBTYPE_UNKNOWN,1,5},
86
+			{'l',SUBTYPE_UNKNOWN,1,-1},
87
+				{'a',SUBTYPE_UNKNOWN,1,-1},
88
+					{'i',SUBTYPE_UNKNOWN,1,-1},
89
+						{'n',SUBTYPE_PLAIN,0,-1},
90
+		{'c',SUBTYPE_UNKNOWN,1,10},
91
+			{'p',SUBTYPE_UNKNOWN,2,-1},
92
+				{'i',SUBTYPE_UNKNOWN,1,9},
93
+					{'m',SUBTYPE_CPIM,0,-1},
94
+				{'l',SUBTYPE_CPL,0,-1},
95
+		{'s',SUBTYPE_UNKNOWN,1,-1},
96
+			{'d',SUBTYPE_UNKNOWN,1,-1},
97
+				{'p',SUBTYPE_SDP,0,-1},
98
+	};
99
+
54 100
 
55 101
 
56 102
 char* parse_content_length( char* buffer, char* end, int* length)
... ...
@@ -96,51 +148,13 @@ error:
96 96
 
97 97
 
98 98
 
99
-
100
-
101
-int parse_content_type_hdr( struct sip_msg *msg )
99
+char* decode_mime_type(char *start, char *end, unsigned int *mime_type)
102 100
 {
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 101
 	int node;
120
-	long mime;
121 102
 	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);
103
+	char *p;
139 104
 
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;
105
+	p = start;
144 106
 
145 107
 	/* search the begining of the type */
146 108
 	while ( p<end && (*p==' ' || *p=='\t' ||
... ...
@@ -150,20 +164,27 @@ int parse_content_type_hdr( struct sip_msg *msg )
150 150
 		goto error;
151 151
 
152 152
 	/* 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++;
153
+	if (*p=='*') {
154
+		*mime_type = TYPE_ALL<<16;
161 155
 		p++;
156
+	} else {
157
+		node = 0;
158
+		mark = p;
159
+		while (p<end && is_mime_char(*p)  ) {
160
+			while ( node!=-1 && !is_char_equal(*p,type_tree[node].c) ){
161
+				node = type_tree[node].next;
162
+			}
163
+			if (node!=-1 && type_tree[node].nr_sons)
164
+				node++;
165
+			p++;
166
+		}
167
+		if (p==end || mark==p)
168
+			goto error;
169
+		if (node!=-1)
170
+			*mime_type = type_tree[node].final<<16;
171
+		else
172
+			*mime_type = TYPE_UNKNOWN<<16;
162 173
 	}
163
-	if (p==end || mark==p)
164
-		goto error;
165
-	if (node!=-1)
166
-		node = type_tree[node].final;
167 174
 
168 175
 	/* search the '/' separator */
169 176
 	while ( p<end && (*p==' ' || *p=='\t' ||
... ...
@@ -180,36 +201,175 @@ int parse_content_type_hdr( struct sip_msg *msg )
180 180
 		goto error;
181 181
 
182 182
 	/* 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++;
183
+	if (*p=='*') {
184
+		*mime_type |= SUBTYPE_ALL;
189 185
 		p++;
186
+	} else {
187
+		node = 0;
188
+		mark = p;
189
+		while (p<end && is_mime_char(*p) ) {
190
+			while(node!=-1 && !is_char_equal(*p,subtype_tree[node].c) )
191
+				node = subtype_tree[node].next;
192
+			if (node!=-1 && subtype_tree[node].nr_sons)
193
+				node++;
194
+			p++;
195
+		}
196
+		if (p==mark)
197
+			goto error;
198
+		if (node!=-1)
199
+			*mime_type |= subtype_tree[node].final;
200
+		else
201
+			*mime_type |= SUBTYPE_UNKNOWN;
190 202
 	}
191
-	if (p==mark)
192
-		goto error;
193
-	if (node!=-1)
194
-		mime = subtype_tree[node].final;
195 203
 
196 204
 	/* now its possible to have some spaces */
197 205
 	while ( p<end && (*p==' ' || *p=='\t' ||
198 206
 	(*p=='\n' && (*(p+1)==' '||*(p+1)=='\t')) ))
199 207
 		p++;
200 208
 
201
-	/* is this the end? if there are params, ignore them!! */
202
-	if ( *p!=';' && p!=end )
209
+	/* if there are params, ignore them!! -> eat everything to
210
+	 * the end or to the first ',' */
211
+	if ( p<end && *p==';' )
212
+		for(p++; p<end && *p!=','; p++);
213
+
214
+	/* is this the correct end? */
215
+	if (p!=end && *p!=',' )
216
+		goto error;
217
+
218
+	/* check the format of the decoded mime */
219
+	if ((*mime_type)>>16==TYPE_ALL && ((*mime_type)&0x00ff)!=SUBTYPE_ALL) {
220
+		LOG(L_ERR,"ERROR:decode_mine_type: invalid mime format found "
221
+			" <*/submime> in [%.*s]!!\n", end-start,start);
222
+		return 0;
223
+	}
224
+
225
+	return p;
226
+error:
227
+	LOG(L_ERR,"ERROR:decode_mine_type: parse error near in [%.*s] char"
228
+		"[%d][%c] offset=%d\n", end-start,start,*p,*p,(int)(p-start));
229
+	return 0;
230
+}
231
+
232
+
233
+
234
+/* returns: > 0 mime found
235
+ *          = 0 hdr not found
236
+ *          =-1 error */
237
+int parse_content_type_hdr( struct sip_msg *msg )
238
+{
239
+	char *end;
240
+	char *ret;
241
+	int  mime;
242
+
243
+	/* is the header already found? */
244
+	if ( msg->content_type==0 ) {
245
+		/* if not, found it */
246
+		if ( parse_headers(msg,HDR_CONTENTTYPE,0)==-1)
247
+			goto error;
248
+		if ( msg->content_type==0 ) {
249
+			DBG("DEBUG:parse_content_type_hdr: missing Content-Type"
250
+				"header\n");
251
+			return 0;
252
+		}
253
+	}
254
+
255
+	/* maybe the header is already parsed! */
256
+	if ( msg->content_type->parsed!=0)
257
+		return get_content_type(msg);
258
+
259
+	/* it seams we have to parse it! :-( */
260
+	end = msg->content_type->body.s + msg->content_type->body.len;
261
+	ret = decode_mime_type(msg->content_type->body.s, end , &mime);
262
+	if (ret==0)
203 263
 		goto error;
264
+	if (ret!=end) {
265
+		LOG(L_ERR,"ERROR:parse_content_type_hdr: CONTENT_TYPE hdr containes "
266
+			"more then one mime type :-(!\n");
267
+		goto error;
268
+	}
269
+	if ((mime&0x00ff)==SUBTYPE_ALL || (mime>>16)==TYPE_ALL) {
270
+		LOG(L_ERR,"ERROR:parse_content_type_hdr: invalid mime with wildcard "
271
+			"'*' in Content-Type hdr!\n");
272
+		goto error;
273
+	}
204 274
 
205
-	mime = ((mime==-1)?CONTENT_TYPE_UNKNOWN:mime);
206 275
 	msg->content_type->parsed = (void*)mime;
207 276
 	return mime;
277
+
208 278
 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 279
 	return -1;
212 280
 }
213 281
 
214 282
 
215 283
 
284
+/* returns: > 0 ok
285
+ *          = 0 hdr not found
286
+ *          = -1 error */
287
+int parse_accept_hdr( struct sip_msg *msg )
288
+{
289
+	static int mimes[MAX_MIMES_NR];
290
+	int nr_mimes;
291
+	int mime;
292
+	char *end;
293
+	char *ret;
294
+
295
+	/* is the header already found? */
296
+	if ( msg->accept==0 ) {
297
+		/* if not, found it */
298
+		if ( parse_headers(msg,HDR_ACCEPT,0)==-1)
299
+			goto error;
300
+		if ( msg->accept==0 ) {
301
+			DBG("DEBUG:parse_accept_hdr: missing Accept header\n");
302
+			return 0;
303
+		}
304
+	}
305
+
306
+	/* maybe the header is already parsed! */
307
+	if ( msg->accept->parsed!=0)
308
+		return 1;
309
+
310
+	/* it seams we have to parse it! :-( */
311
+	ret = msg->accept->body.s;
312
+	end = ret + msg->accept->body.len;
313
+	nr_mimes = 0;
314
+	while (1){
315
+		ret = decode_mime_type(ret, end , &mime);
316
+		if (ret==0)
317
+			goto error;
318
+		/* a new mime was found  -> put it into array */
319
+		if (nr_mimes==MAX_MIMES_NR) {
320
+			LOG(L_ERR,"ERROR:parse_accept_hdr: Accept hdr contains more than"
321
+				" %d mime type -> buffer ovrflow!!\n",MAX_MIMES_NR);
322
+			goto error;
323
+		}
324
+		mimes[nr_mimes++] = mime;
325
+		/* is another mime following? */
326
+		if (ret==end )
327
+			break;
328
+		/* parse the mime separator ',' */
329
+		if (*ret!=',' || ret+1==end) {
330
+			LOG(L_ERR,"ERROR:parse_accept_hdr: parse error between mimes at "
331
+				"char <%x> (offset=%d) in <%.*s>!\n",
332
+				*ret,ret-msg->accept->body.s,
333
+				msg->accept->body.len,msg->accept->body.s);
334
+			goto error;
335
+		}
336
+		/* skip the ',' */
337
+		ret++;
338
+	}
339
+
340
+	/* copy and link the mime buffer into the message */
341
+	msg->accept->parsed = (void*)pkg_malloc((nr_mimes+1)*sizeof(int));
342
+	if (msg->accept->parsed==0) {
343
+		LOG(L_ERR,"ERROR:parse_accept_hdr: no more pkg memory\n");
344
+		goto error;
345
+	}
346
+	memcpy(msg->accept->parsed,mimes,nr_mimes*sizeof(int));
347
+	/* make the buffer null terminated */
348
+	((int*)msg->accept->parsed)[nr_mimes] = 0;
349
+
350
+	return 1;
351
+error:
352
+	return -1;
353
+}
354
+
... ...
@@ -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 54
 #define get_content_type(_msg_)   ((int)(long)((_msg_)->content_type->parsed))
55 55
 
56 56
 
57
+/*
58
+ * returns the accept values of a sip_msg as an null-terminated array
59
+ * of integer
60
+ */
61
+#define get_accept(_msg_) ((int*)((_msg_)->accept->parsed))
57 62
 
58 63
 /*
59 64
  * parse the the body of the Content-Type header. It's value is also converted
60 65
  * as int.
61 66
  * Returns:   n (n>0)  : the found type
62
- *           -1        : error (parse error or hdr not found)
67
+ *            0        : hdr not found
68
+ *           -1        : error (parse error )
63 69
  */
64 70
 int parse_content_type_hdr( struct sip_msg *msg);
65 71
 
72
+/*
73
+ * parse the the body of the Accept header. It's values are also converted
74
+ * as an null-terminated array of ints.
75
+ * Returns:   1 : OK
76
+ *            0 : hdr not found
77
+ *           -1 : error (parse error)
78
+ */
79
+int parse_accept_hdr( struct sip_msg *msg );
80
+
66 81
 
67 82
 /*
68 83
  *  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 74
 #include "case_prox.h"     /* Proxy-Authorization, Proxy-Require */
75 75
 #include "case_allo.h"     /* Allow */
76 76
 #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 77
 #include "case_even.h"     /* Event */
81
-#include "case_acce.h"     /* Accept */
78
+#include "case_acce.h"     /* Accept, Accept-Language */
79
+#include "case_orga.h"     /* Organization */
80
+#include "case_prio.h"     /* Priority */
81
+#include "case_subj.h"     /* Subject */
82
+#include "case_user.h"     /* User-Agent */
83
+#include "case_supp.h"     /* Supported */
82 84
 
83 85
 
84 86
 #define READ(val) \
... ...
@@ -97,15 +100,17 @@ static inline char* skip_ws(char* p, unsigned int size)
97 97
 	case _reco_: reco_CASE; \
98 98
 	case _via2_: via2_CASE; \
99 99
 	case _auth_: auth_CASE; \
100
+	case _supp_: supp_CASE; \
100 101
 	case _expi_: expi_CASE; \
101 102
 	case _prox_: prox_CASE; \
102 103
 	case _allo_: allo_CASE; \
103 104
 	case _unsu_: unsu_CASE; \
104
-	case _requ_: requ_CASE; \
105
-	case _supp_: supp_CASE; \
106
-        case _www__: www_CASE;  \
107 105
         case _even_: even_CASE; \
108
-        case _acce_: acce_CASE;
106
+        case _acce_: acce_CASE; \
107
+        case _orga_: orga_CASE; \
108
+        case _prio_: prio_CASE; \
109
+        case _subj_: subj_CASE; \
110
+        case _user_: user_CASE;
109 111
 
110 112
 
111 113
 #define PARSE_COMPACT(id)          \
... ...
@@ -162,8 +167,8 @@ char* parse_hname2(char* begin, char* end, struct hdr_field* hdr)
162 162
 		case 'i': PARSE_COMPACT(HDR_CALLID);        break;
163 163
 		case 'm': PARSE_COMPACT(HDR_CONTACT);       break;
164 164
 		case 'l': PARSE_COMPACT(HDR_CONTENTLENGTH); break;
165
-		case 'c': PARSE_COMPACT(HDR_CONTENTTYPE);   break;
166 165
 		case 'k': PARSE_COMPACT(HDR_SUPPORTED);     break;
166
+		case 'c': PARSE_COMPACT(HDR_CONTENTTYPE);   break;
167 167
 		case 'o': PARSE_COMPACT(HDR_EVENT);         break;
168 168
 		}
169 169
 		goto other;