Browse code

display name marking introduced to To HF parser

Jiri Kuthan authored on 27/09/2004 04:02:25
Showing 2 changed files
... ...
@@ -1,7 +1,7 @@
1 1
 /*
2 2
  * $Id$
3 3
  *
4
- * Copyright (C) 2001-2003 FhG Fokus
4
+ * Copyright (C) 2001-2003 Fhg Fokus
5 5
  *
6 6
  * This file is part of ser, a free SIP server.
7 7
  *
... ...
@@ -501,6 +501,8 @@ char* parse_to(char* buffer, char *end, struct to_body *to_b)
501 501
 	to_b->error=PARSE_OK;
502 502
 	to_b->uri.len = 0;
503 503
 	to_b->uri.s= 0;
504
+	to_b->display.len = 0;
505
+	to_b->display.s = 0;
504 506
 	foo=0;
505 507
 
506 508
 	for( tmp=buffer; tmp<end; tmp++)
... ...
@@ -624,9 +626,12 @@ char* parse_to(char* buffer, char *end, struct to_body *to_b)
624 626
 					case DISPLAY_QUOTED:
625 627
 						break;
626 628
 					case E_DISPLAY_QUOTED:
629
+						status = S_URI_ENCLOSED;
630
+						break;
627 631
 					case URI_OR_TOKEN:
628 632
 					case DISPLAY_TOKEN: 
629 633
 					case MAYBE_URI_END:
634
+						to_b->display.len=foo-to_b->display.s;
630 635
 						status = S_URI_ENCLOSED;
631 636
 						break;
632 637
 					case F_CRLF:
... ...
@@ -669,10 +674,12 @@ char* parse_to(char* buffer, char *end, struct to_body *to_b)
669 674
 				{
670 675
 					case START_TO:
671 676
 						to_b->body.s = tmp;
677
+						to_b->display.s = tmp;
672 678
 						status = DISPLAY_QUOTED;
673 679
 						break;
674 680
 					case DISPLAY_QUOTED:
675 681
 						status = E_DISPLAY_QUOTED;
682
+						to_b->display.len = tmp-to_b->display.s+1;
676 683
 						break;
677 684
 					case F_CRLF:
678 685
 					case F_LF:
... ...
@@ -717,7 +724,8 @@ char* parse_to(char* buffer, char *end, struct to_body *to_b)
717 724
 				{
718 725
 					case START_TO:
719 726
 						to_b->uri.s = to_b->body.s = tmp;
720
-						status = URI_OR_TOKEN;;
727
+						status = URI_OR_TOKEN;
728
+						to_b->display.s=tmp;
721 729
 						break;
722 730
 					case S_URI_ENCLOSED:
723 731
 						to_b->uri.s=tmp;
... ...
@@ -744,6 +752,7 @@ char* parse_to(char* buffer, char *end, struct to_body *to_b)
744 752
 	}/*for*/
745 753
 
746 754
 endofheader:
755
+	if (to_b->display.len==0) to_b->display.s=0;
747 756
 	status=saved_status;
748 757
 	DBG("end of header reached, state=%d\n", status);
749 758
 	/* check if error*/
... ...
@@ -779,6 +788,3 @@ void free_to(struct to_body* tb)
779 788
 	}
780 789
 	pkg_free(tb);
781 790
 }
782
-
783
-
784
-
... ...
@@ -1,7 +1,7 @@
1 1
 /*
2 2
  * $Id$
3 3
  *
4
- * Copyright (C) 2001-2003 FhG Fokus
4
+ * Copyright (C) 2001-2003 Fhg Fokus
5 5
  *
6 6
  * This file is part of ser, a free SIP server.
7 7
  *
... ...
@@ -47,6 +47,7 @@ struct to_body{
47 47
 	int error;                    /* Error code */
48 48
 	str body;                     /* The whole header field body */
49 49
 	str uri;                      /* URI */
50
+	str display;				  /* Display Name */
50 51
 	str tag_value;                /* Value of tag */
51 52
 	struct to_param *param_lst;   /* Linked list of parameters */
52 53
 	struct to_param *last_param;  /* Last parameter in the list */