1 /* SPDX-License-Identifier: LGPL-2.1+ */
5 Copyright © 2014-2015 Intel Corporation. All rights reserved.
8 #include <net/ethernet.h>
9 #include <netinet/in.h>
16 #include "sparse-endian.h"
18 typedef struct sd_dhcp6_option
{
21 uint32_t enterprise_identifier
;
27 extern const struct hash_ops dhcp6_option_hash_ops
;
29 /* Common option header */
30 typedef struct DHCP6Option
{
34 } _packed_ DHCP6Option
;
38 struct in6_addr address
;
39 be32_t lifetime_preferred
;
40 be32_t lifetime_valid
;
43 /* Prefix Delegation Prefix option */
45 be32_t lifetime_preferred
;
46 be32_t lifetime_valid
;
48 struct in6_addr address
;
51 typedef struct DHCP6Address DHCP6Address
;
54 LIST_FIELDS(DHCP6Address
, addresses
);
58 struct iapdprefix iapdprefix
;
62 /* Non-temporary Address option */
69 /* Prefix Delegation option */
76 /* Temporary Address option */
89 LIST_HEAD(DHCP6Address
, addresses
);
92 typedef struct DHCP6IA DHCP6IA
;
94 #define log_dhcp6_client_errno(p, error, fmt, ...) log_internal(LOG_DEBUG, error, PROJECT_FILE, __LINE__, __func__, "DHCPv6 CLIENT: " fmt, ##__VA_ARGS__)
95 #define log_dhcp6_client(p, fmt, ...) log_dhcp6_client_errno(p, 0, fmt, ##__VA_ARGS__)
97 int dhcp6_option_append(uint8_t **buf
, size_t *buflen
, uint16_t code
,
98 size_t optlen
, const void *optval
);
99 int dhcp6_option_append_ia(uint8_t **buf
, size_t *buflen
, const DHCP6IA
*ia
);
100 int dhcp6_option_append_pd(uint8_t *buf
, size_t len
, const DHCP6IA
*pd
, DHCP6Address
*hint_pd_prefix
);
101 int dhcp6_option_append_fqdn(uint8_t **buf
, size_t *buflen
, const char *fqdn
);
102 int dhcp6_option_append_user_class(uint8_t **buf
, size_t *buflen
, char **user_class
);
103 int dhcp6_option_append_vendor_class(uint8_t **buf
, size_t *buflen
, char **user_class
);
104 int dhcp6_option_append_vendor_option(uint8_t **buf
, size_t *buflen
, OrderedHashmap
*vendor_options
);
105 int dhcp6_option_parse(uint8_t **buf
, size_t *buflen
, uint16_t *optcode
,
106 size_t *optlen
, uint8_t **optvalue
);
107 int dhcp6_option_parse_status(DHCP6Option
*option
, size_t len
);
108 int dhcp6_option_parse_ia(DHCP6Option
*iaoption
, DHCP6IA
*ia
, uint16_t *ret_status_code
);
109 int dhcp6_option_parse_ip6addrs(uint8_t *optval
, uint16_t optlen
,
110 struct in6_addr
**addrs
, size_t count
,
112 int dhcp6_option_parse_domainname(const uint8_t *optval
, uint16_t optlen
,
115 int dhcp6_network_bind_udp_socket(int ifindex
, struct in6_addr
*address
);
116 int dhcp6_network_send_udp_socket(int s
, struct in6_addr
*address
,
117 const void *packet
, size_t len
);
119 const char *dhcp6_message_type_to_string(int s
) _const_
;
120 int dhcp6_message_type_from_string(const char *s
) _pure_
;
121 const char *dhcp6_message_status_to_string(int s
) _const_
;
122 int dhcp6_message_status_from_string(const char *s
) _pure_
;