1 #ifndef _GPXE_DHCPPKT_H
2 #define _GPXE_DHCPPKT_H
10 FILE_LICENCE ( GPL2_OR_LATER );
12 #include <gpxe/dhcp.h>
13 #include <gpxe/dhcpopts.h>
14 #include <gpxe/refcnt.h>
21 /** Reference counter */
23 /** The DHCP packet contents */
24 struct dhcphdr *dhcphdr;
25 /** Maximum length of the DHCP packet buffer */
27 /** Used length of the DHCP packet buffer */
30 struct dhcp_options options;
31 /** Settings interface */
32 struct settings settings;
36 * Increment reference count on DHCP packet
38 * @v dhcppkt DHCP packet
39 * @ret dhcppkt DHCP packet
41 static inline __attribute__ (( always_inline )) struct dhcp_packet *
42 dhcppkt_get ( struct dhcp_packet *dhcppkt ) {
43 ref_get ( &dhcppkt->refcnt );
48 * Decrement reference count on DHCP packet
50 * @v dhcppkt DHCP packet
52 static inline __attribute__ (( always_inline )) void
53 dhcppkt_put ( struct dhcp_packet *dhcppkt ) {
54 ref_put ( &dhcppkt->refcnt );
57 extern int dhcppkt_store ( struct dhcp_packet *dhcppkt, unsigned int tag,
58 const void *data, size_t len );
59 extern int dhcppkt_fetch ( struct dhcp_packet *dhcppkt, unsigned int tag,
60 void *data, size_t len );
61 extern void dhcppkt_init ( struct dhcp_packet *dhcppkt,
62 struct dhcphdr *data, size_t len );
64 #endif /* _GPXE_DHCPPKT_H */