Browse code

core: parse_to_header() moved to parser/parse_to.{c,h}

- more convenient way of testing the validity of To header

Daniel-Constantin Mierla authored on 05/01/2011 15:23:44
Showing 3 changed files
... ...
@@ -840,3 +840,19 @@ void free_to(struct to_body* tb)
840 840
 	free_to_params(tb);
841 841
 	pkg_free(tb);
842 842
 }
843
+
844
+
845
+int parse_to_header(struct sip_msg *msg)
846
+{
847
+	if ( !msg->to && ( parse_headers(msg,HDR_TO_F,0)==-1 || !msg->to)) {
848
+		ERR("bad msg or missing TO header\n");
849
+		return -1;
850
+	}
851
+
852
+	// HDR_TO_T is automatically parsed (get_hdr_field in parser/msg_parser.c)
853
+	// so check only ptr validity
854
+	if (msg->to->parsed)
855
+		return 0;
856
+	else
857
+		return -1;
858
+}
... ...
@@ -69,5 +69,6 @@ void free_to_params(struct to_body* tb);
69 69
 
70 70
 void free_to(struct to_body* tb);
71 71
 
72
+int parse_to_header(struct sip_msg *msg);
72 73
 
73 74
 #endif
... ...
@@ -226,21 +226,6 @@ int select_##_name_##_params(str* res, select_t* s, struct sip_msg* msg) \
226 226
 	return 1; \
227 227
 } 
228 228
 
229
-int parse_to_header(struct sip_msg *msg)
230
-{
231
-	if ( !msg->to && ( parse_headers(msg,HDR_TO_F,0)==-1 || !msg->to)) {
232
-		ERR("bad msg or missing TO header\n");
233
-		return -1;
234
-	}
235
-
236
-	// HDR_TO_T is automatically parsed (get_hdr_field in parser/msg_parser.c)
237
-	// so check only ptr validity
238
-	if (msg->to->parsed)
239
-		return 0;
240
-	else
241
-		return -1;
242
-}
243
-
244 229
 SELECT_uri_header(to)
245 230
 SELECT_uri_header(from)
246 231
 SELECT_uri_header(refer_to)