Module: sip-router Branch: master Commit: e430fa027b632c289cd440a228f102f385d29087 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=e430fa02...
Author: Jan Janak jan@iptel.org Committer: Jan Janak jan@iptel.org Date: Mon Mar 16 18:49:27 2009 +0100
Teach sip-router how to recognized Path header field name.
---
parser/case_path.h | 41 +++++++++++++++++++++++++++++++++++++++++ parser/hf.c | 1 + parser/hf.h | 2 ++ parser/keys.h | 1 + parser/msg_parser.c | 5 +++++ parser/msg_parser.h | 1 + parser/parse_hname2.c | 2 ++ 7 files changed, 53 insertions(+), 0 deletions(-)
diff --git a/parser/case_path.h b/parser/case_path.h new file mode 100644 index 0000000..5b065fc --- /dev/null +++ b/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: + * info@iptel.org + * + * 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 */ diff --git a/parser/hf.c b/parser/hf.c index 594a27f..c5f7ba3 100644 --- a/parser/hf.c +++ b/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", diff --git a/parser/hf.h b/parser/hf.h index 7196833..bddf0a2 100644 --- a/parser/hf.h +++ b/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)
diff --git a/parser/keys.h b/parser/keys.h index 92c60ce..bf17058 100644 --- a/parser/keys.h +++ b/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" */ diff --git a/parser/msg_parser.c b/parser/msg_parser.c index 5cfbd7c..cad8028 100644 --- a/parser/msg_parser.c +++ b/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); diff --git a/parser/msg_parser.h b/parser/msg_parser.h index 4b18ed5..48790c9 100644 --- a/parser/msg_parser.h +++ b/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*/ diff --git a/parser/parse_hname2.c b/parser/parse_hname2.c index 6b8e159..a222d5e 100644 --- a/parser/parse_hname2.c +++ b/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;