Browse code

added parsing of SIP-If-Match header field taken from PIC-SER

Vaclav Kubart authored on 26/10/2005 08:06:55
Showing 6 changed files
... ...
@@ -42,6 +42,7 @@
42 42
 #include "digest/digest.h" /* free_credentials */
43 43
 #include "parse_event.h"
44 44
 #include "parse_expires.h"
45
+#include "parse_sipifmatch.h"
45 46
 #include "parse_rr.h"
46 47
 #include "contact/parse_contact.h"
47 48
 #include "parse_disposition.h"
... ...
@@ -75,6 +76,10 @@ void clean_hdr_field(struct hdr_field* hf)
75 76
 		case HDR_CALLID_T:
76 77
 			break;
77 78
 
79
+		case HDR_SIPIFMATCH_T:
80
+			free_sipifmatch((str **)(&(hf->parsed)));
81
+			break;
82
+
78 83
 		case HDR_CONTACT_T:
79 84
 			free_contact((contact_body_t**)(&(hf->parsed)));
80 85
 			break;
... ...
@@ -86,6 +86,7 @@ enum _hdr_types_t {
86 86
 	HDR_DIVERSION_T				       /* Diversion header field */,
87 87
 	HDR_RPID_T					       /* Remote-Party-ID header field */,
88 88
 	HDR_REFER_TO_T				       /* Refer-To header fiels */,
89
+	HDR_SIPIFMATCH_T                   /* SIP-If-Match header field */,
89 90
 	HDR_EOH_T				       /* Some other header field */
90 91
 };
91 92
 
... ...
@@ -135,6 +136,7 @@ typedef unsigned long long hdr_flags_t;
135 136
 #define HDR_DIVERSION_F				HDR_F_DEF(DIVERSION)
136 137
 #define HDR_RPID_F					HDR_F_DEF(RPID)
137 138
 #define HDR_REFER_TO_F				HDR_F_DEF(REFER_TO)
139
+#define HDR_SIPIFMATCH_F			HDR_F_DEF(SIPIFMATCH)
138 140
 #define HDR_OTHER_F					HDR_F_DEF(OTHER)
139 141
 
140 142
 typedef enum _hdr_types_t hdr_types_t;
... ...
@@ -92,6 +92,9 @@
92 92
 #define _enti_ 0x69746e65   /* "enti" */
93 93
 #define _cate_ 0x65746163   /* "cate" */
94 94
 #define _even_ 0x6e657665   /* "even" */
95
+#define _sip_  0x2d706973   /* "sip-" */
96
+#define _ifm_  0x6d2d6669   /* "if-m" */
97
+#define _atch_ 0x68637461   /* "atch" */
95 98
 
96 99
 #define _pt_l_ 0x6c2d7470   /* "pt-l" */
97 100
 #define _angu_ 0x75676e61   /* "angu" */
... ...
@@ -206,6 +206,7 @@ char* get_hdr_field(char* buf, char* end, struct hdr_field* hdr)
206 206
 		case HDR_ACCEPTDISPOSITION_T:
207 207
 		case HDR_DIVERSION_T:
208 208
 		case HDR_RPID_T:
209
+		case HDR_SIPIFMATCH_T:
209 210
 		case HDR_REFER_TO_T:
210 211
 		case HDR_OTHER_T:
211 212
 			/* just skip over it */
... ...
@@ -305,6 +306,10 @@ int parse_headers(struct sip_msg* msg, hdr_flags_t flags, int next)
305 306
 				if (msg->callid==0) msg->callid=hf;
306 307
 				msg->parsed_flag|=HDR_CALLID_F;
307 308
 				break;
309
+			case HDR_SIPIFMATCH_T:
310
+				if (msg->sipifmatch==0) msg->sipifmatch=hf;
311
+				msg->parsed_flag|=HDR_SIPIFMATCH_F;
312
+				break;
308 313
 			case HDR_TO_T:
309 314
 				if (msg->to==0) msg->to=hf;
310 315
 				msg->parsed_flag|=HDR_TO_F;
... ...
@@ -199,6 +199,7 @@ struct sip_msg {
199 199
 	struct hdr_field* diversion;
200 200
 	struct hdr_field* rpid;
201 201
         struct hdr_field* refer_to;
202
+	struct hdr_field* sipifmatch;
202 203
 
203 204
 	char* eoh;        /* pointer to the end of header (if found) or null */
204 205
 	char* unparsed;   /* here we stopped parsing*/
... ...
@@ -76,6 +76,7 @@ static inline char* skip_ws(char* p, unsigned int size)
76 76
 #include "case_allo.h"     /* Allow */
77 77
 #include "case_unsu.h"     /* Unsupported */
78 78
 #include "case_even.h"     /* Event */
79
+#include "case_sip.h"      /* Sip-If-Match */
79 80
 #include "case_acce.h"     /* Accept, Accept-Language */
80 81
 #include "case_orga.h"     /* Organization */
81 82
 #include "case_prio.h"     /* Priority */
... ...
@@ -109,6 +110,7 @@ static inline char* skip_ws(char* p, unsigned int size)
109 110
 	case _allo_: allo_CASE; \
110 111
 	case _unsu_: unsu_CASE; \
111 112
         case _even_: even_CASE; \
113
+        case _sip_: sip_CASE; \
112 114
         case _acce_: acce_CASE; \
113 115
         case _orga_: orga_CASE; \
114 116
         case _prio_: prio_CASE; \