Browse Source

Kamailio compatibility: Parse and store integer message id in cseq.

This patch modifies the CSeq header field parser. The new version of
the parser will also parse the method string and store an integer id
of the method string in the data structure representing cseq header
fields.
Jan Janak 16 years ago
parent
commit
ae232eca58
2 changed files with 8 additions and 0 deletions
  1. 7 0
      parser/parse_cseq.c
  2. 1 0
      parser/parse_cseq.h

+ 7 - 0
parser/parse_cseq.c

@@ -36,6 +36,7 @@
 #include "parser_f.h"  /* eat_space_end and so on */
 #include "parser_f.h"  /* eat_space_end and so on */
 #include "../dprint.h"
 #include "../dprint.h"
 #include "parse_def.h"
 #include "parse_def.h"
+#include "parse_methods.h"
 #include "../mem/mem.h"
 #include "../mem/mem.h"
 
 
 /*
 /*
@@ -72,6 +73,12 @@ char* parse_cseq(char *buf, char* end, struct cseq_body* cb)
 	t=m_end;
 	t=m_end;
 	cb->method.len=t-cb->method.s;
 	cb->method.len=t-cb->method.s;
 
 
+	/* Cache method id */
+	if (parse_method(&cb->method, &cb->method_id) == 0) {
+		LOG(L_ERR, "ERROR: parse_cseq: Cannot parse method string\n");
+		goto error;
+	}
+
 	/* there may be trailing LWS 
 	/* there may be trailing LWS 
 	 * (it was not my idea to put it in SIP; -jiri )
 	 * (it was not my idea to put it in SIP; -jiri )
 	 */
 	 */

+ 1 - 0
parser/parse_cseq.h

@@ -36,6 +36,7 @@ struct cseq_body{
 	int error;  /* Error code */
 	int error;  /* Error code */
 	str number; /* CSeq number */
 	str number; /* CSeq number */
 	str method; /* Associated method */
 	str method; /* Associated method */
+	unsigned int method_id; /* Associated method ID */
 };
 };