1 #ifndef _GPXE_SETTINGS_H
2 #define _GPXE_SETTINGS_H
6 * Configuration settings
11 #include <gpxe/dhcp.h>
12 #include <gpxe/tables.h>
14 struct config_setting;
17 * A configuration context
19 * This identifies the context within which settings are inspected and
20 * changed. For example, the context might be global, or might be
21 * restricted to the settings stored in NVS on a particular device.
23 struct config_context {
24 /** DHCP options block, or NULL
26 * If NULL, all registered DHCP options blocks will be used.
28 struct dhcp_option_block *options;
32 * A configuration setting type
34 * This represents a type of configuration setting (e.g. string, IPv4
37 struct config_setting_type {
40 * This is the name exposed to the user (e.g. "string").
43 /** Show value of setting
45 * @v context Configuration context
46 * @v setting Configuration setting
47 * @v buf Buffer to contain value
48 * @v len Length of buffer
49 * @ret rc Return status code
51 int ( * show ) ( struct config_context *context,
52 struct config_setting *setting,
53 char *buf, size_t len );
54 /** Set value of setting
56 * @v context Configuration context
57 * @v setting Configuration setting
58 * @v value Setting value (as a string)
59 * @ret rc Return status code
61 int ( * set ) ( struct config_context *context,
62 struct config_setting *setting,
66 /** Declare a configuration setting type */
67 #define __config_setting_type __table ( config_setting_types, 01 )
70 * A configuration setting
72 * This represents a single configuration setting (e.g. "hostname").
74 struct config_setting {
77 * This is the human-readable name for the setting. Where
78 * possible, it should match the name used in dhcpd.conf (see
84 * This is the DHCP tag used to identify the option in DHCP
85 * packets and stored option blocks.
88 /** Configuration setting type
90 * This identifies the type of setting (e.g. string, IPv4
93 struct config_setting_type *type;
96 /** Declare a configuration setting */
97 #define __config_setting __table ( config_settings, 01 )
99 /* Function prototypes */
101 extern int show_setting ( struct config_context *context, const char *name,
102 char *buf, size_t len );
103 extern int set_setting ( struct config_context *context, const char *name,
106 #endif /* _GPXE_SETTINGS_H */