Browse code

- Diversion and Remote-Party-ID support from Juha Heinanen

Jan Janak authored on 18/01/2004 16:15:33
Showing 6 changed files
... ...
@@ -150,6 +150,14 @@ void clean_hdr_field(struct hdr_field* hf)
150 150
 			free_disposition( ((struct disposition**)(&hf->parsed)) );
151 151
 			break;
152 152
 
153
+		case HDR_DIVERSION:
154
+			free_to(hf->parsed);
155
+			break;
156
+
157
+		case HDR_RPID:
158
+			free_to(hf->parsed);
159
+			break;
160
+
153 161
 		default:
154 162
 			LOG(L_CRIT, "BUG: clean_hdr_field: unknown header type %d\n",
155 163
 			    hf->type);
... ...
@@ -71,7 +71,9 @@
71 71
 #define HDR_USERAGENT          (1 << 25)  /* User-Agent header field */
72 72
 #define HDR_ACCEPTDISPOSITION  (1 << 26)  /* Accept-Disposition header field */
73 73
 #define HDR_CONTENTDISPOSITION (1 << 27)  /* Content-Disposition header field */
74
-#define HDR_OTHER              (1 << 28)  /* Some other header field */
74
+#define HDR_DIVERSION          (1 << 28)  /* Diversion header field */
75
+#define HDR_RPID               (1 << 29)  /* Remote-Party-ID header field */
76
+#define HDR_OTHER              (1 << 30)  /* Some other header field */
75 77
 
76 78
 
77 79
 /* 
... ...
@@ -81,7 +83,7 @@ struct hdr_field {
81 83
 	int type;               /* Header field type */
82 84
 	str name;               /* Header field name */
83 85
 	str body;               /* Header field body (may not include CRLF) */
84
-	int len;				/* length from hdr start until EoHF (incl.CRLF) */
86
+	int len;		/* length from hdr start until EoHF (incl.CRLF) */
85 87
 	void* parsed;           /* Parsed data structures */
86 88
 	struct hdr_field* next; /* Next header field in the list */
87 89
 };
... ...
@@ -30,6 +30,7 @@
30 30
  * --------
31 31
  * 2003-05-01 _acce_ macro added (janakj)
32 32
  * 2003-05-01 Macros for Accept-Disposition added (janakj)
33
+ * 2003-11-02 Macros for Diversion added (jh)
33 34
  */
34 35
 
35 36
 #ifndef KEYS_H
... ...
@@ -115,4 +116,13 @@
115 116
 #define _ispo_ 0x6f707369   /* "ispo" */
116 117
 #define _siti_ 0x69746973   /* "siti" */
117 118
 
119
+#define _dive_ 0x65766964   /* "dive" */
120
+#define _rsio_ 0x6f697372   /* "rsio" */
121
+
122
+#define _remo_ 0x6f6d6572   /* "remo" */
123
+#define _te_p_ 0x702d6574   /* "te-p" */
124
+#define _arty_ 0x79747261   /* "arty" */
125
+#define __id2_ 0x2064692d   /* "-id " */
126
+#define __id1_ 0x3a64692d   /* "-id:" */
127
+
118 128
 #endif /* KEYS_H */
... ...
@@ -202,6 +202,8 @@ char* get_hdr_field(char* buf, char* end, struct hdr_field* hdr)
202 202
 	        case HDR_USERAGENT:
203 203
 	        case HDR_CONTENTDISPOSITION:
204 204
 	        case HDR_ACCEPTDISPOSITION:
205
+	        case HDR_DIVERSION:
206
+	        case HDR_RPID:
205 207
 		case HDR_OTHER:
206 208
 			/* just skip over it */
207 209
 			hdr->body.s=tmp;
... ...
@@ -397,6 +399,14 @@ int parse_headers(struct sip_msg* msg, int flags, int next)
397 399
 				if (msg->accept_disposition==0) msg->accept_disposition = hf;
398 400
 				msg->parsed_flag|=HDR_ACCEPTDISPOSITION;
399 401
 				break;
402
+		        case HDR_DIVERSION:
403
+				if (msg->diversion==0) msg->diversion = hf;
404
+				msg->parsed_flag|=HDR_DIVERSION;
405
+				break;
406
+		        case HDR_RPID:
407
+				if (msg->rpid==0) msg->rpid = hf;
408
+				msg->parsed_flag|=HDR_RPID;
409
+				break;
400 410
 			case HDR_VIA:
401 411
 				msg->parsed_flag|=HDR_VIA;
402 412
 				DBG("parse_headers: Via found, flags=%d\n", flags);
... ...
@@ -35,6 +35,7 @@
35 35
  *  2003-04-04  structure for parsed inbound uri added (jiri)
36 36
  *  2003-04-11  updated the  sip_uri structure (lots of fields added) (andrei)
37 37
  *  2003-04-12  added msg_flags to sip_msg (andrei)
38
+ *  2003-11-02  added diversion header field to sip_msg (jh)
38 39
  */
39 40
 
40 41
 
... ...
@@ -187,6 +188,8 @@ struct sip_msg {
187 188
 	struct hdr_field* user_agent;
188 189
 	struct hdr_field* content_disposition;
189 190
 	struct hdr_field* accept_disposition;
191
+	struct hdr_field* diversion;
192
+	struct hdr_field* rpid;
190 193
 
191 194
 	char* eoh;        /* pointer to the end of header (if found) or null */
192 195
 	char* unparsed;   /* here we stopped parsing*/
... ...
@@ -82,6 +82,8 @@ static inline char* skip_ws(char* p, unsigned int size)
82 82
 #include "case_subj.h"     /* Subject */
83 83
 #include "case_user.h"     /* User-Agent */
84 84
 #include "case_supp.h"     /* Supported */
85
+#include "case_dive.h"     /* Diversion */
86
+#include "case_remo.h"     /* Remote-Party-ID */
85 87
 
86 88
 
87 89
 #define READ(val) \
... ...
@@ -110,7 +112,9 @@ static inline char* skip_ws(char* p, unsigned int size)
110 112
         case _orga_: orga_CASE; \
111 113
         case _prio_: prio_CASE; \
112 114
         case _subj_: subj_CASE; \
113
-        case _user_: user_CASE;
115
+        case _user_: user_CASE; \
116
+        case _dive_: dive_CASE; \
117
+        case _remo_: remo_CASE;
114 118
 
115 119
 
116 120
 #define PARSE_COMPACT(id)          \