Commit b538dd14 authored by Omar Kallel's avatar Omar Kallel

use end_session_flag variable cwmp_set_end_sesion function in libbbf_api...

use end_session_flag variable cwmp_set_end_sesion function in libbbf_api instead libbbfdm end session functions
parent 4d6efa06
Pipeline #1221 passed with stage
in 54 seconds
......@@ -51,7 +51,8 @@ icwmpd_LDADD = \
$(LBLOBMSG_LIBS) \
$(LIBZ_LIBS) \
$(LIBM_LIBS) \
-lbbfdm
-lbbfdm \
-lbbf_api
icwmpd_CFLAGS+=-DCWMP_VERSION=\"$(CWMP_VERSION)\"
icwmpd_LDFLAGS+=-DCWMP_VERSION=\"$(CWMP_VERSION)\"
......
......@@ -25,7 +25,8 @@
#include "ubus.h"
#include "diagnostic.h"
#include "config.h"
struct cwmp cwmp_main = {0};
int cwmp_dm_ctx_init(struct cwmp *cwmp, struct dmctx *ctx)
......@@ -500,17 +501,9 @@ struct session *cwmp_add_queue_session (struct cwmp *cwmp)
int run_session_end_func (struct session *session)
{
#ifndef TR098
bbf_apply_end_session();
#else
apply_end_session();
#endif
#ifndef TR098
if (set_bbf_end_session_flag(END_SESSION_EXTERNAL_ACTION))
#else
if (end_session_flag & END_SESSION_EXTERNAL_ACTION)
#endif
{
CWMP_LOG (INFO,"Executing external commands: end session request");
external_init();
......@@ -518,11 +511,7 @@ int run_session_end_func (struct session *session)
external_exit();
}
#ifndef TR098
if (set_bbf_end_session_flag(END_SESSION_FACTORY_RESET))
#else
if (end_session_flag & END_SESSION_FACTORY_RESET)
#endif
{
CWMP_LOG (INFO,"Executing factory reset: end session request");
external_init();
......@@ -531,34 +520,27 @@ int run_session_end_func (struct session *session)
exit(EXIT_SUCCESS);
}
#ifndef TR098
if (set_bbf_end_session_flag(END_SESSION_IPPING_DIAGNOSTIC))
#else
if (end_session_flag & END_SESSION_IPPING_DIAGNOSTIC)
#endif
{
CWMP_LOG (INFO,"Executing ippingdiagnostic: end session request");
cwmp_ip_ping_diagnostic();
}
#ifndef TR098
if (set_bbf_end_session_flag(END_SESSION_DOWNLOAD_DIAGNOSTIC))
if (end_session_flag & END_SESSION_DOWNLOAD_DIAGNOSTIC)
{
CWMP_LOG (INFO,"Executing download diagnostic: end session request");
cwmp_start_diagnostic(DOWNLOAD_DIAGNOSTIC);
}
if (set_bbf_end_session_flag(END_SESSION_UPLOAD_DIAGNOSTIC))
if (end_session_flag & END_SESSION_UPLOAD_DIAGNOSTIC)
{
CWMP_LOG (INFO,"Executing upload diagnostic: end session request");
cwmp_start_diagnostic(UPLOAD_DIAGNOSTIC);
}
#endif
#ifndef TR098
if (set_bbf_end_session_flag(END_SESSION_REBOOT))
#else
if (end_session_flag & END_SESSION_REBOOT)
#endif
{
CWMP_LOG (INFO,"Executing Reboot: end session request");
external_init();
......@@ -567,21 +549,13 @@ int run_session_end_func (struct session *session)
exit(EXIT_SUCCESS);
}
#ifndef TR098
if (set_bbf_end_session_flag(END_SESSION_RELOAD))
#else
if (end_session_flag & END_SESSION_RELOAD)
#endif
{
CWMP_LOG (INFO,"Config reload: end session request");
cwmp_apply_acs_changes();
}
#ifndef TR098
if (set_bbf_end_session_flag(END_SESSION_X_FACTORY_RESET_SOFT))
#else
if (end_session_flag & END_SESSION_X_FACTORY_RESET_SOFT)
#endif
{
CWMP_LOG (INFO,"Executing factory reset soft: end session request");
external_init();
......@@ -590,41 +564,25 @@ int run_session_end_func (struct session *session)
exit(EXIT_SUCCESS);
}
#ifndef TR098
if (set_bbf_end_session_flag(END_SESSION_NSLOOKUP_DIAGNOSTIC))
#else
if (end_session_flag & END_SESSION_NSLOOKUP_DIAGNOSTIC)
#endif
{
CWMP_LOG (INFO,"Executing nslookupdiagnostic: end session request");
cwmp_nslookup_diagnostic();
}
#ifndef TR098
if (set_bbf_end_session_flag(END_SESSION_TRACEROUTE_DIAGNOSTIC))
#else
if (end_session_flag & END_SESSION_TRACEROUTE_DIAGNOSTIC)
#endif
{
CWMP_LOG (INFO,"Executing traceroutediagnostic: end session request");
cwmp_traceroute_diagnostic();
}
#ifndef TR098
if (set_bbf_end_session_flag(END_SESSION_UDPECHO_DIAGNOSTIC))
#else
if (end_session_flag & END_SESSION_UDPECHO_DIAGNOSTIC)
#endif
{
CWMP_LOG (INFO,"Executing udpechodiagnostic: end session request");
cwmp_udp_echo_diagnostic();
}
#ifndef TR098
if (set_bbf_end_session_flag(END_SESSION_SERVERSELECTION_DIAGNOSTIC))
#else
if (end_session_flag & END_SESSION_SERVERSELECTION_DIAGNOSTIC)
#endif
{
CWMP_LOG (INFO,"Executing serverselectiondiagnostic: end session request");
cwmp_serverselection_diagnostic();
......@@ -632,11 +590,7 @@ int run_session_end_func (struct session *session)
dm_entry_restart_services();
#ifndef TR098
reset_bbf_end_session_flag();
#else
end_session_flag = 0;
#endif
return CWMP_OK;
}
......
......@@ -27,6 +27,7 @@
#include <libbbfdm/dmentry.h>
#include <libbbfdm/dmbbfcommon.h>
#include <libbbfdm/dmdiagnostics.h>
#include <libbbf_api/dmbbf.h>
#endif
#define MAX_EVENTS 64
......
......@@ -93,22 +93,14 @@ cwmp_handle_command(struct ubus_context *ctx, struct ubus_object *obj,
if (!strcmp("reload_end_session", cmd)) {
CWMP_LOG(INFO, "triggered ubus reload_end_session");
#ifndef TR098
bbf_cwmp_set_end_session(END_SESSION_RELOAD);
#else
cwmp_set_end_session(END_SESSION_RELOAD);
#endif
blobmsg_add_u32(&b, "status", 0);
if (asprintf(&info, "icwmpd config will reload at the end of the session") == -1)
return -1;
} else if (!strcmp("reload", cmd)) {
CWMP_LOG(INFO, "triggered ubus reload");
if (cwmp_main.session_status.last_status == SESSION_RUNNING) {
#ifndef TR098
bbf_cwmp_set_end_session(END_SESSION_RELOAD);
#else
cwmp_set_end_session(END_SESSION_RELOAD);
#endif
blobmsg_add_u32(&b, "status", 0);
blobmsg_add_string(&b, "info", "Session running, reload at the end of the session");
}
......@@ -122,21 +114,13 @@ cwmp_handle_command(struct ubus_context *ctx, struct ubus_object *obj,
}
} else if (!strcmp("reboot_end_session", cmd)) {
CWMP_LOG(INFO, "triggered ubus reboot_end_session");
#ifndef TR098
bbf_cwmp_set_end_session(END_SESSION_REBOOT);
#else
cwmp_set_end_session(END_SESSION_REBOOT);
#endif
blobmsg_add_u32(&b, "status", 0);
if (asprintf(&info, "icwmpd will reboot at the end of the session") == -1)
return -1;
} else if (!strcmp("action_end_session", cmd)) {
CWMP_LOG(INFO, "triggered ubus action_end_session");
#ifndef TR098
bbf_cwmp_set_end_session(END_SESSION_EXTERNAL_ACTION);
#else
cwmp_set_end_session(END_SESSION_EXTERNAL_ACTION);
#endif
blobmsg_add_u32(&b, "status", 0);
if (asprintf(&info, "icwmpd will execute the scheduled action commands at the end of the session") == -1)
return -1;
......
......@@ -1942,11 +1942,7 @@ int cwmp_handle_rpc_cpe_factory_reset(struct session *session, struct rpc *rpc)
b = mxmlNewElement(b, "cwmp:FactoryResetResponse");
if (!b) goto fault;
#ifndef TR098
bbf_cwmp_set_end_session(END_SESSION_FACTORY_RESET);
#else
cwmp_set_end_session(END_SESSION_FACTORY_RESET);
#endif
return 0;
......@@ -1972,11 +1968,7 @@ int cwmp_handle_rpc_cpe_x_factory_reset_soft(struct session *session, struct rpc
b = mxmlNewElement(b, "cwmp:X_FactoryResetSoftResponse");
if (!b) goto fault;
#ifndef TR098
bbf_cwmp_set_end_session(END_SESSION_X_FACTORY_RESET_SOFT);
#else
cwmp_set_end_session(END_SESSION_X_FACTORY_RESET_SOFT);
#endif
return 0;
......@@ -2108,12 +2100,7 @@ int cwmp_handle_rpc_cpe_reboot(struct session *session, struct rpc *rpc)
b = mxmlNewElement(b, "cwmp:RebootResponse");
if (!b) goto fault;
#ifndef TR098
bbf_cwmp_set_end_session(END_SESSION_REBOOT);
#else
cwmp_set_end_session(END_SESSION_REBOOT);
#endif
return 0;
fault:
......
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