Module: sip-router
Branch: master
Commit: 74f727eb90ad7d1a7e639da17887bc665e4b64b0
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=74f727e…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Fri Apr 13 14:40:47 2012 +0200
lib/kcore: parse Supported header recognize gruu
---
lib/kcore/parse_supported.c | 9 ++++++++-
lib/kcore/parse_supported.h | 5 +++++
2 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/lib/kcore/parse_supported.c b/lib/kcore/parse_supported.c
index 8c81cfb..c30225a 100644
--- a/lib/kcore/parse_supported.c
+++ b/lib/kcore/parse_supported.c
@@ -97,10 +97,17 @@ static inline int parse_supported_body(str *body, unsigned int *sup)
if(pos+SUPPORTED_EVENTLIST_LEN<=len
&& strncasecmp(p, SUPPORTED_EVENTLIST_STR,
SUPPORTED_EVENTLIST_LEN)==0
- && IS_DELIM(p+9) ) {
+ && IS_DELIM(p+SUPPORTED_EVENTLIST_LEN) ) {
*sup |= F_SUPPORTED_EVENTLIST;
pos += SUPPORTED_EVENTLIST_LEN + 1;
p += SUPPORTED_EVENTLIST_LEN + 1;
+ } else if(pos+SUPPORTED_GRUU_LEN<=len
+ && strncasecmp(p, SUPPORTED_GRUU_STR,
+ SUPPORTED_GRUU_LEN)==0
+ && IS_DELIM(p+SUPPORTED_GRUU_LEN)) {
+ *sup |= F_SUPPORTED_GRUU;
+ pos += SUPPORTED_GRUU_LEN + 1;
+ p += SUPPORTED_GRUU_LEN + 1;
} else {
/* skip element */
for (; pos < len && !IS_DELIM(p); ++pos, ++p);
diff --git a/lib/kcore/parse_supported.h b/lib/kcore/parse_supported.h
index 55f04f8..f479eb5 100644
--- a/lib/kcore/parse_supported.h
+++ b/lib/kcore/parse_supported.h
@@ -44,6 +44,7 @@
#define F_SUPPORTED_100REL (1 << 1)
#define F_SUPPORTED_TIMER (1 << 2)
#define F_SUPPORTED_EVENTLIST (1 << 3)
+#define F_SUPPORTED_GRUU (1 << 4)
#define SUPPORTED_PATH_STR "path"
#define SUPPORTED_PATH_LEN (sizeof(SUPPORTED_PATH_STR)-1)
@@ -60,6 +61,10 @@
#define SUPPORTED_EVENTLIST_STR "eventlist"
#define SUPPORTED_EVENTLIST_LEN (sizeof(SUPPORTED_EVENTLIST_STR)-1)
+/* RFC 5627 */
+#define SUPPORTED_GRUU_STR "gruu"
+#define SUPPORTED_GRUU_LEN (sizeof(SUPPORTED_GRUU_STR)-1)
+
#define get_supported(p_msg) \
((p_msg)->supported ? ((struct
supported_body*)(p_msg)->supported->parsed)->supported_all : 0)