diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/libbsc/handover_vty.c | 6 | ||||
-rw-r--r-- | src/libbsc/net_init.c | 2 | ||||
-rw-r--r-- | src/libcommon/gsm_data_shared.c | 2 | ||||
-rw-r--r-- | src/libcommon/handover_cfg.c | 16 |
4 files changed, 18 insertions, 8 deletions
diff --git a/src/libbsc/handover_vty.c b/src/libbsc/handover_vty.c index 225e9a909..4905f35c7 100644 --- a/src/libbsc/handover_vty.c +++ b/src/libbsc/handover_vty.c @@ -38,7 +38,7 @@ static struct handover_cfg *ho_cfg_from_vty(struct vty *vty) } -#define HO_CFG_ONE_MEMBER(TYPE, NAME, DEFAULT_VAL, \ +#define HO_CFG_ONE_MEMBER(TYPE, NAME, DEFAULT_VAL, ON_CHANGE, \ VTY_CMD, VTY_CMD_ARG, VTY_ARG_EVAL, \ VTY_WRITE_FMT, VTY_WRITE_CONV, \ VTY_DOC) \ @@ -72,7 +72,7 @@ HO_CFG_ALL_MEMBERS void ho_vty_write(struct vty *vty, const char *indent, struct handover_cfg *ho) { -#define HO_CFG_ONE_MEMBER(TYPE, NAME, DEFAULT_VAL, \ +#define HO_CFG_ONE_MEMBER(TYPE, NAME, DEFAULT_VAL, ON_CHANGE, \ VTY_CMD, VTY_CMD_ARG, VTY_ARG_EVAL, \ VTY_WRITE_FMT, VTY_WRITE_CONV, \ VTY_DOC) \ @@ -86,7 +86,7 @@ void ho_vty_write(struct vty *vty, const char *indent, struct handover_cfg *ho) static void ho_vty_init_cmds(int parent_node) { -#define HO_CFG_ONE_MEMBER(TYPE, NAME, DEFAULT_VAL, VTY1, VTY2, VTY3, VTY4, VTY5, VTY6) \ +#define HO_CFG_ONE_MEMBER(TYPE, NAME, DEFAULT_VAL, ON_CHANGE, VTY1, VTY2, VTY3, VTY4, VTY5, VTY6) \ install_element(parent_node, &cfg_ho_##NAME##_cmd); HO_CFG_ALL_MEMBERS diff --git a/src/libbsc/net_init.c b/src/libbsc/net_init.c index 57d824156..ba6410247 100644 --- a/src/libbsc/net_init.c +++ b/src/libbsc/net_init.c @@ -56,7 +56,7 @@ struct gsm_network *bsc_network_init(void *ctx, net->T3122 = GSM_T3122_DEFAULT; net->T3141 = GSM_T3141_DEFAULT; - net->ho = ho_cfg_init(net, NULL); + net->ho = ho_cfg_init(net, HO_CFG_CTX_NET, NULL); INIT_LLIST_HEAD(&net->bts_list); diff --git a/src/libcommon/gsm_data_shared.c b/src/libcommon/gsm_data_shared.c index e4ec594f8..df6cf4ea4 100644 --- a/src/libcommon/gsm_data_shared.c +++ b/src/libcommon/gsm_data_shared.c @@ -375,7 +375,7 @@ struct gsm_bts *gsm_bts_alloc(struct gsm_network *net, uint8_t bts_num) /* si handling */ bts->bcch_change_mark = 1; - bts->ho = ho_cfg_init(bts, net->ho); + bts->ho = ho_cfg_init(bts, HO_CFG_CTX_BTS, net->ho); return bts; } diff --git a/src/libcommon/handover_cfg.c b/src/libcommon/handover_cfg.c index 8c208f669..08e94e56f 100644 --- a/src/libcommon/handover_cfg.c +++ b/src/libcommon/handover_cfg.c @@ -30,7 +30,10 @@ struct handover_cfg { struct handover_cfg *higher_level_cfg; -#define HO_CFG_ONE_MEMBER(TYPE, NAME, DEFAULT_VAL, VTY1, VTY2, VTY3, VTY4, VTY5, VTY6) \ + void *ctx; + int ctx_type; + +#define HO_CFG_ONE_MEMBER(TYPE, NAME, DEFAULT_VAL, ON_CHANGE, VTY1, VTY2, VTY3, VTY4, VTY5, VTY6) \ TYPE NAME; \ bool has_##NAME; @@ -38,15 +41,18 @@ struct handover_cfg { #undef HO_CFG_ONE_MEMBER }; -struct handover_cfg *ho_cfg_init(void *ctx, struct handover_cfg *higher_level_cfg) +struct handover_cfg *ho_cfg_init(void *ctx, enum handover_cfg_ctx_type ctx_type, + struct handover_cfg *higher_level_cfg) { struct handover_cfg *ho = talloc_zero(ctx, struct handover_cfg); OSMO_ASSERT(ho); ho->higher_level_cfg = higher_level_cfg; + ho->ctx = ctx; + ho->ctx_type = ctx_type; return ho; } -#define HO_CFG_ONE_MEMBER(TYPE, NAME, DEFAULT_VAL, VTY1, VTY2, VTY_ARG_EVAL, VTY4, VTY5, VTY6) \ +#define HO_CFG_ONE_MEMBER(TYPE, NAME, DEFAULT_VAL, ON_CHANGE, VTY1, VTY2, VTY_ARG_EVAL, VTY4, VTY5, VTY6) \ TYPE ho_get_##NAME(struct handover_cfg *ho) \ { \ if (ho->has_##NAME) \ @@ -58,8 +64,12 @@ TYPE ho_get_##NAME(struct handover_cfg *ho) \ \ void ho_set_##NAME(struct handover_cfg *ho, TYPE value) \ { \ + ho_cfg_on_change_cb_t cb = ON_CHANGE; \ ho->NAME = value; \ ho->has_##NAME = true; \ + \ + if (cb) \ + cb(ho->ctx, ho->ctx_type); \ } \ \ bool ho_isset_##NAME(struct handover_cfg *ho) \ |