summaryrefslogtreecommitdiff
path: root/pjsip
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2008-07-16 12:31:57 +0000
committerBenny Prijono <bennylp@teluu.com>2008-07-16 12:31:57 +0000
commitb0f713cdeec6602682f9bb7b2ae7bca1fd346859 (patch)
tree3406af4624d355af5ca3128bd31954518e4964ab /pjsip
parentc520cb042eb8bd38adf58f4b99031467ad237690 (diff)
Ticket #572: New PJSIP pjsip_msg_find_hdr_by_names() API to find SIP header by either header name or the short header name
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@2146 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip')
-rw-r--r--pjsip/include/pjsip/sip_msg.h19
-rw-r--r--pjsip/src/pjsip/sip_msg.c19
2 files changed, 38 insertions, 0 deletions
diff --git a/pjsip/include/pjsip/sip_msg.h b/pjsip/include/pjsip/sip_msg.h
index 791ae1a2..4b6d330b 100644
--- a/pjsip/include/pjsip/sip_msg.h
+++ b/pjsip/include/pjsip/sip_msg.h
@@ -788,6 +788,25 @@ PJ_DECL(void*) pjsip_msg_find_hdr_by_name( const pjsip_msg *msg,
const void *start);
/**
+ * Find a header in the message by its name and short name version.
+ *
+ * @param msg The message.
+ * @param name The header name to find.
+ * @param sname The short name version of the header name.
+ * @param start The first header field where the search should begin.
+ * If NULL is specified, then the search will begin from the
+ * first header, otherwise the search will begin at the
+ * specified header.
+ *
+ * @return The header field, or NULL if no header with the specified
+ * type is found.
+ */
+PJ_DECL(void*) pjsip_msg_find_hdr_by_names(const pjsip_msg *msg,
+ const pj_str_t *name,
+ const pj_str_t *sname,
+ const void *start);
+
+/**
* Find and remove a header in the message.
*
* @param msg The message.
diff --git a/pjsip/src/pjsip/sip_msg.c b/pjsip/src/pjsip/sip_msg.c
index 9ef2270e..9f15f831 100644
--- a/pjsip/src/pjsip/sip_msg.c
+++ b/pjsip/src/pjsip/sip_msg.c
@@ -361,6 +361,25 @@ PJ_DEF(void*) pjsip_msg_find_hdr_by_name( const pjsip_msg *msg,
return NULL;
}
+PJ_DEF(void*) pjsip_msg_find_hdr_by_names( const pjsip_msg *msg,
+ const pj_str_t *name,
+ const pj_str_t *sname,
+ const void *start)
+{
+ const pjsip_hdr *hdr=(const pjsip_hdr*)start, *end=&msg->hdr;
+
+ if (hdr == NULL) {
+ hdr = msg->hdr.next;
+ }
+ for (; hdr!=end; hdr = hdr->next) {
+ if (pj_stricmp(&hdr->name, name) == 0)
+ return (void*)hdr;
+ if (pj_stricmp(&hdr->name, sname) == 0)
+ return (void*)hdr;
+ }
+ return NULL;
+}
+
PJ_DEF(void*) pjsip_msg_find_remove_hdr( pjsip_msg *msg,
pjsip_hdr_e hdr_type, void *start)
{