Browse Source

display name marking introduced to To HF parser

Jiri Kuthan 21 years ago
parent
commit
9525362dc5
2 changed files with 13 additions and 6 deletions
  1. 11 5
      parser/parse_to.c
  2. 2 1
      parser/parse_to.h

+ 11 - 5
parser/parse_to.c

@@ -1,7 +1,7 @@
 /*
  * $Id$
  *
- * Copyright (C) 2001-2003 FhG Fokus
+ * Copyright (C) 2001-2003 Fhg Fokus
  *
  * This file is part of ser, a free SIP server.
  *
@@ -501,6 +501,8 @@ char* parse_to(char* buffer, char *end, struct to_body *to_b)
 	to_b->error=PARSE_OK;
 	to_b->uri.len = 0;
 	to_b->uri.s= 0;
+	to_b->display.len = 0;
+	to_b->display.s = 0;
 	foo=0;
 
 	for( tmp=buffer; tmp<end; tmp++)
@@ -624,9 +626,12 @@ char* parse_to(char* buffer, char *end, struct to_body *to_b)
 					case DISPLAY_QUOTED:
 						break;
 					case E_DISPLAY_QUOTED:
+						status = S_URI_ENCLOSED;
+						break;
 					case URI_OR_TOKEN:
 					case DISPLAY_TOKEN: 
 					case MAYBE_URI_END:
+						to_b->display.len=foo-to_b->display.s;
 						status = S_URI_ENCLOSED;
 						break;
 					case F_CRLF:
@@ -669,10 +674,12 @@ char* parse_to(char* buffer, char *end, struct to_body *to_b)
 				{
 					case START_TO:
 						to_b->body.s = tmp;
+						to_b->display.s = tmp;
 						status = DISPLAY_QUOTED;
 						break;
 					case DISPLAY_QUOTED:
 						status = E_DISPLAY_QUOTED;
+						to_b->display.len = tmp-to_b->display.s+1;
 						break;
 					case F_CRLF:
 					case F_LF:
@@ -717,7 +724,8 @@ char* parse_to(char* buffer, char *end, struct to_body *to_b)
 				{
 					case START_TO:
 						to_b->uri.s = to_b->body.s = tmp;
-						status = URI_OR_TOKEN;;
+						status = URI_OR_TOKEN;
+						to_b->display.s=tmp;
 						break;
 					case S_URI_ENCLOSED:
 						to_b->uri.s=tmp;
@@ -744,6 +752,7 @@ char* parse_to(char* buffer, char *end, struct to_body *to_b)
 	}/*for*/
 
 endofheader:
+	if (to_b->display.len==0) to_b->display.s=0;
 	status=saved_status;
 	DBG("end of header reached, state=%d\n", status);
 	/* check if error*/
@@ -779,6 +788,3 @@ void free_to(struct to_body* tb)
 	}
 	pkg_free(tb);
 }
-
-
-

+ 2 - 1
parser/parse_to.h

@@ -1,7 +1,7 @@
 /*
  * $Id$
  *
- * Copyright (C) 2001-2003 FhG Fokus
+ * Copyright (C) 2001-2003 Fhg Fokus
  *
  * This file is part of ser, a free SIP server.
  *
@@ -47,6 +47,7 @@ struct to_body{
 	int error;                    /* Error code */
 	str body;                     /* The whole header field body */
 	str uri;                      /* URI */
+	str display;				  /* Display Name */
 	str tag_value;                /* Value of tag */
 	struct to_param *param_lst;   /* Linked list of parameters */
 	struct to_param *last_param;  /* Last parameter in the list */