Browse code

- parsing of Content-Purpose and Content-Action removed - parsing of Accept-Disposition added.

Jan Janak authored on 05/08/2003 17:14:27
Showing 8 changed files
... ...
@@ -272,9 +272,16 @@ struct sip_msg*  sip_msg_cloner( struct sip_msg *org_msg )
272 272
 		len += ROUND4(sizeof( struct hdr_field));
273 273
 		switch (hdr->type)
274 274
 		{
275
-			case HDR_CSEQ:
276
-				len+=ROUND4(sizeof(struct cseq_body));
275
+			case HDR_VIA:
276
+				for (via=(struct via_body*)hdr->parsed;via;via=via->next)
277
+				{
278
+					len+=ROUND4(sizeof(struct via_body));
279
+					/*via param*/
280
+					for(prm=via->param_lst;prm;prm=prm->next)
281
+						len+=ROUND4(sizeof(struct via_param ));
282
+				}
277 283
 				break;
284
+
278 285
 		        case HDR_TO:
279 286
 		        case HDR_FROM:
280 287
 				     /* From header might be unparsed */
... ...
@@ -286,16 +293,12 @@ struct sip_msg*  sip_msg_cloner( struct sip_msg *org_msg )
286 293
 						len+=ROUND4(sizeof(struct to_param ));
287 294
 				}
288 295
 				break;				
289
-			case HDR_VIA:
290
-				for (via=(struct via_body*)hdr->parsed;via;via=via->next)
291
-				{
292
-					len+=ROUND4(sizeof(struct via_body));
293
-					/*via param*/
294
-					for(prm=via->param_lst;prm;prm=prm->next)
295
-						len+=ROUND4(sizeof(struct via_param ));
296
-				}
296
+
297
+			case HDR_CSEQ:
298
+				len+=ROUND4(sizeof(struct cseq_body));
297 299
 				break;
298 300
 
301
+
299 302
 		        case HDR_AUTHORIZATION:
300 303
 		        case HDR_PROXYAUTH:
301 304
 				if (hdr->parsed) {
... ...
@@ -310,9 +313,20 @@ struct sip_msg*  sip_msg_cloner( struct sip_msg *org_msg )
310 313
 			case HDR_RECORDROUTE:
311 314
 			case HDR_CONTENTTYPE:
312 315
 			case HDR_CONTENTLENGTH:
316
+		        case HDR_EXPIRES:
317
+		        case HDR_SUPPORTED:
313 318
 			case HDR_PROXYREQUIRE:
314 319
 			case HDR_UNSUPPORTED:
315 320
 			case HDR_ALLOW:
321
+		        case HDR_EVENT:
322
+		        case HDR_ACCEPT:
323
+		        case HDR_ACCEPTLANGUAGE:
324
+		        case HDR_ORGANIZATION:
325
+		        case HDR_PRIORITY:
326
+		        case HDR_SUBJECT:
327
+		        case HDR_USERAGENT:
328
+		        case HDR_ACCEPTDISPOSITION:
329
+		        case HDR_CONTENTDISPOSITION:
316 330
 				/* we ignore them for now even if they have something parsed*/
317 331
 				break;
318 332
 
... ...
@@ -573,8 +587,35 @@ struct sip_msg*  sip_msg_cloner( struct sip_msg *org_msg )
573 587
 				new_msg->unsupported = new_hdr;
574 588
 				break;
575 589
 			case HDR_ALLOW :
576
-				new_msg->unsupported = new_hdr;	
590
+				new_msg->allow = new_hdr;	
591
+				break;
592
+		        case HDR_EVENT:
593
+				new_msg->event = new_hdr;
594
+				break;
595
+		        case HDR_ACCEPT:
596
+				new_msg->accept = new_hdr;
597
+				break;
598
+		        case HDR_ACCEPTLANGUAGE:
599
+				new_msg->accept_language = new_hdr;
600
+				break;
601
+		        case HDR_ORGANIZATION:
602
+				new_msg->organization = new_hdr;
577 603
 				break;
604
+		        case HDR_PRIORITY:
605
+			        new_msg->priority = new_hdr;
606
+			        break;
607
+		        case HDR_SUBJECT:
608
+			        new_msg->subject = new_hdr;
609
+			        break;
610
+		        case HDR_USERAGENT:
611
+			        new_msg->user_agent = new_hdr;
612
+			        break;
613
+		        case HDR_ACCEPTDISPOSITION:
614
+			        new_msg->accept_disposition = new_hdr;
615
+			        break;
616
+		        case HDR_CONTENTDISPOSITION:
617
+		 	        new_msg->content_disposition = new_hdr;
618
+			        break;
578 619
 		}/*switch*/
579 620
 
580 621
 		if ( last_hdr )
... ...
@@ -55,20 +55,57 @@
55 55
 	}
56 56
 
57 57
 
58
-#define ptl_CASE                   \
58
+#define on_CASE                                            \
59
+        if (LOWER_BYTE(*p) == 'o') {                       \
60
+                p++;                                       \
61
+                if (LOWER_BYTE(*p) == 'n') {               \
62
+                        hdr->type = HDR_ACCEPTDISPOSITION; \
63
+                        p++;                               \
64
+                        goto dc_end;                       \
65
+                }                                          \
66
+        }
67
+
68
+
69
+#define siti_CASE                  \
70
+        switch(LOWER_DWORD(val)) { \
71
+        case _siti_:               \
72
+                p += 4;            \
73
+                val = READ(p);     \
74
+                on_CASE;           \
75
+                goto other;        \
76
+        }
77
+
78
+
79
+#define ispo_CASE                  \
80
+        switch(LOWER_DWORD(val)) { \
81
+        case _ispo_:               \
82
+                p += 4;            \
83
+                val = READ(p);     \
84
+                siti_CASE;         \
85
+                goto other;        \
86
+        }
87
+
88
+
89
+#define ptld_CASE                  \
59 90
         switch(LOWER_DWORD(val)) { \
60 91
         case _pt_l_:               \
61 92
 		p += 4;            \
62 93
 		val = READ(p);     \
63 94
 		angu_CASE;         \
64 95
 		goto other;        \
96
+                                   \
97
+        case _pt_d_:               \
98
+                p += 4;            \
99
+                val = READ(p);     \
100
+                ispo_CASE;         \
101
+                goto other;        \
65 102
 	}
66 103
 
67 104
 
68 105
 #define acce_CASE                           \
69 106
     p += 4;                                 \
70 107
     val = READ(p);                          \
71
-    ptl_CASE;                               \
108
+    ptld_CASE;                              \
72 109
                                             \
73 110
     if (LOWER_BYTE(*p) == 'p') {            \
74 111
             p++;                            \
... ...
@@ -1,8 +1,8 @@
1 1
 /* 
2 2
  * $Id$ 
3 3
  *
4
- * Contact, Content-Type, Content-Length, Content-Purpose,
5
- * Content-Action, Content-Disposition  Header Field Name Parsing Macros
4
+ * Contact, Content-Type, Content-Length, Content-Disposition
5
+ * Header Field Name Parsing Macros
6 6
  *
7 7
  * Copyright (C) 2001-2003 Fhg Fokus
8 8
  *
... ...
@@ -57,33 +57,6 @@
57 57
         }
58 58
 
59 59
 
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 60
 #define ion_CASE                                    \
88 61
         switch(LOWER_DWORD(val)) {                  \
89 62
         case _ion1_:                                \
... ...
@@ -121,18 +94,6 @@
121 94
                 p += 4;                      \
122 95
                 goto dc_end;                 \
123 96
                                              \
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 97
         case _disp_:                         \
137 98
                 p += 4;                      \
138 99
 		val = READ(p);               \
... ...
@@ -63,42 +63,88 @@ void clean_hdr_field(struct hdr_field* hf)
63 63
 			free_to(hf->parsed);
64 64
 			break;
65 65
 
66
+		case HDR_FROM:
67
+			free_to(hf->parsed);
68
+			break;
69
+
66 70
 		case HDR_CSEQ:
67 71
 			free_cseq(hf->parsed);
68 72
 			break;
69 73
 
74
+		case HDR_CALLID:
75
+			break;
76
+
77
+		case HDR_CONTACT:
78
+			free_contact((contact_body_t**)(&(hf->parsed)));
79
+			break;
80
+
81
+		case HDR_MAXFORWARDS:
82
+			break;
83
+
84
+		case HDR_ROUTE:
85
+			free_rr((rr_t**)(&hf->parsed));
86
+			break;
87
+
88
+		case HDR_RECORDROUTE:
89
+			free_rr((rr_t**)(&hf->parsed));
90
+			break;
91
+
92
+		case HDR_CONTENTTYPE:
93
+			break;
94
+
95
+		case HDR_CONTENTLENGTH:
96
+			break;
97
+
70 98
 		case HDR_AUTHORIZATION:
99
+			break;
100
+
101
+		case HDR_EXPIRES:
102
+			free_expires((exp_body_t**)(&(hf->parsed)));
103
+			break;
104
+
71 105
 		case HDR_PROXYAUTH:
72 106
 			free_credentials((auth_body_t**)(&(hf->parsed)));
73 107
 			break;
74 108
 
75
-		case HDR_FROM:
76
-			free_to(hf->parsed);
109
+		case HDR_SUPPORTED:
110
+			break;
111
+
112
+		case HDR_PROXYREQUIRE:
113
+			break;
114
+
115
+		case HDR_UNSUPPORTED:
116
+			break;
117
+
118
+		case HDR_ALLOW:
77 119
 			break;
78 120
 
79 121
 		case HDR_EVENT:
80 122
 			free_event((event_t**)(&(hf->parsed)));
81 123
 			break;
82 124
 
83
-		case HDR_EXPIRES:
84
-			free_expires((exp_body_t**)(&(hf->parsed)));
125
+		case HDR_ACCEPT:
126
+			pkg_free(hf->parsed);
85 127
 			break;
86 128
 
87
-		case HDR_CONTACT:
88
-			free_contact((contact_body_t**)(&(hf->parsed)));
129
+		case HDR_ACCEPTLANGUAGE:
130
+			break;
131
+			
132
+		case HDR_ORGANIZATION:
133
+			break;
134
+			
135
+		case HDR_PRIORITY:
89 136
 			break;
90 137
 
91
-		case HDR_ROUTE:
92
-		case HDR_RECORDROUTE:
93
-			free_rr((rr_t**)(&hf->parsed));
138
+		case HDR_SUBJECT:
94 139
 			break;
95 140
 
96
-		case HDR_CONTENTLENGTH:
97
-		case HDR_CONTENTTYPE:
141
+		case HDR_USERAGENT:
98 142
 			break;
99 143
 
100
-		case HDR_ACCEPT:
101
-			pkg_free(hf->parsed);
144
+		case HDR_ACCEPTDISPOSITION:
145
+			break;
146
+
147
+		case HDR_CONTENTDISPOSITION:
102 148
 			break;
103 149
 
104 150
 		default:
... ...
@@ -69,10 +69,9 @@
69 69
 #define HDR_PRIORITY           (1 << 23)  /* Priority header field */
70 70
 #define HDR_SUBJECT            (1 << 24)  /* Subject header field */
71 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 */
72
+#define HDR_ACCEPTDISPOSITION  (1 << 26)  /* Accept-Disposition header field */
73
+#define HDR_CONTENTDISPOSITION (1 << 27)  /* Content-Disposition header field */
74
+#define HDR_OTHER              (1 << 28)  /* Some other header field */
76 75
 
77 76
 
78 77
 /* 
... ...
@@ -29,6 +29,7 @@
29 29
  * History:
30 30
  * --------
31 31
  * 2003-05-01 _acce_ macro added (janakj)
32
+ * 2003-05-01 Macros for Accept-Disposition added (janakj)
32 33
  */
33 34
 
34 35
 #ifndef KEYS_H
... ...
@@ -105,13 +106,13 @@
105 106
 #define _ect1_ 0x3a746365   /* "ect:" */
106 107
 #define _user_ 0x72657375   /* "user" */
107 108
 #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 109
 #define _disp_ 0x70736964   /* "disp" */
113 110
 #define _osit_ 0x7469736f   /* "osit" */
114 111
 #define _ion2_ 0x206e6f69   /* "ion " */
115 112
 #define _ion1_ 0x3a6e6f69   /* "ion:" */
116 113
 
114
+#define _pt_d_ 0x64617470   /* "pt-d" */
115
+#define _ispo_ 0x6f707369   /* "ispo" */
116
+#define _siti_ 0x69746973   /* "siti" */
117
+
117 118
 #endif /* KEYS_H */
... ...
@@ -200,9 +200,8 @@ char* get_hdr_field(char* buf, char* end, struct hdr_field* hdr)
200 200
 	        case HDR_PRIORITY:
201 201
 	        case HDR_SUBJECT:
202 202
 	        case HDR_USERAGENT:
203
-	        case HDR_CONTENTPURPOSE:
204
-	        case HDR_CONTENTACTION:
205 203
 	        case HDR_CONTENTDISPOSITION:
204
+	        case HDR_ACCEPTDISPOSITION:
206 205
 		case HDR_OTHER:
207 206
 			/* just skip over it */
208 207
 			hdr->body.s=tmp;
... ...
@@ -390,18 +389,14 @@ int parse_headers(struct sip_msg* msg, int flags, int next)
390 389
 				if (msg->user_agent==0) msg->user_agent = hf;
391 390
 				msg->parsed_flag|=HDR_USERAGENT;
392 391
 				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 392
 		        case HDR_CONTENTDISPOSITION:
402 393
 				if (msg->content_disposition==0) msg->content_disposition = hf;
403 394
 				msg->parsed_flag|=HDR_CONTENTDISPOSITION;
404 395
 				break;
396
+		        case HDR_ACCEPTDISPOSITION:
397
+				if (msg->accept_disposition==0) msg->accept_disposition = hf;
398
+				msg->parsed_flag|=HDR_ACCEPTDISPOSITION;
399
+				break;
405 400
 			case HDR_VIA:
406 401
 				msg->parsed_flag|=HDR_VIA;
407 402
 				DBG("parse_headers: Via found, flags=%d\n", flags);
... ...
@@ -184,9 +184,8 @@ struct sip_msg {
184 184
 	struct hdr_field* priority;
185 185
 	struct hdr_field* subject;
186 186
 	struct hdr_field* user_agent;
187
-	struct hdr_field* content_purpose;
188
-	struct hdr_field* content_action;
189 187
 	struct hdr_field* content_disposition;
188
+	struct hdr_field* accept_disposition;
190 189
 
191 190
 	char* eoh;        /* pointer to the end of header (if found) or null */
192 191
 	char* unparsed;   /* here we stopped parsing*/