|
iPXE
|
DHCP packets. More...
#include <stdint.h>#include <stdlib.h>#include <stdio.h>#include <errno.h>#include <string.h>#include <ipxe/netdevice.h>#include <ipxe/dhcp.h>#include <ipxe/dhcpopts.h>#include <ipxe/dhcppkt.h>Go to the source code of this file.
Data Structures | |
| struct | dhcp_packet_field |
| A dedicated field within a DHCP packet. More... | |
Macros | |
| #define | DHCP_PACKET_FIELD(_tag, _field, _used_len) |
| Declare a dedicated field within a DHCP packet. More... | |
Functions | |
| FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
| static size_t | used_len_ipv4 (const void *data, size_t len __unused) |
| Calculate used length of an IPv4 field within a DHCP packet. More... | |
| static size_t | used_len_string (const void *data, size_t len) |
| Calculate used length of a string field within a DHCP packet. More... | |
| static void * | dhcp_packet_field (struct dhcphdr *dhcphdr, struct dhcp_packet_field *field) |
| Get address of a DHCP packet field. More... | |
| static struct dhcp_packet_field * | find_dhcp_packet_field (unsigned int tag) |
| Find DHCP packet field corresponding to settings tag number. More... | |
| static int | dhcppkt_applies (struct dhcp_packet *dhcppkt __unused, unsigned int tag) |
| Check applicability of DHCP setting. 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... | |
| static int | dhcppkt_settings_applies (struct settings *settings, const struct setting *setting) |
| Check applicability of DHCP setting. More... | |
| static int | dhcppkt_settings_store (struct settings *settings, const struct setting *setting, const void *data, size_t len) |
| Store value of DHCP setting. More... | |
| static int | dhcppkt_settings_fetch (struct settings *settings, struct setting *setting, void *data, size_t len) |
| Fetch value of DHCP setting. More... | |
| void | dhcppkt_init (struct dhcp_packet *dhcppkt, struct dhcphdr *data, size_t len) |
| Initialise DHCP packet. More... | |
Variables | |
| static struct dhcp_packet_field | dhcp_packet_fields [] |
| Dedicated fields within a DHCP packet. More... | |
| static struct settings_operations | dhcppkt_settings_operations |
| DHCP settings operations. More... | |
DHCP packets.
Definition in file dhcppkt.c.
| #define DHCP_PACKET_FIELD | ( | _tag, | |
| _field, | |||
| _used_len | |||
| ) |
Declare a dedicated field within a DHCP packet.
| _tag | Settings tag number |
| _field | Field name |
| _used_len | Function to calculate used length of field |
| FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
|
inlinestatic |
Get address of a DHCP packet field.
| dhcphdr | DHCP packet header |
| field | DHCP packet field |
| data | Packet field data |
Definition at line 117 of file dhcppkt.c.
References dhcp_packet_field::offset.
Referenced by dhcppkt_fetch(), and dhcppkt_store().
|
static |
Find DHCP packet field corresponding to settings tag number.
| tag | Settings tag number |
| field | DHCP packet field, or NULL |
Definition at line 129 of file dhcppkt.c.
References dhcp_packet_fields, NULL, tag, and dhcp_packet_field::tag.
Referenced by dhcppkt_fetch(), and dhcppkt_store().
|
static |
Check applicability of DHCP setting.
| dhcppkt | DHCP packet |
| tag | Setting tag number |
| applies | Setting applies within this settings block |
Definition at line 149 of file dhcppkt.c.
References dhcpopt_applies(), and tag.
Referenced by dhcppkt_settings_applies().
| 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(), dhcp_packet_field::len, 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(), dhcp_packet_field::len, 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().
|
static |
Check applicability of DHCP setting.
| settings | Settings block |
| setting | Setting |
| applies | Setting applies within this settings block |
Definition at line 232 of file dhcppkt.c.
References container_of, dhcppkt_applies(), NULL, setting::scope, and setting::tag.
|
static |
Store value of DHCP setting.
| settings | Settings block |
| setting | Setting to store |
| data | Setting data, or NULL to clear setting |
| len | Length of setting data |
| rc | Return status code |
Definition at line 250 of file dhcppkt.c.
References container_of, data, dhcppkt_store(), len, and setting::tag.
|
static |
Fetch value of DHCP setting.
| settings | Settings block, or NULL to search all blocks |
| setting | Setting to fetch |
| data | Buffer to fill with setting data |
| len | Length of buffer |
| len | Length of setting data, or negative error |
Definition at line 268 of file dhcppkt.c.
References container_of, data, dhcppkt_fetch(), len, and setting::tag.
| 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().
|
static |
Dedicated fields within a DHCP packet.
Definition at line 103 of file dhcppkt.c.
Referenced by find_dhcp_packet_field().
|
static |
DHCP settings operations.
Definition at line 278 of file dhcppkt.c.
Referenced by dhcppkt_init().
1.8.15