#include <stdint.h>
Go to the source code of this file.
Data Structures | |
| struct | dhcp_options |
| A DHCP options block. More... | |
Functions | |
| FILE_LICENCE (GPL2_OR_LATER) | |
| int | dhcpopt_store (struct dhcp_options *options, unsigned int tag, const void *data, size_t len) |
| Store value of DHCP option setting. | |
| int | dhcpopt_extensible_store (struct dhcp_options *options, unsigned int tag, const void *data, size_t len) |
| Store value of DHCP option setting, extending options block if necessary. | |
| int | dhcpopt_fetch (struct dhcp_options *options, unsigned int tag, void *data, size_t len) |
| Fetch value of DHCP option setting. | |
| void | dhcpopt_init (struct dhcp_options *options, void *data, size_t max_len) |
| Initialise prepopulated block of DHCP options. | |
Definition in file dhcpopts.h.
| FILE_LICENCE | ( | GPL2_OR_LATER | ) |
| int dhcpopt_store | ( | struct dhcp_options * | options, | |
| unsigned int | tag, | |||
| const void * | data, | |||
| size_t | len | |||
| ) |
Store value of DHCP option setting.
| options | DHCP option block | |
| tag | Setting tag number | |
| data | Setting data, or NULL to clear setting | |
| len | Length of setting data |
| rc | Return status code |
Definition at line 340 of file dhcpopts.c.
References offset, and set_dhcp_option().
Referenced by dhcppkt_store(), and nvo_store().
00341 { 00342 int offset; 00343 00344 offset = set_dhcp_option ( options, tag, data, len, 0 ); 00345 if ( offset < 0 ) 00346 return offset; 00347 return 0; 00348 }
| int dhcpopt_extensible_store | ( | struct dhcp_options * | options, | |
| unsigned int | tag, | |||
| const void * | data, | |||
| size_t | len | |||
| ) |
Store value of DHCP option setting, extending options block if necessary.
| options | DHCP option block | |
| tag | Setting tag number | |
| data | Setting data, or NULL to clear setting | |
| len | Length of setting data |
| rc | Return status code |
Definition at line 359 of file dhcpopts.c.
References offset, and set_dhcp_option().
00360 { 00361 int offset; 00362 00363 offset = set_dhcp_option ( options, tag, data, len, 1 ); 00364 if ( offset < 0 ) 00365 return offset; 00366 return 0; 00367 }
| int dhcpopt_fetch | ( | struct dhcp_options * | options, | |
| unsigned int | tag, | |||
| void * | data, | |||
| size_t | len | |||
| ) |
Fetch value of DHCP option setting.
| options | DHCP option block | |
| tag | Setting tag number | |
| data | Buffer to fill with setting data | |
| len | Length of buffer |
| len | Length of setting data, or negative error |
Definition at line 378 of file dhcpopts.c.
References dhcp_option::data, dhcp_option(), find_dhcp_option_with_encap(), dhcp_option::len, memcpy, NULL, and offset.
Referenced by dhcppkt_fetch(), and nvo_fetch().
00379 { 00380 int offset; 00381 struct dhcp_option *option; 00382 size_t option_len; 00383 00384 offset = find_dhcp_option_with_encap ( options, tag, NULL ); 00385 if ( offset < 0 ) 00386 return offset; 00387 00388 option = dhcp_option ( options, offset ); 00389 option_len = option->len; 00390 if ( len > option_len ) 00391 len = option_len; 00392 memcpy ( data, option->data, len ); 00393 00394 return option_len; 00395 }
| void dhcpopt_init | ( | struct dhcp_options * | options, | |
| void * | data, | |||
| size_t | max_len | |||
| ) |
Initialise prepopulated block of DHCP options.
| options | Uninitialised DHCP option block | |
| data | Memory for DHCP option data | |
| max_len | Length of memory for DHCP option data |
Definition at line 435 of file dhcpopts.c.
References dhcp_options::data, DBGC, dhcpopt_update_len(), dhcp_options::len, and dhcp_options::max_len.
Referenced by dhcppkt_init(), and nvo_init_dhcpopts().
00436 { 00437 00438 /* Fill in fields */ 00439 options->data = data; 00440 options->max_len = max_len; 00441 00442 /* Update length */ 00443 dhcpopt_update_len ( options ); 00444 00445 DBGC ( options, "DHCPOPT %p created (data %p len %#zx max_len %#zx)\n", 00446 options, options->data, options->len, options->max_len ); 00447 }
1.5.7.1