iPXE
dhcpopts.h
Go to the documentation of this file.
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 */
int dhcpopt_fetch(struct dhcp_options *options, unsigned int tag, void *data, size_t len)
Fetch value of DHCP option setting.
Definition: dhcpopts.c:393
int(* realloc)(struct dhcp_options *options, size_t len)
Reallocate option block raw data.
Definition: dhcpopts.h:28
void dhcpopt_init(struct dhcp_options *options, void *data, size_t alloc_len, int(*realloc)(struct dhcp_options *options, size_t len))
Initialise prepopulated block of DHCP options.
Definition: dhcpopts.c:451
size_t alloc_len
Option block allocated length.
Definition: dhcpopts.h:21
void dhcpopt_update_used_len(struct dhcp_options *options)
Recalculate length of DHCP options block.
Definition: dhcpopts.c:420
int dhcpopt_store(struct dhcp_options *options, unsigned int tag, const void *data, size_t len)
Store value of DHCP option setting.
Definition: dhcpopts.c:374
static int options
Definition: 3c515.c:286
int dhcpopt_no_realloc(struct dhcp_options *options, size_t len)
Refuse to reallocate DHCP option block.
Definition: dhcpopts.c:184
int dhcpopt_applies(unsigned int tag)
Check applicability of DHCP option setting.
Definition: dhcpopts.c:359
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
uint32_t len
Length.
Definition: ena.h:14
void * data
Option block raw data.
Definition: dhcpopts.h:17
uint8_t data[48]
Additional event data.
Definition: ena.h:22
void * realloc(void *old_ptr, size_t new_size)
Reallocate memory.
Definition: malloc.c:521
uint64_t tag
Identity tag.
Definition: edd.h:30
size_t used_len
Option block used length.
Definition: dhcpopts.h:19
A DHCP options block.
Definition: dhcpopts.h:15