Browse Source

Teach sip-router how to recognized Path header field name.

Jan Janak 16 years ago
parent
commit
e430fa027b
7 changed files with 53 additions and 0 deletions
  1. 41 0
      parser/case_path.h
  2. 1 0
      parser/hf.c
  3. 2 0
      parser/hf.h
  4. 1 0
      parser/keys.h
  5. 5 0
      parser/msg_parser.c
  6. 1 0
      parser/msg_parser.h
  7. 2 0
      parser/parse_hname2.c

+ 41 - 0
parser/case_path.h

@@ -0,0 +1,41 @@
+/* 
+ * $Id$ 
+ *
+ * Path Header Field Name Parsing Macros
+ *
+ * Copyright (C) 2009 iptelorg GmbH
+ *
+ * This file is part of ser, a free SIP server.
+ *
+ * ser is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version
+ *
+ * For a license to use the ser software under conditions
+ * other than those described here, or to purchase support for this
+ * software, please contact iptel.org by e-mail at the following addresses:
+ *    [email protected]
+ *
+ * ser is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License 
+ * along with this program; if not, write to the Free Software 
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#ifndef CASE_PATH_H
+#define CASE_PATH_H
+
+
+#define path_CASE				\
+	hdr->type = HDR_PATH_T;		\
+	p += 4;						\
+	goto dc_end
+
+
+#endif /* CASE_PATH_H */

+ 1 - 0
parser/hf.c

@@ -211,6 +211,7 @@ void clean_hdr_field(struct hdr_field* hf)
 		case HDR_REQUESTDISPOSITION_T:
 		case HDR_WWW_AUTHENTICATE_T:
 		case HDR_PROXY_AUTHENTICATE_T:
+		case HDR_PATH_T:
 			break;
 		default:
 			LOG(L_CRIT, "BUG: clean_hdr_field: unknown header type %d\n",

+ 2 - 0
parser/hf.h

@@ -109,6 +109,7 @@ enum _hdr_types_t {
 	HDR_RETRY_AFTER_T		           /* Retry-After header field */,
 	HDR_PPI_T                          /**< P-Preferred-Identity header field */,
 	HDR_PAI_T                          /**< P-Asserted-Identity header field */,
+	HDR_PATH_T                         /**< Path header field */,
 	HDR_EOH_T					       /* End of message header */
 };
 
@@ -178,6 +179,7 @@ typedef unsigned long long hdr_flags_t;
 #define HDR_RETRY_AFTER_F			HDR_F_DEF(RETRY_AFTER)
 #define HDR_PPI_F                   HDR_F_DEF(PPI)
 #define HDR_PAI_F                   HDR_F_DEF(PAI)
+#define HDR_PATH_F                  HDR_F_DEF(PATH)
 
 #define HDR_OTHER_F					HDR_F_DEF(OTHER)
 

+ 1 - 0
parser/keys.h

@@ -108,6 +108,7 @@
 #define _iden_ 0x6e656469   /* "iden" */
 #define _tity_ 0x79746974   /* "tity" */
 #define _info_ 0x6f666e69   /* "info" */
+#define _path_ 0x68746170   /* "path" */
 
 #define _pt_l_ 0x6c2d7470   /* "pt-l" */
 #define _angu_ 0x75676e61   /* "angu" */

+ 5 - 0
parser/msg_parser.c

@@ -241,6 +241,7 @@ char* get_hdr_field(char* buf, char* end, struct hdr_field* hdr)
 		case HDR_REQUESTDISPOSITION_T:
 		case HDR_WWW_AUTHENTICATE_T:
 		case HDR_PROXY_AUTHENTICATE_T:
+	    case HDR_PATH_T:
 		case HDR_OTHER_T:
 			/* just skip over it */
 			hdr->body.s=tmp;
@@ -516,6 +517,10 @@ int parse_headers(struct sip_msg* msg, hdr_flags_t flags, int next)
 				if (msg->identity_info==0) msg->identity_info=hf;
 				msg->parsed_flag|=HDR_IDENTITY_INFO_F;
 				break;
+		    case HDR_PATH_T:
+				if (msg->path==0) msg->path=hf;
+				msg->parsed_flag|=HDR_PATH_F;
+				break;
 			default:
 				LOG(L_CRIT, "BUG: parse_headers: unknown header type %d\n",
 							hf->type);

+ 1 - 0
parser/msg_parser.h

@@ -257,6 +257,7 @@ typedef struct sip_msg {
 	struct hdr_field* identity_info;
 	struct hdr_field* pai;
 	struct hdr_field* ppi;
+	struct hdr_field* path;
 
 	char* eoh;        /* pointer to the end of header (if found) or null */
 	char* unparsed;   /* here we stopped parsing*/

+ 2 - 0
parser/parse_hname2.c

@@ -98,6 +98,7 @@ static inline char* skip_ws(char* p, unsigned int size)
 #include "case_date.h"     /* Date */
 #include "case_iden.h"     /* Identity, Identity-info */
 #include "case_retr.h"     /* Retry-After */
+#include "case_path.h"     /* Path */
 
 
 #define READ(val) \
@@ -143,6 +144,7 @@ static inline char* skip_ws(char* p, unsigned int size)
 	case _date_: date_CASE; \
 	case _iden_: iden_CASE; \
 	case _retr_: retr_CASE; \
+    case _path_: path_CASE;