Commit e2e02f48 authored by Omar Kallel's avatar Omar Kallel

Ticket refs #2618: TR069: Ameliorate separation between libbbf_api and...

Ticket refs #2618: TR069: Ameliorate separation between libbbf_api and libbbfdm (apply for end_session_flag)
parent 65c0372c
......@@ -511,11 +511,7 @@ int run_session_end_func (struct session *session)
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();
......@@ -523,11 +519,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();
......@@ -536,34 +528,28 @@ 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();
......@@ -574,21 +560,14 @@ 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();
......@@ -597,41 +576,27 @@ 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();
......@@ -639,11 +604,8 @@ 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;
}
......
......@@ -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;
......
......@@ -1970,11 +1970,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;
......@@ -2000,11 +1996,8 @@ 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;
......@@ -2137,11 +2130,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;
......
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