Commit 5befa386 authored by Pekka Pessi's avatar Pekka Pessi

sip: updated documentation of siptag_filter().

darcs-hash:20060925184735-65a35-cd31197f154f53498cb7b399f80f8f45c285e6cc.gz
parent 14e80cb1
......@@ -572,13 +572,6 @@ int sip_X_d(su_home_t *home, sip_header_t *h, char *s, int bsiz);
*/
int sip_X_e(char buf[], int bsiz, sip_header_t const *h, int flags);
/** @} */
/**@nodefgroup sip SIP Headers and Messages - "sip"
*
* SIP headers and messages.
*/
/**@defgroup sip_status_codes SIP Status Codes and Reason Phrases
*
* The macros and variables for the standard SIP status codes and reason
......
......@@ -97,21 +97,32 @@ tag_class_t sipmsgtag_class[1] =
/* tc_ref_set */ t_ptr_ref_set,
}};
/** Filter a SIP header structure. */
/** Filter a for SIP header tag.
*
* @param[in] dst tag list for filtering result. May be NULL.
* @param[in] f filter tag
* @param[in] src tag item from source list.
* @param[in,out] bb pointer to pointer of mempory area used to dup
* the filtering result
*
* This function is also used to calculate size for filtering result.
*/
tagi_t *siptag_filter(tagi_t *dst,
tagi_t const f[],
tagi_t const *src,
void **bb)
{
tagi_t stub[2] = {{ NULL }};
tag_type_t sctt, tt = f->t_tag;
tag_type_t srctt, tt = f->t_tag;
msg_hclass_t *hc = (msg_hclass_t *)tt->tt_magic;
assert(src);
sctt = src->t_tag;
srctt = src->t_tag;
if (sctt && sctt->tt_class == sipmsgtag_class) {
/* Match filtered header with a header from a SIP message */
if (srctt && srctt->tt_class == sipmsgtag_class) {
sip_t const *sip = (sip_t const *)src->t_value;
sip_header_t const **hh, *h;
......@@ -122,6 +133,7 @@ tagi_t *siptag_filter(tagi_t *dst,
msg_hclass_offset((msg_mclass_t *)sip->sip_common->h_class,
(msg_pub_t *)sip, hc);
/* Is header present in the SIP message? */
if ((char *)hh >= ((char *)sip + sip->sip_size) ||
(char *)hh < (char *)&sip->sip_request)
return dst;
......@@ -133,10 +145,10 @@ tagi_t *siptag_filter(tagi_t *dst,
stub[0].t_tag = tt;
stub[0].t_value = (tag_value_t)h;
src = stub; sctt = tt;
src = stub; srctt = tt;
}
if (tt != sctt)
if (tt != srctt)
return dst;
if (!src->t_value)
......@@ -152,7 +164,7 @@ tagi_t *siptag_filter(tagi_t *dst,
/** Add duplicates of headers from taglist to the SIP message. */
int sip_add_tl(msg_t *msg, sip_t *sip,
tag_type_t tag, tag_value_t value, ...)
tag_type_t tag, tag_value_t value, ...)
{
tagi_t const *t;
ta_list ta;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment