Enhance separation between libbbf_api and libbbfdm: apply for end_session_flag variable

This commit is contained in:
Omar Kallel 2020-06-22 17:18:21 +01:00
parent e4f1fd8653
commit b6be5bdaa0
4 changed files with 23 additions and 7 deletions

View file

@ -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;
}

View file

@ -11,6 +11,8 @@
#include <libbbf_api/dmcommon.h>
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);

View file

@ -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, ...)

View file

@ -8,6 +8,7 @@
* Author MOHAMED Kallel <mohamed.kallel@pivasoftware.com>
* Author Imen Bhiri <imen.bhiri@pivasoftware.com>
* Author Feten Besbes <feten.besbes@pivasoftware.com>
* Author Omar Kallel <omar.kallel@pivasoftware.c>
* Author Amin Ben Ramdhane <amin.benramdhane@pivasoftware.com>
*
*/
@ -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);