Procházet zdrojové kódy

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

Vaclav Kubart před 20 roky
rodič
revize
9200d4107e
6 změnil soubory, kde provedl 18 přidání a 0 odebrání
  1. 5 0
      parser/hf.c
  2. 2 0
      parser/hf.h
  3. 3 0
      parser/keys.h
  4. 5 0
      parser/msg_parser.c
  5. 1 0
      parser/msg_parser.h
  6. 2 0
      parser/parse_hname2.c

+ 5 - 0
parser/hf.c

@@ -42,6 +42,7 @@
 #include "digest/digest.h" /* free_credentials */
 #include "parse_event.h"
 #include "parse_expires.h"
+#include "parse_sipifmatch.h"
 #include "parse_rr.h"
 #include "contact/parse_contact.h"
 #include "parse_disposition.h"
@@ -75,6 +76,10 @@ void clean_hdr_field(struct hdr_field* hf)
 		case HDR_CALLID_T:
 			break;
 
+		case HDR_SIPIFMATCH_T:
+			free_sipifmatch((str **)(&(hf->parsed)));
+			break;
+
 		case HDR_CONTACT_T:
 			free_contact((contact_body_t**)(&(hf->parsed)));
 			break;

+ 2 - 0
parser/hf.h

@@ -86,6 +86,7 @@ enum _hdr_types_t {
 	HDR_DIVERSION_T				       /* Diversion header field */,
 	HDR_RPID_T					       /* Remote-Party-ID header field */,
 	HDR_REFER_TO_T				       /* Refer-To header fiels */,
+	HDR_SIPIFMATCH_T                   /* SIP-If-Match header field */,
 	HDR_EOH_T				       /* Some other header field */
 };
 
@@ -135,6 +136,7 @@ typedef unsigned long long hdr_flags_t;
 #define HDR_DIVERSION_F				HDR_F_DEF(DIVERSION)
 #define HDR_RPID_F					HDR_F_DEF(RPID)
 #define HDR_REFER_TO_F				HDR_F_DEF(REFER_TO)
+#define HDR_SIPIFMATCH_F			HDR_F_DEF(SIPIFMATCH)
 #define HDR_OTHER_F					HDR_F_DEF(OTHER)
 
 typedef enum _hdr_types_t hdr_types_t;

+ 3 - 0
parser/keys.h

@@ -92,6 +92,9 @@
 #define _enti_ 0x69746e65   /* "enti" */
 #define _cate_ 0x65746163   /* "cate" */
 #define _even_ 0x6e657665   /* "even" */
+#define _sip_  0x2d706973   /* "sip-" */
+#define _ifm_  0x6d2d6669   /* "if-m" */
+#define _atch_ 0x68637461   /* "atch" */
 
 #define _pt_l_ 0x6c2d7470   /* "pt-l" */
 #define _angu_ 0x75676e61   /* "angu" */

+ 5 - 0
parser/msg_parser.c

@@ -206,6 +206,7 @@ char* get_hdr_field(char* buf, char* end, struct hdr_field* hdr)
 		case HDR_ACCEPTDISPOSITION_T:
 		case HDR_DIVERSION_T:
 		case HDR_RPID_T:
+		case HDR_SIPIFMATCH_T:
 		case HDR_REFER_TO_T:
 		case HDR_OTHER_T:
 			/* just skip over it */
@@ -305,6 +306,10 @@ int parse_headers(struct sip_msg* msg, hdr_flags_t flags, int next)
 				if (msg->callid==0) msg->callid=hf;
 				msg->parsed_flag|=HDR_CALLID_F;
 				break;
+			case HDR_SIPIFMATCH_T:
+				if (msg->sipifmatch==0) msg->sipifmatch=hf;
+				msg->parsed_flag|=HDR_SIPIFMATCH_F;
+				break;
 			case HDR_TO_T:
 				if (msg->to==0) msg->to=hf;
 				msg->parsed_flag|=HDR_TO_F;

+ 1 - 0
parser/msg_parser.h

@@ -199,6 +199,7 @@ struct sip_msg {
 	struct hdr_field* diversion;
 	struct hdr_field* rpid;
         struct hdr_field* refer_to;
+	struct hdr_field* sipifmatch;
 
 	char* eoh;        /* pointer to the end of header (if found) or null */
 	char* unparsed;   /* here we stopped parsing*/

+ 2 - 0
parser/parse_hname2.c

@@ -76,6 +76,7 @@ static inline char* skip_ws(char* p, unsigned int size)
 #include "case_allo.h"     /* Allow */
 #include "case_unsu.h"     /* Unsupported */
 #include "case_even.h"     /* Event */
+#include "case_sip.h"      /* Sip-If-Match */
 #include "case_acce.h"     /* Accept, Accept-Language */
 #include "case_orga.h"     /* Organization */
 #include "case_prio.h"     /* Priority */
@@ -109,6 +110,7 @@ static inline char* skip_ws(char* p, unsigned int size)
 	case _allo_: allo_CASE; \
 	case _unsu_: unsu_CASE; \
         case _even_: even_CASE; \
+        case _sip_: sip_CASE; \
         case _acce_: acce_CASE; \
         case _orga_: orga_CASE; \
         case _prio_: prio_CASE; \