X-Git-Url: http://git.ozlabs.org/?p=petitboot;a=blobdiff_plain;f=discover%2Fdiscover-server.c;h=5f6f4d5190422aa257db6f2f7cbbce6cf887e654;hp=bd631f61bf86eac57c76dbfb8dfcb43476ad741a;hb=6993af8a4b8bb3c6b1d12172b346c5aa41b7dc61;hpb=7832d10c59cfe7f06e19bc6f0b6acaac1a552618 diff --git a/discover/discover-server.c b/discover/discover-server.c index bd631f6..5f6f4d5 100644 --- a/discover/discover-server.c +++ b/discover/discover-server.c @@ -20,6 +20,7 @@ #include "device-handler.h" #include "discover-server.h" +#include "platform.h" #include "sysinfo.h" struct discover_server { @@ -214,6 +215,8 @@ static int discover_server_process_message(void *arg) struct pb_protocol_message *message; struct boot_command *boot_command; struct client *client = arg; + struct config *config; + char *url; int rc; message = pb_protocol_read_message(client, client->fd); @@ -243,6 +246,30 @@ static int discover_server_process_message(void *arg) device_handler_cancel_default(client->server->device_handler); break; + case PB_PROTOCOL_ACTION_REINIT: + device_handler_reinit(client->server->device_handler); + break; + + case PB_PROTOCOL_ACTION_CONFIG: + config = talloc_zero(client, struct config); + + rc = pb_protocol_deserialise_config(config, message); + if (rc) { + pb_log("%s: no config?", __func__); + return 0; + } + + device_handler_update_config(client->server->device_handler, + config); + break; + + case PB_PROTOCOL_ACTION_ADD_URL: + url = pb_protocol_deserialise_string((void *) client, message); + + device_handler_process_url(client->server->device_handler, + url, NULL, NULL); + break; + default: pb_log("%s: invalid action %d\n", __func__, message->action); return 0; @@ -259,7 +286,7 @@ static int discover_server_process_connection(void *arg) struct client *client; /* accept the incoming connection */ - fd = accept(server->socket, NULL, 0); + fd = accept(server->socket, NULL, NULL); if (fd < 0) { pb_log("accept: %s\n", strerror(errno)); return 0;