iPXE
|
Configuration settings. More...
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <strings.h>
#include <byteswap.h>
#include <errno.h>
#include <assert.h>
#include <time.h>
#include <ipxe/in.h>
#include <ipxe/ip.h>
#include <ipxe/ipv6.h>
#include <ipxe/vsprintf.h>
#include <ipxe/dhcp.h>
#include <ipxe/uuid.h>
#include <ipxe/uri.h>
#include <ipxe/base16.h>
#include <ipxe/base64.h>
#include <ipxe/pci.h>
#include <ipxe/init.h>
#include <ipxe/version.h>
#include <ipxe/settings.h>
Go to the source code of this file.
Data Structures | |
struct | generic_setting |
A generic setting. More... | |
struct | autovivified_settings |
Autovivified settings block. More... | |
Macros | |
#define | settings_root generic_settings_root.settings |
Root settings block. More... | |
#define | SETTING_TYPE_UINT_NAME(index) setting_type_int_name[index] |
Get unsigned integer setting type name. More... | |
#define | SETTING_TYPE_INT_NAME(index) ( setting_type_int_name[index] + 1 ) |
Get signed integer setting type name. More... | |
#define | SETTING_TYPE_INT(index) |
Define a signed integer setting type. More... | |
#define | SETTING_TYPE_UINT(index) |
Define an unsigned integer setting type. More... | |
Enumerations | |
enum | setting_type_int_index { SETTING_TYPE_INT8 = 0, SETTING_TYPE_INT16 = 1, SETTING_TYPE_INT32 = 2 } |
Integer setting type indices. More... | |
Functions | |
FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
static void * | generic_setting_name (struct generic_setting *generic) |
Get generic setting name. More... | |
static void * | generic_setting_data (struct generic_setting *generic) |
Get generic setting data. More... | |
static struct generic_setting * | find_generic_setting (struct generic_settings *generics, const struct setting *setting) |
Find generic setting. More... | |
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... | |
static void | autovivified_settings_free (struct refcnt *refcnt) |
Free autovivified settings block. 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... | |
static struct settings * | parse_settings_name (const char *name, get_child_settings_t get_child) |
Parse settings block name. More... | |
struct settings * | find_settings (const char *name) |
Find settings block. More... | |
static void | apply_settings (void) |
Apply all settings. More... | |
static void | reprioritise_settings (struct settings *settings) |
Reprioritise settings. 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... | |
static const struct setting * | applicable_setting (struct settings *settings, const struct setting *setting) |
Find setting applicable to settings block, if any. 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... | |
static int | fetch_setting_alloc (struct settings *settings, const struct setting *setting, struct settings **origin, struct setting *fetched, void **data, void *(*alloc)(size_t len)) |
Fetch allocated copy of 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... | |
static void * | fetch_string_setting_copy_alloc (size_t len) |
Allocate memory for copy 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... | |
static int | numeric_setting_value (int is_signed, const void *raw, size_t len, unsigned long *value) |
Extract numeric value of setting. More... | |
int | fetch_numeric_setting (struct settings *settings, const struct setting *setting, unsigned long *value, int is_signed) |
Fetch value of numeric 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... | |
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... | |
struct setting * | find_setting (const char *name) |
Find predefined setting. More... | |
static uint64_t | parse_setting_tag (const char *name) |
Parse setting name as tag number. More... | |
static const struct setting_type * | find_setting_type (const char *name) |
Find setting type. 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... | |
static int | parse_string_setting (const struct setting_type *type __unused, const char *value, void *buf, size_t len) |
Parse string setting value. More... | |
static int | format_string_setting (const struct setting_type *type __unused, const void *raw, size_t raw_len, char *buf, size_t len) |
Format string setting value. More... | |
static int | parse_uristring_setting (const struct setting_type *type __unused, const char *value, void *buf, size_t len) |
Parse URI-encoded string setting value. More... | |
static int | format_uristring_setting (const struct setting_type *type __unused, const void *raw, size_t raw_len, char *buf, size_t len) |
Format URI-encoded string setting value. More... | |
__weak int | parse_ipv4_setting (const struct setting_type *type __unused, const char *value __unused, void *buf __unused, size_t len __unused) |
Parse IPv4 address setting value (when IPv4 support is not present) More... | |
__weak int | format_ipv4_setting (const struct setting_type *type __unused, const void *raw __unused, size_t raw_len __unused, char *buf __unused, size_t len __unused) |
Format IPv4 address setting value (when IPv4 support is not present) More... | |
__weak int | parse_ipv6_setting (const struct setting_type *type __unused, const char *value __unused, void *buf __unused, size_t len __unused) |
Parse IPv6 address setting value (when IPv6 support is not present) More... | |
__weak int | format_ipv6_setting (const struct setting_type *type __unused, const void *raw __unused, size_t raw_len __unused, char *buf __unused, size_t len __unused) |
Format IPv6 address setting value (when IPv6 support is not present) More... | |
static unsigned int | setting_type_int_index (const struct setting_type *type) |
Get integer setting type index. More... | |
static unsigned int | setting_type_int_width (const struct setting_type *type) |
Get integer setting type width. More... | |
static int | setting_type_int_is_signed (const struct setting_type *type) |
Get integer setting type signedness. More... | |
static int | denumerate_int_setting (const struct setting_type *type, unsigned long value, void *buf, size_t len) |
Convert number to setting value. More... | |
static int | numerate_int_setting (const struct setting_type *type, const void *raw, size_t raw_len, unsigned long *value) |
Convert setting value to number. More... | |
static int | parse_int_setting (const struct setting_type *type, const char *value, void *buf, size_t len) |
Parse integer setting value. More... | |
static int | format_int_setting (const struct setting_type *type, const void *raw, size_t raw_len, char *buf, size_t len) |
Format signed integer setting value. More... | |
static int | format_uint_setting (const struct setting_type *type, const void *raw, size_t raw_len, char *buf, size_t len) |
Format unsigned integer setting value. More... | |
static int | parse_hex_setting (const struct setting_type *type __unused, const char *value, void *buf, size_t len) |
Parse hex string setting value (using colon delimiter) More... | |
static int | format_hex_colon_setting (const struct setting_type *type __unused, const void *raw, size_t raw_len, char *buf, size_t len) |
Format hex string setting value (using colon delimiter) More... | |
static int | parse_hex_hyphen_setting (const struct setting_type *type __unused, const char *value, void *buf, size_t len) |
Parse hex string setting value (using hyphen delimiter) More... | |
static int | format_hex_hyphen_setting (const struct setting_type *type __unused, const void *raw, size_t raw_len, char *buf, size_t len) |
Format hex string setting value (using hyphen delimiter) More... | |
static int | parse_hex_raw_setting (const struct setting_type *type __unused, const char *value, void *buf, size_t len) |
Parse hex string setting value (using no delimiter) More... | |
static int | format_hex_raw_setting (const struct setting_type *type __unused, const void *raw, size_t raw_len, char *buf, size_t len) |
Format hex string setting value (using no delimiter) More... | |
static int | parse_base64_setting (const struct setting_type *type __unused, const char *value, void *buf, size_t len) |
Parse Base64-encoded setting value. More... | |
static int | format_base64_setting (const struct setting_type *type __unused, const void *raw, size_t raw_len, char *buf, size_t len) |
Format Base64-encoded setting value. More... | |
static int | parse_uuid_setting (const struct setting_type *type, const char *value, void *buf, size_t len) |
Parse UUID/GUID setting value. More... | |
static int | format_uuid_setting (const struct setting_type *type, const void *raw, size_t raw_len, char *buf, size_t len) |
Format UUID/GUID setting value. More... | |
static int | format_busdevfn_setting (const struct setting_type *type __unused, const void *raw, size_t raw_len, char *buf, size_t len) |
Format PCI bus:dev.fn setting value. More... | |
char * | expand_settings (const char *string) |
Expand variables within string. More... | |
const struct setting hostname_setting | __setting (SETTING_HOST, hostname) |
Hostname setting. More... | |
const struct setting domain_setting | __setting (SETTING_IP_EXTRA, domain) |
Domain name setting. More... | |
const struct setting next_server_setting | __setting (SETTING_BOOT, next-server) |
TFTP server setting. More... | |
const struct setting filename_setting | __setting (SETTING_BOOT, filename) |
Filename setting. More... | |
const struct setting root_path_setting | __setting (SETTING_SANBOOT, root-path) |
Root path setting. More... | |
const struct setting san_filename_setting | __setting (SETTING_SANBOOT, san-filename) |
SAN filename setting. More... | |
const struct setting username_setting | __setting (SETTING_AUTH, username) |
Username setting. More... | |
const struct setting password_setting | __setting (SETTING_AUTH, password) |
Password setting. More... | |
const struct setting priority_setting | __setting (SETTING_MISC, priority) |
Priority setting. More... | |
const struct setting user_class_setting | __setting (SETTING_HOST_EXTRA, user-class) |
DHCP user class setting. More... | |
const struct setting vendor_class_setting | __setting (SETTING_HOST_EXTRA, vendor-class) |
DHCP vendor class setting. More... | |
static int | errno_fetch (void *data, size_t len) |
Fetch error number setting. More... | |
const struct setting errno_setting | __setting (SETTING_MISC, errno) |
Error number setting. More... | |
static int | buildarch_fetch (void *data, size_t len) |
Fetch build architecture setting. More... | |
const struct setting buildarch_setting | __setting (SETTING_MISC, buildarch) |
Build architecture setting. More... | |
static int | platform_fetch (void *data, size_t len) |
Fetch platform setting. More... | |
const struct setting platform_setting | __setting (SETTING_MISC, platform) |
Platform setting. More... | |
static int | version_fetch (void *data, size_t len) |
Fetch version setting. More... | |
const struct setting version_setting | __setting (SETTING_MISC, version) |
Version setting. More... | |
static int | unixtime_fetch (void *data, size_t len) |
Fetch current time setting. More... | |
const struct setting unixtime_setting | __setting (SETTING_MISC, unixtime) |
Current time setting. More... | |
static int | cwuri_fetch_uri (void *data, size_t len, const char *rel) |
Fetch current working URI-related setting. More... | |
static int | cwuri_fetch (void *data, size_t len) |
Fetch current working URI setting. More... | |
static int | cwduri_fetch (void *data, size_t len) |
Fetch current working directory URI setting. More... | |
const struct setting cwuri_setting | __setting (SETTING_MISC, cwuri) |
Current working URI setting. More... | |
const struct setting cwduri_setting | __setting (SETTING_MISC, cwduri) |
Current working directory URI setting. More... | |
static int | builtin_fetch (struct settings *settings __unused, struct setting *setting, void *data, size_t len) |
Fetch built-in setting. More... | |
static int | builtin_applies (struct settings *settings __unused, const struct setting *setting) |
Check applicability of built-in setting. More... | |
static void | builtin_init (void) |
Initialise built-in settings. More... | |
struct init_fn builtin_init_fn | __init_fn (INIT_NORMAL) |
Built-in settings initialiser. More... | |
Variables | |
struct settings_operations | generic_settings_operations |
Generic settings operations. More... | |
struct generic_settings | generic_settings_root |
Root generic settings block. More... | |
const struct setting_type setting_type_string | __setting_type |
A string setting type. More... | |
const struct settings_scope | dhcpv6_scope |
IPv6 settings scope. More... | |
static const char | setting_type_int_name [][8] |
Integer setting type names. More... | |
const struct settings_scope | builtin_scope |
Built-in setting scope. More... | |
struct builtin_setting errno_builtin_setting | __builtin_setting |
Error number built-in setting. More... | |
static struct settings_operations | builtin_settings_operations |
Built-in settings operations. More... | |
static struct settings | builtin_settings |
Built-in settings. More... | |
Configuration settings.
Definition in file settings.c.
#define settings_root generic_settings_root.settings |
Root settings block.
Definition at line 249 of file settings.c.
#define SETTING_TYPE_UINT_NAME | ( | index | ) | setting_type_int_name[index] |
Get unsigned integer setting type name.
index | Integer setting type index |
name | Setting type name |
Definition at line 1827 of file settings.c.
#define SETTING_TYPE_INT_NAME | ( | index | ) | ( setting_type_int_name[index] + 1 ) |
Get signed integer setting type name.
index | Integer setting type index |
name | Setting type name |
Definition at line 1835 of file settings.c.
#define SETTING_TYPE_INT | ( | index | ) |
Define a signed integer setting type.
index | Integer setting type index |
type | Setting type |
Definition at line 1996 of file settings.c.
#define SETTING_TYPE_UINT | ( | index | ) |
Define an unsigned integer setting type.
index | Integer setting type index |
type | Setting type |
Definition at line 2010 of file settings.c.
Integer setting type indices.
These indexes are defined such that (1<<index) gives the width of the integer, in bytes.
Enumerator | |
---|---|
SETTING_TYPE_INT8 | |
SETTING_TYPE_INT16 | |
SETTING_TYPE_INT32 |
Definition at line 1800 of file settings.c.
FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
|
inlinestatic |
Get generic setting name.
generic | Generic setting |
name | Generic setting name |
Definition at line 83 of file settings.c.
Referenced by generic_settings_store().
|
inlinestatic |
Get generic setting data.
generic | Generic setting |
data | Generic setting data |
Definition at line 93 of file settings.c.
References generic.
Referenced by generic_settings_fetch(), and generic_settings_store().
|
static |
Find generic setting.
generics | Generic settings block |
setting | Setting to find |
generic | Generic setting, or NULL |
Definition at line 106 of file settings.c.
References generic, generic_settings::list, generic_setting::list, list_for_each_entry, NULL, and setting_cmp().
Referenced by generic_settings_fetch(), and generic_settings_store().
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().
|
static |
Free autovivified settings block.
refcnt | Reference count |
Definition at line 264 of file settings.c.
References container_of, free, autovivified_settings::generic, generic_settings_clear(), and generic_settings::settings.
Referenced by autovivify_child_settings().
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(), cachedhcp_recycle(), efi_path_net_probe(), 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(), parse_autovivified_setting(), and parse_names().
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().
|
static |
Parse settings block name.
name | Name |
get_child | Function to find or create child settings block |
settings | Settings block, or NULL |
Definition at line 371 of file settings.c.
References free, name, NULL, settings_root, strchr(), and strdup().
Referenced by find_settings(), and parse_setting_name().
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().
|
static |
Apply all settings.
Definition at line 415 of file settings.c.
References settings_applicator::apply, DBG, for_each_table_entry, rc, SETTINGS_APPLICATORS, and strerror().
Referenced by register_settings(), store_setting(), and unregister_settings().
|
static |
Reprioritise settings.
settings | Settings block |
Reorders the settings block amongst its siblings according to its priority.
Definition at line 437 of file settings.c.
References settings::children, fetch_intz_setting(), list_add_tail, list_del, list_for_each_entry, settings::order, settings::parent, priority, settings::siblings, and tmp.
Referenced by register_settings(), and store_setting().
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(), efi_path_net_probe(), efivars_init(), 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(), smbios_init(), and usb_settings_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 cachedhcp_recycle(), dhcp_request_rx(), lldp_probe(), lldp_remove(), 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().
|
static |
Find setting applicable to settings block, if any.
settings | Settings block |
setting | Setting |
setting | Applicable setting, if any |
Definition at line 589 of file settings.c.
References for_each_table_entry, NULL, generic_setting::setting, setting_applies(), setting_cmp(), and SETTINGS.
Referenced by fetch_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(), 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().
|
static |
Fetch allocated 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 |
alloc | Allocation function |
len | Length of setting, or negative error |
The caller is responsible for eventually freeing the allocated buffer.
Definition at line 736 of file settings.c.
References assert(), data, ENOMEM, fetch_setting(), len, NULL, and origin.
Referenced by fetch_setting_copy(), and fetch_string_setting_copy().
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(), eap_rx_identity(), eap_rx_md5(), 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(), net80211_autoassociate(), net80211_check_settings_update(), wpa_psk_start(), and xsigo_xds_complete().
|
static |
Allocate memory for copy of string setting.
len | Length of setting |
ptr | Allocated memory |
Definition at line 856 of file settings.c.
Referenced by fetch_string_setting_copy().
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(), eap_rx_mschapv2_request(), 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().
|
static |
Extract numeric value of setting.
is_signed | Treat value as a signed integer |
raw | Raw setting data |
len | Length of raw setting data |
value | Numeric value |
len | Length of setting, or negative error |
Definition at line 966 of file settings.c.
References ERANGE, len, pad, raw, and value.
Referenced by fetch_numeric_setting(), format_busdevfn_setting(), and numerate_int_setting().
int fetch_numeric_setting | ( | struct settings * | settings, |
const struct setting * | setting, | ||
unsigned long * | value, | ||
int | is_signed | ||
) |
Fetch value of numeric 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 997 of file settings.c.
References fetch_raw_setting(), len, numeric_setting_value(), tmp, and value.
Referenced by fetch_int_setting(), fetch_intz_setting(), fetch_uint_setting(), and fetch_uintz_setting().
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 setting::name, setting::scope, strcmp(), and setting::tag.
Referenced by applicable_setting(), builtin_fetch(), dhcpv6_fetch(), efi_path_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().
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(), and fetchf_setting_copy().
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(), load_values(), read_value(), select_setting_row(), 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(), save_values(), 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(), pciscan_exec(), and usbscan_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(), pciscan_exec(), and usbscan_exec().
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().
|
static |
Parse setting name as tag number.
name | Name |
tag | Tag number, or 0 if not a valid number |
Definition at line 1482 of file settings.c.
References name, strtoul(), tag, and tmp.
Referenced by parse_setting_name().
|
static |
Find setting type.
name | Name |
type | Setting type, or NULL |
Definition at line 1502 of file settings.c.
References for_each_table_entry, name, NULL, SETTING_TYPES, strcmp(), and type.
Referenced by parse_setting_name().
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(), parse_names(), 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().
|
static |
Parse string 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 1632 of file settings.c.
|
static |
Format string setting value.
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 1654 of file settings.c.
|
static |
Parse URI-encoded string 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 1683 of file settings.c.
References len, uri_decode(), and value.
|
static |
Format URI-encoded string setting value.
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 1699 of file settings.c.
References len, raw, raw_len, and uri_encode().
__weak int parse_ipv4_setting | ( | const struct setting_type *type | __unused, |
const char *value | __unused, | ||
void *buf | __unused, | ||
size_t len | __unused | ||
) |
Parse IPv4 address setting value (when IPv4 support is not present)
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 1722 of file settings.c.
References ENOTSUP.
__weak int format_ipv4_setting | ( | const struct setting_type *type | __unused, |
const void *raw | __unused, | ||
size_t raw_len | __unused, | ||
char *buf | __unused, | ||
size_t len | __unused | ||
) |
Format IPv4 address setting value (when IPv4 support is not present)
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 1738 of file settings.c.
References ENOTSUP.
__weak int parse_ipv6_setting | ( | const struct setting_type *type | __unused, |
const char *value | __unused, | ||
void *buf | __unused, | ||
size_t len | __unused | ||
) |
Parse IPv6 address setting value (when IPv6 support is not present)
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 1761 of file settings.c.
References ENOTSUP.
__weak int format_ipv6_setting | ( | const struct setting_type *type | __unused, |
const void *raw | __unused, | ||
size_t raw_len | __unused, | ||
char *buf | __unused, | ||
size_t len | __unused | ||
) |
Format IPv6 address setting value (when IPv6 support is not present)
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 1777 of file settings.c.
References ENOTSUP.
|
static |
Get integer setting type index.
type | Setting type |
index | Integer setting type index |
Definition at line 1843 of file settings.c.
References setting_type_int_name, and type.
|
static |
Get integer setting type width.
type | Setting type |
index | Integer setting type width |
Definition at line 1855 of file settings.c.
References type.
Referenced by denumerate_int_setting().
|
static |
Get integer setting type signedness.
type | Setting type |
is_signed | Integer setting type is signed |
Definition at line 1866 of file settings.c.
References setting_type_int_name, and type.
Referenced by numerate_int_setting().
|
static |
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 1879 of file settings.c.
References bytes, htonl, len, memcpy(), num, setting_type_int_width(), size, type, u, and value.
|
static |
Convert setting value to number.
type | Setting type |
raw | Raw setting value |
raw_len | Length of raw setting value |
value | Numeric value to fill in |
rc | Return status code |
Definition at line 1905 of file settings.c.
References assert(), numeric_setting_value(), raw, raw_len, setting_type_int_is_signed(), type, and value.
|
static |
Parse integer 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 1929 of file settings.c.
|
static |
Format signed integer setting value.
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 1952 of file settings.c.
|
static |
Format unsigned integer setting value.
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 1976 of file settings.c.
|
static |
Parse hex string setting value (using colon delimiter)
type | Setting type |
value | Formatted setting value |
buf | Buffer to contain raw value |
len | Length of buffer |
size | Integer size, in bytes |
len | Length of raw value, or negative error |
Definition at line 2052 of file settings.c.
References hex_decode(), len, and value.
|
static |
Format hex string setting value (using colon delimiter)
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 2067 of file settings.c.
References hex_encode(), len, raw, and raw_len.
|
static |
Parse hex string setting value (using hyphen delimiter)
type | Setting type |
value | Formatted setting value |
buf | Buffer to contain raw value |
len | Length of buffer |
size | Integer size, in bytes |
len | Length of raw value, or negative error |
Definition at line 2083 of file settings.c.
References hex_decode(), len, and value.
|
static |
Format hex string setting value (using hyphen delimiter)
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 2099 of file settings.c.
References hex_encode(), len, raw, and raw_len.
|
static |
Parse hex string setting value (using no delimiter)
type | Setting type |
value | Formatted setting value |
buf | Buffer to contain raw value |
len | Length of buffer |
size | Integer size, in bytes |
len | Length of raw value, or negative error |
Definition at line 2115 of file settings.c.
References hex_decode(), len, and value.
|
static |
Format hex string setting value (using no delimiter)
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 2130 of file settings.c.
References hex_encode(), len, raw, and raw_len.
|
static |
Parse Base64-encoded setting value.
type | Setting type |
value | Formatted setting value |
buf | Buffer to contain raw value |
len | Length of buffer |
size | Integer size, in bytes |
len | Length of raw value, or negative error |
Definition at line 2167 of file settings.c.
References base64_decode(), len, and value.
|
static |
Format Base64-encoded setting value.
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 2183 of file settings.c.
References base64_encode(), len, raw, and raw_len.
|
static |
Parse UUID/GUID setting value.
type | Setting type |
value | Formatted setting value |
buf | Buffer to contain raw value |
len | Length of buffer |
size | Integer size, in bytes |
len | Length of raw value, or negative error |
Definition at line 2207 of file settings.c.
References len, memcpy(), uuid::raw, rc, type, uuid, uuid_aton(), uuid_mangle(), and value.
|
static |
Format UUID/GUID setting value.
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 2238 of file settings.c.
References ERANGE, len, memcpy(), raw, raw_len, snprintf(), type, uuid, uuid_mangle(), and uuid_ntoa().
|
static |
Format PCI bus:dev.fn setting value.
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 2282 of file settings.c.
References assert(), bus, busdevfn, len, numeric_setting_value(), PCI_BUS, PCI_FUNC, PCI_SEG, PCI_SLOT, raw, raw_len, seg, slot, and snprintf().
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 2330 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 hostname_setting __setting | ( | SETTING_HOST | , |
hostname | |||
) |
Hostname setting.
const struct setting domain_setting __setting | ( | SETTING_IP_EXTRA | , |
domain | |||
) |
Domain name setting.
const struct setting next_server_setting __setting | ( | SETTING_BOOT | , |
next- | server | ||
) |
TFTP server setting.
const struct setting filename_setting __setting | ( | SETTING_BOOT | , |
filename | |||
) |
Filename setting.
const struct setting root_path_setting __setting | ( | SETTING_SANBOOT | , |
root- | path | ||
) |
Root path setting.
const struct setting san_filename_setting __setting | ( | SETTING_SANBOOT | , |
san- | filename | ||
) |
SAN filename setting.
const struct setting username_setting __setting | ( | SETTING_AUTH | , |
username | |||
) |
Username setting.
const struct setting password_setting __setting | ( | SETTING_AUTH | , |
password | |||
) |
Password setting.
const struct setting priority_setting __setting | ( | SETTING_MISC | , |
priority | |||
) |
Priority setting.
const struct setting user_class_setting __setting | ( | SETTING_HOST_EXTRA | , |
user- | class | ||
) |
DHCP user class setting.
const struct setting vendor_class_setting __setting | ( | SETTING_HOST_EXTRA | , |
vendor- | class | ||
) |
DHCP vendor class setting.
|
static |
Fetch error number setting.
data | Buffer to fill with setting data |
len | Length of buffer |
len | Length of setting data, or negative error |
Definition at line 2514 of file settings.c.
const struct setting errno_setting __setting | ( | SETTING_MISC | , |
errno | |||
) |
Error number setting.
|
static |
Fetch build architecture setting.
data | Buffer to fill with setting data |
len | Length of buffer |
len | Length of setting data, or negative error |
Definition at line 2546 of file settings.c.
const struct setting buildarch_setting __setting | ( | SETTING_MISC | , |
buildarch | |||
) |
Build architecture setting.
|
static |
Fetch platform setting.
data | Buffer to fill with setting data |
len | Length of buffer |
len | Length of setting data, or negative error |
Definition at line 2574 of file settings.c.
const struct setting platform_setting __setting | ( | SETTING_MISC | , |
platform | |||
) |
Platform setting.
|
static |
Fetch version setting.
data | Buffer to fill with setting data |
len | Length of buffer |
len | Length of setting data, or negative error |
Definition at line 2602 of file settings.c.
References data, len, product_version, strlen(), and strncpy().
const struct setting version_setting __setting | ( | SETTING_MISC | , |
version | |||
) |
Version setting.
|
static |
Fetch current time setting.
data | Buffer to fill with setting data |
len | Length of buffer |
len | Length of setting data, or negative error |
Definition at line 2628 of file settings.c.
const struct setting unixtime_setting __setting | ( | SETTING_MISC | , |
unixtime | |||
) |
Current time setting.
|
static |
Fetch current working URI-related setting.
data | Buffer to fill with setting data |
len | Length of buffer |
rel | Relative URI string |
len | Length of setting data, or negative error |
Definition at line 2661 of file settings.c.
References cwuri, data, ENOENT, ENOMEM, format_uri_alloc(), free, len, parse_uri(), resolve_uri(), strlen(), strncpy(), and uri_put().
Referenced by cwduri_fetch(), and cwuri_fetch().
|
static |
Fetch current working URI setting.
data | Buffer to fill with setting data |
len | Length of buffer |
len | Length of setting data, or negative error |
Definition at line 2715 of file settings.c.
References cwuri_fetch_uri(), data, and len.
|
static |
Fetch current working directory URI setting.
data | Buffer to fill with setting data |
len | Length of buffer |
len | Length of setting data, or negative error |
Definition at line 2727 of file settings.c.
References cwuri_fetch_uri(), data, and len.
const struct setting cwuri_setting __setting | ( | SETTING_MISC | , |
cwuri | |||
) |
Current working URI setting.
const struct setting cwduri_setting __setting | ( | SETTING_MISC | , |
cwduri | |||
) |
Current working directory URI setting.
|
static |
Fetch built-in 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 2769 of file settings.c.
References BUILTIN_SETTINGS, data, ENOENT, builtin_setting::fetch, for_each_table_entry, len, builtin_setting::setting, and setting_cmp().
|
static |
Check applicability of built-in setting.
settings | Settings block |
setting | Setting |
applies | Setting applies within this settings block |
Definition at line 2788 of file settings.c.
References builtin_scope, and setting::scope.
|
static |
Initialise built-in settings.
Definition at line 2809 of file settings.c.
References builtin_settings, DBG, NULL, rc, register_settings(), and strerror().
struct init_fn builtin_init_fn __init_fn | ( | INIT_NORMAL | ) |
Built-in settings initialiser.
struct settings_operations generic_settings_operations |
Generic settings operations.
Definition at line 221 of file settings.c.
Referenced by generic_settings_init().
struct generic_settings generic_settings_root |
Root generic settings block.
Definition at line 235 of file settings.c.
const struct setting_type setting_type_busdevfn __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.
Definition at line 1668 of file settings.c.
const struct settings_scope dhcpv6_scope |
IPv6 settings scope.
DHCPv6 setting scope.
Definition at line 1792 of file settings.c.
Referenced by dhcpv6_applies(), and dhcpv6_register().
|
static |
Integer setting type names.
These names exist as a static array in order to allow the type's integer size and signedness to be determined from the type's name. Note that there are no separate entries for the signed integer types: the name pointers simply point to the second character of the relevant string.
Definition at line 1815 of file settings.c.
Referenced by setting_type_int_index(), and setting_type_int_is_signed().
const struct settings_scope builtin_scope |
Built-in setting scope.
Definition at line 2505 of file settings.c.
Referenced by builtin_applies().
struct builtin_setting cwduri_builtin_setting __builtin_setting |
Error number built-in setting.
Current working directory URI built-in setting.
Current working URI built-in setting.
Current time built-in setting.
Version built-in setting.
Platform built-in setting.
Build architecture built-in setting.
Definition at line 2534 of file settings.c.
|
static |
Built-in settings operations.
Definition at line 2795 of file settings.c.
|
static |
Built-in settings.
Definition at line 2801 of file settings.c.
Referenced by builtin_init().