Browse Source

kcore: added outbound tag to Supported hdr parser

Daniel-Constantin Mierla 13 years ago
parent
commit
41e57ff7c4
2 changed files with 12 additions and 0 deletions
  1. 7 0
      lib/kcore/parse_supported.c
  2. 5 0
      lib/kcore/parse_supported.h

+ 7 - 0
lib/kcore/parse_supported.c

@@ -108,6 +108,13 @@ static inline int parse_supported_body(str *body, unsigned int *sup)
 					*sup |= F_SUPPORTED_GRUU;
 					pos += SUPPORTED_GRUU_LEN + 1;
 					p   += SUPPORTED_GRUU_LEN + 1;
+				} else if(pos+SUPPORTED_OUTBOUND_LEN<=len
+						&& strncasecmp(p, SUPPORTED_OUTBOUND_STR,
+							SUPPORTED_OUTBOUND_LEN)==0
+						&& IS_DELIM(p+SUPPORTED_OUTBOUND_LEN)) {
+					*sup |= F_SUPPORTED_OUTBOUND;
+					pos += SUPPORTED_OUTBOUND_LEN + 1;
+					p   += SUPPORTED_OUTBOUND_LEN + 1;
 				} else {
 					/* skip element */
 					for (; pos < len && !IS_DELIM(p); ++pos, ++p);

+ 5 - 0
lib/kcore/parse_supported.h

@@ -45,6 +45,7 @@
 #define F_SUPPORTED_TIMER		(1 << 2)
 #define F_SUPPORTED_EVENTLIST   (1 << 3)
 #define F_SUPPORTED_GRUU        (1 << 4)
+#define F_SUPPORTED_OUTBOUND    (1 << 5)
 
 #define SUPPORTED_PATH_STR		"path"
 #define SUPPORTED_PATH_LEN		(sizeof(SUPPORTED_PATH_STR)-1)
@@ -65,6 +66,10 @@
 #define SUPPORTED_GRUU_STR		"gruu"
 #define SUPPORTED_GRUU_LEN		(sizeof(SUPPORTED_GRUU_STR)-1)
 
+/* RFC 5626 */
+#define SUPPORTED_OUTBOUND_STR	"outbound"
+#define SUPPORTED_OUTBOUND_LEN	(sizeof(SUPPORTED_OUTBOUND_STR)-1)
+
 #define get_supported(p_msg) \
 	((p_msg)->supported ? ((struct supported_body*)(p_msg)->supported->parsed)->supported_all : 0)