iPXE
settings.h
Go to the documentation of this file.
1#ifndef _IPXE_SETTINGS_H
2#define _IPXE_SETTINGS_H
3
4/** @file
5 *
6 * Configuration settings
7 *
8 */
9
10FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
11FILE_SECBOOT ( PERMITTED );
12
13#include <stdint.h>
14#include <ipxe/tables.h>
15#include <ipxe/list.h>
16#include <ipxe/refcnt.h>
17
18struct settings;
19struct in_addr;
20struct in6_addr;
21union uuid;
22
23/** A setting */
24struct setting {
25 /** Name
26 *
27 * This is the human-readable name for the setting.
28 */
29 const char *name;
30 /** Description */
31 const char *description;
32 /** Setting type
33 *
34 * This identifies the type of setting (e.g. string, IPv4
35 * address, etc.).
36 */
37 const struct setting_type *type;
38 /** Setting tag, if applicable
39 *
40 * The setting tag is a numerical description of the setting
41 * (such as a DHCP option number, or an SMBIOS structure and
42 * field number).
43 */
45 /** Setting scope (or NULL)
46 *
47 * For historic reasons, a NULL scope with a non-zero tag
48 * indicates a DHCPv4 option setting.
49 */
50 const struct settings_scope *scope;
51};
52
53/** Configuration setting table */
54#define SETTINGS __table ( struct setting, "settings" )
55
56/** Declare a configuration setting */
57#define __setting( setting_order, name ) \
58 __table_entry ( SETTINGS, setting_order.name )
59
60/** @defgroup setting_order Setting ordering
61 * @{
62 */
63
64#define SETTING_NETDEV 01 /**< Network device settings */
65#define SETTING_NETDEV_EXTRA 02 /**< Network device additional settings */
66#define SETTING_IP4 03 /**< IPv4 settings */
67#define SETTING_IP4_EXTRA 04 /**< IPv4 additional settings */
68#define SETTING_IP6 05 /**< IPv6 settings */
69#define SETTING_IP6_EXTRA 06 /**< IPv6 additional settings */
70#define SETTING_IP 07 /**< IPv4 settings */
71#define SETTING_IP_EXTRA 08 /**< IPv4 additional settings */
72#define SETTING_BOOT 09 /**< Generic boot settings */
73#define SETTING_BOOT_EXTRA 10 /**< Generic boot additional settings */
74#define SETTING_SANBOOT 11 /**< SAN boot settings */
75#define SETTING_SANBOOT_EXTRA 12 /**< SAN boot additional settings */
76#define SETTING_HOST 13 /**< Host identity settings */
77#define SETTING_HOST_EXTRA 14 /**< Host identity additional settings */
78#define SETTING_AUTH 15 /**< Authentication settings */
79#define SETTING_AUTH_EXTRA 16 /**< Authentication additional settings */
80#define SETTING_CRYPTO 17 /**< Cryptography settings */
81#define SETTING_MISC 18 /**< Miscellaneous settings */
82
83/** @} */
84
85/** Settings block operations */
87 /** Redirect to underlying settings block (if applicable)
88 *
89 * @v settings Settings block
90 * @ret settings Underlying settings block
91 */
92 struct settings * ( * redirect ) ( struct settings *settings );
93 /** Check applicability of setting
94 *
95 * @v settings Settings block
96 * @v setting Setting
97 * @ret applies Setting applies within this settings block
98 */
99 int ( * applies ) ( struct settings *settings,
100 const struct setting *setting );
101 /** Store value of setting
102 *
103 * @v settings Settings block
104 * @v setting Setting to store
105 * @v data Setting data, or NULL to clear setting
106 * @v len Length of setting data
107 * @ret rc Return status code
108 */
109 int ( * store ) ( struct settings *settings,
110 const struct setting *setting,
111 const void *data, size_t len );
112 /** Fetch value of setting
113 *
114 * @v settings Settings block
115 * @v setting Setting to fetch
116 * @v data Buffer to fill with setting data
117 * @v len Length of buffer
118 * @ret len Length of setting data, or negative error
119 *
120 * The actual length of the setting will be returned even if
121 * the buffer was too small.
122 */
123 int ( * fetch ) ( struct settings *settings, struct setting *setting,
124 void *data, size_t len );
125 /** Clear settings block
126 *
127 * @v settings Settings block
128 */
129 void ( * clear ) ( struct settings *settings );
130};
131
132/** A settings block */
133struct settings {
134 /** Reference counter */
135 struct refcnt *refcnt;
136 /** Name */
137 const char *name;
138 /** Parent settings block */
140 /** Sibling settings blocks */
142 /** Child settings blocks */
144 /** Settings block operations */
146 /** Default scope for numerical settings constructed for this block */
148 /** Sibling ordering */
149 int order;
150};
151
152/**
153 * A setting scope
154 *
155 * Users can construct tags for settings that are not explicitly known
156 * to iPXE using the generic syntax for numerical settings. For
157 * example, the setting name "60" will be interpreted as referring to
158 * DHCP option 60 (the vendor class identifier).
159 *
160 * This creates a potential for namespace collisions, since the
161 * interpretation of the numerical description will vary according to
162 * the settings block. When a user attempts to fetch a generic
163 * numerical setting, we need to ensure that only the intended
164 * settings blocks interpret this numerical description. (For
165 * example, we do not want to attempt to retrieve the subnet mask from
166 * SMBIOS, or the system UUID from DHCP.)
167 *
168 * This potential problem is resolved by including a user-invisible
169 * "scope" within the definition of each setting. Settings blocks may
170 * use this to determine whether or not the setting is applicable.
171 * Any settings constructed from a numerical description
172 * (e.g. "smbios/1.4.0") will be assigned the default scope of the
173 * settings block specified in the description (e.g. "smbios"); this
174 * provides behaviour matching the user's expectations in most
175 * circumstances.
176 */
178 /** Dummy field
179 *
180 * This is included only to ensure that pointers to different
181 * scopes always compare differently.
182 */
184} __attribute__ (( packed ));
185
186/**
187 * A setting type
188 *
189 * This represents a type of setting (e.g. string, IPv4 address,
190 * etc.).
191 */
193 /** Name
194 *
195 * This is the name exposed to the user (e.g. "string").
196 */
197 const char *name;
198 /** Parse formatted string to setting value
199 *
200 * @v type Setting type
201 * @v value Formatted setting value
202 * @v buf Buffer to contain raw value
203 * @v len Length of buffer
204 * @ret len Length of raw value, or negative error
205 */
206 int ( * parse ) ( const struct setting_type *type, const char *value,
207 void *buf, size_t len );
208 /** Format setting value as a string
209 *
210 * @v type Setting type
211 * @v raw Raw setting value
212 * @v raw_len Length of raw setting value
213 * @v buf Buffer to contain formatted value
214 * @v len Length of buffer
215 * @ret len Length of formatted value, or negative error
216 */
217 int ( * format ) ( const struct setting_type *type, const void *raw,
218 size_t raw_len, char *buf, size_t len );
219 /** Convert number to setting value
220 *
221 * @v type Setting type
222 * @v value Numeric value
223 * @v buf Buffer to contain raw value
224 * @v len Length of buffer
225 * @ret len Length of raw value, or negative error
226 */
227 int ( * denumerate ) ( const struct setting_type *type,
228 unsigned long value,
229 void *buf, size_t len );
230 /** Convert setting value to number
231 *
232 * @v type Setting type
233 * @v raw Raw setting value
234 * @v raw_len Length of raw setting value
235 * @v value Numeric value to fill in
236 * @ret rc Return status code
237 */
238 int ( * numerate ) ( const struct setting_type *type, const void *raw,
239 size_t raw_len, unsigned long *value );
240};
241
242/** Configuration setting type table */
243#define SETTING_TYPES __table ( struct setting_type, "setting_types" )
244
245/** Declare a configuration setting type */
246#define __setting_type __table_entry ( SETTING_TYPES, 01 )
247
248/**
249 * A settings applicator
250 *
251 */
253 /** Apply updated settings
254 *
255 * @ret rc Return status code
256 */
257 int ( * apply ) ( void );
258};
259
260/** Settings applicator table */
261#define SETTINGS_APPLICATORS \
262 __table ( struct settings_applicator, "settings_applicators" )
263
264/** Declare a settings applicator */
265#define __settings_applicator __table_entry ( SETTINGS_APPLICATORS, 01 )
266
267/** A built-in setting */
269 /** Setting */
270 const struct setting *setting;
271 /** Fetch setting value
272 *
273 * @v data Buffer to fill with setting data
274 * @v len Length of buffer
275 * @ret len Length of setting data, or negative error
276 */
277 int ( * fetch ) ( void *data, size_t len );
278};
279
280/** Built-in settings table */
281#define BUILTIN_SETTINGS __table ( struct builtin_setting, "builtin_settings" )
282
283/** Declare a built-in setting */
284#define __builtin_setting __table_entry ( BUILTIN_SETTINGS, 01 )
285
286/** Built-in setting scope */
287extern const struct settings_scope builtin_scope;
288
289/** IPv6 setting scope */
290extern const struct settings_scope ipv6_settings_scope;
291
292/** DHCPv6 setting scope */
293extern const struct settings_scope dhcpv6_scope;
294
295/**
296 * A generic settings block
297 *
298 */
300 /** Settings block */
302 /** List of generic settings */
304};
305
306/** A child settings block locator function */
307typedef struct settings * ( *get_child_settings_t ) ( struct settings *settings,
308 const char *name );
310extern int generic_settings_store ( struct settings *settings,
311 const struct setting *setting,
312 const void *data, size_t len );
313extern int generic_settings_fetch ( struct settings *settings,
314 struct setting *setting,
315 void *data, size_t len );
316extern void generic_settings_clear ( struct settings *settings );
317
318extern int register_settings ( struct settings *settings,
319 struct settings *parent, const char *name );
320extern void unregister_settings ( struct settings *settings );
321
322extern struct settings * settings_target ( struct settings *settings );
323extern int setting_applies ( struct settings *settings,
324 const struct setting *setting );
325extern int store_setting ( struct settings *settings,
326 const struct setting *setting,
327 const void *data, size_t len );
328extern int fetch_setting ( struct settings *settings,
329 const struct setting *setting,
330 struct settings **origin, struct setting *fetched,
331 void *data, size_t len );
332extern int fetch_setting_copy ( struct settings *settings,
333 const struct setting *setting,
334 struct settings **origin,
335 struct setting *fetched, void **data );
336extern int fetch_raw_setting ( struct settings *settings,
337 const struct setting *setting,
338 void *data, size_t len );
339extern int fetch_raw_setting_copy ( struct settings *settings,
340 const struct setting *setting,
341 void **data );
342extern int fetch_string_setting ( struct settings *settings,
343 const struct setting *setting,
344 char *data, size_t len );
345extern int fetch_string_setting_copy ( struct settings *settings,
346 const struct setting *setting,
347 char **data );
348extern int fetch_ipv4_array_setting ( struct settings *settings,
349 const struct setting *setting,
350 struct in_addr *inp, unsigned int count );
351extern int fetch_ipv4_setting ( struct settings *settings,
352 const struct setting *setting,
353 struct in_addr *inp );
354extern int fetch_ipv6_array_setting ( struct settings *settings,
355 const struct setting *setting,
356 struct in6_addr *inp, unsigned int count);
357extern int fetch_ipv6_setting ( struct settings *settings,
358 const struct setting *setting,
359 struct in6_addr *inp );
360extern int fetch_int_setting ( struct settings *settings,
361 const struct setting *setting, long *value );
362extern int fetch_uint_setting ( struct settings *settings,
363 const struct setting *setting,
364 unsigned long *value );
365extern long fetch_intz_setting ( struct settings *settings,
366 const struct setting *setting );
367extern unsigned long fetch_uintz_setting ( struct settings *settings,
368 const struct setting *setting );
369extern int fetch_uuid_setting ( struct settings *settings,
370 const struct setting *setting,
371 union uuid *uuid );
372extern void clear_settings ( struct settings *settings );
373extern int setting_cmp ( const struct setting *a, const struct setting *b );
374
375extern struct settings * find_child_settings ( struct settings *parent,
376 const char *name );
377extern struct settings * autovivify_child_settings ( struct settings *parent,
378 const char *name );
379extern const char * settings_name ( struct settings *settings );
380extern struct settings * find_settings ( const char *name );
381extern struct setting * find_setting ( const char *name );
382extern int parse_setting_name ( char *name, get_child_settings_t get_child,
383 struct settings **settings,
384 struct setting *setting );
385extern int setting_name ( struct settings *settings,
386 const struct setting *setting,
387 char *buf, size_t len );
388extern int setting_format ( const struct setting_type *type, const void *raw,
389 size_t raw_len, char *buf, size_t len );
390extern int setting_parse ( const struct setting_type *type, const char *value,
391 void *buf, size_t len );
392extern int setting_numerate ( const struct setting_type *type, const void *raw,
393 size_t raw_len, unsigned long *value );
394extern int setting_denumerate ( const struct setting_type *type,
395 unsigned long value, void *buf, size_t len );
396extern int fetchf_setting ( struct settings *settings,
397 const struct setting *setting,
398 struct settings **origin, struct setting *fetched,
399 char *buf, size_t len );
400extern int fetchf_setting_copy ( struct settings *settings,
401 const struct setting *setting,
402 struct settings **origin,
403 struct setting *fetched, char **value );
404extern int storef_setting ( struct settings *settings,
405 const struct setting *setting, const char *value );
406extern int fetchn_setting ( struct settings *settings,
407 const struct setting *setting,
408 struct settings **origin, struct setting *fetched,
409 unsigned long *value );
410extern int storen_setting ( struct settings *settings,
411 const struct setting *setting,
412 unsigned long value );
413extern char * expand_settings ( const char *string );
414
415extern const struct setting_type setting_type_string __setting_type;
416extern const struct setting_type setting_type_uristring __setting_type;
417extern const struct setting_type setting_type_ipv4 __setting_type;
418extern const struct setting_type setting_type_ipv6 __setting_type;
419extern const struct setting_type setting_type_int8 __setting_type;
420extern const struct setting_type setting_type_int16 __setting_type;
421extern const struct setting_type setting_type_int32 __setting_type;
422extern const struct setting_type setting_type_uint8 __setting_type;
423extern const struct setting_type setting_type_uint16 __setting_type;
424extern const struct setting_type setting_type_uint32 __setting_type;
425extern const struct setting_type setting_type_hex __setting_type;
426extern const struct setting_type setting_type_hexhyp __setting_type;
427extern const struct setting_type setting_type_hexraw __setting_type;
428extern const struct setting_type setting_type_base64 __setting_type;
429extern const struct setting_type setting_type_uuid __setting_type;
430extern const struct setting_type setting_type_guid __setting_type;
431extern const struct setting_type setting_type_busdevfn __setting_type;
432extern const struct setting_type setting_type_dnssl __setting_type;
433
434extern const struct setting
436extern const struct setting
438extern const struct setting
440extern const struct setting
441static_route_setting __setting ( SETTING_IP4, static_routes );
442extern const struct setting
444extern const struct setting
446extern const struct setting
448extern const struct setting
450extern const struct setting
452extern const struct setting
453hostname_setting __setting ( SETTING_HOST, hostname );
454extern const struct setting
455domain_setting __setting ( SETTING_IP_EXTRA, domain );
456extern const struct setting
457filename_setting __setting ( SETTING_BOOT, filename );
458extern const struct setting
459root_path_setting __setting ( SETTING_SANBOOT, root-path );
460extern const struct setting
461san_filename_setting __setting ( SETTING_SANBOOT, san-filename );
462extern const struct setting
463username_setting __setting ( SETTING_AUTH, username );
464extern const struct setting
465password_setting __setting ( SETTING_AUTH, password );
466extern const struct setting
467priority_setting __setting ( SETTING_MISC, priority );
468extern const struct setting
469uuid_setting __setting ( SETTING_HOST, uuid );
470extern const struct setting
471next_server_setting __setting ( SETTING_BOOT, next-server );
472extern const struct setting
473mac_setting __setting ( SETTING_NETDEV, mac );
474extern const struct setting
475busid_setting __setting ( SETTING_NETDEV, busid );
476extern const struct setting
477linktype_setting __setting ( SETTING_NETDEV, linktype );
478extern const struct setting
479user_class_setting __setting ( SETTING_HOST_EXTRA, user-class );
480extern const struct setting
481vendor_class_setting __setting ( SETTING_HOST_EXTRA, vendor-class );
482extern const struct setting
483manufacturer_setting __setting ( SETTING_HOST_EXTRA, manufacturer );
484extern const struct setting
486extern const struct setting
488extern const struct setting
489asset_setting __setting ( SETTING_HOST_EXTRA, asset );
490extern const struct setting
491board_serial_setting __setting ( SETTING_HOST_EXTRA, board-serial );
492extern const struct setting dhcp_server_setting __setting ( SETTING_MISC,
493 dhcp-server );
494
495/**
496 * Initialise a settings block
497 *
498 * @v settings Settings block
499 * @v op Settings block operations
500 * @v refcnt Containing object reference counter, or NULL
501 * @v default_scope Default scope
502 */
503static inline void settings_init ( struct settings *settings,
504 struct settings_operations *op,
505 struct refcnt *refcnt,
506 const struct settings_scope *default_scope ){
509 settings->op = op;
511 settings->default_scope = default_scope;
512}
513
514/**
515 * Initialise a settings block
516 *
517 * @v generics Generic settings block
518 * @v refcnt Containing object reference counter, or NULL
519 */
520static inline void generic_settings_init ( struct generic_settings *generics,
521 struct refcnt *refcnt ) {
523 refcnt, NULL );
524 INIT_LIST_HEAD ( &generics->list );
525}
526
527/**
528 * Delete setting
529 *
530 * @v settings Settings block
531 * @v setting Setting to delete
532 * @ret rc Return status code
533 */
534static inline int delete_setting ( struct settings *settings,
535 const struct setting *setting ) {
536 return store_setting ( settings, setting, NULL, 0 );
537}
538
539/**
540 * Check existence of predefined setting
541 *
542 * @v settings Settings block, or NULL to search all blocks
543 * @v setting Setting to fetch
544 * @ret exists Setting exists
545 */
546static inline int setting_exists ( struct settings *settings,
547 const struct setting *setting ) {
548 return ( fetch_setting ( settings, setting, NULL, NULL,
549 NULL, 0 ) >= 0 );
550}
551
552#endif /* _IPXE_SETTINGS_H */
linktype
Definition 3c90x.h:240
#define NULL
NULL pointer (VOID *)
Definition Base.h:322
__be32 raw[7]
Definition CIB_PRM.h:0
pseudo_bit_t value[0x00020]
Definition arbel.h:2
unsigned long long uint64_t
Definition stdint.h:13
unsigned char uint8_t
Definition stdint.h:10
const char * name
Definition ath9k_hw.c:1986
static size_t raw_len
Definition base16.h:54
static unsigned short vendor
Definition davicom.c:128
static struct dns_server dns6
IPv6 DNS server list.
Definition dns.c:86
uint32_t next
Next descriptor address.
Definition dwmac.h:11
ring len
Length.
Definition dwmac.h:226
uint64_t serial
Serial number.
Definition edd.h:1
const struct setting gateway6_setting
const struct setting ip_setting
const struct setting len6_setting
const struct setting ip6_setting
const struct setting dns_setting
const struct setting dns6_setting
const struct setting netmask_setting
const struct setting gateway_setting
uint32_t type
Operating system type.
Definition ena.h:1
uint8_t data[48]
Additional event data.
Definition ena.h:11
uint8_t scope
Scope.
Definition ena.h:7
uint8_t mac[ETH_ALEN]
MAC address.
Definition ena.h:13
static unsigned int count
Number of entries.
Definition dwmac.h:220
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
Definition compiler.h:896
#define FILE_SECBOOT(_status)
Declare a file's UEFI Secure Boot permission status.
Definition compiler.h:926
#define SETTING_IP4_EXTRA
IPv4 additional settings.
Definition settings.h:67
#define SETTING_IP4
IPv4 settings.
Definition settings.h:66
#define SETTING_HOST_EXTRA
Host identity additional settings.
Definition settings.h:77
#define SETTING_SANBOOT
SAN boot settings.
Definition settings.h:74
#define SETTING_BOOT
Generic boot settings.
Definition settings.h:72
#define SETTING_NETDEV
Network device settings.
Definition settings.h:64
#define SETTING_IP6
IPv6 settings.
Definition settings.h:68
#define SETTING_IP_EXTRA
IPv4 additional settings.
Definition settings.h:71
#define SETTING_HOST
Host identity settings.
Definition settings.h:76
#define SETTING_IP6_EXTRA
IPv6 additional settings.
Definition settings.h:69
#define SETTING_AUTH
Authentication settings.
Definition settings.h:78
#define SETTING_MISC
Miscellaneous settings.
Definition settings.h:81
#define __attribute__(x)
Definition compiler.h:10
uint64_t origin
Origin.
Definition hyperv.h:9
#define __setting(setting_order, name)
Declare a configuration setting.
Definition settings.h:57
int setting_numerate(const struct setting_type *type, const void *raw, size_t raw_len, unsigned long *value)
Convert setting value to number.
Definition settings.c:1190
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.
Definition settings.c:1152
int register_settings(struct settings *settings, struct settings *parent, const char *name)
Register settings block.
Definition settings.c:476
char * expand_settings(const char *string)
Expand variables within string.
Definition settings.c:2331
struct settings * autovivify_child_settings(struct settings *parent, const char *name)
Find or create child settings block.
Definition settings.c:307
int setting_name(struct settings *settings, const struct setting *setting, char *buf, size_t len)
Return full setting name.
Definition settings.c:1607
int fetch_raw_setting_copy(struct settings *settings, const struct setting *setting, void **data)
Fetch value of setting.
Definition settings.c:822
static int delete_setting(struct settings *settings, const struct setting *setting)
Delete setting.
Definition settings.h:534
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.
Definition settings.c:929
struct settings *(* get_child_settings_t)(struct settings *settings, const char *name)
A child settings block locator function.
Definition settings.h:307
int fetch_raw_setting(struct settings *settings, const struct setting *setting, void *data, size_t len)
Fetch value of setting.
Definition settings.c:804
int fetch_setting(struct settings *settings, const struct setting *setting, struct settings **origin, struct setting *fetched, void *data, size_t len)
Fetch setting.
Definition settings.c:667
static void settings_init(struct settings *settings, struct settings_operations *op, struct refcnt *refcnt, const struct settings_scope *default_scope)
Initialise a settings block.
Definition settings.h:503
struct settings * settings_target(struct settings *settings)
Redirect to target settings block.
Definition settings.c:550
int fetchn_setting(struct settings *settings, const struct setting *setting, struct settings **origin, struct setting *fetched, unsigned long *value)
Fetch numeric value of setting.
Definition settings.c:1373
unsigned long fetch_uintz_setting(struct settings *settings, const struct setting *setting)
Fetch value of unsigned integer setting, or zero.
Definition settings.c:1069
int setting_parse(const struct setting_type *type, const char *value, void *buf, size_t len)
Parse formatted string to setting value.
Definition settings.c:1171
static int setting_exists(struct settings *settings, const struct setting *setting)
Check existence of predefined setting.
Definition settings.h:546
int fetch_int_setting(struct settings *settings, const struct setting *setting, long *value)
Fetch value of signed integer setting.
Definition settings.c:1024
int fetch_setting_copy(struct settings *settings, const struct setting *setting, struct settings **origin, struct setting *fetched, void **data)
Fetch copy of setting.
Definition settings.c:786
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.
Definition settings.c:891
int fetch_string_setting(struct settings *settings, const struct setting *setting, char *data, size_t len)
Fetch value of string setting.
Definition settings.c:842
static void generic_settings_init(struct generic_settings *generics, struct refcnt *refcnt)
Initialise a settings block.
Definition settings.h:520
int parse_setting_name(char *name, get_child_settings_t get_child, struct settings **settings, struct setting *setting)
Parse setting name.
Definition settings.c:1529
struct setting * find_setting(const char *name)
Find predefined setting.
Definition settings.c:1467
int setting_applies(struct settings *settings, const struct setting *setting)
Check applicability of setting.
Definition settings.c:571
void clear_settings(struct settings *settings)
Clear settings block.
Definition settings.c:1103
int fetch_ipv6_setting(struct settings *settings, const struct setting *setting, struct in6_addr *inp)
Fetch value of IPv6 address setting.
Definition settings.c:951
int fetch_string_setting_copy(struct settings *settings, const struct setting *setting, char **data)
Fetch value of string setting.
Definition settings.c:874
void unregister_settings(struct settings *settings)
Unregister settings block.
Definition settings.c:515
int setting_cmp(const struct setting *a, const struct setting *b)
Compare two settings.
Definition settings.c:1121
int generic_settings_fetch(struct settings *settings, struct setting *setting, void *data, size_t len)
Fetch value of generic setting.
Definition settings.c:179
int fetch_ipv4_setting(struct settings *settings, const struct setting *setting, struct in_addr *inp)
Fetch value of IPv4 address setting.
Definition settings.c:913
struct settings * find_settings(const char *name)
Find settings block.
Definition settings.c:407
int fetch_uint_setting(struct settings *settings, const struct setting *setting, unsigned long *value)
Fetch value of unsigned integer setting.
Definition settings.c:1040
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.
Definition settings.c:1230
void generic_settings_clear(struct settings *settings)
Clear generic settings block.
Definition settings.c:208
struct settings * find_child_settings(struct settings *parent, const char *name)
Find child settings block.
Definition settings.c:280
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.
Definition settings.c:1277
int generic_settings_store(struct settings *settings, const struct setting *setting, const void *data, size_t len)
Store value of generic setting.
Definition settings.c:127
int storef_setting(struct settings *settings, const struct setting *setting, const char *value)
Store formatted value of setting.
Definition settings.c:1320
long fetch_intz_setting(struct settings *settings, const struct setting *setting)
Fetch value of signed integer setting, or zero.
Definition settings.c:1054
int fetch_uuid_setting(struct settings *settings, const struct setting *setting, union uuid *uuid)
Fetch value of UUID setting.
Definition settings.c:1085
int store_setting(struct settings *settings, const struct setting *setting, const void *data, size_t len)
Store value of setting.
Definition settings.c:616
#define __setting_type
Declare a configuration setting type.
Definition settings.h:246
int storen_setting(struct settings *settings, const struct setting *setting, unsigned long value)
Store numeric value of setting.
Definition settings.c:1415
const char * settings_name(struct settings *settings)
Return settings block name.
Definition settings.c:346
int setting_denumerate(const struct setting_type *type, unsigned long value, void *buf, size_t len)
Convert number to setting value.
Definition settings.c:1209
uint8_t product
Product string.
Definition smbios.h:5
uint8_t manufacturer
Manufacturer string.
Definition smbios.h:3
const struct settings_scope ipv6_settings_scope
IPv6 settings scope.
Definition ipv6.c:1121
Linked lists.
#define INIT_LIST_HEAD(list)
Initialise a list head.
Definition list.h:46
static struct dynamic_item username
Definition login_ui.c:36
static struct dynamic_item password
Definition login_ui.c:37
static uint16_t struct vmbus_xfer_pages_operations * op
Definition netvsc.h:327
IP4_t ip
Destination IP address.
Definition pxe_api.h:1
Reference counting.
const struct settings_scope dhcpv6_scope
IPv6 settings scope.
Definition settings.c:1793
int fetch_setting(struct settings *settings, const struct setting *setting, struct settings **origin, struct setting *fetched, void *data, size_t len)
Fetch setting.
Definition settings.c:667
const struct settings_scope builtin_scope
Built-in setting scope.
Definition settings.c:2506
struct settings_operations generic_settings_operations
Generic settings operations.
Definition settings.c:222
uint16_t priority
Priotity.
Definition stp.h:1
struct stp_switch root
Root switch.
Definition stp.h:15
A built-in setting.
Definition settings.h:268
const struct setting * setting
Setting.
Definition settings.h:270
int(* fetch)(void *data, size_t len)
Fetch setting value.
Definition settings.h:277
A generic settings block.
Definition settings.h:299
struct list_head list
List of generic settings.
Definition settings.h:303
struct settings settings
Settings block.
Definition settings.h:301
IP6 address structure.
Definition in.h:51
IP address structure.
Definition in.h:42
A doubly-linked list entry (or list head)
Definition list.h:19
A reference counter.
Definition refcnt.h:27
A setting type.
Definition settings.h:192
int(* format)(const struct setting_type *type, const void *raw, size_t raw_len, char *buf, size_t len)
Format setting value as a string.
Definition settings.h:217
const char * name
Name.
Definition settings.h:197
int(* numerate)(const struct setting_type *type, const void *raw, size_t raw_len, unsigned long *value)
Convert setting value to number.
Definition settings.h:238
int(* denumerate)(const struct setting_type *type, unsigned long value, void *buf, size_t len)
Convert number to setting value.
Definition settings.h:227
int(* parse)(const struct setting_type *type, const char *value, void *buf, size_t len)
Parse formatted string to setting value.
Definition settings.h:206
A setting.
Definition settings.h:24
const char * name
Name.
Definition settings.h:29
const char * description
Description.
Definition settings.h:31
const struct setting_type * type
Setting type.
Definition settings.h:37
uint64_t tag
Setting tag, if applicable.
Definition settings.h:44
A settings applicator.
Definition settings.h:252
int(* apply)(void)
Apply updated settings.
Definition settings.h:257
Settings block operations.
Definition settings.h:86
int(* applies)(struct settings *settings, const struct setting *setting)
Check applicability of setting.
Definition settings.h:99
int(* fetch)(struct settings *settings, struct setting *setting, void *data, size_t len)
Fetch value of setting.
Definition settings.h:123
int(* store)(struct settings *settings, const struct setting *setting, const void *data, size_t len)
Store value of setting.
Definition settings.h:109
void(* clear)(struct settings *settings)
Clear settings block.
Definition settings.h:129
A setting scope.
Definition settings.h:177
uint8_t dummy
Dummy field.
Definition settings.h:183
A settings block.
Definition settings.h:133
struct settings_operations * op
Settings block operations.
Definition settings.h:145
const struct settings_scope * default_scope
Default scope for numerical settings constructed for this block.
Definition settings.h:147
struct list_head children
Child settings blocks.
Definition settings.h:143
int order
Sibling ordering.
Definition settings.h:149
const char * name
Name.
Definition settings.h:137
struct settings * parent
Parent settings block.
Definition settings.h:139
struct list_head siblings
Sibling settings blocks.
Definition settings.h:141
struct refcnt * refcnt
Reference counter.
Definition settings.h:135
Linker tables.
A universally unique ID.
Definition uuid.h:16