diff --git a/dmbbfcommon.c b/dmbbfcommon.c index 6a1d62ca..5e01e323 100644 --- a/dmbbfcommon.c +++ b/dmbbfcommon.c @@ -11,6 +11,7 @@ #include "dmbbfcommon.h" +int end_session_flag = 0; int bbfdmuci_lookup_ptr(struct uci_context *ctx, struct uci_ptr *ptr, char *package, char *section, char *option, char *value) { return dmuci_lookup_ptr(ctx, ptr, package, section, option, value); @@ -104,3 +105,12 @@ struct list_head get_bbf_list_enabled_lw_notify(void) { return list_enabled_lw_notify; } + +void cwmp_set_end_session (unsigned int flag) +{ + if (end_session_flag_ptr != NULL) { + end_session_flag = *end_session_flag_ptr; + end_session_flag_ptr = &end_session_flag; + } + end_session_flag |= flag; +} diff --git a/dmbbfcommon.h b/dmbbfcommon.h index 8ff8c7ab..04227a2a 100644 --- a/dmbbfcommon.h +++ b/dmbbfcommon.h @@ -11,6 +11,8 @@ #include +extern int end_session_flag; + int bbfdmuci_lookup_ptr(struct uci_context *ctx, struct uci_ptr *ptr, char *package, char *section, char *option, char *value); void bbf_apply_end_session(void); int set_bbfdatamodel_type(int bbf_type); @@ -30,3 +32,4 @@ void bbfdmjson_get_var(char *jkey, char **jval); void bbfdm_update_enabled_notify(struct dm_enabled_notify *p, char *new_value); struct list_head get_bbf_list_enabled_lw_notify(void); +void cwmp_set_end_session (unsigned int flag); diff --git a/libbbf_api/dmbbf.c b/libbbf_api/dmbbf.c index 53ed0805..5b3a28c8 100644 --- a/libbbf_api/dmbbf.c +++ b/libbbf_api/dmbbf.c @@ -96,7 +96,7 @@ LIST_HEAD(list_enabled_notify); LIST_HEAD(list_enabled_lw_notify); LIST_HEAD(list_execute_end_session); -int end_session_flag = 0; +int* end_session_flag_ptr = NULL; int ip_version = 4; char dm_delim = DMDELIM_CWMP; char dmroot[64] = "Device"; @@ -1728,7 +1728,7 @@ static int mobj_set_notification_in_obj(DMOBJECT_ARGS) add_set_list_tmp(dmctx, dmctx->in_param, dmctx->in_notification, 0); } else if (dmctx->setaction == VALUESET) { set_parameter_notification(dmctx, dmctx->in_param, dmctx->in_notification); - cwmp_set_end_session(END_SESSION_RELOAD); + bbf_api_cwmp_set_end_session(END_SESSION_RELOAD); } return 0; } @@ -1755,7 +1755,7 @@ static int mparam_set_notification_in_param(DMPARAM_ARGS) add_set_list_tmp(dmctx, dmctx->in_param, dmctx->in_notification, 0); } else if (dmctx->setaction == VALUESET) { set_parameter_notification(dmctx, dmctx->in_param, dmctx->in_notification); - cwmp_set_end_session(END_SESSION_RELOAD); + bbf_api_cwmp_set_end_session(END_SESSION_RELOAD); } dmfree(refparam); return 0; @@ -3207,9 +3207,11 @@ int apply_end_session() return 0; } -void cwmp_set_end_session (unsigned int flag) +void bbf_api_cwmp_set_end_session (unsigned int flag) { - end_session_flag |= flag; + if(end_session_flag_ptr == NULL) + end_session_flag_ptr = (int*)dmmalloc(sizeof(int)); + *end_session_flag_ptr |= flag; } char *dm_print_path(char *fpath, ...) diff --git a/libbbf_api/dmbbf.h b/libbbf_api/dmbbf.h index cf382bb4..70d2fc1a 100644 --- a/libbbf_api/dmbbf.h +++ b/libbbf_api/dmbbf.h @@ -8,6 +8,7 @@ * Author MOHAMED Kallel * Author Imen Bhiri * Author Feten Besbes + * Author Omar Kallel * Author Amin Ben Ramdhane * */ @@ -527,7 +528,7 @@ extern struct list_head list_upnp_changed_onalarm; extern struct list_head list_upnp_changed_version; #endif -extern int end_session_flag; +extern int* end_session_flag_ptr; extern int ip_version; extern char dm_delim; extern char dmroot[64]; @@ -588,7 +589,7 @@ char *get_last_instance_lev2_bbfdm(char *package, char *section, char* dmmap_pac char *handle_update_instance(int instance_ranck, struct dmctx *ctx, char **last_inst, char * (*up_instance)(int action, char **last_inst, void *argv[]), int argc, ...); int dm_add_end_session(struct dmctx *ctx, void(*function)(struct execute_end_session *), int action, void *data); int apply_end_session(); -void cwmp_set_end_session (unsigned int flag); +void bbf_api_cwmp_set_end_session (unsigned int flag); char *dm_print_path(char *fpath, ...); void free_all_list_enabled_lwnotify(); int dm_link_inst_obj(struct dmctx *dmctx, DMNODE *parent_node, void *data, char *instance);