Go to the source code of this file.
Macros | |
#define | LDNS_OPTIONLIST_INIT 8 |
Functions | |
size_t | ldns_edns_get_size (const ldns_edns_option *edns) |
returns the size of the EDNS data. More... | |
ldns_edns_option_code | ldns_edns_get_code (const ldns_edns_option *edns) |
returns the option code of the EDNS data. More... | |
uint8_t * | ldns_edns_get_data (const ldns_edns_option *edns) |
returns the EDNS option data. More... | |
ldns_buffer * | ldns_edns_get_wireformat_buffer (const ldns_edns_option *edns) |
serialise the EDNS option into wireformat. More... | |
void | ldns_edns_set_size (ldns_edns_option *edns, size_t size) |
void | ldns_edns_set_code (ldns_edns_option *edns, ldns_edns_option_code code) |
void | ldns_edns_set_data (ldns_edns_option *edns, void *data) |
ldns_edns_option * | ldns_edns_new (ldns_edns_option_code code, size_t size, void *data) |
allocates a new EDNS structure and fills it. More... | |
ldns_edns_option * | ldns_edns_new_from_data (ldns_edns_option_code code, size_t size, const void *data) |
allocates a new EDNS structure and fills it. More... | |
ldns_edns_option * | ldns_edns_clone (ldns_edns_option *edns) |
clone an EDNS option More... | |
void | ldns_edns_deep_free (ldns_edns_option *edns) |
free the EDNS option. More... | |
void | ldns_edns_free (ldns_edns_option *edns) |
ldns_edns_option_list * | ldns_edns_option_list_new () |
allocates space for a new list of EDNS options More... | |
ldns_edns_option_list * | ldns_edns_option_list_clone (ldns_edns_option_list *old_list) |
clone the EDNS options list and it's contents More... | |
void | ldns_edns_option_list_free (ldns_edns_option_list *option_list) |
free the EDNS option list. More... | |
void | ldns_edns_option_list_deep_free (ldns_edns_option_list *option_list) |
size_t | ldns_edns_option_list_get_count (const ldns_edns_option_list *option_list) |
returns the number of options in the EDNS options list. More... | |
ldns_edns_option * | ldns_edns_option_list_get_option (const ldns_edns_option_list *option_list, size_t index) |
returns the EDNS option as the specified index in the list of EDNS options. More... | |
size_t | ldns_edns_option_list_get_options_size (const ldns_edns_option_list *option_list) |
returns the total size of all the individual EDNS options in the EDNS list. More... | |
ldns_edns_option * | ldns_edns_option_list_set_option (ldns_edns_option_list *option_list, ldns_edns_option *option, size_t index) |
adds an EDNS option to the list of options at the specified index. More... | |
bool | ldns_edns_option_list_push (ldns_edns_option_list *option_list, ldns_edns_option *option) |
adds an EDNS option at the end of the list of options. More... | |
ldns_edns_option * | ldns_edns_option_list_pop (ldns_edns_option_list *option_list) |
removes and returns the EDNS option at the end of the list of options. More... | |
ldns_buffer * | ldns_edns_option_list2wireformat_buffer (const ldns_edns_option_list *option_list) |
serializes all the EDNS options into a single wireformat buffer More... | |
size_t ldns_edns_get_size | ( | const ldns_edns_option * | edns | ) |
returns the size of the EDNS data.
[in] | *edns | the EDNS struct to read from |
Definition at line 24 of file edns.c.
References ldns_struct_edns_option::_size.
ldns_edns_option_code ldns_edns_get_code | ( | const ldns_edns_option * | edns | ) |
returns the option code of the EDNS data.
[in] | *edns | the EDNS struct to read from |
Definition at line 31 of file edns.c.
References ldns_struct_edns_option::_code.
uint8_t* ldns_edns_get_data | ( | const ldns_edns_option * | edns | ) |
returns the EDNS option data.
[in] | *edns | the EDNS option to read from |
Definition at line 38 of file edns.c.
References ldns_struct_edns_option::_data.
ldns_buffer* ldns_edns_get_wireformat_buffer | ( | const ldns_edns_option * | edns | ) |
serialise the EDNS option into wireformat.
[in] | *edns | the EDNS option to read from |
Definition at line 45 of file edns.c.
References ldns_buffer_new(), ldns_edns_get_code(), ldns_edns_get_data(), and ldns_edns_get_size().
void ldns_edns_set_size | ( | ldns_edns_option * | edns, |
size_t | size | ||
) |
Definition at line 77 of file edns.c.
References ldns_struct_edns_option::_size.
void ldns_edns_set_code | ( | ldns_edns_option * | edns, |
ldns_edns_option_code | code | ||
) |
Definition at line 84 of file edns.c.
References ldns_struct_edns_option::_code.
void ldns_edns_set_data | ( | ldns_edns_option * | edns, |
void * | data | ||
) |
Definition at line 91 of file edns.c.
References ldns_struct_edns_option::_data.
ldns_edns_option* ldns_edns_new | ( | ldns_edns_option_code | code, |
size_t | size, | ||
void * | data | ||
) |
allocates a new EDNS structure and fills it.
This function DOES NOT copy the contents from the data parameter.
[in] | code | the EDNS code |
[in] | size | size of the buffer |
[in] | data | pointer to the buffer to be assigned |
Definition at line 100 of file edns.c.
References ldns_edns_set_code(), ldns_edns_set_data(), ldns_edns_set_size(), and LDNS_MALLOC.
ldns_edns_option* ldns_edns_new_from_data | ( | ldns_edns_option_code | code, |
size_t | size, | ||
const void * | data | ||
) |
allocates a new EDNS structure and fills it.
This function DOES copy the contents from the data parameter.
[in] | code | the EDNS code |
[in] | size | size of the buffer |
[in] | data | pointer to the buffer to be assigned |
Definition at line 115 of file edns.c.
References ldns_struct_edns_option::_data, ldns_edns_set_code(), ldns_edns_set_size(), LDNS_FREE, LDNS_MALLOC, and LDNS_XMALLOC.
ldns_edns_option* ldns_edns_clone | ( | ldns_edns_option * | edns | ) |
clone an EDNS option
[in] | edns | the EDNS option |
Definition at line 137 of file edns.c.
References ldns_edns_get_code(), ldns_edns_get_data(), ldns_edns_get_size(), and ldns_edns_new_from_data().
void ldns_edns_deep_free | ( | ldns_edns_option * | edns | ) |
free the EDNS option.
Use deep_free if the _data member is allocated.
[in] | edns | the EDNS option to free |
Definition at line 151 of file edns.c.
References ldns_struct_edns_option::_data, and LDNS_FREE.
void ldns_edns_free | ( | ldns_edns_option * | edns | ) |
ldns_edns_option_list* ldns_edns_option_list_new | ( | void | ) |
allocates space for a new list of EDNS options
Definition at line 170 of file edns.c.
References ldns_struct_edns_option_list::_option_capacity, ldns_struct_edns_option_list::_option_count, ldns_struct_edns_option_list::_options, ldns_struct_edns_option_list::_options_size, and LDNS_MALLOC.
ldns_edns_option_list* ldns_edns_option_list_clone | ( | ldns_edns_option_list * | options_list | ) |
clone the EDNS options list and it's contents
[in] | options_list | the EDNS options_list to read from |
Definition at line 185 of file edns.c.
References ldns_struct_edns_option_list::_option_count, ldns_edns_clone(), ldns_edns_deep_free(), ldns_edns_option_list_deep_free(), ldns_edns_option_list_get_option(), ldns_edns_option_list_new(), and ldns_edns_option_list_push().
void ldns_edns_option_list_free | ( | ldns_edns_option_list * | options_list | ) |
free the EDNS option list.
Use deep_free to free the options options in the list as well.
[in] | options_list | the EDNS option to free |
Definition at line 216 of file edns.c.
References ldns_struct_edns_option_list::_options, and LDNS_FREE.
void ldns_edns_option_list_deep_free | ( | ldns_edns_option_list * | option_list | ) |
Definition at line 225 of file edns.c.
References ldns_edns_deep_free(), ldns_edns_option_list_free(), ldns_edns_option_list_get_count(), and ldns_edns_option_list_get_option().
size_t ldns_edns_option_list_get_count | ( | const ldns_edns_option_list * | options_list | ) |
returns the number of options in the EDNS options list.
[in] | options_list | the EDNS options_list to read from |
Definition at line 238 of file edns.c.
References ldns_struct_edns_option_list::_option_count.
ldns_edns_option* ldns_edns_option_list_get_option | ( | const ldns_edns_option_list * | options_list, |
size_t | index | ||
) |
returns the EDNS option as the specified index in the list of EDNS options.
[in] | options_list | the EDNS options_list to read from |
[in] | index | the location of the EDNS option to get in the list |
Definition at line 248 of file edns.c.
References ldns_struct_edns_option_list::_options, and ldns_edns_option_list_get_count().
size_t ldns_edns_option_list_get_options_size | ( | const ldns_edns_option_list * | options_list | ) |
returns the total size of all the individual EDNS options in the EDNS list.
[in] | options_list | the EDNS options_list to read from |
Definition at line 259 of file edns.c.
References ldns_struct_edns_option_list::_options_size.
ldns_edns_option* ldns_edns_option_list_set_option | ( | ldns_edns_option_list * | options_list, |
ldns_edns_option * | option, | ||
size_t | index | ||
) |
adds an EDNS option to the list of options at the specified index.
Also returns the option that was previously at that index.
[in] | options_list | the EDNS options_list to add to |
[in] | option | the EDNS option to add to the list |
[in] | index | the index in the list where to set the option |
Definition at line 270 of file edns.c.
References ldns_struct_edns_option_list::_options, ldns_struct_edns_option_list::_options_size, ldns_edns_get_size(), ldns_edns_option_list_get_count(), and ldns_edns_option_list_get_option().
bool ldns_edns_option_list_push | ( | ldns_edns_option_list * | options_list, |
ldns_edns_option * | option | ||
) |
adds an EDNS option at the end of the list of options.
[in] | options_list | the EDNS options_list to add to |
[in] | option | the (non-NULL) EDNS option to add to the list |
Definition at line 299 of file edns.c.
References ldns_struct_edns_option_list::_option_capacity, ldns_struct_edns_option_list::_option_count, ldns_struct_edns_option_list::_options, ldns_edns_option_list_get_count(), ldns_edns_option_list_set_option(), LDNS_OPTIONLIST_INIT, and LDNS_XREALLOC.
ldns_edns_option* ldns_edns_option_list_pop | ( | ldns_edns_option_list * | options_list | ) |
removes and returns the EDNS option at the end of the list of options.
[in] | options_list | the EDNS options_list to add to |
Definition at line 345 of file edns.c.
References ldns_struct_edns_option_list::_option_capacity, ldns_struct_edns_option_list::_option_count, ldns_struct_edns_option_list::_options, ldns_struct_edns_option_list::_options_size, ldns_edns_get_size(), ldns_edns_option_list_get_count(), ldns_edns_option_list_get_option(), LDNS_OPTIONLIST_INIT, and LDNS_XREALLOC.
ldns_buffer* ldns_edns_option_list2wireformat_buffer | ( | const ldns_edns_option_list * | option_list | ) |
serializes all the EDNS options into a single wireformat buffer
[in] | option_list | the EDNS options_list to combine into one wireformat |
Definition at line 387 of file edns.c.
References ldns_buffer_new(), ldns_edns_get_code(), ldns_edns_get_data(), ldns_edns_get_size(), ldns_edns_option_list_get_count(), ldns_edns_option_list_get_option(), and ldns_edns_option_list_get_options_size().