Functions to encode DNS packets.
More...
#include <freeradius-devel/io/test_point.h>
#include <freeradius-devel/util/dbuff.h>
#include <freeradius-devel/util/dns.h>
#include <freeradius-devel/util/proto.h>
#include <freeradius-devel/util/struct.h>
#include <freeradius-devel/util/encode.h>
#include "dns.h"
#include "attrs.h"
Go to the source code of this file.
|
static ssize_t | encode_child (fr_dbuff_t *dbuff, fr_da_stack_t *da_stack, unsigned int depth, fr_dcursor_t *cursor, void *encode_ctx) |
|
static ssize_t | encode_option_hdr (fr_dbuff_marker_t *m, uint16_t option, size_t data_len) |
| Macro-like function for encoding an option header. More...
|
|
static ssize_t | encode_record (fr_dbuff_t *dbuff, fr_da_stack_t *da_stack, fr_pair_list_t *vps, fr_dict_attr_t const *attr, fr_dns_ctx_t *packet_ctx, uint8_t *counter) |
|
static ssize_t | encode_rfc (fr_dbuff_t *dbuff, fr_da_stack_t *da_stack, unsigned int depth, fr_dcursor_t *cursor, void *encode_ctx) |
| Encode an RFC format TLV. More...
|
|
static int | encode_test_ctx (void **out, TALLOC_CTX *ctx) |
|
static ssize_t | encode_tlv (fr_dbuff_t *dbuff, fr_da_stack_t *da_stack, unsigned int depth, fr_dcursor_t *cursor, void *encode_ctx) |
|
static ssize_t | encode_value (fr_dbuff_t *dbuff, fr_da_stack_t *da_stack, unsigned int depth, fr_dcursor_t *cursor, void *encode_ctx) |
|
ssize_t | fr_dns_encode (fr_dbuff_t *dbuff, fr_pair_list_t *vps, fr_dns_ctx_t *packet_ctx) |
| Encode a DNS packet. More...
|
|
static ssize_t | fr_dns_encode_proto (UNUSED TALLOC_CTX *ctx, fr_pair_list_t *vps, uint8_t *data, size_t data_len, void *proto_ctx) |
|
static ssize_t | fr_dns_encode_rr (fr_dbuff_t *dbuff, fr_dcursor_t *cursor, void *encode_ctx) |
| Encode a Dns option and any sub-options. More...
|
|
Functions to encode DNS packets.
- Id
- 3acb03c834f7aa463a8b65296c1ddcbf65728f9e
- Author
- Alan DeKok (aland.nosp@m.@fre.nosp@m.eradi.nosp@m.us.o.nosp@m.rg)
- Copyright
- 2021 NetworkRADIUS SARL (legal.nosp@m.@net.nosp@m.workr.nosp@m.adiu.nosp@m.s.com)
Definition in file encode.c.
◆ DNS_OPT_HDR_LEN
◆ encode_child()
◆ encode_option_hdr()
Macro-like function for encoding an option header.
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | option-code | option-len | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
-
[out] | m | Where to write the 4 byte option header. |
[in] | option | The option number (host byte order). |
[in] | data_len | The length of the option (host byte order). |
- Returns
- <0 How much data would have been required as a negative value.
- 4 The length of data written.
Definition at line 70 of file encode.c.
◆ encode_record()
◆ encode_rfc()
Encode an RFC format TLV.
This could be a standard attribute, or a TLV data type. If it's a standard attribute, then vp->da->attr == attribute. Otherwise, attribute may be something else.
Definition at line 286 of file encode.c.
◆ encode_test_ctx()
static int encode_test_ctx |
( |
void ** |
out, |
|
|
TALLOC_CTX * |
ctx |
|
) |
| |
|
static |
◆ encode_tlv()
◆ encode_value()
◆ fr_dns_encode()
Encode a DNS packet.
Definition at line 451 of file encode.c.
◆ fr_dns_encode_proto()
◆ fr_dns_encode_rr()
Encode a Dns option and any sub-options.
- Parameters
-
[out] | dbuff | Where to write encoded DHCP attributes. |
[in] | cursor | with current VP set to the option to be encoded. Will be advanced to the next option to encode. |
[in] | encode_ctx | containing parameters for the encoder. |
- Returns
- > 0 length of data written.
- < 0 error.
Definition at line 379 of file encode.c.
◆ dns_tp_encode_pair
Initial value:= {
}
static ssize_t fr_dns_encode_rr(fr_dbuff_t *dbuff, fr_dcursor_t *cursor, void *encode_ctx)
Encode a Dns option and any sub-options.
static int encode_test_ctx(void **out, TALLOC_CTX *ctx)
Definition at line 553 of file encode.c.
◆ dns_tp_encode_proto
Initial value:= {
}
static ssize_t fr_dns_encode_proto(UNUSED TALLOC_CTX *ctx, fr_pair_list_t *vps, uint8_t *data, size_t data_len, void *proto_ctx)
Definition at line 559 of file encode.c.