4 #include <talloc/talloc.h>
8 #include "parser-conf.h"
9 #include "parser-utils.h"
12 static void pxe_finish(struct conf_context *conf)
14 printf("%s\n", __func__);
15 discover_context_add_boot_option(conf->dc, conf->parser_info);
18 static void pxe_process_pair(struct conf_context *ctx,
19 const char *name, char *value)
21 struct discover_boot_option *opt = ctx->parser_info;
27 if (streq(name, "LABEL")) {
31 opt = discover_boot_option_create(ctx->dc, ctx->dc->device);
32 ctx->parser_info = opt;
34 opt->option->name = talloc_strdup(opt, value);
35 opt->option->id = talloc_asprintf(opt, "%s@%p",
36 ctx->dc->device->device->id, opt);
40 /* all other parameters need an option */
44 if (streq(name, "KERNEL")) {
45 url = pb_url_join(ctx->dc, ctx->dc->conf_url, value);
46 opt->boot_image = create_url_resource(opt, url);
48 } else if (streq(name, "APPEND")) {
49 opt->option->boot_args = talloc_strdup(opt->option, value);
50 /* todo: initrd extraction */
54 static int pxe_parse(struct discover_context *dc, char *buf, int len)
56 struct conf_context *conf;
58 conf = talloc_zero(dc, struct conf_context);
64 conf->get_pair = conf_get_pair_space;
65 conf->process_pair = pxe_process_pair;
66 conf->finish = pxe_finish;
68 conf_parse_buf(conf, buf, len);
74 static struct parser pxe_parser = {
77 .method = CONF_METHOD_DHCP,
80 register_parser(pxe_parser);