From 880db72aee0b6ebcd5debbdee73fbf5a759b899e Mon Sep 17 00:00:00 2001 From: Thierry Carré Date: Tue, 19 Mar 2013 15:50:39 +0100 Subject: cleo/{devkit/plcd, app/libspid}: add 'force_role' item in hpav.conf, refs #3789 Option is read and save in plcd context, but not use yet. --- cleopatre/devkit/plcd/src/plcd_files.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'cleopatre/devkit/plcd/src') diff --git a/cleopatre/devkit/plcd/src/plcd_files.c b/cleopatre/devkit/plcd/src/plcd_files.c index 0f834726a1..d877bc47c1 100644 --- a/cleopatre/devkit/plcd/src/plcd_files.c +++ b/cleopatre/devkit/plcd/src/plcd_files.c @@ -23,12 +23,14 @@ plcd_files_read_hpavconf (plcd_ctx_t *ctx) { char is_cco_preferred_str[LIBSPID_BOOLEAN_STR_MAX_LEN]; char was_cco_str[LIBSPID_BOOLEAN_STR_MAX_LEN]; + char force_role_str[LIBSPID_HPAV_CONF_FORCE_ROLE_MAX_LEN]; libspid_error_t libspid_ret; PLCD_ASSERT (ctx); memset (is_cco_preferred_str, 0, sizeof (is_cco_preferred_str)); memset (was_cco_str, 0, sizeof (was_cco_str)); + memset (force_role_str, 0, sizeof (force_role_str)); /* Only NMK item is mandatory, other are optionals. * There is no default value possible. */ @@ -46,14 +48,15 @@ plcd_files_read_hpavconf (plcd_ctx_t *ctx) /* Optional items. * Be careful, amount of labels, values and lens must be sync. */ -#define PLCD_HPAV_CONF_NB_ITEM 6 +#define PLCD_HPAV_CONF_NB_ITEM 7 const char * const hpav_conf_labels[PLCD_HPAV_CONF_NB_ITEM] = { LIBSPID_HPAV_CONF_LABEL_CCO_PREFERRED, LIBSPID_HPAV_CONF_LABEL_WAS_CCO, LIBSPID_HPAV_CONF_LABEL_NID, LIBSPID_HPAV_CONF_LABEL_SL, LIBSPID_HPAV_CONF_LABEL_USER_HFID, - LIBSPID_HPAV_CONF_LABEL_AVLN_HFID + LIBSPID_HPAV_CONF_LABEL_AVLN_HFID, + LIBSPID_HPAV_CONF_LABEL_FORCE_ROLE }; char *hpav_conf_values[PLCD_HPAV_CONF_NB_ITEM] = { is_cco_preferred_str, @@ -61,7 +64,8 @@ plcd_files_read_hpavconf (plcd_ctx_t *ctx) ctx->hpav_conf.nid_str, ctx->hpav_conf.sl_str, ctx->hpav_conf.user_hfid, - ctx->hpav_conf.avln_hfid + ctx->hpav_conf.avln_hfid, + force_role_str }; const int hpav_conf_len[PLCD_HPAV_CONF_NB_ITEM] = { LIBSPID_BOOLEAN_STR_MAX_LEN, @@ -69,7 +73,8 @@ plcd_files_read_hpavconf (plcd_ctx_t *ctx) LIBSPID_HPAV_CONF_NID_STR_LEN, LIBSPID_HPAV_CONF_SL_STR_MAX_LEN, LIBSPID_HPAV_CONF_HFID_MAX_LEN, - LIBSPID_HPAV_CONF_HFID_MAX_LEN + LIBSPID_HPAV_CONF_HFID_MAX_LEN, + LIBSPID_HPAV_CONF_FORCE_ROLE_MAX_LEN }; libspid_ret = libspid_config_read_items ( @@ -102,6 +107,16 @@ plcd_files_read_hpavconf (plcd_ctx_t *ctx) /* No default value for user_hfid and avln_hfid. */ + /* Set force_role. Convert libspid string result to plcd enum value. */ + if (!strcmp (LIBSPID_HPAV_CONF_VALUE_FORCE_ROLE_CCO, + force_role_str)) + ctx->hpav_conf.force_role = PLCD_FORCE_ROLE_CCO; + else if (!strcmp (LIBSPID_HPAV_CONF_VALUE_FORCE_ROLE_STA, + force_role_str)) + ctx->hpav_conf.force_role = PLCD_FORCE_ROLE_STA; + else + ctx->hpav_conf.force_role = PLCD_FORCE_ROLE_NONE; + return 0; } -- cgit v1.2.3