Module: sip-router Branch: master Commit: 87d849786768991e8b1287f14567ce409b27d0c9 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=87d84978...
Author: Jan Janak jan@iptel.org Committer: Jan Janak jan@iptel.org Date: Fri Mar 27 08:59:37 2009 +0100
Kamailio compatibility: Privacy header field name parser
This patch adds support for the Privacy header field name parser.
---
parser/case_priv.h | 51 +++++++++++++++++++++++++++++++++++++++++++++++++ parser/hf.c | 1 + parser/hf.h | 2 + parser/keys.h | 4 +++ parser/msg_parser.c | 5 ++++ parser/msg_parser.h | 1 + parser/parse_hname2.c | 5 ++- 7 files changed, 67 insertions(+), 2 deletions(-)
diff --git a/parser/case_priv.h b/parser/case_priv.h new file mode 100644 index 0000000..a8f68e0 --- /dev/null +++ b/parser/case_priv.h @@ -0,0 +1,51 @@ +/* + * $Id$ + * + * Call-ID Header Name Parsing Macros + * + * Copyright (C) 2001-2003 FhG FOKUS + * + * 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 + * + * 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_PRIV_H +#define _CASE_PRIV_H + + +#define ACY_CASE \ + switch(LOWER_DWORD(val)) { \ + case _acy1_: \ + hdr->type = HDR_PRIVACY_T; \ + hdr->name.len = 7; \ + return (p + 4); \ + \ + case _acy2_: \ + hdr->type = HDR_PRIVACY_T; \ + p += 4; \ + goto dc_end; \ + } + + +#define priv_CASE \ + p += 4; \ + val = READ(p); \ + ACY_CASE; \ + goto other; + + + +#endif /* _CASE_PRIV_H */ diff --git a/parser/hf.c b/parser/hf.c index f33aaa1..a54865e 100644 --- a/parser/hf.c +++ b/parser/hf.c @@ -214,6 +214,7 @@ void clean_hdr_field(struct hdr_field* hf) case HDR_WWW_AUTHENTICATE_T: case HDR_PROXY_AUTHENTICATE_T: case HDR_PATH_T: + case HDR_PRIVACY_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 bddf0a2..93b0648 100644 --- a/parser/hf.h +++ b/parser/hf.h @@ -110,6 +110,7 @@ enum _hdr_types_t { HDR_PPI_T /**< P-Preferred-Identity header field */, HDR_PAI_T /**< P-Asserted-Identity header field */, HDR_PATH_T /**< Path header field */, + HDR_PRIVACY_T /**< Privacy header field */, HDR_EOH_T /* End of message header */ };
@@ -180,6 +181,7 @@ typedef unsigned long long hdr_flags_t; #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_PRIVACY_F HDR_F_DEF(PRIVACY)
#define HDR_OTHER_F HDR_F_DEF(OTHER)
diff --git a/parser/keys.h b/parser/keys.h index bf17058..bd53863 100644 --- a/parser/keys.h +++ b/parser/keys.h @@ -181,4 +181,8 @@ #define _ter1_ 0x3a726574 /* "ter:" */ #define _ter2_ 0x20726574 /* "ter " */
+#define _priv_ 0x76697270 /* "priv" */ +#define _acy2_ 0x20796361 /* "acy " */ +#define _acy1_ 0x3a796361 /* "acy:" */ + #endif /* KEYS_H */ diff --git a/parser/msg_parser.c b/parser/msg_parser.c index bc73fb7..23201c5 100644 --- a/parser/msg_parser.c +++ b/parser/msg_parser.c @@ -242,6 +242,7 @@ char* get_hdr_field(char* buf, char* end, struct hdr_field* hdr) case HDR_WWW_AUTHENTICATE_T: case HDR_PROXY_AUTHENTICATE_T: case HDR_PATH_T: + case HDR_PRIVACY_T: case HDR_OTHER_T: /* just skip over it */ hdr->body.s=tmp; @@ -521,6 +522,10 @@ int parse_headers(struct sip_msg* msg, hdr_flags_t flags, int next) if (msg->path==0) msg->path=hf; msg->parsed_flag|=HDR_PATH_F; break; + case HDR_PRIVACY_T: + if (msg->privacy==0) msg->privacy=hf; + msg->parsed_flag|=HDR_PRIVACY_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 74754f7..1b250df 100644 --- a/parser/msg_parser.h +++ b/parser/msg_parser.h @@ -278,6 +278,7 @@ typedef struct sip_msg { struct hdr_field* pai; struct hdr_field* ppi; struct hdr_field* path; + struct hdr_field* privacy;
struct msg_body* body;
diff --git a/parser/parse_hname2.c b/parser/parse_hname2.c index a222d5e..2b4152a 100644 --- a/parser/parse_hname2.c +++ b/parser/parse_hname2.c @@ -99,6 +99,7 @@ static inline char* skip_ws(char* p, unsigned int size) #include "case_iden.h" /* Identity, Identity-info */ #include "case_retr.h" /* Retry-After */ #include "case_path.h" /* Path */ +#include "case_priv.h"
#define READ(val) \ @@ -144,8 +145,8 @@ 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; - + case _path_: path_CASE; \ + case _priv_: priv_CASE;
#define PARSE_COMPACT(id) \