[sr-dev] git:master: kcore: extended supported parser with eventlist

Daniel-Constantin Mierla miconda at gmail.com
Wed Jan 5 20:02:05 CET 2011


Module: sip-router
Branch: master
Commit: 6baa261b6494736034af8f5b90446237500eee79
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=6baa261b6494736034af8f5b90446237500eee79

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Wed Jan  5 15:11:08 2011 +0100

kcore: extended supported parser with eventlist

---

 lib/kcore/parse_supported.c |   15 ++++++++++++---
 lib/kcore/parse_supported.h |   12 ++++++++----
 2 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/lib/kcore/parse_supported.c b/lib/kcore/parse_supported.c
index e655d30..8720397 100644
--- a/lib/kcore/parse_supported.c
+++ b/lib/kcore/parse_supported.c
@@ -92,10 +92,19 @@ static inline int parse_supported_body(str *body, unsigned int *sup)
 				}
 				break;
 
-			/* unknown */
+			/* extra supported or unknown */
 			default:
-				/* skip element */
-				for (; pos < len && !IS_DELIM(p); ++pos, ++p);
+				if(pos+SUPPORTED_EVENTLIST_LEN<=len
+						&& strncasecmp(p, SUPPORTED_EVENTLIST_STR,
+							SUPPORTED_EVENTLIST_LEN)==0
+						&& IS_DELIM(p+9) ) {
+					*sup |= F_SUPPORTED_EVENTLIST;
+					pos += SUPPORTED_EVENTLIST_LEN + 1;
+					p   += SUPPORTED_EVENTLIST_LEN + 1;
+				} else {
+					/* skip element */
+					for (; pos < len && !IS_DELIM(p); ++pos, ++p);
+				}
 				break;
 		}
 	}
diff --git a/lib/kcore/parse_supported.h b/lib/kcore/parse_supported.h
index c618b8d..126f56e 100644
--- a/lib/kcore/parse_supported.h
+++ b/lib/kcore/parse_supported.h
@@ -39,14 +39,15 @@
 #include "../../mem/mem.h"
 
 
-#define F_SUPPORTED_PATH	(1 << 0)
-#define F_SUPPORTED_100REL	(1 << 1)
-#define F_SUPPORTED_TIMER	(1 << 2)
+#define F_SUPPORTED_PATH		(1 << 0)
+#define F_SUPPORTED_100REL		(1 << 1)
+#define F_SUPPORTED_TIMER		(1 << 2)
+#define F_SUPPORTED_EVENTLIST   (1 << 3)
 
 #define SUPPORTED_PATH_STR		"path"
 #define SUPPORTED_PATH_LEN		(sizeof(SUPPORTED_PATH_STR)-1)
 
-/* RFC 3262 */
+/* RFC 3262 (PRACK) */
 #define SUPPORTED_100REL_STR	"100rel"
 #define SUPPORTED_100REL_LEN	(sizeof(SUPPORTED_100REL_STR)-1)
 
@@ -54,6 +55,9 @@
 #define SUPPORTED_TIMER_STR		"timer"
 #define SUPPORTED_TIMER_LEN		(sizeof(SUPPORTED_TIMER_STR)-1)
 
+/* RFC 4662 (RLS) */
+#define SUPPORTED_EVENTLIST_STR  "eventlist"
+#define SUPPORTED_EVENTLIST_LEN  (sizeof(SUPPORTED_EVENTLIST_STR)-1)
 
 #define get_supported(p_msg) \
 	((p_msg)->supported ? ((struct supported_body*)(p_msg)->supported->parsed)->supported_all : 0)




More information about the sr-dev mailing list