diff options
Diffstat (limited to 'pjsip')
-rw-r--r-- | pjsip/include/pjsip/sip_msg.h | 19 | ||||
-rw-r--r-- | pjsip/src/pjsip/sip_msg.c | 19 |
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) { |