Commit 2256126f authored by Pekka Pessi's avatar Pekka Pessi

Cleaned up sip parser.

Renamed msg_name_addr_d/msg_name_addr_e as sip_name_addr_d/sip_name_addr_e
(because the function is sip-specific).
Not using old sip-specific parser macros.

darcs-hash:20051107203605-65a35-1fe6e6bcf8eea413f1333406e264c68fca28952b.gz
parent 867d38fc
......@@ -232,8 +232,7 @@
* @}
*/
/**@ingroup sip
* @defgroup sip_headers SIP Headers
/**@defgroup sip_headers SIP Headers
*
* SIP headers and other SIP message elements.
*
......@@ -540,15 +539,13 @@ int sip_X_e(char buf[], int bsiz, sip_header_t const *h, int flags);
* SIP headers and messages.
*/
/**@ingroup sip
* @defgroup sip_status_codes SIP Status Codes and Reason Phrases
/**@defgroup sip_status_codes SIP Status Codes and Reason Phrases
*
* This submodule contains macros and variables for the standard SIP status
* codes and reason phrases.
*/
/**@ingroup sip
* @defgroup sip_tag SIP Tags
/**@defgroup sip_tag SIP Tags
*
* SIP headers in tag item lists and tagged argument lists.
*
......
......@@ -646,7 +646,7 @@ struct sip_caller_prefs_s
unsigned cp_explicit : 1;
};
/**@ingroup sip-reason
/**@ingroup sip_reason
* @brief Structure for @b Reason header.
*/
struct sip_reason_s
......
This diff is collapsed.
......@@ -82,7 +82,7 @@
* {
* sip_common_t rd_common[1]; // Common fragment info
* sip_unknown_t *rd_next; // Link to next (dummy)
* sip_param_t *rd_items;
* msg_param_t *rd_items;
* } sip_request_disposition_t;
* @endcode
*/
......@@ -118,7 +118,7 @@ int sip_request_disposition_dup_xtra(sip_header_t const *h, int offset)
{
sip_request_disposition_t const *o = h->sh_request_disposition;
SIP_PARAMS_SIZE(offset, o->rd_items);
MSG_PARAMS_SIZE(offset, o->rd_items);
return offset;
}
......@@ -146,13 +146,13 @@ void sip_caller_prefs_update_one(sip_caller_prefs_t *cp, char const *p)
{
switch (p[0]) {
case 'e':
SIP_PARAM_MATCH_P(cp->cp_explicit, p, "explicit");
MSG_PARAM_MATCH_P(cp->cp_explicit, p, "explicit");
break;
case 'q':
SIP_PARAM_MATCH(cp->cp_q, p, "q");
MSG_PARAM_MATCH(cp->cp_q, p, "q");
break;
case 'r':
SIP_PARAM_MATCH_P(cp->cp_require, p, "require");
MSG_PARAM_MATCH_P(cp->cp_require, p, "require");
break;
}
}
......@@ -197,7 +197,7 @@ int sip_caller_prefs_add_param(su_home_t *home,
{
sip_fragment_clear(cp->cp_common);
if (sip_params_replace(home, (char const ***)&cp->cp_params, param) < 0)
if (msg_params_replace(home, (char const ***)&cp->cp_params, param) < 0)
return -1;
sip_caller_prefs_update_one(cp, param);
......@@ -262,7 +262,7 @@ int sip_caller_prefs_d(su_home_t *home, sip_header_t *h, char *s, int slen)
return -1;
}
/* Parse params (and ignore display name and url) */
else if (msg_name_addr_d(home, &s, &ignore, url, &cp->cp_params, NULL)
else if (sip_name_addr_d(home, &s, &ignore, url, &cp->cp_params, NULL)
== -1)
return -1;
/* Be liberal... */
......@@ -302,7 +302,7 @@ int sip_caller_prefs_dup_xtra(sip_header_t const *h, int offset)
int rv = offset;
sip_caller_prefs_t const *cp = h->sh_caller_prefs;
SIP_PARAMS_SIZE(rv, cp->cp_params);
MSG_PARAMS_SIZE(rv, cp->cp_params);
return rv;
}
......@@ -315,7 +315,7 @@ char *sip_caller_prefs_dup_one(sip_header_t *dst, sip_header_t const *src,
sip_caller_prefs_t *cp = dst->sh_caller_prefs;
sip_caller_prefs_t const *o = src->sh_caller_prefs;
b = sip_params_dup(&cp->cp_params, o->cp_params, b, xtra);
b = msg_params_dup(&cp->cp_params, o->cp_params, b, xtra);
assert(b <= end);
......@@ -375,8 +375,8 @@ char *sip_caller_prefs_dup_one(sip_header_t *dst, sip_header_t const *src,
* {
* sip_common_t cp_common[1]; // Common fragment info
* sip_caller_prefs_t *cp_next; // Link to next
* sip_param_t const *cp_params;
* sip_param_t cp_q; // Priority
* msg_param_t const *cp_params;
* msg_param_t cp_q; // Priority
* unsigned cp_require;
* unsigned cp_explicit;
* } sip_accept_contact_t, sip_reject_contact_t;
......@@ -409,8 +409,8 @@ int sip_accept_contact_e(char b[], int bsiz, sip_header_t const *h, int flags)
* {
* sip_common_t cp_common[1]; // Common fragment info
* sip_caller_prefs_t *cp_next; // Link to next
* sip_param_t const *cp_params;
* sip_param_t cp_q; // Priority
* msg_param_t const *cp_params;
* msg_param_t cp_q; // Priority
* unsigned cp_require;
* unsigned cp_explicit;
* } sip_reject_contact_t;
......
......@@ -76,8 +76,8 @@
* sip_common_t o_common; // Common fragment info
* sip_error_t *o_next; // Link to next (dummy)
* char const * o_type; // Event type
* sip_param_t const *o_params; // List of parameters
* sip_param_t o_id; // Event ID
* msg_param_t const *o_params; // List of parameters
* msg_param_t o_id; // Event ID
* } sip_event_t;
* @endcode
*/
......@@ -111,8 +111,8 @@ int sip_event_e(char b[], int bsiz, sip_header_t const *h, int f)
sip_event_t const *o = h->sh_event;
assert(sip_is_event(h));
SIP_STRING_E(b, end, o->o_type);
SIP_PARAMS_E(b, end, o->o_params, flags);
MSG_STRING_E(b, end, o->o_type);
MSG_PARAMS_E(b, end, o->o_params, flags);
return b - b0;
}
......@@ -121,8 +121,8 @@ int sip_event_dup_xtra(sip_header_t const *h, int offset)
{
sip_event_t const *o = h->sh_event;
SIP_PARAMS_SIZE(offset, o->o_params);
offset += SIP_STRING_SIZE(o->o_type);
MSG_PARAMS_SIZE(offset, o->o_params);
offset += MSG_STRING_SIZE(o->o_type);
return offset;
}
......@@ -135,8 +135,8 @@ char *sip_event_dup_one(sip_header_t *dst, sip_header_t const *src,
sip_event_t const *o_src = src->sh_event;
char *end = b + xtra;
b = sip_params_dup(&o_dst->o_params, o_src->o_params, b, xtra);
SIP_STRING_DUP(b, o_dst->o_type, o_src->o_type);
b = msg_params_dup(&o_dst->o_params, o_src->o_params, b, xtra);
MSG_STRING_DUP(b, o_dst->o_type, o_src->o_type);
if (o_dst->o_params)
sip_event_update(o_dst);
assert(b <= end);
......@@ -208,7 +208,7 @@ int sip_allow_events_add(su_home_t *home,
e = su_strdup(home, e);
if (!e)
return -1;
return msg_params_replace(home, (sip_param_t **)&ae->k_items, e);
return msg_params_replace(home, (msg_param_t **)&ae->k_items, e);
}
/* ====================================================================== */
......@@ -248,10 +248,10 @@ int sip_allow_events_add(su_home_t *home,
* sip_common_t ss_common[1];
* sip_unknown_t *ss_next;
* char const *ss_substate; // State value
* sip_param_t const *ss_params; // List of parameters
* sip_param_t ss_reason; // Value of reason parameter
* sip_param_t ss_expires; // Value of expires parameter
* sip_param_t ss_retry_after; // Value of retry-after parameter
* msg_param_t const *ss_params; // List of parameters
* msg_param_t ss_reason; // Value of reason parameter
* msg_param_t ss_expires; // Value of expires parameter
* msg_param_t ss_retry_after; // Value of retry-after parameter
* } sip_subscription_state_t;
* @endcode
*/
......@@ -296,8 +296,8 @@ int sip_subscription_state_e(char b[], int bsiz, sip_header_t const *h, int flag
assert(sip_is_subscription_state(h));
SIP_STRING_E(b, end, ss->ss_substate);
SIP_PARAMS_E(b, end, ss->ss_params, flags);
MSG_STRING_E(b, end, ss->ss_substate);
MSG_PARAMS_E(b, end, ss->ss_params, flags);
return b - b0;
}
......@@ -307,8 +307,8 @@ int sip_subscription_state_dup_xtra(sip_header_t const *h, int offset)
sip_subscription_state_t const *ss = h->sh_subscription_state;
/* Calculates memory size occupied */
SIP_PARAMS_SIZE(offset, ss->ss_params);
offset += SIP_STRING_SIZE(ss->ss_substate);
MSG_PARAMS_SIZE(offset, ss->ss_params);
offset += MSG_STRING_SIZE(ss->ss_substate);
return offset;
}
......@@ -321,8 +321,8 @@ char *sip_subscription_state_dup_one(sip_header_t *dst, sip_header_t const *src,
sip_subscription_state_t const *ss_src = src->sh_subscription_state;
char *end = b + xtra;
b = sip_params_dup(&ss_dst->ss_params, ss_src->ss_params, b, xtra);
SIP_STRING_DUP(b, ss_dst->ss_substate, ss_src->ss_substate);
b = msg_params_dup(&ss_dst->ss_params, ss_src->ss_params, b, xtra);
MSG_STRING_DUP(b, ss_dst->ss_substate, ss_src->ss_substate);
if (ss_dst->ss_params)
sip_subscription_state_update(dst);
......@@ -341,12 +341,12 @@ sip_subscription_state_param_update(sip_subscription_state_t *ss,
switch(p[0]) {
case 'r':
if (strncasecmp(p, "reason", 6) == 0)
SIP_PARAM_MATCH(ss->ss_reason, p, "reason");
MSG_PARAM_MATCH(ss->ss_reason, p, "reason");
else if (strncasecmp(p, "retry-after", 11) == 0)
SIP_PARAM_MATCH(ss->ss_retry_after, p, "retry-after");
MSG_PARAM_MATCH(ss->ss_retry_after, p, "retry-after");
break;
case 'e':
SIP_PARAM_MATCH(ss->ss_expires, p, "expires");
MSG_PARAM_MATCH(ss->ss_expires, p, "expires");
break;
}
......@@ -395,9 +395,9 @@ struct sip_publication_s
sip_common_t pub_common; /**< Common fragment info */
sip_error_t *pub_next; /**< Link to next (dummy) */
char const * pub_package; /**< Publication packaage */
sip_param_t const *pub_params; /**< List of parameters */
sip_param_t pub_type; /**< Publication type */
sip_param_t pub_stream; /**< Publication stream */
msg_param_t const *pub_params; /**< List of parameters */
msg_param_t pub_type; /**< Publication type */
msg_param_t pub_stream; /**< Publication stream */
};
static msg_xtra_f sip_publication_dup_xtra;
......@@ -431,8 +431,8 @@ int sip_publication_e(char b[], int bsiz, sip_header_t const *h, int f)
sip_publication_t const *pub = h->sh_publication;
assert(sip_is_publication(h));
SIP_STRING_E(b, end, pub->pub_package);
SIP_PARAMS_E(b, end, pub->pub_params, flags);
MSG_STRING_E(b, end, pub->pub_package);
MSG_PARAMS_E(b, end, pub->pub_params, flags);
return b - b0;
}
......@@ -441,8 +441,8 @@ int sip_publication_dup_xtra(sip_header_t const *h, int offset)
{
sip_publication_t const *pub = h->sh_publication;
SIP_PARAMS_SIZE(offset, pub->pub_params);
offset += SIP_STRING_SIZE(pub->pub_package);
MSG_PARAMS_SIZE(offset, pub->pub_params);
offset += MSG_STRING_SIZE(pub->pub_package);
return offset;
}
......@@ -455,8 +455,8 @@ char *sip_publication_dup_one(sip_header_t *dst, sip_header_t const *src,
sip_publication_t const *pub_src = src->sh_publication;
char *end = b + xtra;
b = sip_params_dup(&pub_dst->pub_params, pub_src->pub_params, b, xtra);
SIP_STRING_DUP(b, pub_dst->pub_package, pub_src->pub_package);
b = msg_params_dup(&pub_dst->pub_params, pub_src->pub_params, b, xtra);
MSG_STRING_DUP(b, pub_dst->pub_package, pub_src->pub_package);
if (pub_dst->pub_params)
sip_publication_update(pub_dst);
assert(b <= end);
......@@ -514,7 +514,7 @@ int sip_allow_publications_add(su_home_t *home,
e = su_strdup(home, e);
if (!e)
return -1;
return msg_params_replace(home, (sip_param_t **)&ae->k_items, e);
return msg_params_replace(home, (msg_param_t **)&ae->k_items, e);
}
#endif
......@@ -74,8 +74,8 @@
* sip_common_t ci_common[1]; // Common fragment info
* sip_call_info_t *ci_next; // Link to next Call-Info
* url_t ci_url[1]; // URI to call info
* sip_param_t const *ci_params; // List of parameters
* sip_param_t ci_purpose; // Value of @b purpose parameter
* msg_param_t const *ci_params; // List of parameters
* msg_param_t ci_purpose; // Value of @b purpose parameter
* };
* @endcode
*/
......@@ -141,7 +141,7 @@ void sip_call_info_update(sip_header_t *h)
{
if (h->sh_call_info->ci_params)
h->sh_call_info->ci_purpose =
sip_params_find(h->sh_call_info->ci_params, "purpose=");
msg_params_find(h->sh_call_info->ci_params, "purpose=");
}
/* ====================================================================== */
......@@ -171,7 +171,7 @@ void sip_call_info_update(sip_header_t *h)
* sip_common_t ei_common[1]; // Common fragment info
* sip_error_info_t *ei_next; // Link to next Error-Info
* url_t ei_url[1]; // URI to error info
* sip_param_t const *ei_params; // List of parameters
* msg_param_t const *ei_params; // List of parameters
* };
* @endcode
*/
......@@ -396,10 +396,10 @@ int sip_timestamp_e(char b[], int bsiz, sip_header_t const *h, int f)
assert(sip_timestamp_p(h));
SIP_STRING_E(b, end, ts->ts_stamp);
MSG_STRING_E(b, end, ts->ts_stamp);
if (ts->ts_delay) {
SIP_CHAR_E(b, end, ' ');
SIP_STRING_E(b, end, ts->ts_delay);
MSG_CHAR_E(b, end, ' ');
MSG_STRING_E(b, end, ts->ts_delay);
}
MSG_TERM_E(b, end);
......@@ -412,8 +412,8 @@ int sip_timestamp_dup_xtra(sip_header_t const *h, int offset)
int rv = offset;
sip_timestamp_t const *ts = h->sh_timestamp;
rv += SIP_STRING_SIZE(ts->ts_stamp);
rv += SIP_STRING_SIZE(ts->ts_delay);
rv += MSG_STRING_SIZE(ts->ts_stamp);
rv += MSG_STRING_SIZE(ts->ts_delay);
return rv;
}
......@@ -427,8 +427,8 @@ char *sip_timestamp_dup_one(sip_header_t *dst,
sip_timestamp_t const *o = src->sh_timestamp;
char *end = b + xtra;
SIP_STRING_DUP(b, ts->ts_stamp, o->ts_stamp);
SIP_STRING_DUP(b, ts->ts_delay, o->ts_delay);
MSG_STRING_DUP(b, ts->ts_stamp, o->ts_stamp);
MSG_STRING_DUP(b, ts->ts_delay, o->ts_delay);
assert(b <= end);
......@@ -560,7 +560,7 @@ int sip_info_dup_xtra(sip_header_t const *h, int offset)
int rv = offset;
sip_call_info_t const *ci = h->sh_call_info;
SIP_PARAMS_SIZE(rv, ci->ci_params);
MSG_PARAMS_SIZE(rv, ci->ci_params);
rv += url_xtra(ci->ci_url);
return rv;
......@@ -575,7 +575,7 @@ char *sip_info_dup_one(sip_header_t *dst,
sip_call_info_t const *o = src->sh_call_info;
char *end = b + xtra;
b = sip_params_dup(&ci->ci_params, o->ci_params, b, xtra);
b = msg_params_dup(&ci->ci_params, o->ci_params, b, xtra);
URL_DUP(b, end, ci->ci_url, o->ci_url);
assert(b <= end);
......
......@@ -337,10 +337,10 @@ sip_has_unsupported_any(su_home_t *home,
{
int i, j;
sip_unsupported_t *unsupported = NULL;
sip_param_t const empty[1] = { NULL };
sip_param_t const *slist = empty;
sip_param_t const *rlist = empty;
sip_param_t const *prlist = empty;
msg_param_t const empty[1] = { NULL };
msg_param_t const *slist = empty;
msg_param_t const *rlist = empty;
msg_param_t const *prlist = empty;
if (require2 == NULL)
require2 = require3, require3 = NULL;
......@@ -356,7 +356,7 @@ sip_has_unsupported_any(su_home_t *home,
prlist = by_proxy_require->k_items;
for (i = 0; require->k_items && require->k_items[i];) {
sip_param_t feature = require->k_items[i++];
msg_param_t feature = require->k_items[i++];
for (j = 0; slist[j]; j++)
if (strcasecmp(feature, slist[j]) == 0) {
......@@ -383,7 +383,7 @@ sip_has_unsupported_any(su_home_t *home,
if (unsupported == NULL)
unsupported = sip_unsupported_make(home, feature);
else
sip_params_add(home,
msg_params_add(home,
(msg_param_t **)&unsupported->k_items,
feature);
}
......@@ -452,7 +452,7 @@ int sip_has_supported(sip_supported_t const *supported, char const *feature)
* sip_path_t *r_next; // Link to next Path
* char const *r_display; // Display name
* url_t r_url[1]; // Path URL
* sip_param_t const *r_params; // List of parameters
* msg_param_t const *r_params; // List of parameters
* } sip_path_t;
* @endcode
*/
......@@ -507,7 +507,7 @@ int sip_path_e(char b[], int bsiz, sip_header_t const *h, int flags)
* sip_service_route_t*r_next; // Link to next Service-Route
* char const *r_display; // Display name
* url_t r_url[1]; // Service-Route URL
* sip_param_t const *r_params; // List of parameters
* msg_param_t const *r_params; // List of parameters
* } sip_service_route_t;
* @endcode
*/
......
......@@ -75,12 +75,7 @@ sip_header_t *sip_header_d(su_home_t *home, msg_t const *msg, char const *b)
/** Encode a SIP header. */
int sip_header_e(char b[], int bsiz, sip_header_t const *h, int flags)
{
return msg_header_e(b, bsiz, h, flags);
}
int sip_e(sip_t const *sip, int flags, char b[], int size)
{
return msg_object_e(b, size, sip, flags);
return msg_header_e(b, bsiz, (msg_header_t const *)h, flags);
}
sip_header_t *sip_header_format(su_home_t *home,
......@@ -100,24 +95,12 @@ sip_header_t *sip_header_format(su_home_t *home,
return h;
}
/** Serialize headers into the fragment chain. */
int sip_serialize(msg_t *msg, sip_t *sip)
{
return msg_serialize(msg, sip);
}
/** Copy a complete message, keeping the header chain structure. */
int sip_copy_all(msg_t *msg, sip_t *dst, sip_t const *src)
{
return msg_copy_all(msg, dst, src);
}
/** Add a duplicate of header object to a SIP message. */
int sip_add_dup(msg_t *msg,
sip_t *sip,
sip_header_t const *o)
{
return msg_header_add_dup(msg, sip, o);
return msg_header_add_dup(msg, (msg_pub_t *)sip, o);
}
int sip_add_dup_as(msg_t *msg,
......@@ -125,7 +108,7 @@ int sip_add_dup_as(msg_t *msg,
msg_hclass_t *hc,
sip_header_t const *o)
{
return msg_header_add_dup_as(msg, sip, hc, o);
return msg_header_add_dup_as(msg, (msg_pub_t *)sip, hc, o);
}
int sip_add_make(msg_t *msg,
......@@ -135,19 +118,3 @@ int sip_add_make(msg_t *msg,
{
return msg_header_add_make(msg, sip, hc, s);
}
/** Add duplicates of headers to the SIP message. */
int sip_add_headers(msg_t *msg, sip_t *sip,
void const *extra, va_list headers)
{
for (;
extra;
extra = va_arg(headers, void *)) {
if (extra != SIP_NONE)
if (sip_add_dup(msg, sip, extra) < 0) {
return -1;
}
}
return 0;
}
......@@ -81,8 +81,8 @@
* sip_accept_t *ac_next; // Pointer to next Accept header
* char const *ac_type; // Pointer to type/subtype
* char const *ac_subtype; // Points after first slash in type
* sip_param_t const *ac_params; // List of parameters
* sip_param_t ac_q; // Value of q parameter
* msg_param_t const *ac_params; // List of parameters
* msg_param_t ac_q; // Value of q parameter
* } sip_accept_t;
* @endcode
*/
......@@ -168,8 +168,8 @@ int sip_accept_disposition_e(char b[], int bsiz, sip_header_t const *h, int flag
char *b0 = b, *end = b + bsiz;
sip_accept_disposition_t const *ad = h->sh_accept_disposition;
SIP_STRING_E(b, end, ad->ad_type);
SIP_PARAMS_E(b, end, ad->ad_params, flags);
MSG_STRING_E(b, end, ad->ad_type);
MSG_PARAMS_E(b, end, ad->ad_params, flags);
MSG_TERM_E(b, end);
return b - b0;
......@@ -386,8 +386,8 @@ int sip_content_disposition_e(char b[], int bsiz, sip_header_t const *h, int f)
char *b0 = b, *end = b + bsiz;
sip_content_disposition_t const *cd = h->sh_content_disposition;
SIP_STRING_E(b, end, cd->cd_type);
SIP_PARAMS_E(b, end, cd->cd_params, f);
MSG_STRING_E(b, end, cd->cd_type);
MSG_PARAMS_E(b, end, cd->cd_params, f);
MSG_TERM_E(b, end);
......@@ -400,8 +400,8 @@ int sip_content_disposition_dup_xtra(sip_header_t const *h, int offset)
int rv = offset;
sip_content_disposition_t const *cd = h->sh_content_disposition;
SIP_PARAMS_SIZE(rv, cd->cd_params);
rv += SIP_STRING_SIZE(cd->cd_type);
MSG_PARAMS_SIZE(rv, cd->cd_params);
rv += MSG_STRING_SIZE(cd->cd_type);
return rv;
}
......@@ -416,8 +416,8 @@ char *sip_content_disposition_dup_one(sip_header_t *dst,
sip_content_disposition_t const *o = src->sh_content_disposition;
char *end = b + xtra;
b = sip_params_dup(&cd->cd_params, o->cd_params, b, xtra);
SIP_STRING_DUP(b, cd->cd_type, o->cd_type);
b = msg_params_dup(&cd->cd_params, o->cd_params, b, xtra);
MSG_STRING_DUP(b, cd->cd_type, o->cd_type);
if (cd->cd_params)
sip_content_disposition_update(dst->sh_content_disposition);
......@@ -430,7 +430,7 @@ char *sip_content_disposition_dup_one(sip_header_t *dst,
static void sip_content_disposition_update(sip_content_disposition_t *cd)
{
int i;
sip_param_t h;
msg_param_t h;
/* cd->cd_action = NULL, cd->cd_store = 0, cd->cd_remove = 0; */
cd->cd_handling = NULL, cd->cd_required = 0, cd->cd_optional = 0;
......@@ -585,7 +585,7 @@ int sip_content_language_e(char b[], int bsiz, sip_header_t const *h, int f)
* sip_unknown_t *c_next; // Dummy link to next
* char const *c_type; // Pointer to type/subtype
* char const *c_subtype; // Points after first slash in type
* sip_param_t const *c_params; // List of parameters
* msg_param_t const *c_params; // List of parameters
* } sip_content_type_t;
* @endcode
*
......@@ -624,8 +624,8 @@ int sip_content_type_e(char b[], int bsiz, sip_header_t const *h, int flags)
char *b0 = b, *end = b + bsiz;
sip_content_type_t const *c = h->sh_content_type;
SIP_STRING_E(b, end, c->c_type);
SIP_PARAMS_E(b, end, c->c_params, flags);
MSG_STRING_E(b, end, c->c_type);
MSG_PARAMS_E(b, end, c->c_params, flags);
MSG_TERM_E(b, end);
return b - b0;
......@@ -637,8 +637,8 @@ int sip_content_type_dup_xtra(sip_header_t const *h, int offset)
int rv = offset;
sip_content_type_t const *c = h->sh_content_type;
SIP_PARAMS_SIZE(rv, c->c_params);
rv += SIP_STRING_SIZE(c->c_type);
MSG_PARAMS_SIZE(rv, c->c_params);
rv += MSG_STRING_SIZE(c->c_type);
return rv;
}
......@@ -652,8 +652,8 @@ char *sip_content_type_dup_one(sip_header_t *dst, sip_header_t const *src,
sip_content_type_t const *o = src->sh_content_type;
char *end = b + xtra;
b = sip_params_dup(&c->c_params, o->c_params, b, xtra);
SIP_STRING_DUP(b, c->c_type, o->c_type);
b = msg_params_dup(&c->c_params, o->c_params, b, xtra);
MSG_STRING_DUP(b, c->c_type, o->c_type);
c->c_subtype = strchr(c->c_type, '/');
c->c_subtype++;
......
......@@ -80,7 +80,7 @@ int sip_extract_body(msg_t *msg, sip_t *sip, char b[], int bsiz, int eos)
if (!(sip->sip_flags & MSG_FLG_BODY)) {
/* We are looking at a potential empty line */
m = msg_extract_separator(msg, sip, b, bsiz, eos);
m = msg_extract_separator(msg, (msg_pub_t *)sip, b, bsiz, eos);
if (m <= 0)
return m;
sip->sip_flags |= MSG_FLG_BODY;
......@@ -112,7 +112,8 @@ int sip_extract_body(msg_t *msg, sip_t *sip, char b[], int bsiz, int eos)
return bsiz;
}
if ((m = msg_extract_payload(msg, sip, NULL, body_len, b, bsiz, eos)) == -1)
if ((m = msg_extract_payload(msg, (msg_pub_t *)sip,
NULL, body_len, b, bsiz, eos)) == -1)
return -1;
sip->sip_flags |= MSG_FLG_FRAGS;
......@@ -190,7 +191,7 @@ int sip_version_xtra(char const *version)
{
if (version == SIP_VERSION_CURRENT)
return 0;
return SIP_STRING_SIZE(version);
return MSG_STRING_SIZE(version);
}
/** Duplicate a transport string */
......@@ -199,7 +200,7 @@ void sip_version_dup(char **pp, char const **dd, char const *s)
if (s == SIP_VERSION_CURRENT)
*dd = s;
else
SIP_STRING_DUP(*pp, *dd, s);
MSG_STRING_DUP(*pp, *dd, s);
}
char const sip_method_name_invite[] = "INVITE";
......@@ -439,7 +440,7 @@ int sip_transport_xtra(char const *transport)
strcasecmp(transport, sip_transport_tls) == 0)
return 0;
return SIP_STRING_SIZE(transport);
return MSG_STRING_SIZE(transport);
}
/** Duplicate a transport string */
......@@ -462,10 +463,10 @@ void sip_transport_dup(char **pp, char const **dd, char const *s)
else if (strcasecmp(s, sip_transport_tls) == 0)
*dd = sip_transport_tls;
else
SIP_STRING_DUP(*pp, *dd, s);
MSG_STRING_DUP(*pp, *dd, s);
}
/** Parse SIP word "@" word construct. */
/** Parse SIP <word "@" word> construct. */
char *sip_word_at_word_d(char **ss)
{
char *rv = *ss, *s0 = *ss;
......@@ -489,10 +490,9 @@ char *sip_word_at_word_d(char **ss)
/**Add message separator, then test if message is complete.
*
* The function adds sip_content_length and sip_separator components, if
* they are missing. It then tests that all necessary message components (@b
* From, @b To, @b CSeq, @b Call-ID, @b Content-Length and message separator
* are present.
* Add sip_content_length and sip_separator if they are missing.
* It then tests that all necessary message components (@b From, @b To, @b
* CSeq, @b Call-ID, @b Content-Length and message separator are present.
*
* @retval 0 when successful
* @retval -1 upon an error
......@@ -534,7 +534,7 @@ int sip_complete_message(msg_t *msg)
len += sip->sip_payload->pl_len;
if (!sip->sip_content_length) {
msg_header_insert(msg, sip, (msg_header_t*)
msg_header_insert(msg, (msg_pub_t *)sip, (msg_header_t*)
sip_content_length_create(home, len));
}
else {
......
......@@ -120,6 +120,20 @@ int sip_any_route_dup_xtra(sip_header_t const *h, int offset);
char *sip_any_route_dup_one(sip_header_t *dst, sip_header_t const *src,
char *b, int xtra);
int sip_name_addr_d(su_home_t *home,
char **inout_s,
char const **return_display,
url_t *out_url,
msg_param_t const **return_params,
char const **return_comment);
int sip_name_addr_e(char b[], int bsiz,
int flags,
char const *display,
int always_ltgt, url_t const url[],
msg_param_t const params[],
char const *comment);
/* ---------------------------------------------------------------------------
* 3) Compatibility macros
......@@ -150,9 +164,6 @@ char *sip_any_route_dup_one(sip_header_t *dst, sip_header_t const *src,
#define SIP_STRUCT_SIZE_ALIGN MSG_STRUCT_SIZE_ALIGN
#define SIP_STRUCT_ALIGN MSG_STRUCT_ALIGN
#define sip_name_addr_d msg_name_addr_d
#define sip_name_addr_e msg_name_addr_e
#define sip_comment_d msg_comment_d
#define sip_quoted_d(ss, qq) msg_quoted_d(ss, qq)
......
......@@ -102,7 +102,7 @@ int sip_rack_dup_xtra(sip_header_t const *h, int offset)
sip_rack_t const *ra = h->sh_rack;
if (ra->ra_method == sip_method_unknown)
return offset + SIP_STRING_SIZE(ra->ra_method_name);
return offset + MSG_STRING_SIZE(ra->ra_method_name);
else
return offset;
}
......@@ -121,7 +121,7 @@ char *sip_rack_dup_one(sip_header_t *dst, sip_header_t const *src,
ra_dst->ra_method = ra_src->ra_method;
if (ra_src->ra_method == sip_method_unknown)
SIP_STRING_DUP(b, ra_dst->ra_method_name, ra_src->ra_method_name);
MSG_STRING_DUP(b, ra_dst->ra_method_name, ra_src->ra_method_name);
else
ra_dst->ra_method_name = ra_src->ra_method_name;
......
......@@ -391,7 +391,7 @@ sip_contact_t *sip_contact_immunize(su_home_t *home, sip_contact_t const *m)
{
unsigned i, j;
sip_contact_t m0[1], *m1;
sip_param_t *params;
msg_param_t *params;