Browse code

core: relocate parse_contact_hader() to parser folder

Daniel-Constantin Mierla authored on 07/09/2021 08:42:39
Showing 3 changed files
... ...
@@ -228,7 +228,7 @@ int contact_iterator(contact_t** c, struct sip_msg* msg, contact_t* prev)
228 228
 }
229 229
 
230 230
 /**
231
- *
231
+ * Parse all contact headers
232 232
  */
233 233
 int parse_contact_headers(sip_msg_t *msg)
234 234
 {
... ...
@@ -254,3 +254,20 @@ int parse_contact_headers(sip_msg_t *msg)
254 254
 
255 255
 	return 0;
256 256
 }
257
+
258
+/**
259
+ * Parse first contact header
260
+ */
261
+int parse_contact_header(sip_msg_t *msg)
262
+{
263
+	if ( !msg->contact && ( parse_headers(msg,HDR_CONTACT_F,0)==-1
264
+				|| !msg->contact)) {
265
+		LM_DBG("bad msg or missing CONTACT header\n");
266
+		return -1;
267
+	}
268
+
269
+	if (msg->contact->parsed)
270
+		return 0;
271
+
272
+	return parse_contact(msg->contact);
273
+}
... ...
@@ -75,4 +75,9 @@ int contact_iterator(contact_t** c, struct sip_msg* msg, contact_t* prev);
75 75
  */
76 76
 int parse_contact_headers(sip_msg_t *msg);
77 77
 
78
+/*
79
+ * parse first Contact header
80
+ */
81
+int parse_contact_header(sip_msg_t *msg);
82
+
78 83
 #endif /* PARSE_CONTACT_H */
... ...
@@ -221,18 +221,6 @@ SELECT_uri_header(from)
221 221
 SELECT_uri_header(refer_to)
222 222
 SELECT_uri_header(rpid)
223 223
 
224
-int parse_contact_header( struct sip_msg *msg)
225
-{
226
-        if ( !msg->contact && ( parse_headers(msg,HDR_CONTACT_F,0)==-1 || !msg->contact)) {
227
-                LM_DBG("bad msg or missing CONTACT header\n");
228
-                return -1;
229
-        }
230
-
231
-        if (msg->contact->parsed)
232
-                return 0;
233
-
234
-	return parse_contact(msg->contact);
235
-}
236 224
 
237 225
 #define get_contact(msg) ((contact_body_t*)(msg->contact->parsed))
238 226