Commit 67277fb2 authored by Pekka Pessi's avatar Pekka Pessi

nua: added NUTAG_AUTH_CACHE(), nutag_auth_cache, NUTAG_AUTH_CACHE_REF(), nutag_auth_cache_ref

darcs-hash:20070326153214-55b16-dc208b07b080e56400c211759fd6a8cab7c15f9e.gz
parent 2416f34a
......@@ -393,6 +393,7 @@ int nua_stack_init_instance(nua_handle_t *nh, tagi_t const *tags)
* NUTAG_ALLOW(), SIPTAG_ALLOW(), and SIPTAG_ALLOW_STR() \n
* NUTAG_ALLOW_EVENTS(), SIPTAG_ALLOW_EVENTS(), and
* SIPTAG_ALLOW_EVENTS_STR() \n
* NUTAG_AUTH_CACHE() \n
* NUTAG_AUTOACK() \n
* NUTAG_AUTOALERT() \n
* NUTAG_AUTOANSWER() \n
......@@ -778,6 +779,11 @@ static int nhp_set_tags(su_home_t *home,
else if (tag == nutag_path_enable) {
NHP_SET(nhp, path_enable, value != 0);
}
/* NUTAG_AUTH_CACHE(auth_cache) */
else if (tag == nutag_auth_cache) {
if (value >= 0 && value < (tag_value_t)_nua_auth_cache_invalid)
NHP_SET(nhp, auth_cache, (int)value);
}
/* NUTAG_REFER_EXPIRES(refer_expires) */
else if (tag == nutag_refer_expires) {
NHP_SET(nhp, refer_expires, value);
......@@ -1363,6 +1369,7 @@ int nua_stack_set_smime_params(nua_t *nua, tagi_t const *tags)
* @param sip NULL
* @param tags
* NUTAG_APPL_METHOD() \n
* NUTAG_AUTH_CACHE() \n
* NUTAG_AUTOACK() \n
* NUTAG_AUTOALERT() \n
* NUTAG_AUTOANSWER() \n
......@@ -1546,6 +1553,7 @@ int nua_stack_get_params(nua_t *nua, nua_handle_t *nh, nua_event_t e,
TIF(NUTAG_MEDIA_FEATURES, media_features),
TIF(NUTAG_SERVICE_ROUTE_ENABLE, service_route_enable),
TIF(NUTAG_PATH_ENABLE, path_enable),
TIF(NUTAG_AUTH_CACHE, auth_cache),
TIF(NUTAG_REFER_EXPIRES, refer_expires),
TIF(NUTAG_REFER_WITH_ID, refer_with_id),
......
......@@ -95,9 +95,11 @@ typedef struct nua_handle_preferences
unsigned nhp_service_route_enable:1;
/** Enable Path */
unsigned nhp_path_enable:1;
/** Authentication cache policy */
unsigned nhp_auth_cache:1;
/** Always include id with Event: refer */
unsigned nhp_refer_with_id:1;
unsigned:0;
/* Default lifetime for implicit subscriptions created by REFER */
......@@ -157,6 +159,7 @@ typedef struct nua_handle_preferences
unsigned nhb_media_features:1;
unsigned nhb_service_route_enable:1;
unsigned nhb_path_enable:1;
unsigned nhb_auth_cache:1;
unsigned nhb_refer_with_id:1;
unsigned nhb_refer_expires:1;
unsigned nhb_substate:1;
......
......@@ -144,6 +144,7 @@ tag_typedef_t nutag_supported = STRTAG_TYPEDEF(supported);
tag_typedef_t nutag_path_enable = BOOLTAG_TYPEDEF(path_enable);
tag_typedef_t nutag_service_route_enable =
BOOLTAG_TYPEDEF(service_route_enable);
tag_typedef_t nutag_auth_cache = INTTAG_TYPEDEF(auth_cache);
tag_typedef_t nutag_detect_network_updates = UINTTAG_TYPEDEF(detect_network_updates);
......
......@@ -1247,6 +1247,38 @@ SOFIAPUBVAR tag_typedef_t nutag_auth;
#define NUTAG_AUTH_REF(x) nutag_auth_ref, tag_str_vr(&(x))
SOFIAPUBVAR tag_typedef_t nutag_auth_ref;
/** Authentication caching policy
*
* @par Used with
* nua_set_params(), nua_set_hparams() \n
* nua_get_params(), nua_get_hparams() \n
* @NUA_HPARAM_CALLS
*
* @par Parameter type
* enum nua_auth_cache
*
* @par Values
* - nua_auth_cache_dialog (0) - include credentials within dialog
* - nua_auth_cache_challenged (1) - include credentials only when
* challenged
*
* Corresponding tag taking reference parameter is NUTAG_AUTH_CACHE_REF()
*/
#define NUTAG_AUTH_CACHE(x) nutag_auth_cache, tag_int_v(x)
SOFIAPUBVAR tag_typedef_t nutag_auth_cache;
#define NUTAG_AUTH_CACHE_REF(x) nutag_auth_cache_ref, tag_int_vr(&(x))
SOFIAPUBVAR tag_typedef_t nutag_auth_cache_ref;
/** Authentication caching policy */
enum nua_auth_cache {
/** Include credentials within dialog (default) */
nua_auth_cache_dialog = 0,
/** Include credentials only when challenged */
nua_auth_cache_challenged = 1,
_nua_auth_cache_invalid
};
/** Keepalive interval in milliseconds.
*
* This setting applies to OPTIONS/STUN keepalives. See documentation
......
......@@ -193,6 +193,7 @@ int test_nua_params(struct context *ctx)
NUTAG_MEDIA_FEATURES(1),
NUTAG_SERVICE_ROUTE_ENABLE(0),
NUTAG_PATH_ENABLE(0),
NUTAG_AUTH_CACHE(nua_auth_cache_challenged),
NUTAG_REFER_EXPIRES(333),
NUTAG_REFER_WITH_ID(0),
NUTAG_SUBSTATE(nua_substate_pending),
......@@ -268,6 +269,7 @@ int test_nua_params(struct context *ctx)
int media_features = -1;
int service_route_enable = -1;
int path_enable = -1;
int auth_cache = -1;
unsigned refer_expires = (unsigned)-1;
int refer_with_id = -1;
int substate = -1;
......@@ -331,6 +333,7 @@ int test_nua_params(struct context *ctx)
NUTAG_MEDIA_FEATURES_REF(media_features),
NUTAG_SERVICE_ROUTE_ENABLE_REF(service_route_enable),
NUTAG_PATH_ENABLE_REF(path_enable),
NUTAG_AUTH_CACHE_REF(auth_cache),
NUTAG_REFER_EXPIRES_REF(refer_expires),
NUTAG_REFER_WITH_ID_REF(refer_with_id),
NUTAG_SUBSTATE_REF(substate),
......@@ -361,7 +364,7 @@ int test_nua_params(struct context *ctx)
NUTAG_INSTANCE_REF(instance),
TAG_END());
TEST(n, 47);
TEST(n, 48);
TEST_S(sip_header_as_string(tmphome, (void *)from), Alice);
TEST_S(from_str, Alice);
......@@ -391,6 +394,7 @@ int test_nua_params(struct context *ctx)
TEST(media_features, 1);
TEST(service_route_enable, 0);
TEST(path_enable, 0);
TEST(auth_cache, nua_auth_cache_challenged);
TEST(refer_expires, 333);
TEST(refer_with_id, 0);
TEST(substate, nua_substate_pending);
......@@ -455,6 +459,7 @@ int test_nua_params(struct context *ctx)
int media_features = -1;
int service_route_enable = -1;
int path_enable = -1;
int auth_cache = -1;
unsigned refer_expires = (unsigned)-1;
int refer_with_id = -1;
int substate = -1;
......@@ -513,6 +518,7 @@ int test_nua_params(struct context *ctx)
NUTAG_MEDIA_FEATURES_REF(media_features),
NUTAG_SERVICE_ROUTE_ENABLE_REF(service_route_enable),
NUTAG_PATH_ENABLE_REF(path_enable),
NUTAG_AUTH_CACHE_REF(auth_cache),
NUTAG_SUBSTATE_REF(substate),
SIPTAG_SUPPORTED_REF(supported),
......@@ -565,6 +571,7 @@ int test_nua_params(struct context *ctx)
TEST(media_features, -1);
TEST(service_route_enable, -1);
TEST(path_enable, -1);
TEST(auth_cache, -1);
TEST(refer_expires, (unsigned)-1);
TEST(refer_with_id, -1);
TEST(substate, -1);
......
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