Commit 328429b1 authored by Pekka Pessi's avatar Pekka Pessi

nua: added NUTAG_AUTO302(), NUTAG_AUTO305()

Ignore-this: b8c0c194aff5b03534970cf376cf6163

darcs-hash:20090924154617-db55f-62d29e7960b0283e42f4f38c23d40bfb669b247f.gz
parent b8b03b51
......@@ -1128,6 +1128,11 @@ int nua_base_client_check_restart(nua_client_request_t *cr,
if (status == 302 || status == 305) {
sip_route_t r[1];
if (status == 302 && !NH_PGET(nh, auto302))
return 0;
if (status == 305 && !NH_PGET(nh, auto305))
return 0;
if (!can_redirect(sip->sip_contact, cr->cr_method))
return 0;
......
......@@ -160,6 +160,9 @@ int nua_stack_set_defaults(nua_handle_t *nh,
NHP_SET(nhp, refer_expires, 300);
NHP_SET(nhp, refer_with_id, 1);
NHP_SET(nhp, auto302, 1);
NHP_SET(nhp, auto305, 1);
NHP_SET(nhp, substate, nua_substate_active);
NHP_SET(nhp, sub_expires, 3600);
......@@ -741,6 +744,14 @@ static int nhp_set_tags(su_home_t *home,
else if (tag == nutag_autoack) {
NHP_SET(nhp, auto_ack, value != 0);
}
/* NUTAG_AUTO302(auto302) */
else if (tag == nutag_auto302) {
NHP_SET(nhp, auto302, value != 0);
}
/* NUTAG_AUTO305(auto305) */
else if (tag == nutag_auto305) {
NHP_SET(nhp, auto305, value != 0);
}
/* NUTAG_INVITE_TIMER(invite_timeout) */
else if (tag == nutag_invite_timer) {
NHP_SET(nhp, invite_timeout, (unsigned)value);
......@@ -1656,6 +1667,9 @@ int nua_stack_get_params(nua_t *nua, nua_handle_t *nh, nua_event_t e,
TIF(NUTAG_REFER_EXPIRES, refer_expires),
TIF(NUTAG_REFER_WITH_ID, refer_with_id),
TIF(NUTAG_AUTO302, auto302);
TIF(NUTAG_AUTO305, auto305);
TIF(NUTAG_SUBSTATE, substate),
TIF(NUTAG_SUB_EXPIRES, sub_expires),
......
......@@ -109,6 +109,10 @@ struct nua_handle_preferences
/** Always include id with Event: refer */
unsigned nhp_refer_with_id:1;
/** Redirect automatically with 302 responses */
unsigned nhp_auto302:1;
/** Redirect automatically with 305 responses */
unsigned nhp_auto305:1;
unsigned:0;
/* Default lifetime for implicit subscriptions created by REFER */
......@@ -181,13 +185,16 @@ struct nua_handle_preferences
unsigned nhb_path_enable:1;
unsigned nhb_auth_cache:1;
unsigned nhb_refer_with_id:1;
unsigned nhb_auto302:1;
unsigned nhb_auto305:1;
unsigned nhb_refer_expires:1;
unsigned nhb_substate:1;
unsigned nhb_sub_expires:1;
unsigned nhb_keepalive:1;
unsigned :0; /* at most 32 bits before this point */
unsigned nhb_keepalive_stream:1;
unsigned nhb_registrar:1;
unsigned :0; /* at most 32 bits before this point */
unsigned nhb_allow:1;
unsigned nhb_supported:1;
......
......@@ -95,6 +95,7 @@
* - NUTAG_SUPPORTED(), SIPTAG_SUPPORTED(), and SIPTAG_SUPPORTED_STR()
* - NUTAG_USER_AGENT(), SIPTAG_USER_AGENT() and SIPTAG_USER_AGENT_STR()
* - SIPTAG_ORGANIZATION() and SIPTAG_ORGANIZATION_STR()
* - NUTAG_AUTO302(), NUTAG_AUTO305()
*
* @par Client Authenticating Requests
* - nua_authenticate(), #nua_r_authenticate
......@@ -1412,6 +1413,78 @@ tag_typedef_t nutag_enablemessenger = BOOLTAG_TYPEDEF(enableMessenger);
* Reference tag for NUTAG_ENABLEMESSENGER().
*/
/**@def NUTAG_AUTO302(x)
*
* Recurse automatically on 302 response.
*
* If this parameter is true, a client recurses automatically upon receiving
* a 302 response. The request is resent with the request-URI from the
* @Contact header in the 302 response.
*
* @par Used with
* nua_create(), nua_set_params(), nua_set_hparams(), \n
* nua_get_params(), nua_get_hparams(), \n
* nua_invite(), nua_prack(), nua_ack(), nua_update(), nua_respond(), \n
* nua_info(), nua_cancel(), nua_bye(), \n
* nua_register(), nua_unregister(), nua_publish(), nua_unpublish(), \n
* nua_subscribe(), nua_unsubscribe(), nua_refer(), nua_notify(), \n
* nua_options(), nua_message(), nua_method()
*
* @par Parameter type
* int (boolean: nonzero is true, zero is false)
*
* @par Values
* - 0 (false) - process 302 as an ordinary final response
* - 1 (true) - resend request with URI received in 302 response
*
* Default value is NUTAG_AUTO302(1).
*
* Corresponding tag taking reference parameter is NUTAG_AUTO302_REF().
*/
tag_typedef_t nutag_auto302 = BOOLTAG_TYPEDEF(auto302);
/**@def NUTAG_AUTO302_REF(x)
* Reference tag for NUTAG_AUTO302().
*/
/**@def NUTAG_AUTO305(x)
*
* Recurse automatically on 305 response.
*
* If this parameter is true, a client recurses automatically upon receiving
* a 305 response. The request is resent via the proxy specified by the
* @Contact header in the 305 response. The proxy URI is included in the
* @Route header of the request.
*
* Note that the NUTAG_PROXY() takes a precedence over the proxy in 305, and
* the NUTAG_PROXY() is responsible of actually routing the request through
* the 305 proxy.
*
* @par Used with
* nua_create(), nua_set_params(), nua_set_hparams(), \n
* nua_get_params(), nua_get_hparams(), \n
* nua_invite(), nua_prack(), nua_ack(), nua_update(), nua_respond(), \n
* nua_info(), nua_cancel(), nua_bye(), \n
* nua_register(), nua_unregister(), nua_publish(), nua_unpublish(), \n
* nua_subscribe(), nua_unsubscribe(), nua_refer(), nua_notify(), \n
* nua_options(), nua_message(), nua_method()
*
* @par Parameter type
* int (boolean: nonzero is true, zero is false)
*
* @par Values
* - 0 (false) - process 305 as an ordinary final response
* - 1 (true) - resend request via proxy received in 305 response
*
* Default value is NUTAG_AUTO305(1).
*
* Corresponding tag taking reference parameter is NUTAG_AUTO305_REF().
*/
tag_typedef_t nutag_auto305 = BOOLTAG_TYPEDEF(auto305);
/**@def NUTAG_AUTO305_REF(x)
* Reference tag for NUTAG_AUTO305().
*/
/**@def NUTAG_SMIME_ENABLE(x)
*
......
......@@ -220,6 +220,16 @@ SOFIAPUBVAR tag_typedef_t nutag_enablemessenger;
nutag_enablemessenger_ref, tag_bool_vr(&(x))
SOFIAPUBVAR tag_typedef_t nutag_enablemessenger_ref;
#define NUTAG_AUTO302(x) nutag_auto302, tag_bool_v(x)
SOFIAPUBVAR tag_typedef_t nutag_auto302;
#define NUTAG_AUTO302_REF(x) nutag_auto302_ref, tag_bool_vr(&(x))
SOFIAPUBVAR tag_typedef_t nutag_auto302_ref;
#define NUTAG_AUTO305(x) nutag_auto305, tag_bool_v(x)
SOFIAPUBVAR tag_typedef_t nutag_auto305;
#define NUTAG_AUTO305_REF(x) nutag_auto305_ref, tag_bool_vr(&(x))
SOFIAPUBVAR tag_typedef_t nutag_auto305_ref;
/* Start NRC Boston */
#define NUTAG_SMIME_ENABLE(x) nutag_smime_enable, tag_bool_v(x)
......
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