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;
24 if (streq(name, "LABEL")) {
28 opt = discover_boot_option_create(ctx->dc, ctx->dc->device);
29 ctx->parser_info = opt;
31 opt->option->name = talloc_strdup(opt, value);
32 opt->option->id = talloc_asprintf(opt, "%s@%p",
33 ctx->dc->device->device->id, opt);
37 /* all other parameters need an option */
41 if (streq(name, "KERNEL")) {
42 url = pb_url_join(ctx->dc, ctx->dc->conf_url, value);
43 opt->boot_image = create_url_resource(opt, url);
45 } else if (streq(name, "APPEND")) {
46 opt->option->boot_args = talloc_strdup(opt->option, value);
47 /* todo: initrd extraction */
51 static int pxe_parse(struct discover_context *dc, char *buf, int len)
53 struct conf_context *conf;
55 conf = talloc_zero(dc, struct conf_context);
61 conf->get_pair = conf_get_pair_space;
62 conf->process_pair = pxe_process_pair;
63 conf->finish = pxe_finish;
65 conf_parse_buf(conf, buf, len);
71 static struct parser pxe_parser = {
74 .method = CONF_METHOD_DHCP,
77 register_parser(pxe_parser);