1 #ifndef _IPXE_DHCPOPTS_H
2 #define _IPXE_DHCPOPTS_H
3 
4 /** @file
5  *
6  * DHCP options
7  *
8  */
9 
10 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
11 
12 #include <stdint.h>
13 
14 /** A DHCP options block */
15 struct dhcp_options {
16 	/** Option block raw data */
17 	void *data;
18 	/** Option block used length */
19 	size_t used_len;
20 	/** Option block allocated length */
21 	size_t alloc_len;
22 	/** Reallocate option block raw data
23 	 *
24 	 * @v options		DHCP option block
25 	 * @v len		New length
26 	 * @ret rc		Return status code
27 	 */
28 	int ( * realloc ) ( struct dhcp_options *options, size_t len );
29 };
30 
31 extern int dhcpopt_applies ( unsigned int tag );
32 extern int dhcpopt_store ( struct dhcp_options *options, unsigned int tag,
33 			   const void *data, size_t len );
34 extern int dhcpopt_fetch ( struct dhcp_options *options, unsigned int tag,
35 			   void *data, size_t len );
36 extern void dhcpopt_init ( struct dhcp_options *options,
37 			   void *data, size_t alloc_len,
38 			   int ( * realloc ) ( struct dhcp_options *options,
39 					       size_t len ) );
40 extern void dhcpopt_update_used_len ( struct dhcp_options *options );
41 extern int dhcpopt_no_realloc ( struct dhcp_options *options, size_t len );
42 
43 #endif /* _IPXE_DHCPOPTS_H */
44