Browse code

- added branch meber to via_body - added free_via_param_list

Andrei Pelinescu-Onciul authored on 26/11/2001 19:32:07
Showing 3 changed files
... ...
@@ -869,12 +869,25 @@ void free_uri(struct sip_uri* u)
869 869
 
870 870
 
871 871
 
872
+void free_via_param_list(struct via_param* vp)
873
+{
874
+	struct via_param* foo;
875
+	while(vp){
876
+		foo=vp;
877
+		vp=vp->next;
878
+		pkg_free(foo);
879
+	}
880
+}
881
+
882
+
883
+
872 884
 void free_via_list(struct via_body* vb)
873 885
 {
874 886
 	struct via_body* foo;
875 887
 	while(vb){
876 888
 		foo=vb;
877 889
 		vb=vb->next;
890
+		if (foo->param_lst) free_via_param_list(foo->param_lst);
878 891
 		pkg_free(foo);
879 892
 	}
880 893
 }
... ...
@@ -112,9 +112,12 @@ struct via_body{  /* format: name/version/transport host:port;params comment */
112 112
 	str port_str;
113 113
 	str params;
114 114
 	str comment;
115
+	int bsize;    /* body size, not including hdr */
115 116
 	struct via_param* param_lst; /* list of parameters*/
116 117
 	struct via_param* last_param; /*last via parameter, internal use*/
117
-	int bsize;    /* body size, not including hdr */
118
+	/* shortcuts to "important" params*/
119
+	struct via_param* branch;
120
+	
118 121
 	struct via_body* next; /* pointer to next via body string if
119 122
 							  compact via or null */
120 123
 };
... ...
@@ -202,6 +205,7 @@ char* parse_via(char* buffer, char* end, struct via_body *vb);
202 205
 char* parse_cseq(char* buffer, char* end, struct cseq_body *cb);
203 206
 #endif
204 207
 
208
+void free_via_param_list(struct via_param *vp);
205 209
 void free_via_list(struct via_body *vb);
206 210
 void clean_hdr_field(struct hdr_field* hf);
207 211
 void free_hdr_field_lst(struct hdr_field* hf);
... ...
@@ -1572,6 +1572,8 @@ main_via:
1572 1572
 						if (vb->last_param)	vb->last_param->next=param;
1573 1573
 						else				vb->param_lst=param;
1574 1574
 						vb->last_param=param;
1575
+						if (param->type==PARAM_BRANCH)
1576
+							vb->branch=param;
1575 1577
 						
1576 1578
 						switch(state){
1577 1579
 							case L_PARAM: