@@ -21,6 +21,7 @@ extern unsigned int server_get_polling_interval(void);
extern server_op_res_t server_start(const char *cfgfname, int argc, char *argv[]);
extern server_op_res_t server_stop(void);
extern server_op_res_t server_ipc(int fd);
+extern void server_print_help(void);
static struct server_t {
server_op_res_t (*has_pending_action)(int *action_id);
@@ -30,10 +31,12 @@ static struct server_t {
server_op_res_t (*start)(const char *fname, int argc, char *argv[]);
server_op_res_t (*stop)(void);
server_op_res_t (*ipc)(int fd);
+ void (*help)(void);
} server = {.has_pending_action = &server_has_pending_action,
.install_update = &server_install_update,
.send_target_data = &server_send_target_data,
.get_polling_interval = &server_get_polling_interval,
+ .help = &server_print_help,
.ipc = &server_ipc,
.start = &server_start,
.stop = &server_stop};
@@ -108,7 +108,7 @@ server_op_res_t server_process_update_artifact(int action_id,
const char *part,
const char *version,
const char *name);
-void suricatta_print_help(void);
+void server_print_help(void);
server_op_res_t server_set_polling_interval(json_object *json_root);
server_op_res_t server_set_config_data(json_object *json_root);
static update_state_t get_state(void);
@@ -1474,7 +1474,7 @@ cleanup:
return result;
}
-void suricatta_print_help(void)
+void server_print_help(void)
{
fprintf(
stderr,
@@ -17,6 +17,11 @@
#include "suricatta/suricatta.h"
#include "suricatta/server.h"
+void suricatta_print_help(void)
+{
+ server.help();
+}
+
int suricatta_wait(int seconds)
{
fd_set readfds;
Each server has its own setup and comman line parameters. Set a general function to be called in suricatta daemon that references to the server specific help function. Signed-off-by: Stefano Babic <sbabic@denx.de> --- include/suricatta/server.h | 3 +++ suricatta/server_hawkbit.c | 4 ++-- suricatta/suricatta.c | 5 +++++ 3 files changed, 10 insertions(+), 2 deletions(-)