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