From a5a6ffb506aa3c2a0c7fe8fd09abf3f737984aa5 Mon Sep 17 00:00:00 2001 From: "Enrico Loparco (eloparco)" Date: Tue, 23 Mar 2021 14:58:34 +0100 Subject: [HICN-645] Fix data structures to support hicn-light-daemon and hicn-light-control communication The daemon should be able to start, receive commands from hicn-light-control and execute them. Signed-off-by: Enrico Loparco (eloparco) Change-Id: I0ca5bb3d9bdfb37ac8cfa9f671f6c162c9a394f5 Signed-off-by: Enrico Loparco (eloparco) --- hicn-light/src/hicn/cli/hicnc.c | 28 +++++----------------------- 1 file changed, 5 insertions(+), 23 deletions(-) (limited to 'hicn-light/src/hicn/cli') diff --git a/hicn-light/src/hicn/cli/hicnc.c b/hicn-light/src/hicn/cli/hicnc.c index d6c7c4180..2c1c3500e 100644 --- a/hicn-light/src/hicn/cli/hicnc.c +++ b/hicn-light/src/hicn/cli/hicnc.c @@ -123,9 +123,6 @@ main(int argc, char * const * argv) goto ERR_PARSE; } - - hc_data_t * data; - hc_sock_t * s; if (server_ip) { if (server_port == 0) @@ -147,28 +144,13 @@ main(int argc, char * const * argv) goto ERR_CONNECT; } - /* XXX connection list */ - if (hc_connection_list(s, &data) < 0) { - fprintf(stderr, "Error running command"); - goto ERR_CMD; - } - - char buf[MAXSZ_HC_CONNECTION]; // XXX - foreach_connection(c, data) { - /* XXX connection print */ - int rc = hc_connection_snprintf(buf, MAXSZ_HC_CONNECTION, c); - if (rc < 0) { - strncpy(buf, "(Error)", MAXSZ_HC_CONNECTION); - } else if (rc >= MAXSZ_HC_CONNECTION) { - buf[MAXSZ_HC_CONNECTION-1] = '\0'; - buf[MAXSZ_HC_CONNECTION-2] = '.'; - buf[MAXSZ_HC_CONNECTION-3] = '.'; - buf[MAXSZ_HC_CONNECTION-4] = '.'; + // TODO: handle all commands + if (command.action == ACTION_CREATE && command.object.type == OBJECT_LISTENER) { + if (hc_listener_create(s, &command.object.listener) < 0) { + fprintf(stderr, "Error running command"); + goto ERR_CMD; } - printf("%s\n", buf); } - - hc_data_free(data); exit(EXIT_SUCCESS); ERR_CMD: -- cgit 1.2.3-korg