dhcppkt.h

Go to the documentation of this file.
00001 #ifndef _GPXE_DHCPPKT_H
00002 #define _GPXE_DHCPPKT_H
00003 
00004 /** @file
00005  *
00006  * DHCP packets
00007  *
00008  */
00009 
00010 FILE_LICENCE ( GPL2_OR_LATER );
00011 
00012 #include <gpxe/dhcp.h>
00013 #include <gpxe/dhcpopts.h>
00014 #include <gpxe/refcnt.h>
00015 
00016 /**
00017  * A DHCP packet
00018  *
00019  */
00020 struct dhcp_packet {
00021         /** Reference counter */
00022         struct refcnt refcnt;
00023         /** The DHCP packet contents */
00024         struct dhcphdr *dhcphdr;
00025         /** Maximum length of the DHCP packet buffer */
00026         size_t max_len;
00027         /** Used length of the DHCP packet buffer */
00028         size_t len;
00029         /** DHCP options */
00030         struct dhcp_options options;
00031         /** Settings interface */
00032         struct settings settings;
00033 };
00034 
00035 /**
00036  * Increment reference count on DHCP packet
00037  *
00038  * @v dhcppkt           DHCP packet
00039  * @ret dhcppkt         DHCP packet
00040  */
00041 static inline __attribute__ (( always_inline )) struct dhcp_packet *
00042 dhcppkt_get ( struct dhcp_packet *dhcppkt ) {
00043         ref_get ( &dhcppkt->refcnt );
00044         return dhcppkt;
00045 }
00046 
00047 /**
00048  * Decrement reference count on DHCP packet
00049  *
00050  * @v dhcppkt           DHCP packet
00051  */
00052 static inline __attribute__ (( always_inline )) void
00053 dhcppkt_put ( struct dhcp_packet *dhcppkt ) {
00054         ref_put ( &dhcppkt->refcnt );
00055 }
00056 
00057 extern int dhcppkt_store ( struct dhcp_packet *dhcppkt, unsigned int tag,
00058                            const void *data, size_t len );
00059 extern int dhcppkt_fetch ( struct dhcp_packet *dhcppkt, unsigned int tag,
00060                            void *data, size_t len );
00061 extern void dhcppkt_init ( struct dhcp_packet *dhcppkt, 
00062                            struct dhcphdr *data, size_t len );
00063 
00064 #endif /* _GPXE_DHCPPKT_H */

Generated on Tue Apr 6 20:01:06 2010 for gPXE by  doxygen 1.5.7.1