Functions to encode DHCP options.
More...
#include <stdint.h>
#include <stddef.h>
#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 "dhcpv6.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_relay_message (fr_dbuff_t *dbuff, fr_da_stack_t *da_stack, unsigned int depth, fr_dcursor_t *cursor, UNUSED void *encode_ctx) |
| Encode a Relay-Message. More...
|
|
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) |
|
static ssize_t | encode_vsio (fr_dbuff_t *dbuff, fr_da_stack_t *da_stack, unsigned int depth, fr_dcursor_t *cursor, void *encode_ctx) |
| Encode a Vendor-Specific Information Option. More...
|
|
ssize_t | fr_dhcpv6_encode_foreign (fr_dbuff_t *dbuff, fr_pair_list_t const *list) |
|
ssize_t | fr_dhcpv6_encode_option (fr_dbuff_t *dbuff, fr_dcursor_t *cursor, void *encode_ctx) |
| Encode a DHCPv6 option and any sub-options. More...
|
|
static ssize_t | fr_dhcpv6_encode_proto (UNUSED TALLOC_CTX *ctx, fr_pair_list_t *vps, uint8_t *data, size_t data_len, UNUSED void *proto_ctx) |
|
Functions to encode DHCP options.
- Id
- c78dd365d22d6a42b65ac26c007fe230372df3dc
- Author
- Arran Cudbard-Bell (a.cud.nosp@m.bard.nosp@m.b@fre.nosp@m.erad.nosp@m.ius.o.nosp@m.rg)
- Copyright
- 2018 The freeradius server project
-
2018 NetworkRADIUS SARL (legal.nosp@m.@net.nosp@m.workr.nosp@m.adiu.nosp@m.s.com)
Definition in file encode.c.
◆ 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 71 of file encode.c.
◆ encode_relay_message()
Encode a Relay-Message.
Header + stuff
Definition at line 615 of file encode.c.
◆ 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 446 of file encode.c.
◆ encode_test_ctx()
static int encode_test_ctx |
( |
void ** |
out, |
|
|
TALLOC_CTX * |
ctx |
|
) |
| |
|
static |
◆ encode_tlv()
◆ encode_value()
◆ encode_vsio()
Encode a Vendor-Specific Information Option.
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_VENDOR_OPTS | option-len | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | enterprise-number | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ . . . option-data . . . +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Definition at line 540 of file encode.c.
◆ fr_dhcpv6_encode_foreign()
◆ fr_dhcpv6_encode_option()
Encode a DHCPv6 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 670 of file encode.c.
◆ fr_dhcpv6_encode_proto()
◆ dhcpv6_tp_encode_pair
Initial value:= {
}
void * fr_dhcpv6_next_encodable(fr_dlist_head_t *list, void *current, void *uctx)
DHCPV6-specific iterator.
ssize_t fr_dhcpv6_encode_option(fr_dbuff_t *dbuff, fr_dcursor_t *cursor, void *encode_ctx)
Encode a DHCPv6 option and any sub-options.
static int encode_test_ctx(void **out, TALLOC_CTX *ctx)
Definition at line 778 of file encode.c.
◆ dhcpv6_tp_encode_proto
Initial value:= {
}
static ssize_t fr_dhcpv6_encode_proto(UNUSED TALLOC_CTX *ctx, fr_pair_list_t *vps, uint8_t *data, size_t data_len, UNUSED void *proto_ctx)
Definition at line 785 of file encode.c.