Browse Source

parser directory cleanup

Jan Janak 23 years ago
parent
commit
34af87afae
8 changed files with 13 additions and 19 deletions
  1. 1 1
      forward.c
  2. 1 1
      modules/tm/t_reply.c
  3. 1 1
      parser/msg_parser.c
  4. 0 3
      parser/parse_fline.c
  5. 3 3
      parser/parse_fline.h
  6. 4 4
      parser/parse_via.c
  7. 0 3
      parser/parse_via.h
  8. 3 3
      receive.c

+ 1 - 1
forward.c

@@ -228,7 +228,7 @@ int forward_reply(struct sip_msg* msg)
 	}
 	
 	/* we have to forward the reply stateless, so we need second via -bogdan*/
-	if ((msg->via2==0) || (msg->via2->error!=VIA_PARSE_OK))
+	if ((msg->via2==0) || (msg->via2->error!=PARSE_OK))
 	{
 		/* no second via => error */
 		LOG(L_ERR, "ERROR: forward_msg: no 2nd via found in reply\n");

+ 1 - 1
modules/tm/t_reply.c

@@ -246,7 +246,7 @@ int t_on_reply( struct sip_msg  *p_msg )
 	}
 
 	/* do we have via2 ? - maybe we'll need it for forwarding -bogdan*/
-	if ((p_msg->via2==0) || (p_msg->via2->error!=VIA_PARSE_OK)){
+	if ((p_msg->via2==0) || (p_msg->via2->error!=PARSE_OK)){
 		/* no second via => error */
 		LOG(L_ERR, "ERROR: t_on_reply: no 2nd via found in reply\n");
 		goto error;

+ 1 - 1
parser/msg_parser.c

@@ -66,7 +66,7 @@ char* get_hdr_field(char* buf, char* end, struct hdr_field* hdr)
 			memset(vb,0,sizeof(struct via_body));
 			hdr->body.s=tmp;
 			tmp=parse_via(tmp, end, vb);
-			if (vb->error==VIA_PARSE_ERROR){
+			if (vb->error==PARSE_ERROR){
 				LOG(L_ERR, "ERROR: get_hdr_field: bad via\n");
 				pkg_free(vb);
 				goto error;

+ 0 - 3
parser/parse_fline.c

@@ -5,14 +5,11 @@
  * 
  */
 
-
-
 #include "../dprint.h"
 #include "msg_parser.h"
 #include "parser_f.h"
 #include "../mem/mem.h"
 
-
 /* grammar:
 	request  =  method SP uri SP version CRLF
 	response =  version SP status  SP reason  CRLF

+ 3 - 3
parser/parse_fline.h

@@ -7,16 +7,15 @@
 
 #include "../str.h"
 
-/* Message is a request */
+/* Message is request */
 #define SIP_REQUEST 1
 
-/* Message is a reply */
+/* Message is reply */
 #define SIP_REPLY   2
 
 /* Invalid message */
 #define SIP_INVALID 0
 
-
 #define SIP_VERSION "SIP/2.0"
 #define SIP_VERSION_LEN 7
 
@@ -29,6 +28,7 @@
 #define ACK_LEN 3
 #define BYE_LEN 3
 
+
 struct msg_start {
 	int type;                         /* Type of the Message - Request/Response */
 	union {

+ 4 - 4
parser/parse_via.c

@@ -850,7 +850,7 @@ char* parse_via(char* buffer, char* end, struct via_body *vb)
 	struct via_param* param;
 
 parse_again:
-	vb->error=VIA_PARSE_ERROR;
+	vb->error=PARSE_ERROR;
 	/* parse start of via ( SIP/2.0/UDP    )*/
 	state=F_SIP;
 	for(tmp=buffer;tmp<end;tmp++){
@@ -1733,7 +1733,7 @@ endofpacket:
 	*/
 	/*DBG("parse_via: rest=<%s>\n", tmp);*/
 
-	vb->error=VIA_PARSE_OK;
+	vb->error=PARSE_OK;
 	vb->bsize=tmp-buffer;
 	if (vb->port_str.s){
 		vb->port=str2s((unsigned char*)vb->port_str.s, vb->port_str.len, &err);
@@ -1746,7 +1746,7 @@ endofpacket:
 	return tmp;
 nextvia:
 	DBG("parse_via: next_via\n");
-	vb->error=VIA_PARSE_OK;
+	vb->error=PARSE_OK;
 	vb->bsize=tmp-buffer;
 	if (vb->port_str.s){
 		vb->port=str2s((unsigned char*)vb->port_str.s, vb->port_str.len, &err);
@@ -1776,7 +1776,7 @@ error:
 	}else{
 		LOG(L_ERR, "ERROR: parse_via: via parse error\n");
 	}
-	vb->error=VIA_PARSE_ERROR;
+	vb->error=PARSE_ERROR;
 	return tmp;
 }
 

+ 0 - 3
parser/parse_via.h

@@ -7,9 +7,6 @@
 
 #include "../str.h"
 
-#define VIA_PARSE_OK	1
-#define VIA_PARSE_ERROR -1
-
 /* via param types
  * WARNING: keep in sync w/ FIN_*, GEN_PARAM and PARAM_ERROR from via_parse.c
  */

+ 3 - 3
receive.c

@@ -64,7 +64,7 @@ int receive_msg(char* buf, unsigned int len, union sockaddr_union* src_su)
 	DBG("After parse_msg...\n");
 	if (msg->first_line.type==SIP_REQUEST){
 		/* sanity checks */
-		if ((msg->via1==0) || (msg->via1->error!=VIA_PARSE_OK)){
+		if ((msg->via1==0) || (msg->via1->error!=PARSE_OK)){
 			/* no via, send back error ? */
 			LOG(L_ERR, "ERROR: receive_msg: no via found in request\n");
 			goto error;
@@ -97,13 +97,13 @@ int receive_msg(char* buf, unsigned int len, union sockaddr_union* src_su)
 #endif
 	}else if (msg->first_line.type==SIP_REPLY){
 		/* sanity checks */
-		if ((msg->via1==0) || (msg->via1->error!=VIA_PARSE_OK)){
+		if ((msg->via1==0) || (msg->via1->error!=PARSE_OK)){
 			/* no via, send back error ? */
 			LOG(L_ERR, "ERROR: receive_msg: no via found in reply\n");
 			goto error;
 		}
 #if 0
-		if ((msg->via2==0) || (msg->via2->error!=VIA_PARSE_OK)){
+		if ((msg->via2==0) || (msg->via2->error!=PARSE_OK)){
 			/* no second via => error? */
 			LOG(L_ERR, "ERROR: receive_msg: no 2nd via found in reply\n");
 			goto error;