523cada5cab3f745c792ff2d748610ee14f6832e
[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 #include <types/types.h>
8
9 #define HWADDR_SIZE     6
10
11 struct interface_config {
12         uint8_t hwaddr[HWADDR_SIZE];
13         bool    ignore;
14         enum {
15                 CONFIG_METHOD_DHCP,
16                 CONFIG_METHOD_STATIC,
17         } method;
18         union {
19                 struct {
20                 } dhcp_config;
21                 struct {
22                         char *address;
23                         char *gateway;
24                 } static_config;
25         };
26 };
27
28 struct network_config {
29         struct interface_config **interfaces;
30         int                     n_interfaces;
31         const char              **dns_servers;
32         int                     n_dns_servers;
33 };
34
35 struct boot_priority {
36         enum device_type        type;
37 };
38
39 struct config {
40         bool                    autoboot_enabled;
41         int                     autoboot_timeout_sec;
42         struct network_config   network;
43         struct boot_priority    *boot_priorities;
44         int                     n_boot_priorities;
45 };
46
47
48 int config_init(void *ctx);
49 const struct config *config_get(void);
50 void config_set_autoboot(bool autoboot_enabled);
51 int config_fini(void);
52
53 #endif /* CONFIGURATION_H */
54