]> git.ozlabs.org Git - petitboot/blob - lib/pb-config/pb-config.h
config: Split interface configuration from network configuration
[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                         char *dns;
23                 } static_config;
24         };
25 };
26
27 struct network_config {
28         struct interface_config **interfaces;
29         int                     n_interfaces;
30 };
31
32 struct config {
33         bool                    autoboot_enabled;
34         struct network_config   network;
35 };
36
37
38 int config_init(void *ctx);
39 const struct config *config_get(void);
40 void config_set_autoboot(bool autoboot_enabled);
41 int config_fini(void);
42
43 #endif /* CONFIGURATION_H */
44