Browse code

kcore: extended supported parser with eventlist

Daniel-Constantin Mierla authored on 05/01/2011 14:11:08
Showing 2 changed files
... ...
@@ -92,10 +92,19 @@ static inline int parse_supported_body(str *body, unsigned int *sup)
92 92
 				}
93 93
 				break;
94 94
 
95
-			/* unknown */
95
+			/* extra supported or unknown */
96 96
 			default:
97
-				/* skip element */
98
-				for (; pos < len && !IS_DELIM(p); ++pos, ++p);
97
+				if(pos+SUPPORTED_EVENTLIST_LEN<=len
98
+						&& strncasecmp(p, SUPPORTED_EVENTLIST_STR,
99
+							SUPPORTED_EVENTLIST_LEN)==0
100
+						&& IS_DELIM(p+9) ) {
101
+					*sup |= F_SUPPORTED_EVENTLIST;
102
+					pos += SUPPORTED_EVENTLIST_LEN + 1;
103
+					p   += SUPPORTED_EVENTLIST_LEN + 1;
104
+				} else {
105
+					/* skip element */
106
+					for (; pos < len && !IS_DELIM(p); ++pos, ++p);
107
+				}
99 108
 				break;
100 109
 		}
101 110
 	}
... ...
@@ -39,14 +39,15 @@
39 39
 #include "../../mem/mem.h"
40 40
 
41 41
 
42
-#define F_SUPPORTED_PATH	(1 << 0)
43
-#define F_SUPPORTED_100REL	(1 << 1)
44
-#define F_SUPPORTED_TIMER	(1 << 2)
42
+#define F_SUPPORTED_PATH		(1 << 0)
43
+#define F_SUPPORTED_100REL		(1 << 1)
44
+#define F_SUPPORTED_TIMER		(1 << 2)
45
+#define F_SUPPORTED_EVENTLIST   (1 << 3)
45 46
 
46 47
 #define SUPPORTED_PATH_STR		"path"
47 48
 #define SUPPORTED_PATH_LEN		(sizeof(SUPPORTED_PATH_STR)-1)
48 49
 
49
-/* RFC 3262 */
50
+/* RFC 3262 (PRACK) */
50 51
 #define SUPPORTED_100REL_STR	"100rel"
51 52
 #define SUPPORTED_100REL_LEN	(sizeof(SUPPORTED_100REL_STR)-1)
52 53
 
... ...
@@ -54,6 +55,9 @@
54 54
 #define SUPPORTED_TIMER_STR		"timer"
55 55
 #define SUPPORTED_TIMER_LEN		(sizeof(SUPPORTED_TIMER_STR)-1)
56 56
 
57
+/* RFC 4662 (RLS) */
58
+#define SUPPORTED_EVENTLIST_STR  "eventlist"
59
+#define SUPPORTED_EVENTLIST_LEN  (sizeof(SUPPORTED_EVENTLIST_STR)-1)
57 60
 
58 61
 #define get_supported(p_msg) \
59 62
 	((p_msg)->supported ? ((struct supported_body*)(p_msg)->supported->parsed)->supported_all : 0)