c74fa1b530188410478e3414a2c8759a813fdfda
[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         int                     autoboot_timeout_sec;
36         struct network_config   network;
37 };
38
39
40 int config_init(void *ctx);
41 const struct config *config_get(void);
42 void config_set_autoboot(bool autoboot_enabled);
43 int config_fini(void);
44
45 #endif /* CONFIGURATION_H */
46