]> git.ozlabs.org Git - petitboot/blob - lib/pb-config/pb-config.h
6a64ef116670030783e685350b82313f24add494
[petitboot] / lib / pb-config / pb-config.h
1 #ifndef CONFIGURATION_H
2 #define CONFIGURATION_H
3
4 #include <stdbool.h>
5 #include <stdint.h>
6
7 #define HWADDR_SIZE     6
8
9 struct interface_config {
10         uint8_t hwaddr[HWADDR_SIZE];
11         bool    ignore;
12         enum {
13                 CONFIG_METHOD_DHCP,
14                 CONFIG_METHOD_STATIC,
15         } method;
16         union {
17                 struct {
18                 } dhcp_config;
19                 struct {
20                         char *address;
21                         char *gateway;
22                 } static_config;
23         };
24 };
25
26 struct network_config {
27         struct interface_config **interfaces;
28         int                     n_interfaces;
29         const char              **dns_servers;
30         int                     n_dns_servers;
31 };
32
33 struct config {
34         bool                    autoboot_enabled;
35         struct network_config   network;
36 };
37
38
39 int config_init(void *ctx);
40 const struct config *config_get(void);
41 void config_set_autoboot(bool autoboot_enabled);
42 int config_fini(void);
43
44 #endif /* CONFIGURATION_H */
45