iPXE
|
DHCP options. More...
#include <stdint.h>
Go to the source code of this file.
Data Structures | |
struct | dhcp_options |
A DHCP options block. More... | |
Functions | |
FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
int | dhcpopt_applies (unsigned int tag) |
Check applicability of DHCP option setting. More... | |
int | dhcpopt_store (struct dhcp_options *options, unsigned int tag, const void *data, size_t len) |
Store value of DHCP option setting. More... | |
int | dhcpopt_fetch (struct dhcp_options *options, unsigned int tag, void *data, size_t len) |
Fetch value of DHCP option setting. More... | |
void | dhcpopt_init (struct dhcp_options *options, void *data, size_t alloc_len, int(*realloc)(struct dhcp_options *options, size_t len)) |
Initialise prepopulated block of DHCP options. More... | |
void | dhcpopt_update_used_len (struct dhcp_options *options) |
Recalculate length of DHCP options block. More... | |
int | dhcpopt_no_realloc (struct dhcp_options *options, size_t len) |
Refuse to reallocate DHCP option block. More... | |
DHCP options.
Definition in file dhcpopts.h.
FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
int dhcpopt_applies | ( | unsigned int | tag | ) |
Check applicability of DHCP option setting.
tag | Setting tag number |
applies | Setting applies to this option block |
Definition at line 359 of file dhcpopts.c.
References DHCP_ENCAP_OPT, DHCP_MAX_OPTION, and tag.
Referenced by dhcppkt_applies(), and nvo_applies().
int dhcpopt_store | ( | struct dhcp_options * | options, |
unsigned int | tag, | ||
const void * | data, | ||
size_t | len | ||
) |
Store value of DHCP option setting.
options | DHCP option block |
tag | Setting tag number |
data | Setting data, or NULL to clear setting |
len | Length of setting data |
rc | Return status code |
Definition at line 374 of file dhcpopts.c.
References data, len, offset, options, set_dhcp_option(), and tag.
Referenced by dhcppkt_store(), and nvo_store().
int dhcpopt_fetch | ( | struct dhcp_options * | options, |
unsigned int | tag, | ||
void * | data, | ||
size_t | len | ||
) |
Fetch value of DHCP option setting.
options | DHCP option block |
tag | Setting tag number |
data | Buffer to fill with setting data |
len | Length of buffer |
len | Length of setting data, or negative error |
Definition at line 393 of file dhcpopts.c.
References data, dhcp_option(), find_dhcp_option_with_encap(), len, memcpy(), NULL, offset, options, and tag.
Referenced by dhcppkt_fetch(), and nvo_fetch().
void dhcpopt_init | ( | struct dhcp_options * | options, |
void * | data, | ||
size_t | alloc_len, | ||
int(*)(struct dhcp_options *options, size_t len) | realloc | ||
) |
Initialise prepopulated block of DHCP options.
options | Uninitialised DHCP option block |
data | Memory for DHCP option data |
alloc_len | Length of memory for DHCP option data |
realloc | DHCP option block reallocator |
The memory content must already be filled with valid DHCP options. A zeroed block counts as a block of valid DHCP options.
Definition at line 451 of file dhcpopts.c.
References data, DBGC, dhcpopt_update_used_len(), options, and realloc().
Referenced by dhcppkt_init(), and nvo_init().
void dhcpopt_update_used_len | ( | struct dhcp_options * | options | ) |
Recalculate length of DHCP options block.
options | Uninitialised DHCP option block |
The "used length" field will be updated based on scanning through the block to find the end of the options.
Definition at line 420 of file dhcpopts.c.
References dhcp_option(), dhcp_option_len(), DHCP_PAD, offset, and options.
Referenced by dhcpopt_init(), and nvo_load().
int dhcpopt_no_realloc | ( | struct dhcp_options * | options, |
size_t | len | ||
) |
Refuse to reallocate DHCP option block.
options | DHCP option block |
len | New length |
rc | Return status code |
Definition at line 184 of file dhcpopts.c.
References ENOSPC.
Referenced by dhcppkt_init(), and nvo_realloc_dhcpopt().