![]() |
The FreeRADIUS server $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
|
Functions to manipulate DNS labels. More...
Go to the source code of this file.
Data Structures | |
| struct | fr_dns_block_t |
| struct | fr_dns_labels_t |
Functions | |
| ssize_t | fr_dns_label_from_value_box (size_t *need, uint8_t *buf, size_t buflen, uint8_t *where, bool compression, fr_value_box_t const *value, fr_dns_labels_t *lb) |
| Encode a single value box of type string, serializing its contents to a dns label. | |
| ssize_t | fr_dns_label_from_value_box_dbuff (fr_dbuff_t *dbuff, bool compression, fr_value_box_t const *value, fr_dns_labels_t *lb) |
| Encode a single value box of type string, serializing its contents to a dns label in a dbuff. | |
| ssize_t | fr_dns_label_to_value_box (TALLOC_CTX *ctx, fr_value_box_t *dst, uint8_t const *src, size_t len, uint8_t const *label, bool tainted, fr_dns_labels_t *lb) |
| Decode a fr_value_box_t from one DNS label. | |
| ssize_t | fr_dns_label_uncompressed_length (uint8_t const *packet, uint8_t const *buf, size_t buf_len, uint8_t const **p_label, fr_dns_labels_t *lb) |
| Get the uncompressed length of a DNS label in a network buffer. | |
| ssize_t | fr_dns_labels_network_verify (uint8_t const *packet, uint8_t const *buf, size_t buf_len, uint8_t const *start, fr_dns_labels_t *lb)) |
| Verify that a network buffer contains valid DNS labels. | |
Functions to manipulate DNS labels.
Definition in file dns.h.
| struct fr_dns_labels_t |
Collaboration diagram for fr_dns_labels_t:| Data Fields | ||
|---|---|---|
| fr_dns_block_t * | blocks |
maximum number of labels array holding "max" labels |
| uint8_t const * | end | end of the packet |
| uint8_t * | mark | markup buffer used for decoding. |
| int | max | |
| int | num | number of used labels |
| uint8_t const * | start | start of packet |
| ssize_t fr_dns_label_from_value_box | ( | size_t * | need, |
| uint8_t * | buf, | ||
| size_t | buf_len, | ||
| uint8_t * | where, | ||
| bool | compression, | ||
| fr_value_box_t const * | value, | ||
| fr_dns_labels_t * | lb | ||
| ) |
Encode a single value box of type string, serializing its contents to a dns label.
This functions takes a large buffer and encodes the label in part of the buffer. This API is necessary in order to allow DNS label compression.
| [out] | need | if not NULL, how long "buf_len" should be to serialize the rest of the data. Note: Only variable length types will be partially encoded. Fixed length types will not be partially encoded. |
| [out] | buf | Buffer where labels are stored |
| [in] | buf_len | The length of the output buffer |
| [out] | where | Where to write this label |
| [in] | compression | Whether or not to do DNS label compression. |
| [in] | value | to encode. |
| [in] | lb | label tracking data structure |
Definition at line 639 of file dns.c.
Here is the call graph for this function:
Here is the caller graph for this function:| ssize_t fr_dns_label_from_value_box_dbuff | ( | fr_dbuff_t * | dbuff, |
| bool | compression, | ||
| fr_value_box_t const * | value, | ||
| fr_dns_labels_t * | lb | ||
| ) |
Encode a single value box of type string, serializing its contents to a dns label in a dbuff.
| [in] | dbuff | Buffer where labels are written |
| [in] | compression | Whether or not to do DNS label compression. |
| [in] | value | to encode. |
| [in] | lb | label tracking data structure. |
Definition at line 604 of file dns.c.
Here is the call graph for this function:
Here is the caller graph for this function:| ssize_t fr_dns_label_to_value_box | ( | TALLOC_CTX * | ctx, |
| fr_value_box_t * | dst, | ||
| uint8_t const * | src, | ||
| size_t | len, | ||
| uint8_t const * | label, | ||
| bool | tainted, | ||
| fr_dns_labels_t * | lb | ||
| ) |
Decode a fr_value_box_t from one DNS label.
The output type is always FR_TYPE_STRING
Note that the caller MUST call fr_dns_labels_network_verify(src, len, start) before calling this function. Otherwise bad things will happen.
| [in] | ctx | Where to allocate any talloc buffers required. |
| [out] | dst | value_box to write the result to. |
| [in] | src | Start of the buffer containing DNS labels |
| [in] | len | Length of the buffer to decode |
| [in] | label | This particular label |
| [in] | tainted | Whether the value came from a trusted source. |
| [in] | lb | label tracking data structure |
Definition at line 1225 of file dns.c.
Here is the call graph for this function:
Here is the caller graph for this function:| ssize_t fr_dns_label_uncompressed_length | ( | uint8_t const * | packet, |
| uint8_t const * | buf, | ||
| size_t | buf_len, | ||
| uint8_t const ** | next, | ||
| fr_dns_labels_t * | lb | ||
| ) |
Get the uncompressed length of a DNS label in a network buffer.
i.e. how bytes are required to store the uncompressed version of the label.
Note that a bare 0x00 byte has length 1, to account for '.'
| [in] | packet | where the packet starts |
| [in] | buf | buffer holding one or more DNS labels |
| [in] | buf_len | total length of the buffer |
| [in,out] | next | the DNS label to check, updated to point to the next label |
| [in] | lb | label tracking data structure |
Definition at line 884 of file dns.c.
Here is the call graph for this function:
Here is the caller graph for this function:| ssize_t fr_dns_labels_network_verify | ( | uint8_t const * | packet, |
| uint8_t const * | buf, | ||
| size_t | buf_len, | ||
| uint8_t const * | start, | ||
| fr_dns_labels_t * | lb | ||
| ) |
Verify that a network buffer contains valid DNS labels.
| [in] | packet | where the packet starts |
| [in] | buf | buffer holding one or more DNS labels |
| [in] | buf_len | total length of the buffer |
| [in] | start | where to start looking |
| [in] | lb | label tracking data structure |
Definition at line 1137 of file dns.c.
Here is the call graph for this function:
Here is the caller graph for this function:
1.9.8