Quellcode durchsuchen

- conflicting identifiers fixed in parse_methods
- Added Allow header field parser, implemented by Juha Heinanen

Jan Janak vor 21 Jahren
Ursprung
Commit
f3650067a1
3 geänderte Dateien mit 30 neuen und 28 gelöschten Zeilen
  1. 2 0
      parser/hf.c
  2. 14 14
      parser/parse_methods.c
  3. 14 14
      parser/parse_methods.h

+ 2 - 0
parser/hf.c

@@ -45,6 +45,7 @@
 #include "parse_rr.h"
 #include "contact/parse_contact.h"
 #include "parse_disposition.h"
+#include "parse_allow.h"
 #include "../ut.h"
 
 
@@ -118,6 +119,7 @@ void clean_hdr_field(struct hdr_field* hf)
 			break;
 
 		case HDR_ALLOW:
+			free_allow((unsigned int**)(&(hf->parsed)));
 			break;
 
 		case HDR_EVENT:

+ 14 - 14
parser/parse_methods.c

@@ -65,7 +65,7 @@ static int parse_method(str* _next, unsigned int* _method)
 	 case 'A':
 	 case 'a':
 		 if ((_next->len > 2) && !strncasecmp(_next->s + 1, "ck", 2)) {
- 			*_method = METHOD_ACK;
+ 			*_method = METH_ACK;
  			_next->len -= 3;
  			_next->s += 3;
  			return 1;
@@ -76,7 +76,7 @@ static int parse_method(str* _next, unsigned int* _method)
  	case 'B':
  	case 'b':
  		if ((_next->len > 2) && !strncasecmp(_next->s + 1, "ye", 2)) {
- 			*_method = METHOD_BYE;
+ 			*_method = METH_BYE;
  			_next->len -= 3;
  			_next->s += 3;
  			return 1;
@@ -87,7 +87,7 @@ static int parse_method(str* _next, unsigned int* _method)
  	case 'C':
  	case 'c':
  		if ((_next->len > 5) && !strncasecmp(_next->s + 1, "ancel", 5)) {
- 			*_method = METHOD_CANCEL;
+ 			*_method = METH_CANCEL;
  			_next->len -= 6;
  			_next->s += 6;
  			return 1;
@@ -100,14 +100,14 @@ static int parse_method(str* _next, unsigned int* _method)
  		if ((_next->len > 3) &&
  		    ((*(_next->s + 1) == 'N') || (*(_next->s + 1) == 'n'))) {
  			if (!strncasecmp(_next->s + 2, "fo", 2)) {
- 				*_method = METHOD_INFO;
+ 				*_method = METH_INFO;
  				_next->len -= 4;
  				_next->s += 4;
  				return 1;
  			}
 
  			if ((_next->len > 5) && !strncasecmp(_next->s + 2, "vite", 4)) {
- 				*_method = METHOD_INVITE;
+ 				*_method = METH_INVITE;
  				_next->len -= 6;
  				_next->s += 6;
  				return 1;
@@ -118,7 +118,7 @@ static int parse_method(str* _next, unsigned int* _method)
  	case 'M':
  	case 'm':
  		if ((_next->len > 6) && !strncasecmp(_next->s + 1, "essage", 6)) {
- 			*_method = METHOD_MESSAGE;
+ 			*_method = METH_MESSAGE;
  			_next->len -= 7;
  			_next->s += 7;
  			return 1;
@@ -129,7 +129,7 @@ static int parse_method(str* _next, unsigned int* _method)
  	case 'N':
  	case 'n':
  		if ((_next->len > 5) && !strncasecmp(_next->s + 1, "otify", 5)) {
- 			*_method = METHOD_NOTIFY;
+ 			*_method = METH_NOTIFY;
  			_next->len -= 6;
  			_next->s += 6;
  			return 1;
@@ -140,7 +140,7 @@ static int parse_method(str* _next, unsigned int* _method)
  	case 'O':
  	case 'o':
  		if ((_next->len > 6) && !strncasecmp(_next->s + 1, "ptions", 6)) {
- 			*_method = METHOD_OPTIONS;
+ 			*_method = METH_OPTIONS;
  			_next->len -= 7;
  			_next->s += 7;
  			return 1;
@@ -151,7 +151,7 @@ static int parse_method(str* _next, unsigned int* _method)
  	case 'P':
  	case 'p':
  		if ((_next->len > 4) && !strncasecmp(_next->s + 1, "rack", 4)) {
- 			*_method = METHOD_PRACK;
+ 			*_method = METH_PRACK;
  			_next->len -= 5;
  			_next->s += 5;
  			return 1;
@@ -164,14 +164,14 @@ static int parse_method(str* _next, unsigned int* _method)
  		if ((_next->len > 4) &&
  		    ((*(_next->s + 1) == 'E') || (*(_next->s + 1) == 'e'))) {
  			if (!strncasecmp(_next->s + 2, "fer", 3)) {
- 				*_method = METHOD_REFER;
+ 				*_method = METH_REFER;
  				_next->len -= 5;
  				_next->s += 5;
  				return 1;
  			}
 
  			if ((_next->len > 7) && !strncasecmp(_next->s + 2, "gister", 6)) {
- 				*_method = METHOD_REGISTER;
+ 				*_method = METH_REGISTER;
  				_next->len -= 8;
  				_next->s += 8;
  				return 1;
@@ -182,7 +182,7 @@ static int parse_method(str* _next, unsigned int* _method)
  	case 'S':
  	case 's':
  		if ((_next->len > 8) && !strncasecmp(_next->s + 1, "ubscribe", 8)) {
- 			*_method = METHOD_SUBSCRIBE;
+ 			*_method = METH_SUBSCRIBE;
  			_next->len -= 9;
  			_next->s += 9;
  			return 1;
@@ -193,7 +193,7 @@ static int parse_method(str* _next, unsigned int* _method)
  	case 'U':
  	case 'u':
  		if ((_next->len > 5) && !strncasecmp(_next->s + 1, "pdate", 5)) {
- 			*_method = METHOD_UPDATE;
+ 			*_method = METH_UPDATE;
  			_next->len -= 6;
  			_next->s += 6;
  			return 1;
@@ -211,7 +211,7 @@ static int parse_method(str* _next, unsigned int* _method)
  			_next->s++;
  			_next->len--;
  		} while (_next->len && token_char(*(_next->s)));
- 		*_method = METHOD_UNKNOWN;
+ 		*_method = METH_UNKNOWN;
  		return 1;
  	} else {
  		return 0;

+ 14 - 14
parser/parse_methods.h

@@ -34,20 +34,20 @@
  * Methods found in methods Contact parameter or Allow header.
  */
 enum method {
-	METHOD_UNKNOWN = 1, 
-	METHOD_ACK = 2, 
-	METHOD_BYE = 4, 
-	METHOD_CANCEL = 8,
-	METHOD_INFO = 16, 
-	METHOD_INVITE = 32, 
-	METHOD_NOTIFY = 64,
-	METHOD_OPTIONS = 128, 
-	METHOD_PRACK = 256, 
-	METHOD_REGISTER  = 512,
-	METHOD_SUBSCRIBE = 1024, 
-	METHOD_UPDATE = 2048, 
-	METHOD_MESSAGE = 4096,
-	METHOD_REFER = 8192
+	METH_UNKNOWN = 1, 
+	METH_ACK = 2, 
+	METH_BYE = 4, 
+	METH_CANCEL = 8,
+	METH_INFO = 16, 
+	METH_INVITE = 32, 
+	METH_NOTIFY = 64,
+	METH_OPTIONS = 128, 
+	METH_PRACK = 256, 
+	METH_REGISTER  = 512,
+	METH_SUBSCRIBE = 1024, 
+	METH_UPDATE = 2048, 
+	METH_MESSAGE = 4096,
+	METH_REFER = 8192
 };