Module: sip-router
Branch: 3.1
Commit: e4b1dd72ae5afb0cdac78f75f92964382711a35b
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=e4b1dd7…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Wed Jan 5 16:23:44 2011 +0100
core: parse_to_header() moved to parser/parse_to.{c,h}
- more convenient way of testing the validity of To header
(cherry picked from commit 10e4fcf8a75208dc934f9cbc821f7c081e6c4994)
---
parser/parse_to.c | 16 ++++++++++++++++
parser/parse_to.h | 1 +
select_core.c | 15 ---------------
3 files changed, 17 insertions(+), 15 deletions(-)
diff --git a/parser/parse_to.c b/parser/parse_to.c
index 8bfdca7..bcd0bd0 100644
--- a/parser/parse_to.c
+++ b/parser/parse_to.c
@@ -840,3 +840,19 @@ void free_to(struct to_body* tb)
free_to_params(tb);
pkg_free(tb);
}
+
+
+int parse_to_header(struct sip_msg *msg)
+{
+ if ( !msg->to && ( parse_headers(msg,HDR_TO_F,0)==-1 || !msg->to)) {
+ ERR("bad msg or missing TO header\n");
+ return -1;
+ }
+
+ // HDR_TO_T is automatically parsed (get_hdr_field in parser/msg_parser.c)
+ // so check only ptr validity
+ if (msg->to->parsed)
+ return 0;
+ else
+ return -1;
+}
diff --git a/parser/parse_to.h b/parser/parse_to.h
index 22a95d6..0c79a08 100644
--- a/parser/parse_to.h
+++ b/parser/parse_to.h
@@ -69,5 +69,6 @@ void free_to_params(struct to_body* tb);
void free_to(struct to_body* tb);
+int parse_to_header(struct sip_msg *msg);
#endif
diff --git a/select_core.c b/select_core.c
index f8c668b..42f6aff 100644
--- a/select_core.c
+++ b/select_core.c
@@ -226,21 +226,6 @@ int select_##_name_##_params(str* res, select_t* s, struct sip_msg*
msg) \
return 1; \
}
-int parse_to_header(struct sip_msg *msg)
-{
- if ( !msg->to && ( parse_headers(msg,HDR_TO_F,0)==-1 || !msg->to)) {
- ERR("bad msg or missing TO header\n");
- return -1;
- }
-
- // HDR_TO_T is automatically parsed (get_hdr_field in parser/msg_parser.c)
- // so check only ptr validity
- if (msg->to->parsed)
- return 0;
- else
- return -1;
-}
-
SELECT_uri_header(to)
SELECT_uri_header(from)
SELECT_uri_header(refer_to)