Browse Source

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

Jan Janak 22 years ago
parent
commit
dccbcda9b2
6 changed files with 40 additions and 3 deletions
  1. 8 0
      parser/hf.c
  2. 4 2
      parser/hf.h
  3. 10 0
      parser/keys.h
  4. 10 0
      parser/msg_parser.c
  5. 3 0
      parser/msg_parser.h
  6. 5 1
      parser/parse_hname2.c

+ 8 - 0
parser/hf.c

@@ -150,6 +150,14 @@ void clean_hdr_field(struct hdr_field* hf)
 			free_disposition( ((struct disposition**)(&hf->parsed)) );
 			break;
 
+		case HDR_DIVERSION:
+			free_to(hf->parsed);
+			break;
+
+		case HDR_RPID:
+			free_to(hf->parsed);
+			break;
+
 		default:
 			LOG(L_CRIT, "BUG: clean_hdr_field: unknown header type %d\n",
 			    hf->type);

+ 4 - 2
parser/hf.h

@@ -71,7 +71,9 @@
 #define HDR_USERAGENT          (1 << 25)  /* User-Agent header field */
 #define HDR_ACCEPTDISPOSITION  (1 << 26)  /* Accept-Disposition header field */
 #define HDR_CONTENTDISPOSITION (1 << 27)  /* Content-Disposition header field */
-#define HDR_OTHER              (1 << 28)  /* Some other header field */
+#define HDR_DIVERSION          (1 << 28)  /* Diversion header field */
+#define HDR_RPID               (1 << 29)  /* Remote-Party-ID header field */
+#define HDR_OTHER              (1 << 30)  /* Some other header field */
 
 
 /* 
@@ -81,7 +83,7 @@ struct hdr_field {
 	int type;               /* Header field type */
 	str name;               /* Header field name */
 	str body;               /* Header field body (may not include CRLF) */
-	int len;				/* length from hdr start until EoHF (incl.CRLF) */
+	int len;		/* length from hdr start until EoHF (incl.CRLF) */
 	void* parsed;           /* Parsed data structures */
 	struct hdr_field* next; /* Next header field in the list */
 };

+ 10 - 0
parser/keys.h

@@ -30,6 +30,7 @@
  * --------
  * 2003-05-01 _acce_ macro added (janakj)
  * 2003-05-01 Macros for Accept-Disposition added (janakj)
+ * 2003-11-02 Macros for Diversion added (jh)
  */
 
 #ifndef KEYS_H
@@ -115,4 +116,13 @@
 #define _ispo_ 0x6f707369   /* "ispo" */
 #define _siti_ 0x69746973   /* "siti" */
 
+#define _dive_ 0x65766964   /* "dive" */
+#define _rsio_ 0x6f697372   /* "rsio" */
+
+#define _remo_ 0x6f6d6572   /* "remo" */
+#define _te_p_ 0x702d6574   /* "te-p" */
+#define _arty_ 0x79747261   /* "arty" */
+#define __id2_ 0x2064692d   /* "-id " */
+#define __id1_ 0x3a64692d   /* "-id:" */
+
 #endif /* KEYS_H */

+ 10 - 0
parser/msg_parser.c

@@ -202,6 +202,8 @@ char* get_hdr_field(char* buf, char* end, struct hdr_field* hdr)
 	        case HDR_USERAGENT:
 	        case HDR_CONTENTDISPOSITION:
 	        case HDR_ACCEPTDISPOSITION:
+	        case HDR_DIVERSION:
+	        case HDR_RPID:
 		case HDR_OTHER:
 			/* just skip over it */
 			hdr->body.s=tmp;
@@ -397,6 +399,14 @@ int parse_headers(struct sip_msg* msg, int flags, int next)
 				if (msg->accept_disposition==0) msg->accept_disposition = hf;
 				msg->parsed_flag|=HDR_ACCEPTDISPOSITION;
 				break;
+		        case HDR_DIVERSION:
+				if (msg->diversion==0) msg->diversion = hf;
+				msg->parsed_flag|=HDR_DIVERSION;
+				break;
+		        case HDR_RPID:
+				if (msg->rpid==0) msg->rpid = hf;
+				msg->parsed_flag|=HDR_RPID;
+				break;
 			case HDR_VIA:
 				msg->parsed_flag|=HDR_VIA;
 				DBG("parse_headers: Via found, flags=%d\n", flags);

+ 3 - 0
parser/msg_parser.h

@@ -35,6 +35,7 @@
  *  2003-04-04  structure for parsed inbound uri added (jiri)
  *  2003-04-11  updated the  sip_uri structure (lots of fields added) (andrei)
  *  2003-04-12  added msg_flags to sip_msg (andrei)
+ *  2003-11-02  added diversion header field to sip_msg (jh)
  */
 
 
@@ -187,6 +188,8 @@ struct sip_msg {
 	struct hdr_field* user_agent;
 	struct hdr_field* content_disposition;
 	struct hdr_field* accept_disposition;
+	struct hdr_field* diversion;
+	struct hdr_field* rpid;
 
 	char* eoh;        /* pointer to the end of header (if found) or null */
 	char* unparsed;   /* here we stopped parsing*/

+ 5 - 1
parser/parse_hname2.c

@@ -82,6 +82,8 @@ static inline char* skip_ws(char* p, unsigned int size)
 #include "case_subj.h"     /* Subject */
 #include "case_user.h"     /* User-Agent */
 #include "case_supp.h"     /* Supported */
+#include "case_dive.h"     /* Diversion */
+#include "case_remo.h"     /* Remote-Party-ID */
 
 
 #define READ(val) \
@@ -110,7 +112,9 @@ static inline char* skip_ws(char* p, unsigned int size)
         case _orga_: orga_CASE; \
         case _prio_: prio_CASE; \
         case _subj_: subj_CASE; \
-        case _user_: user_CASE;
+        case _user_: user_CASE; \
+        case _dive_: dive_CASE; \
+        case _remo_: remo_CASE;
 
 
 #define PARSE_COMPACT(id)          \