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 
10 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
11 FILE_SECBOOT ( PERMITTED );
12 
13 #include <stdint.h>
14 #include <ipxe/tables.h>
15 #include <ipxe/list.h>
16 #include <ipxe/refcnt.h>
17 
18 struct settings;
19 struct in_addr;
20 struct in6_addr;
21 union uuid;
22 
23 /** A setting */
24 struct 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 */
133 struct settings {
134  /** Reference counter */
135  struct refcnt *refcnt;
136  /** Name */
137  const char *name;
138  /** Parent settings block */
139  struct settings *parent;
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  */
192 struct setting_type {
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 */
287 extern const struct settings_scope builtin_scope;
288 
289 /** IPv6 setting scope */
290 extern const struct settings_scope ipv6_settings_scope;
291 
292 /** DHCPv6 setting scope */
293 extern const struct settings_scope dhcpv6_scope;
294 
295 /**
296  * A generic settings block
297  *
298  */
300  /** Settings block */
302  /** List of generic settings */
303  struct list_head list;
304 };
305 
306 /** A child settings block locator function */
307 typedef struct settings * ( *get_child_settings_t ) ( struct settings *settings,
308  const char *name );
310 extern int generic_settings_store ( struct settings *settings,
311  const struct setting *setting,
312  const void *data, size_t len );
313 extern int generic_settings_fetch ( struct settings *settings,
314  struct setting *setting,
315  void *data, size_t len );
316 extern void generic_settings_clear ( struct settings *settings );
317 
318 extern int register_settings ( struct settings *settings,
319  struct settings *parent, const char *name );
320 extern void unregister_settings ( struct settings *settings );
321 
322 extern struct settings * settings_target ( struct settings *settings );
323 extern int setting_applies ( struct settings *settings,
324  const struct setting *setting );
325 extern int store_setting ( struct settings *settings,
326  const struct setting *setting,
327  const void *data, size_t len );
328 extern int fetch_setting ( struct settings *settings,
329  const struct setting *setting,
330  struct settings **origin, struct setting *fetched,
331  void *data, size_t len );
332 extern int fetch_setting_copy ( struct settings *settings,
333  const struct setting *setting,
334  struct settings **origin,
335  struct setting *fetched, void **data );
336 extern int fetch_raw_setting ( struct settings *settings,
337  const struct setting *setting,
338  void *data, size_t len );
339 extern int fetch_raw_setting_copy ( struct settings *settings,
340  const struct setting *setting,
341  void **data );
342 extern int fetch_string_setting ( struct settings *settings,
343  const struct setting *setting,
344  char *data, size_t len );
345 extern int fetch_string_setting_copy ( struct settings *settings,
346  const struct setting *setting,
347  char **data );
348 extern int fetch_ipv4_array_setting ( struct settings *settings,
349  const struct setting *setting,
350  struct in_addr *inp, unsigned int count );
351 extern int fetch_ipv4_setting ( struct settings *settings,
352  const struct setting *setting,
353  struct in_addr *inp );
354 extern int fetch_ipv6_array_setting ( struct settings *settings,
355  const struct setting *setting,
356  struct in6_addr *inp, unsigned int count);
357 extern int fetch_ipv6_setting ( struct settings *settings,
358  const struct setting *setting,
359  struct in6_addr *inp );
360 extern int fetch_int_setting ( struct settings *settings,
361  const struct setting *setting, long *value );
362 extern int fetch_uint_setting ( struct settings *settings,
363  const struct setting *setting,
364  unsigned long *value );
365 extern long fetch_intz_setting ( struct settings *settings,
366  const struct setting *setting );
367 extern unsigned long fetch_uintz_setting ( struct settings *settings,
368  const struct setting *setting );
369 extern int fetch_uuid_setting ( struct settings *settings,
370  const struct setting *setting,
371  union uuid *uuid );
372 extern void clear_settings ( struct settings *settings );
373 extern int setting_cmp ( const struct setting *a, const struct setting *b );
374 
375 extern struct settings * find_child_settings ( struct settings *parent,
376  const char *name );
377 extern struct settings * autovivify_child_settings ( struct settings *parent,
378  const char *name );
379 extern const char * settings_name ( struct settings *settings );
380 extern struct settings * find_settings ( const char *name );
381 extern struct setting * find_setting ( const char *name );
382 extern int parse_setting_name ( char *name, get_child_settings_t get_child,
383  struct settings **settings,
384  struct setting *setting );
385 extern int setting_name ( struct settings *settings,
386  const struct setting *setting,
387  char *buf, size_t len );
388 extern int setting_format ( const struct setting_type *type, const void *raw,
389  size_t raw_len, char *buf, size_t len );
390 extern int setting_parse ( const struct setting_type *type, const char *value,
391  void *buf, size_t len );
392 extern int setting_numerate ( const struct setting_type *type, const void *raw,
393  size_t raw_len, unsigned long *value );
394 extern int setting_denumerate ( const struct setting_type *type,
395  unsigned long value, void *buf, size_t len );
396 extern int fetchf_setting ( struct settings *settings,
397  const struct setting *setting,
398  struct settings **origin, struct setting *fetched,
399  char *buf, size_t len );
400 extern int fetchf_setting_copy ( struct settings *settings,
401  const struct setting *setting,
402  struct settings **origin,
403  struct setting *fetched, char **value );
404 extern int storef_setting ( struct settings *settings,
405  const struct setting *setting, const char *value );
406 extern int fetchn_setting ( struct settings *settings,
407  const struct setting *setting,
408  struct settings **origin, struct setting *fetched,
409  unsigned long *value );
410 extern int storen_setting ( struct settings *settings,
411  const struct setting *setting,
412  unsigned long value );
413 extern char * expand_settings ( const char *string );
414 
415 extern const struct setting_type setting_type_string __setting_type;
416 extern const struct setting_type setting_type_uristring __setting_type;
417 extern const struct setting_type setting_type_ipv4 __setting_type;
418 extern const struct setting_type setting_type_ipv6 __setting_type;
419 extern const struct setting_type setting_type_int8 __setting_type;
420 extern const struct setting_type setting_type_int16 __setting_type;
421 extern const struct setting_type setting_type_int32 __setting_type;
422 extern const struct setting_type setting_type_uint8 __setting_type;
423 extern const struct setting_type setting_type_uint16 __setting_type;
424 extern const struct setting_type setting_type_uint32 __setting_type;
425 extern const struct setting_type setting_type_hex __setting_type;
426 extern const struct setting_type setting_type_hexhyp __setting_type;
427 extern const struct setting_type setting_type_hexraw __setting_type;
428 extern const struct setting_type setting_type_base64 __setting_type;
429 extern const struct setting_type setting_type_uuid __setting_type;
430 extern const struct setting_type setting_type_guid __setting_type;
431 extern const struct setting_type setting_type_busdevfn __setting_type;
432 extern const struct setting_type setting_type_dnssl __setting_type;
433 
434 extern const struct setting
435 ip_setting __setting ( SETTING_IP4, ip );
436 extern const struct setting
437 netmask_setting __setting ( SETTING_IP4, netmask );
438 extern const struct setting
439 gateway_setting __setting ( SETTING_IP4, gateway );
440 extern const struct setting
441 static_route_setting __setting ( SETTING_IP4, static_routes );
442 extern const struct setting
443 dns_setting __setting ( SETTING_IP4_EXTRA, dns );
444 extern const struct setting
445 ip6_setting __setting ( SETTING_IP6, ip6 );
446 extern const struct setting
447 len6_setting __setting ( SETTING_IP6, len6 );
448 extern const struct setting
449 gateway6_setting __setting ( SETTING_IP6, gateway6 );
450 extern const struct setting
451 dns6_setting __setting ( SETTING_IP6_EXTRA, dns6 );
452 extern const struct setting
453 hostname_setting __setting ( SETTING_HOST, hostname );
454 extern const struct setting
455 domain_setting __setting ( SETTING_IP_EXTRA, domain );
456 extern const struct setting
457 filename_setting __setting ( SETTING_BOOT, filename );
458 extern const struct setting
459 root_path_setting __setting ( SETTING_SANBOOT, root-path );
460 extern const struct setting
461 san_filename_setting __setting ( SETTING_SANBOOT, san-filename );
462 extern const struct setting
463 username_setting __setting ( SETTING_AUTH, username );
464 extern const struct setting
465 password_setting __setting ( SETTING_AUTH, password );
466 extern const struct setting
467 priority_setting __setting ( SETTING_MISC, priority );
468 extern const struct setting
469 uuid_setting __setting ( SETTING_HOST, uuid );
470 extern const struct setting
471 next_server_setting __setting ( SETTING_BOOT, next-server );
472 extern const struct setting
473 mac_setting __setting ( SETTING_NETDEV, mac );
474 extern const struct setting
475 busid_setting __setting ( SETTING_NETDEV, busid );
476 extern const struct setting
477 linktype_setting __setting ( SETTING_NETDEV, linktype );
478 extern const struct setting
479 user_class_setting __setting ( SETTING_HOST_EXTRA, user-class );
480 extern const struct setting
481 vendor_class_setting __setting ( SETTING_HOST_EXTRA, vendor-class );
482 extern const struct setting
483 manufacturer_setting __setting ( SETTING_HOST_EXTRA, manufacturer );
484 extern const struct setting
485 product_setting __setting ( SETTING_HOST_EXTRA, product );
486 extern const struct setting
487 serial_setting __setting ( SETTING_HOST_EXTRA, serial );
488 extern const struct setting
489 asset_setting __setting ( SETTING_HOST_EXTRA, asset );
490 extern const struct setting
491 board_serial_setting __setting ( SETTING_HOST_EXTRA, board-serial );
492 extern 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  */
503 static 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  */
520 static 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  */
534 static 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  */
546 static 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 */
void clear_settings(struct settings *settings)
Clear settings block.
Definition: settings.c:1103
#define SETTING_IP4
IPv4 settings.
Definition: settings.h:66
#define __attribute__(x)
Definition: compiler.h:10
#define SETTING_IP_EXTRA
IPv4 additional settings.
Definition: settings.h:71
const char * name
Definition: ath9k_hw.c:1986
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 storef_setting(struct settings *settings, const struct setting *setting, const char *value)
Store formatted value of setting.
Definition: settings.c:1320
uint64_t origin
Origin.
Definition: hyperv.h:20
const struct settings_scope ipv6_settings_scope
IPv6 setting scope.
Definition: ipv6.c:1121
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
char * expand_settings(const char *string)
Expand variables within string.
Definition: settings.c:2331
int fetch_uint_setting(struct settings *settings, const struct setting *setting, unsigned long *value)
Fetch value of unsigned integer setting.
Definition: settings.c:1040
struct stp_switch root
Root switch.
Definition: stp.h:27
A universally unique ID.
Definition: uuid.h:16
struct settings * parent
Parent settings block.
Definition: settings.h:139
static void generic_settings_init(struct generic_settings *generics, struct refcnt *refcnt)
Initialise a settings block.
Definition: settings.h:520
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(* denumerate)(const struct setting_type *type, unsigned long value, void *buf, size_t len)
Convert number to setting value.
Definition: settings.h:227
static unsigned short vendor
Definition: davicom.c:128
const char * settings_name(struct settings *settings)
Return settings block name.
Definition: settings.c:346
int generic_settings_fetch(struct settings *settings, struct setting *setting, void *data, size_t len)
Fetch value of generic setting.
Definition: settings.c:179
uint32_t type
Operating system type.
Definition: ena.h:12
#define SETTING_AUTH
Authentication settings.
Definition: settings.h:78
static int delete_setting(struct settings *settings, const struct setting *setting)
Delete setting.
Definition: settings.h:534
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
unsigned long long uint64_t
Definition: stdint.h:13
int(* fetch)(void *data, size_t len)
Fetch setting value.
Definition: settings.h:277
A settings applicator.
Definition: settings.h:252
int setting_cmp(const struct setting *a, const struct setting *b)
Compare two settings.
Definition: settings.c:1121
#define SETTING_SANBOOT
SAN boot settings.
Definition: settings.h:74
#define SETTING_HOST_EXTRA
Host identity additional settings.
Definition: settings.h:77
#define SETTING_MISC
Miscellaneous settings.
Definition: settings.h:81
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 fetch_string_setting(struct settings *settings, const struct setting *setting, char *data, size_t len)
Fetch value of string setting.
Definition: settings.c:842
uint8_t mac[ETH_ALEN]
MAC address.
Definition: ena.h:24
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
const char * description
Description.
Definition: settings.h:31
static void(*) struct refcnt refcnt)
Definition: pool.h:63
void(* clear)(struct settings *settings)
Clear settings block.
Definition: settings.h:129
const struct settings_scope * default_scope
Default scope for numerical settings constructed for this block.
Definition: settings.h:147
struct settings_operations * op
Settings block operations.
Definition: settings.h:145
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
A doubly-linked list entry (or list head)
Definition: list.h:19
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
#define __setting(setting_order, name)
Declare a configuration setting.
Definition: settings.h:57
A reference counter.
Definition: refcnt.h:27
const char * name
Name.
Definition: settings.h:29
uint64_t tag
Setting tag, if applicable.
Definition: settings.h:44
int setting_name(struct settings *settings, const struct setting *setting, char *buf, size_t len)
Return full setting name.
Definition: settings.c:1607
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
struct list_head list
List of generic settings.
Definition: settings.h:303
int setting_applies(struct settings *settings, const struct setting *setting)
Check applicability of setting.
Definition: settings.c:571
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
#define SETTING_NETDEV
Network device settings.
Definition: settings.h:64
int fetch_uuid_setting(struct settings *settings, const struct setting *setting, union uuid *uuid)
Fetch value of UUID setting.
Definition: settings.c:1085
const struct setting * setting
Setting.
Definition: settings.h:270
struct settings * settings_target(struct settings *settings)
Redirect to target settings block.
Definition: settings.c:550
#define SETTING_IP4_EXTRA
IPv4 additional settings.
Definition: settings.h:67
#define __setting_type
Declare a configuration setting type.
Definition: settings.h:246
struct settings *(* get_child_settings_t)(struct settings *settings, const char *name)
A child settings block locator function.
Definition: settings.h:307
pseudo_bit_t value[0x00020]
Definition: arbel.h:13
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
ring len
Length.
Definition: dwmac.h:231
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 unsigned int count
Number of entries.
Definition: dwmac.h:225
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
const struct setting_type * type
Setting type.
Definition: settings.h:37
IP6 address structure.
Definition: in.h:51
struct settings * find_settings(const char *name)
Find settings block.
Definition: settings.c:407
const struct settings_scope dhcpv6_scope
DHCPv6 setting scope.
Definition: settings.c:1793
Linked lists.
static size_t raw_len
Definition: base16.h:54
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
IP address structure.
Definition: in.h:42
int storen_setting(struct settings *settings, const struct setting *setting, unsigned long value)
Store numeric value of setting.
Definition: settings.c:1415
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
uint64_t serial
Serial number.
Definition: edd.h:31
A built-in setting.
Definition: settings.h:268
IP4_t ip
Destination IP address.
Definition: pxe_api.h:58
Settings block operations.
Definition: settings.h:86
A settings block.
Definition: settings.h:133
unsigned char uint8_t
Definition: stdint.h:10
#define SETTING_BOOT
Generic boot settings.
Definition: settings.h:72
A setting scope.
Definition: settings.h:177
const char * name
Name.
Definition: settings.h:137
FILE_SECBOOT(PERMITTED)
int fetch_string_setting_copy(struct settings *settings, const struct setting *setting, char **data)
Fetch value of string setting.
Definition: settings.c:874
int register_settings(struct settings *settings, struct settings *parent, const char *name)
Register settings block.
Definition: settings.c:476
uint32_t next
Next descriptor address.
Definition: dwmac.h:22
static struct dynamic_item password
Definition: login_ui.c:37
struct list_head siblings
Sibling settings blocks.
Definition: settings.h:141
uint8_t manufacturer
Manufacturer string.
Definition: smbios.h:15
A setting.
Definition: settings.h:24
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
static int setting_exists(struct settings *settings, const struct setting *setting)
Check existence of predefined setting.
Definition: settings.h:546
static uint16_t struct vmbus_xfer_pages_operations * op
Definition: netvsc.h:327
#define INIT_LIST_HEAD(list)
Initialise a list head.
Definition: list.h:46
int order
Sibling ordering.
Definition: settings.h:149
A generic settings block.
Definition: settings.h:299
int fetch_raw_setting_copy(struct settings *settings, const struct setting *setting, void **data)
Fetch value of setting.
Definition: settings.c:822
struct settings settings
Settings block.
Definition: settings.h:301
#define SETTING_IP6_EXTRA
IPv6 additional settings.
Definition: settings.h:69
struct settings * find_child_settings(struct settings *parent, const char *name)
Find child settings block.
Definition: settings.c:280
uint16_t priority
Priotity.
Definition: stp.h:13
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_ipv4_setting(struct settings *settings, const struct setting *setting, struct in_addr *inp)
Fetch value of IPv4 address setting.
Definition: settings.c:913
int(* fetch)(struct settings *settings, struct setting *setting, void *data, size_t len)
Fetch value of setting.
Definition: settings.h:123
int fetch_int_setting(struct settings *settings, const struct setting *setting, long *value)
Fetch value of signed integer setting.
Definition: settings.c:1024
void generic_settings_clear(struct settings *settings)
Clear generic settings block.
Definition: settings.c:208
const char * name
Name.
Definition: settings.h:197
Reference counting.
uint8_t data[48]
Additional event data.
Definition: ena.h:22
Linker tables.
static struct dynamic_item username
Definition: login_ui.c:36
struct settings_operations generic_settings_operations
Generic settings operations.
Definition: settings.c:222
uint8_t product
Product string.
Definition: smbios.h:17
__be32 raw[7]
Definition: CIB_PRM.h:28
int(* apply)(void)
Apply updated settings.
Definition: settings.h:257
int(* applies)(struct settings *settings, const struct setting *setting)
Check applicability of setting.
Definition: settings.h:99
struct list_head children
Child settings blocks.
Definition: settings.h:143
struct settings * autovivify_child_settings(struct settings *parent, const char *name)
Find or create child settings block.
Definition: settings.c:307
#define SETTING_IP6
IPv6 settings.
Definition: settings.h:68
uint8_t dummy
Dummy field.
Definition: settings.h:183
const struct settings_scope * scope
Setting scope (or NULL)
Definition: settings.h:50
const struct settings_scope builtin_scope
Built-in setting scope.
Definition: settings.c:2506
linktype
Definition: 3c90x.h:240
int store_setting(struct settings *settings, const struct setting *setting, const void *data, size_t len)
Store value of setting.
Definition: settings.c:616
int(* store)(struct settings *settings, const struct setting *setting, const void *data, size_t len)
Store value of setting.
Definition: settings.h:109
void unregister_settings(struct settings *settings)
Unregister settings block.
Definition: settings.c:515
#define NULL
NULL pointer (VOID *)
Definition: Base.h:322
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
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
A setting type.
Definition: settings.h:192
struct setting * find_setting(const char *name)
Find predefined setting.
Definition: settings.c:1467
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
unsigned long fetch_uintz_setting(struct settings *settings, const struct setting *setting)
Fetch value of unsigned integer setting, or zero.
Definition: settings.c:1069
struct refcnt * refcnt
Reference counter.
Definition: settings.h:135
static struct dns_server dns6
IPv6 DNS server list.
Definition: dns.c:86
#define SETTING_HOST
Host identity settings.
Definition: settings.h:76
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