iPXE
|
DHCP packets. More...
Go to the source code of this file.
Data Structures | |
struct | dhcp_packet |
A DHCP packet. More... | |
Functions | |
FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
static struct dhcp_packet * | dhcppkt_get (struct dhcp_packet *dhcppkt) |
Increment reference count on DHCP packet. More... | |
static void | dhcppkt_put (struct dhcp_packet *dhcppkt) |
Decrement reference count on DHCP packet. More... | |
static size_t | dhcppkt_len (struct dhcp_packet *dhcppkt) |
Get used length of DHCP packet. More... | |
int | dhcppkt_store (struct dhcp_packet *dhcppkt, unsigned int tag, const void *data, size_t len) |
Store value of DHCP packet setting. More... | |
int | dhcppkt_fetch (struct dhcp_packet *dhcppkt, unsigned int tag, void *data, size_t len) |
Fetch value of DHCP packet setting. More... | |
void | dhcppkt_init (struct dhcp_packet *dhcppkt, struct dhcphdr *data, size_t len) |
Initialise DHCP packet. More... | |
DHCP packets.
Definition in file dhcppkt.h.
FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
|
inlinestatic |
Increment reference count on DHCP packet.
dhcppkt | DHCP packet |
dhcppkt | DHCP packet |
Definition at line 38 of file dhcppkt.h.
References ref_get, and dhcp_packet::refcnt.
Referenced by dhcp_discovery_rx().
|
inlinestatic |
Decrement reference count on DHCP packet.
dhcppkt | DHCP packet |
Definition at line 49 of file dhcppkt.h.
References ref_put, and dhcp_packet::refcnt.
Referenced by cachedhcp_free(), cachedhcp_record(), dhcp_deliver(), dhcp_discovery_rx(), and dhcp_free().
|
inlinestatic |
Get used length of DHCP packet.
dhcppkt | DHCP packet |
len | Used length |
Definition at line 59 of file dhcppkt.h.
References offsetof, dhcp_packet::options, options, and dhcp_options::used_len.
Referenced by cachedhcp_record(), dhcp_tx(), and efi_pxe_fake().
int dhcppkt_store | ( | struct dhcp_packet * | dhcppkt, |
unsigned int | tag, | ||
const void * | data, | ||
size_t | len | ||
) |
Store value of DHCP packet setting.
dhcppkt | DHCP packet |
tag | Setting tag number |
data | Setting data, or NULL to clear setting |
len | Length of setting data |
rc | Return status code |
Definition at line 164 of file dhcppkt.c.
References data, dhcp_packet_field(), dhcp_packet::dhcphdr, dhcpopt_store(), ENOSPC, find_dhcp_packet_field(), len, dhcp_packet_field::len, memcpy(), memset(), NULL, dhcp_packet::options, and tag.
Referenced by copy_encap_settings(), dhcp_create_packet(), dhcp_create_request(), dhcp_proxy_tx(), dhcp_pxebs_tx(), dhcp_request_tx(), and dhcppkt_settings_store().
int dhcppkt_fetch | ( | struct dhcp_packet * | dhcppkt, |
unsigned int | tag, | ||
void * | data, | ||
size_t | len | ||
) |
Fetch value of DHCP packet setting.
dhcppkt | DHCP packet |
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 195 of file dhcppkt.c.
References data, dhcp_packet_field(), dhcp_packet::dhcphdr, dhcpopt_fetch(), find_dhcp_packet_field(), len, dhcp_packet_field::len, memcpy(), NULL, dhcp_packet::options, tag, and dhcp_packet_field::used_len.
Referenced by dhcp_deliver(), dhcp_discovery_rx(), dhcp_has_pxeopts(), dhcp_pxebs_rx(), and dhcppkt_settings_fetch().
void dhcppkt_init | ( | struct dhcp_packet * | dhcppkt, |
struct dhcphdr * | data, | ||
size_t | len | ||
) |
Initialise DHCP packet.
dhcppkt | DHCP packet structure to fill in |
data | DHCP packet raw data |
max_len | Length of raw data buffer |
Initialise a DHCP packet structure from a data buffer containing a DHCP packet.
Definition at line 300 of file dhcppkt.c.
References data, dhcp_packet::dhcphdr, dhcpopt_init(), dhcpopt_no_realloc(), dhcppkt_settings_operations, len, NULL, offsetof, dhcp_packet::options, options, dhcphdr::options, ref_init, dhcp_packet::refcnt, dhcp_packet::settings, and settings_init().
Referenced by cachedhcp_record(), dhcp_create_packet(), dhcp_deliver(), and efi_pxe_fake().