iPXE
|
Configuration settings. More...
Go to the source code of this file.
Data Structures | |
struct | setting |
A setting. More... | |
struct | settings_operations |
Settings block operations. More... | |
struct | settings |
A settings block. More... | |
struct | settings_scope |
A setting scope. More... | |
struct | setting_type |
A setting type. More... | |
struct | settings_applicator |
A settings applicator. More... | |
struct | builtin_setting |
A built-in setting. More... | |
struct | generic_settings |
A generic settings block. More... | |
Macros | |
#define | SETTINGS __table ( struct setting, "settings" ) |
Configuration setting table. More... | |
#define | __setting(setting_order, name) __table_entry ( SETTINGS, setting_order.name ) |
Declare a configuration setting. More... | |
#define | SETTING_NETDEV 01 |
Network device settings. More... | |
#define | SETTING_NETDEV_EXTRA 02 |
Network device additional settings. More... | |
#define | SETTING_IP4 03 |
IPv4 settings. More... | |
#define | SETTING_IP4_EXTRA 04 |
IPv4 additional settings. More... | |
#define | SETTING_IP6 05 |
IPv6 settings. More... | |
#define | SETTING_IP6_EXTRA 06 |
IPv6 additional settings. More... | |
#define | SETTING_IP 07 |
IPv4 settings. More... | |
#define | SETTING_IP_EXTRA 08 |
IPv4 additional settings. More... | |
#define | SETTING_BOOT 09 |
Generic boot settings. More... | |
#define | SETTING_BOOT_EXTRA 10 |
Generic boot additional settings. More... | |
#define | SETTING_SANBOOT 11 |
SAN boot settings. More... | |
#define | SETTING_SANBOOT_EXTRA 12 |
SAN boot additional settings. More... | |
#define | SETTING_HOST 13 |
Host identity settings. More... | |
#define | SETTING_HOST_EXTRA 14 |
Host identity additional settings. More... | |
#define | SETTING_AUTH 15 |
Authentication settings. More... | |
#define | SETTING_AUTH_EXTRA 16 |
Authentication additional settings. More... | |
#define | SETTING_CRYPTO 17 |
Cryptography settings. More... | |
#define | SETTING_MISC 18 |
Miscellaneous settings. More... | |
#define | SETTING_TYPES __table ( struct setting_type, "setting_types" ) |
Configuration setting type table. More... | |
#define | __setting_type __table_entry ( SETTING_TYPES, 01 ) |
Declare a configuration setting type. More... | |
#define | SETTINGS_APPLICATORS __table ( struct settings_applicator, "settings_applicators" ) |
Settings applicator table. More... | |
#define | __settings_applicator __table_entry ( SETTINGS_APPLICATORS, 01 ) |
Declare a settings applicator. More... | |
#define | BUILTIN_SETTINGS __table ( struct builtin_setting, "builtin_settings" ) |
Built-in settings table. More... | |
#define | __builtin_setting __table_entry ( BUILTIN_SETTINGS, 01 ) |
Declare a built-in setting. More... | |
Typedefs | |
typedef struct settings *(* | get_child_settings_t) (struct settings *settings, const char *name) |
A child settings block locator function. More... | |
Functions | |
FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
int | generic_settings_store (struct settings *settings, const struct setting *setting, const void *data, size_t len) |
Store value of generic setting. More... | |
int | generic_settings_fetch (struct settings *settings, struct setting *setting, void *data, size_t len) |
Fetch value of generic setting. More... | |
void | generic_settings_clear (struct settings *settings) |
Clear generic settings block. More... | |
int | register_settings (struct settings *settings, struct settings *parent, const char *name) |
Register settings block. More... | |
void | unregister_settings (struct settings *settings) |
Unregister settings block. More... | |
struct settings * | settings_target (struct settings *settings) |
Redirect to target settings block. More... | |
int | setting_applies (struct settings *settings, const struct setting *setting) |
Check applicability of setting. More... | |
int | store_setting (struct settings *settings, const struct setting *setting, const void *data, size_t len) |
Store value of setting. More... | |
int | fetch_setting (struct settings *settings, const struct setting *setting, struct settings **origin, struct setting *fetched, void *data, size_t len) |
Fetch setting. More... | |
int | fetch_setting_copy (struct settings *settings, const struct setting *setting, struct settings **origin, struct setting *fetched, void **data) |
Fetch copy of setting. More... | |
int | fetch_raw_setting (struct settings *settings, const struct setting *setting, void *data, size_t len) |
Fetch value of setting. More... | |
int | fetch_raw_setting_copy (struct settings *settings, const struct setting *setting, void **data) |
Fetch value of setting. More... | |
int | fetch_string_setting (struct settings *settings, const struct setting *setting, char *data, size_t len) |
Fetch value of string setting. More... | |
int | fetch_string_setting_copy (struct settings *settings, const struct setting *setting, char **data) |
Fetch value of string setting. More... | |
int | fetch_ipv4_array_setting (struct settings *settings, const struct setting *setting, struct in_addr *inp, unsigned int count) |
Fetch value of IPv4 address setting. More... | |
int | fetch_ipv4_setting (struct settings *settings, const struct setting *setting, struct in_addr *inp) |
Fetch value of IPv4 address setting. More... | |
int | fetch_ipv6_array_setting (struct settings *settings, const struct setting *setting, struct in6_addr *inp, unsigned int count) |
Fetch value of IPv6 address setting. More... | |
int | fetch_ipv6_setting (struct settings *settings, const struct setting *setting, struct in6_addr *inp) |
Fetch value of IPv6 address setting. More... | |
int | fetch_int_setting (struct settings *settings, const struct setting *setting, long *value) |
Fetch value of signed integer setting. More... | |
int | fetch_uint_setting (struct settings *settings, const struct setting *setting, unsigned long *value) |
Fetch value of unsigned integer setting. More... | |
long | fetch_intz_setting (struct settings *settings, const struct setting *setting) |
Fetch value of signed integer setting, or zero. More... | |
unsigned long | fetch_uintz_setting (struct settings *settings, const struct setting *setting) |
Fetch value of unsigned integer setting, or zero. More... | |
int | fetch_uuid_setting (struct settings *settings, const struct setting *setting, union uuid *uuid) |
Fetch value of UUID setting. More... | |
void | clear_settings (struct settings *settings) |
Clear settings block. More... | |
int | setting_cmp (const struct setting *a, const struct setting *b) |
Compare two settings. More... | |
struct settings * | find_child_settings (struct settings *parent, const char *name) |
Find child settings block. More... | |
struct settings * | autovivify_child_settings (struct settings *parent, const char *name) |
Find or create child settings block. More... | |
const char * | settings_name (struct settings *settings) |
Return settings block name. More... | |
struct settings * | find_settings (const char *name) |
Find settings block. More... | |
struct setting * | find_setting (const char *name) |
Find predefined setting. More... | |
int | parse_setting_name (char *name, get_child_settings_t get_child, struct settings **settings, struct setting *setting) |
Parse setting name. More... | |
int | setting_name (struct settings *settings, const struct setting *setting, char *buf, size_t len) |
Return full setting name. More... | |
int | setting_format (const struct setting_type *type, const void *raw, size_t raw_len, char *buf, size_t len) |
Format setting value as a string. More... | |
int | setting_parse (const struct setting_type *type, const char *value, void *buf, size_t len) |
Parse formatted string to setting value. More... | |
int | setting_numerate (const struct setting_type *type, const void *raw, size_t raw_len, unsigned long *value) |
Convert setting value to number. More... | |
int | setting_denumerate (const struct setting_type *type, unsigned long value, void *buf, size_t len) |
Convert number to setting value. More... | |
int | fetchf_setting (struct settings *settings, const struct setting *setting, struct settings **origin, struct setting *fetched, char *buf, size_t len) |
Fetch formatted value of setting. More... | |
int | fetchf_setting_copy (struct settings *settings, const struct setting *setting, struct settings **origin, struct setting *fetched, char **value) |
Fetch copy of formatted value of setting. More... | |
int | storef_setting (struct settings *settings, const struct setting *setting, const char *value) |
Store formatted value of setting. More... | |
int | fetchn_setting (struct settings *settings, const struct setting *setting, struct settings **origin, struct setting *fetched, unsigned long *value) |
Fetch numeric value of setting. More... | |
int | storen_setting (struct settings *settings, const struct setting *setting, unsigned long value) |
Store numeric value of setting. More... | |
char * | expand_settings (const char *string) |
Expand variables within string. More... | |
const struct setting ip_setting | __setting (SETTING_IP4, ip) |
const struct setting netmask_setting | __setting (SETTING_IP4, netmask) |
const struct setting gateway_setting | __setting (SETTING_IP4, gateway) |
const struct setting dns_setting | __setting (SETTING_IP4_EXTRA, dns) |
const struct setting ip6_setting | __setting (SETTING_IP6, ip6) |
const struct setting len6_setting | __setting (SETTING_IP6, len6) |
const struct setting gateway6_setting | __setting (SETTING_IP6, gateway6) |
const struct setting hostname_setting | __setting (SETTING_HOST, hostname) |
const struct setting domain_setting | __setting (SETTING_IP_EXTRA, domain) |
const struct setting filename_setting | __setting (SETTING_BOOT, filename) |
const struct setting root_path_setting | __setting (SETTING_SANBOOT, root-path) |
const struct setting san_filename_setting | __setting (SETTING_SANBOOT, san-filename) |
const struct setting username_setting | __setting (SETTING_AUTH, username) |
const struct setting password_setting | __setting (SETTING_AUTH, password) |
const struct setting priority_setting | __setting (SETTING_MISC, priority) |
const struct setting uuid_setting | __setting (SETTING_HOST, uuid) |
const struct setting next_server_setting | __setting (SETTING_BOOT, next-server) |
const struct setting mac_setting | __setting (SETTING_NETDEV, mac) |
const struct setting busid_setting | __setting (SETTING_NETDEV, busid) |
const struct setting user_class_setting | __setting (SETTING_HOST_EXTRA, user-class) |
const struct setting vendor_class_setting | __setting (SETTING_HOST_EXTRA, vendor-class) |
const struct setting manufacturer_setting | __setting (SETTING_HOST_EXTRA, manufacturer) |
const struct setting product_setting | __setting (SETTING_HOST_EXTRA, product) |
const struct setting serial_setting | __setting (SETTING_HOST_EXTRA, serial) |
const struct setting asset_setting | __setting (SETTING_HOST_EXTRA, asset) |
const struct setting board_serial_setting | __setting (SETTING_HOST_EXTRA, board-serial) |
const struct setting dhcp_server_setting | __setting (SETTING_MISC, dhcp-server) |
static void | settings_init (struct settings *settings, struct settings_operations *op, struct refcnt *refcnt, const struct settings_scope *default_scope) |
Initialise a settings block. More... | |
static void | generic_settings_init (struct generic_settings *generics, struct refcnt *refcnt) |
Initialise a settings block. More... | |
static int | delete_setting (struct settings *settings, const struct setting *setting) |
Delete setting. More... | |
static int | setting_exists (struct settings *settings, const struct setting *setting) |
Check existence of predefined setting. More... | |
Variables | |
const struct settings_scope | builtin_scope |
Built-in setting scope. More... | |
const struct settings_scope | ipv6_settings_scope |
IPv6 setting scope. More... | |
const struct settings_scope | dhcpv6_scope |
DHCPv6 setting scope. More... | |
struct settings_operations | generic_settings_operations |
Generic settings operations. More... | |
const struct setting_type setting_type_string | __setting_type |
A string setting type. More... | |
Configuration settings.
Definition in file settings.h.
Configuration setting table.
Definition at line 53 of file settings.h.
#define __setting | ( | setting_order, | |
name | |||
) | __table_entry ( SETTINGS, setting_order.name ) |
Declare a configuration setting.
Definition at line 56 of file settings.h.
#define SETTING_TYPES __table ( struct setting_type, "setting_types" ) |
Configuration setting type table.
Definition at line 242 of file settings.h.
const struct setting_type setting_type_dnssl __setting_type __table_entry ( SETTING_TYPES, 01 ) |
Declare a configuration setting type.
PCI bus:dev.fn setting type.
GUID setting type.
UUID setting type.
A Base64-encoded setting.
A hex-string setting (non-delimited)
A hex-string setting (hyphen-delimited)
A hex-string setting (colon-delimited)
An unsigned 32-bit integer setting type.
An unsigned 16-bit integer setting type.
An unsigned 8-bit integer setting type.
A signed 32-bit integer setting type.
A signed 16-bit integer setting type.
A signed 8-bit integer setting type.
An IPv6 address setting type.
An IPv4 address setting type.
A URI-encoded string setting type.
Definition at line 245 of file settings.h.
#define SETTINGS_APPLICATORS __table ( struct settings_applicator, "settings_applicators" ) |
Settings applicator table.
Definition at line 260 of file settings.h.
#define __settings_applicator __table_entry ( SETTINGS_APPLICATORS, 01 ) |
Declare a settings applicator.
Definition at line 264 of file settings.h.
#define BUILTIN_SETTINGS __table ( struct builtin_setting, "builtin_settings" ) |
Built-in settings table.
Definition at line 280 of file settings.h.
struct builtin_setting unixtime_builtin_setting __builtin_setting __table_entry ( BUILTIN_SETTINGS, 01 ) |
Declare a built-in setting.
Current time built-in setting.
Version built-in setting.
Platform built-in setting.
Build architecture built-in setting.
Definition at line 283 of file settings.h.
A child settings block locator function.
Definition at line 306 of file settings.h.
FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
int generic_settings_store | ( | struct settings * | settings, |
const struct setting * | setting, | ||
const void * | data, | ||
size_t | len | ||
) |
Store value of generic setting.
settings | Settings block |
setting | Setting to store |
data | Setting data, or NULL to clear setting |
len | Length of setting data |
rc | Return status code |
Definition at line 126 of file settings.c.
References container_of, data, ENOMEM, find_generic_setting(), free, generic_setting_data(), generic_setting_name(), len, generic_settings::list, list_add, list_del, memcpy(), setting::name, generic_setting::name_len, NULL, old, strlen(), and zalloc().
Referenced by netdev_store().
int generic_settings_fetch | ( | struct settings * | settings, |
struct setting * | setting, | ||
void * | data, | ||
size_t | len | ||
) |
Fetch value of generic setting.
settings | Settings block |
setting | Setting to fetch |
data | Buffer to fill with setting data |
len | Length of buffer |
len | Length of setting data, or negative error |
Definition at line 178 of file settings.c.
References container_of, data, ENOENT, find_generic_setting(), generic, generic_setting_data(), len, memcpy(), and setting::type.
Referenced by netdev_fetch().
void generic_settings_clear | ( | struct settings * | settings | ) |
Clear generic settings block.
settings | Settings block |
Definition at line 207 of file settings.c.
References assert(), container_of, free, generic, generic_settings::list, generic_setting::list, list_del, list_empty, list_for_each_entry_safe, and tmp.
Referenced by autovivified_settings_free(), and netdev_clear().
Register settings block.
settings | Settings block |
parent | Parent settings block, or NULL |
name | Settings block name |
rc | Return status code |
Definition at line 475 of file settings.c.
References apply_settings(), assert(), settings::children, DBGC, find_child_settings(), list_add_tail, settings::name, name, NULL, settings::parent, ref_get, settings::refcnt, reprioritise_settings(), settings_name(), settings_target(), settings::siblings, and unregister_settings().
Referenced by acpi_settings_init(), autovivify_child_settings(), builtin_init(), cachedhcp_apply(), cpuid_settings_init(), dhcp_proxy_rx(), dhcp_pxebs_rx(), dhcp_request_rx(), dhcpv6_register(), guestinfo_init(), guestinfo_net_probe(), ipv6_register_settings(), lldp_probe(), memmap_settings_init(), ndp_register_settings(), netdev_redirect_settings_init(), pci_settings_init(), phantom_probe(), register_netdev(), register_nvo(), settings_test_exec(), and smbios_init().
void unregister_settings | ( | struct settings * | settings | ) |
Unregister settings block.
settings | Settings block |
Definition at line 514 of file settings.c.
References apply_settings(), settings::children, DBGC, list_del, list_first_entry, NULL, settings::parent, ref_put, settings::refcnt, settings_name(), settings::siblings, and unregister_settings().
Referenced by dhcp_request_rx(), guestinfo_net_remove(), lldp_probe(), ndp_register_settings(), phantom_probe(), phantom_remove(), register_netdev(), register_settings(), settings_test_exec(), unregister_netdev(), unregister_nvo(), and unregister_settings().
Redirect to target settings block.
settings | Settings block, or NULL |
settings | Underlying settings block |
Definition at line 549 of file settings.c.
References settings::op, settings_operations::redirect, and settings_root.
Referenced by autovivify_child_settings(), clear_settings(), fetch_setting(), find_child_settings(), register_settings(), select_settings(), setting_applies(), setting_name(), settings_name(), and store_setting().
Check applicability of setting.
settings | Settings block |
setting | Setting |
applies | Setting applies within this settings block |
Definition at line 570 of file settings.c.
References settings_operations::applies, settings::op, and settings_target().
Referenced by applicable_setting(), select_setting_row(), and store_setting().
int store_setting | ( | struct settings * | settings, |
const struct setting * | setting, | ||
const void * | data, | ||
size_t | len | ||
) |
Store value of setting.
settings | Settings block, or NULL |
setting | Setting to store |
data | Setting data, or NULL to clear setting |
len | Length of setting data |
rc | Return status code |
Definition at line 615 of file settings.c.
References apply_settings(), data, ENOTSUP, ENOTTY, len, settings::op, settings::parent, rc, reprioritise_settings(), setting_applies(), setting_cmp(), settings_root, settings_target(), and settings_operations::store.
Referenced by delete_setting(), login_ui(), nslookup_resolv_done(), storef_setting(), and storen_setting().
int fetch_setting | ( | struct settings * | settings, |
const struct setting * | setting, | ||
struct settings ** | origin, | ||
struct setting * | fetched, | ||
void * | data, | ||
size_t | len | ||
) |
Fetch setting.
settings | Settings block, or NULL to search all blocks |
setting | Setting to fetch |
origin | Origin of setting to fill in, or NULL |
fetched | Fetched setting to fill in, or NULL |
data | Buffer to fill with setting data |
len | Length of buffer |
len | Length of setting data, or negative error |
The actual length of the setting will be returned even if the buffer was too small.
Definition at line 666 of file settings.c.
References applicable_setting(), settings::children, data, ENOENT, ENOTSUP, settings_operations::fetch, fetch_setting(), len, list_for_each_entry, memcpy(), memset(), NULL, settings::op, origin, settings_target(), and tmp.
Referenced by fetch_next_server_and_filename(), fetch_raw_setting(), fetch_setting(), fetch_setting_alloc(), ibft_fill_nic(), ibft_set_string_setting(), ipv6_create_routes(), and setting_exists().
int fetch_setting_copy | ( | struct settings * | settings, |
const struct setting * | setting, | ||
struct settings ** | origin, | ||
struct setting * | fetched, | ||
void ** | data | ||
) |
Fetch copy of setting.
settings | Settings block, or NULL to search all blocks |
setting | Setting to fetch |
origin | Origin of setting to fill in, or NULL |
fetched | Fetched setting to fill in, or NULL |
data | Buffer to allocate and fill with setting data |
len | Length of setting, or negative error |
The caller is responsible for eventually freeing the allocated buffer.
Definition at line 785 of file settings.c.
References data, fetch_setting_alloc(), malloc(), and origin.
Referenced by fetch_raw_setting_copy(), fetchf_setting(), and fetchn_setting().
int fetch_raw_setting | ( | struct settings * | settings, |
const struct setting * | setting, | ||
void * | data, | ||
size_t | len | ||
) |
Fetch value of setting.
settings | Settings block, or NULL to search all blocks |
setting | Setting to fetch |
data | Buffer to fill with setting string data |
len | Length of buffer |
len | Length of setting, or negative error |
Definition at line 803 of file settings.c.
References data, fetch_setting(), len, and NULL.
Referenced by dhcp_create_request(), dhcpv6_user_class(), fetch_ipv4_array_setting(), fetch_ipv6_array_setting(), fetch_numeric_setting(), fetch_string_setting(), fetch_uuid_setting(), pxe_menu_parse(), start_pxebs(), trivial_change_key(), and trivial_init().
int fetch_raw_setting_copy | ( | struct settings * | settings, |
const struct setting * | setting, | ||
void ** | data | ||
) |
Fetch value of setting.
settings | Settings block, or NULL to search all blocks |
setting | Setting to fetch |
data | Buffer to allocate and fill with setting data |
len | Length of setting, or negative error |
The caller is responsible for eventually freeing the allocated buffer.
Definition at line 821 of file settings.c.
References data, fetch_setting_copy(), and NULL.
Referenced by apply_dns_search(), apply_dns_servers(), certstore_apply_settings(), copy_encap_settings(), dhcp_create_request(), privkey_apply_settings(), and rootcert_init().
int fetch_string_setting | ( | struct settings * | settings, |
const struct setting * | setting, | ||
char * | data, | ||
size_t | len | ||
) |
Fetch value of string setting.
settings | Settings block, or NULL to search all blocks |
setting | Setting to fetch |
data | Buffer to fill with setting string data |
len | Length of buffer |
len | Length of string setting, or negative error |
The resulting string is guaranteed to be correctly NUL-terminated. The returned length will be the length of the underlying setting data.
Definition at line 841 of file settings.c.
References data, fetch_raw_setting(), len, and memset().
Referenced by have_pxe_menu(), ib_sma_node_desc(), ibft_set_string_setting(), login_ui(), net80211_autoassociate(), net80211_check_settings_update(), wpa_psk_start(), and xsigo_xds_complete().
int fetch_string_setting_copy | ( | struct settings * | settings, |
const struct setting * | setting, | ||
char ** | data | ||
) |
Fetch value of string setting.
settings | Settings block, or NULL to search all blocks |
setting | Setting to fetch |
data | Buffer to allocate and fill with setting string data |
len | Length of string setting, or negative error |
The resulting string is guaranteed to be correctly NUL-terminated. The returned length will be the length of the underlying setting data. The caller is responsible for eventually freeing the allocated buffer.
Definition at line 873 of file settings.c.
References data, fetch_setting_alloc(), fetch_string_setting_copy_alloc(), and NULL.
Referenced by apply_dns_search(), apply_peerdisc_settings(), apply_syslog_settings(), apply_syslogs_settings(), efi_veto(), fetch_next_server_and_filename(), fetch_root_path(), fetch_san_filename(), ipxe(), iscsi_fetch_settings(), keymap_apply(), oncrpc_init_cred_sys(), and validator_start_download().
int fetch_ipv4_array_setting | ( | struct settings * | settings, |
const struct setting * | setting, | ||
struct in_addr * | inp, | ||
unsigned int | count | ||
) |
Fetch value of IPv4 address setting.
settings | Settings block, or NULL to search all blocks |
setting | Setting to fetch |
inp | IPv4 addresses to fill in |
count | Maximum number of IPv4 addresses |
len | Length of setting, or negative error |
Definition at line 890 of file settings.c.
References count, ERANGE, fetch_raw_setting(), and len.
Referenced by fetch_ipv4_setting(), and ibft_set_ipaddr_setting().
int fetch_ipv4_setting | ( | struct settings * | settings, |
const struct setting * | setting, | ||
struct in_addr * | inp | ||
) |
Fetch value of IPv4 address setting.
settings | Settings block, or NULL to search all blocks |
setting | Setting to fetch |
inp | IPv4 address to fill in |
len | Length of setting, or negative error |
Definition at line 912 of file settings.c.
References fetch_ipv4_array_setting().
Referenced by apply_syslog_settings(), create_fakepxebsack(), efi_pxe_install(), efi_pxe_ip(), fetch_next_server_and_filename(), gdbudp_configure(), ibft_fill_nic(), ipv4_settings(), start_pxebs(), and tftp_apply_settings().
int fetch_ipv6_array_setting | ( | struct settings * | settings, |
const struct setting * | setting, | ||
struct in6_addr * | inp, | ||
unsigned int | count | ||
) |
Fetch value of IPv6 address setting.
settings | Settings block, or NULL to search all blocks |
setting | Setting to fetch |
inp | IPv6 addresses to fill in |
count | Maximum number of IPv6 addresses |
len | Length of setting, or negative error |
Definition at line 928 of file settings.c.
References count, ERANGE, fetch_raw_setting(), and len.
Referenced by fetch_ipv6_setting().
int fetch_ipv6_setting | ( | struct settings * | settings, |
const struct setting * | setting, | ||
struct in6_addr * | inp | ||
) |
Fetch value of IPv6 address setting.
settings | Settings block, or NULL to search all blocks |
setting | Setting to fetch |
inp | IPv6 address to fill in |
len | Length of setting, or negative error |
Definition at line 950 of file settings.c.
References fetch_ipv6_array_setting().
Referenced by apply_syslog_settings().
Fetch value of signed integer setting.
settings | Settings block, or NULL to search all blocks |
setting | Setting to fetch |
value | Integer value to fill in |
len | Length of setting, or negative error |
Definition at line 1023 of file settings.c.
References fetch_numeric_setting(), and value.
Referenced by apply_peerdist_settings().
int fetch_uint_setting | ( | struct settings * | settings, |
const struct setting * | setting, | ||
unsigned long * | value | ||
) |
Fetch value of unsigned integer setting.
settings | Settings block, or NULL to search all blocks |
setting | Setting to fetch |
value | Integer value to fill in |
len | Length of setting, or negative error |
Definition at line 1039 of file settings.c.
References fetch_numeric_setting(), and value.
Referenced by san_default_drive(), and sandev_apply().
Fetch value of signed integer setting, or zero.
settings | Settings block, or NULL to search all blocks |
setting | Setting to fetch |
value | Setting value, or zero |
Definition at line 1053 of file settings.c.
References fetch_numeric_setting(), and value.
Referenced by net80211_step_associate(), reprioritise_settings(), and uriboot().
Fetch value of unsigned integer setting, or zero.
settings | Settings block, or NULL to search all blocks |
setting | Setting to fetch |
value | Setting value, or zero |
Definition at line 1068 of file settings.c.
References fetch_numeric_setting(), and value.
Referenced by apply_netdev_settings(), have_pxe_menu(), oncrpc_init_cred_sys(), and start_pxebs().
int fetch_uuid_setting | ( | struct settings * | settings, |
const struct setting * | setting, | ||
union uuid * | uuid | ||
) |
Fetch value of UUID setting.
settings | Settings block, or NULL to search all blocks |
setting | Setting to fetch |
uuid | UUID to fill in |
len | Length of setting, or negative error |
Definition at line 1084 of file settings.c.
References ERANGE, fetch_raw_setting(), and len.
Referenced by dhcp_create_request(), iscsi_fetch_settings(), rbg_startup(), and start_dhcpv6().
void clear_settings | ( | struct settings * | settings | ) |
Clear settings block.
settings | Settings block |
Definition at line 1102 of file settings.c.
References settings_operations::clear, settings::op, and settings_target().
Referenced by free_netdev(), register_netdev(), settings_test_exec(), and unregister_netdev().
Compare two settings.
a | Setting to compare |
b | Setting to compare |
0 | Settings are the same |
non-zero | Settings are not the same |
Definition at line 1120 of file settings.c.
References a, b, and strcmp().
Referenced by applicable_setting(), builtin_fetch(), dhcpv6_applies(), dhcpv6_fetch(), efi_snp_hii_questions(), find_generic_setting(), ipv6_fetch(), ndp_prefix_fetch(), netdev_fetch(), netdev_store(), parse_setting_name(), phantom_clp_setting(), select_setting_row(), and store_setting().
Find child settings block.
parent | Parent settings block |
name | Name within this parent |
settings | Settings block, or NULL |
Definition at line 279 of file settings.c.
References settings::children, list_for_each_entry, settings::name, name, NULL, settings_target(), and strcmp().
Referenced by autovivify_child_settings(), efi_snp_hii_settings(), expand_settings(), find_settings(), parse_existing_setting(), and register_settings().
Find or create child settings block.
parent | Parent settings block |
name | Name within this parent |
settings | Settings block, or NULL |
Definition at line 306 of file settings.c.
References autovivified_settings_free(), DBGC, find_child_settings(), generic_settings_init(), memcpy(), settings::name, name, NULL, ref_init, ref_put, settings::refcnt, register_settings(), settings_target(), strlen(), and zalloc().
Referenced by nslookup_resolv_done(), and parse_autovivified_setting().
const char* settings_name | ( | struct settings * | settings | ) |
Return settings block name.
settings | Settings block |
name | Settings block name |
Definition at line 345 of file settings.c.
References memcpy(), settings::name, settings::parent, settings_target(), snprintf(), and tmp.
Referenced by draw_title_row(), parse_setting_name(), register_settings(), setting_name(), and unregister_settings().
struct settings* find_settings | ( | const char * | name | ) |
Find settings block.
name | Name |
settings | Settings block, or NULL |
Definition at line 406 of file settings.c.
References find_child_settings(), name, and parse_settings_name().
Referenced by create_fakepxebsack(), dhcp_request_rx(), parse_settings(), and pxe_menu_boot().
struct setting* find_setting | ( | const char * | name | ) |
Find predefined setting.
name | Name |
setting | Setting, or NULL |
Definition at line 1466 of file settings.c.
References for_each_table_entry, setting::name, name, NULL, generic_setting::setting, SETTINGS, and strcmp().
Referenced by efi_snp_hii_fetch(), efi_snp_hii_store(), and guestinfo_fetch_type().
int parse_setting_name | ( | char * | name, |
get_child_settings_t | get_child, | ||
struct settings ** | settings, | ||
struct setting * | setting | ||
) |
Parse setting name.
name | Name of setting |
get_child | Function to find or create child settings block |
settings | Settings block to fill in |
setting | Setting to fill in |
rc | Return status code |
Interprets a name of the form "[settings_name/]tag_name[:type_name]" and fills in the appropriate fields.
Note that on success, this function will have modified the original setting name
.
Definition at line 1528 of file settings.c.
References DBG, ENODEV, ENOTSUP, find_setting_type(), for_each_table_entry, memcpy(), memset(), setting::name, name, NULL, parse_setting_tag(), parse_settings_name(), rc, setting::scope, setting_cmp(), setting_name(), SETTINGS, settings_name(), settings_root, strchr(), setting::tag, and setting::type.
Referenced by expand_settings(), nslookup_resolv_done(), and parse_setting().
int setting_name | ( | struct settings * | settings, |
const struct setting * | setting, | ||
char * | buf, | ||
size_t | len | ||
) |
Return full setting name.
settings | Settings block, or NULL |
setting | Setting |
buf | Buffer |
len | Length of buffer |
len | Length of setting name, or negative error |
Definition at line 1606 of file settings.c.
References len, setting::name, setting_type::name, name, settings_name(), settings_target(), snprintf(), and setting::type.
Referenced by draw_info_row(), nslookup(), nslookup_exec(), parse_setting_name(), resolv_setting(), and show_exec().
int setting_format | ( | const struct setting_type * | type, |
const void * | raw, | ||
size_t | raw_len, | ||
char * | buf, | ||
size_t | len | ||
) |
Format setting value as a string.
type | Setting type |
raw | Raw setting value |
raw_len | Length of raw setting value |
buf | Buffer to contain formatted value |
len | Length of buffer |
len | Length of formatted value, or negative error |
Definition at line 1151 of file settings.c.
References ENOTSUP, len, raw, raw_len, and type.
Referenced by fetchf_setting().
int setting_parse | ( | const struct setting_type * | type, |
const char * | value, | ||
void * | buf, | ||
size_t | len | ||
) |
Parse formatted string to setting value.
type | Setting type |
value | Formatted setting value |
buf | Buffer to contain raw value |
len | Length of buffer |
len | Length of raw value, or negative error |
Definition at line 1170 of file settings.c.
References ENOTSUP, len, type, and value.
Referenced by guestinfo_fetch_type(), and storef_setting().
int setting_numerate | ( | const struct setting_type * | type, |
const void * | raw, | ||
size_t | raw_len, | ||
unsigned long * | value | ||
) |
Convert setting value to number.
type | Setting type |
raw | Raw setting value |
raw_len | Length of raw setting value |
value | Numeric value |
rc | Return status code |
Definition at line 1189 of file settings.c.
References ENOTSUP, raw, raw_len, type, and value.
Referenced by fetchn_setting().
int setting_denumerate | ( | const struct setting_type * | type, |
unsigned long | value, | ||
void * | buf, | ||
size_t | len | ||
) |
Convert number to setting value.
type | Setting type |
value | Numeric value |
buf | Buffer to contain raw value |
len | Length of buffer |
len | Length of raw value, or negative error |
Definition at line 1208 of file settings.c.
References ENOTSUP, len, type, and value.
Referenced by storen_setting().
int fetchf_setting | ( | struct settings * | settings, |
const struct setting * | setting, | ||
struct settings ** | origin, | ||
struct setting * | fetched, | ||
char * | buf, | ||
size_t | len | ||
) |
Fetch formatted value of setting.
settings | Settings block, or NULL to search all blocks |
setting | Setting to fetch |
origin | Origin of setting to fill in, or NULL |
fetched | Fetched setting to fill in, or NULL |
buf | Buffer to contain formatted value |
len | Length of buffer |
len | Length of formatted value, or negative error |
Definition at line 1229 of file settings.c.
References assert(), fetch_setting_copy(), free, len, NULL, origin, raw, raw_len, setting_format(), and setting::type.
Referenced by efi_snp_hii_fetch(), fetchf_setting_copy(), and select_setting_row().
int fetchf_setting_copy | ( | struct settings * | settings, |
const struct setting * | setting, | ||
struct settings ** | origin, | ||
struct setting * | fetched, | ||
char ** | value | ||
) |
Fetch copy of formatted value of setting.
settings | Settings block, or NULL to search all blocks |
setting | Setting to fetch |
origin | Origin of setting to fill in, or NULL |
fetched | Fetched setting to fill in, or NULL |
value | Buffer to allocate and fill with formatted value |
len | Length of formatted value, or negative error |
The caller is responsible for eventually freeing the allocated buffer.
Definition at line 1276 of file settings.c.
References assert(), ENOMEM, fetchf_setting(), len, NULL, origin, value, and zalloc().
Referenced by expand_settings(), read_value(), and show_exec().
int storef_setting | ( | struct settings * | settings, |
const struct setting * | setting, | ||
const char * | value | ||
) |
Store formatted value of setting.
settings | Settings block |
setting | Setting to store |
value | Formatted setting data, or NULL |
rc | Return status code |
Definition at line 1319 of file settings.c.
References assert(), delete_setting(), ENOMEM, free, malloc(), NULL, raw, raw_len, rc, setting_parse(), store_setting(), setting::type, and value.
Referenced by choose_exec(), efi_snp_hii_store(), save_setting(), and set_core_exec().
int fetchn_setting | ( | struct settings * | settings, |
const struct setting * | setting, | ||
struct settings ** | origin, | ||
struct setting * | fetched, | ||
unsigned long * | value | ||
) |
Fetch numeric value of setting.
settings | Settings block, or NULL to search all blocks |
setting | Setting to fetch |
origin | Origin of setting to fill in, or NULL |
fetched | Fetched setting to fill in, or NULL |
value | Numeric value to fill in |
rc | Return status code |
Definition at line 1372 of file settings.c.
References assert(), fetch_setting_copy(), free, NULL, origin, raw, raw_len, rc, setting_numerate(), setting::type, and value.
Referenced by inc_exec(), and pciscan_exec().
int storen_setting | ( | struct settings * | settings, |
const struct setting * | setting, | ||
unsigned long | value | ||
) |
Store numeric value of setting.
settings | Settings block |
setting | Setting |
value | Numeric value |
rc | Return status code |
Definition at line 1414 of file settings.c.
References assert(), ENOMEM, free, malloc(), NULL, raw, raw_len, rc, setting_denumerate(), store_setting(), setting::type, and value.
Referenced by inc_exec(), and pciscan_exec().
char* expand_settings | ( | const char * | string | ) |
Expand variables within string.
string | String |
expstr | Expanded string |
The expanded string is allocated with malloc() and the caller must eventually free() it.
Definition at line 2297 of file settings.c.
References asprintf(), end, fetchf_setting_copy(), find_child_settings(), free, head, name, NULL, parse_setting_name(), rc, generic_setting::setting, start, strdup(), tmp, and value.
Referenced by expand_tokens(), fetch_next_server_and_filename(), fetch_root_path(), and fetch_san_filename().
const struct setting ip_setting __setting | ( | SETTING_IP4 | , |
ip | |||
) |
const struct setting netmask_setting __setting | ( | SETTING_IP4 | , |
netmask | |||
) |
const struct setting gateway_setting __setting | ( | SETTING_IP4 | , |
gateway | |||
) |
const struct setting dns_setting __setting | ( | SETTING_IP4_EXTRA | , |
dns | |||
) |
const struct setting ip6_setting __setting | ( | SETTING_IP6 | , |
ip6 | |||
) |
const struct setting len6_setting __setting | ( | SETTING_IP6 | , |
len6 | |||
) |
const struct setting gateway6_setting __setting | ( | SETTING_IP6 | , |
gateway6 | |||
) |
const struct setting hostname_setting __setting | ( | SETTING_HOST | , |
hostname | |||
) |
const struct setting domain_setting __setting | ( | SETTING_IP_EXTRA | , |
domain | |||
) |
const struct setting filename_setting __setting | ( | SETTING_BOOT | , |
filename | |||
) |
const struct setting root_path_setting __setting | ( | SETTING_SANBOOT | , |
root- | path | ||
) |
const struct setting san_filename_setting __setting | ( | SETTING_SANBOOT | , |
san- | filename | ||
) |
const struct setting username_setting __setting | ( | SETTING_AUTH | , |
username | |||
) |
const struct setting password_setting __setting | ( | SETTING_AUTH | , |
password | |||
) |
const struct setting priority_setting __setting | ( | SETTING_MISC | , |
priority | |||
) |
const struct setting uuid_setting __setting | ( | SETTING_HOST | , |
uuid | |||
) |
const struct setting next_server_setting __setting | ( | SETTING_BOOT | , |
next- | server | ||
) |
const struct setting mac_setting __setting | ( | SETTING_NETDEV | , |
mac | |||
) |
const struct setting busid_setting __setting | ( | SETTING_NETDEV | , |
busid | |||
) |
const struct setting user_class_setting __setting | ( | SETTING_HOST_EXTRA | , |
user- | class | ||
) |
const struct setting vendor_class_setting __setting | ( | SETTING_HOST_EXTRA | , |
vendor- | class | ||
) |
const struct setting manufacturer_setting __setting | ( | SETTING_HOST_EXTRA | , |
manufacturer | |||
) |
const struct setting product_setting __setting | ( | SETTING_HOST_EXTRA | , |
product | |||
) |
const struct setting serial_setting __setting | ( | SETTING_HOST_EXTRA | , |
serial | |||
) |
const struct setting asset_setting __setting | ( | SETTING_HOST_EXTRA | , |
asset | |||
) |
const struct setting board_serial_setting __setting | ( | SETTING_HOST_EXTRA | , |
board- | serial | ||
) |
const struct setting dhcp_server_setting __setting | ( | SETTING_MISC | , |
dhcp- | server | ||
) |
|
inlinestatic |
Initialise a settings block.
settings | Settings block |
op | Settings block operations |
refcnt | Containing object reference counter, or NULL |
default_scope | Default scope |
Definition at line 496 of file settings.h.
References settings::children, settings::default_scope, INIT_LIST_HEAD, settings::op, op, refcnt, settings::refcnt, and settings::siblings.
Referenced by dhcppkt_init(), dhcpv6_register(), generic_settings_init(), guestinfo_net_probe(), ipv6_register_settings(), lldp_probe(), ndp_register_settings(), nvo_init(), and phantom_probe().
|
inlinestatic |
Initialise a settings block.
generics | Generic settings block |
refcnt | Containing object reference counter, or NULL |
Definition at line 513 of file settings.h.
References generic_settings_operations, INIT_LIST_HEAD, generic_settings::list, NULL, generic_settings::settings, and settings_init().
Referenced by autovivify_child_settings(), and netdev_settings_init().
|
inlinestatic |
Delete setting.
settings | Settings block |
setting | Setting to delete |
rc | Return status code |
Definition at line 527 of file settings.h.
References NULL, and store_setting().
Referenced by main_loop(), and storef_setting().
|
inlinestatic |
Check existence of predefined setting.
settings | Settings block, or NULL to search all blocks |
setting | Setting to fetch |
exists | Setting exists |
Definition at line 539 of file settings.h.
References fetch_setting(), and NULL.
Referenced by efi_snp_hii_fetch(), and have_pxe_menu().
const struct settings_scope builtin_scope |
Built-in setting scope.
Definition at line 2472 of file settings.c.
Referenced by builtin_applies().
const struct settings_scope ipv6_settings_scope |
IPv6 setting scope.
IPv6 setting scope.
Definition at line 1120 of file ipv6.c.
Referenced by ipv6_applies(), ipv6_register_settings(), and ndp_prefix_applies().
const struct settings_scope dhcpv6_scope |
DHCPv6 setting scope.
DHCPv6 setting scope.
Definition at line 1792 of file settings.c.
Referenced by dhcpv6_applies(), and dhcpv6_register().
struct settings_operations generic_settings_operations |
Generic settings operations.
Definition at line 221 of file settings.c.
Referenced by generic_settings_init().
const struct setting_type setting_type_dnssl __setting_type |
A string setting type.
PCI bus:dev.fn setting type.
GUID setting type.
UUID setting type.
A Base64-encoded setting.
A hex-string setting (non-delimited)
A hex-string setting (hyphen-delimited)
A hex-string setting (colon-delimited)
An unsigned 32-bit integer setting type.
An unsigned 16-bit integer setting type.
An unsigned 8-bit integer setting type.
A signed 32-bit integer setting type.
A signed 16-bit integer setting type.
A signed 8-bit integer setting type.
An IPv6 address setting type.
An IPv4 address setting type.
A URI-encoded string setting type.
A string setting type.
Definition at line 415 of file settings.h.