diff options
| author | Michael Brown | 2009-01-31 08:36:05 +0100 |
|---|---|---|
| committer | Michael Brown | 2009-02-01 02:21:40 +0100 |
| commit | e65afc4b10552ec9ac7de2f0d924b96bc71aaad0 (patch) | |
| tree | 36e528a6d947aa8701208953e74cd496728955b4 /src/include/gpxe/dhcppkt.h | |
| parent | [settings] Avoid duplicate settings block names (diff) | |
| download | ipxe-e65afc4b10552ec9ac7de2f0d924b96bc71aaad0.tar.gz ipxe-e65afc4b10552ec9ac7de2f0d924b96bc71aaad0.tar.xz ipxe-e65afc4b10552ec9ac7de2f0d924b96bc71aaad0.zip | |
[dhcp] Split PXE menuing code out of dhcp.c
The DHCP client code now implements only the mechanism of the DHCP and
PXE Boot Server protocols. Boot Server Discovery can be initiated
manually using the "pxebs" command. The menuing code is separated out
into a user-level function on a par with boot_root_path(), and is
entered in preference to a normal filename boot if the DHCP vendor
class is "PXEClient" and the PXE boot menu option exists.
Diffstat (limited to 'src/include/gpxe/dhcppkt.h')
| -rw-r--r-- | src/include/gpxe/dhcppkt.h | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/src/include/gpxe/dhcppkt.h b/src/include/gpxe/dhcppkt.h index 179be2f8e..e8f8fafd9 100644 --- a/src/include/gpxe/dhcppkt.h +++ b/src/include/gpxe/dhcppkt.h @@ -9,27 +9,54 @@ #include <gpxe/dhcp.h> #include <gpxe/dhcpopts.h> +#include <gpxe/refcnt.h> /** * A DHCP packet * */ struct dhcp_packet { + /** Reference counter */ + struct refcnt refcnt; /** The DHCP packet contents */ struct dhcphdr *dhcphdr; /** Maximum length of the DHCP packet buffer */ size_t max_len; /** Used length of the DHCP packet buffer */ size_t len; - /** DHCP option blocks */ + /** DHCP options */ struct dhcp_options options; + /** Settings interface */ + struct settings settings; }; +/** + * Increment reference count on DHCP packet + * + * @v dhcppkt DHCP packet + * @ret dhcppkt DHCP packet + */ +static inline __attribute__ (( always_inline )) struct dhcp_packet * +dhcppkt_get ( struct dhcp_packet *dhcppkt ) { + ref_get ( &dhcppkt->refcnt ); + return dhcppkt; +} + +/** + * Decrement reference count on DHCP packet + * + * @v dhcppkt DHCP packet + */ +static inline __attribute__ (( always_inline )) void +dhcppkt_put ( struct dhcp_packet *dhcppkt ) { + ref_put ( &dhcppkt->refcnt ); +} + extern int dhcppkt_store ( struct dhcp_packet *dhcppkt, unsigned int tag, const void *data, size_t len ); extern int dhcppkt_fetch ( struct dhcp_packet *dhcppkt, unsigned int tag, void *data, size_t len ); extern void dhcppkt_init ( struct dhcp_packet *dhcppkt, - void *data, size_t len ); + struct dhcphdr *data, size_t len ); #endif /* _GPXE_DHCPPKT_H */ |
