]> git.ozlabs.org Git - petitboot/blobdiff - discover/discover-server.c
discover/pxe-parser: Parse simple iPXE scripts
[petitboot] / discover / discover-server.c
index e2e87ca43618d86086a7b1a75172636399e8f202..3377fa66621fc29be47b0c4cb388342641000bfa 100644 (file)
@@ -5,6 +5,7 @@
 #include <stdint.h>
 #include <errno.h>
 #include <assert.h>
+#include <string.h>
 
 #include <sys/socket.h>
 #include <sys/un.h>
@@ -246,6 +247,7 @@ static int write_config_message(struct discover_server *server,
 
 static int discover_server_process_message(void *arg)
 {
+       struct autoboot_option *autoboot_opt;
        struct pb_protocol_message *message;
        struct boot_command *boot_command;
        struct client *client = arg;
@@ -304,6 +306,27 @@ static int discover_server_process_message(void *arg)
                                url, NULL, NULL);
                break;
 
+       case PB_PROTOCOL_ACTION_PLUGIN_INSTALL:
+               url = pb_protocol_deserialise_string((void *) client, message);
+
+               device_handler_install_plugin(client->server->device_handler,
+                               url);
+               break;
+
+       case PB_PROTOCOL_ACTION_TEMP_AUTOBOOT:
+               autoboot_opt = talloc_zero(client, struct autoboot_option);
+               rc = pb_protocol_deserialise_temp_autoboot(autoboot_opt,
+                               message);
+               if (rc) {
+                       pb_log("can't parse temporary autoboot message\n");
+                       return 0;
+               }
+
+               device_handler_apply_temp_autoboot(
+                               client->server->device_handler,
+                               autoboot_opt);
+               break;
+
        default:
                pb_log("%s: invalid action %d\n", __func__, message->action);
                return 0;