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>
15 #include "sparse-endian.h"
17 typedef struct sd_dhcp6_option
{
25 extern const struct hash_ops dhcp6_option_hash_ops
;
27 /* Common option header */
28 typedef struct DHCP6Option
{
32 } _packed_ DHCP6Option
;
36 struct in6_addr address
;
37 be32_t lifetime_preferred
;
38 be32_t lifetime_valid
;
41 /* Prefix Delegation Prefix option */
43 be32_t lifetime_preferred
;
44 be32_t lifetime_valid
;
46 struct in6_addr address
;
49 typedef struct DHCP6Address DHCP6Address
;
52 LIST_FIELDS(DHCP6Address
, addresses
);
56 struct iapdprefix iapdprefix
;
60 /* Non-temporary Address option */
67 /* Prefix Delegation option */
74 /* Temporary Address option */
87 LIST_HEAD(DHCP6Address
, addresses
);
90 typedef struct DHCP6IA DHCP6IA
;
92 #define log_dhcp6_client_errno(p, error, fmt, ...) log_internal(LOG_DEBUG, error, PROJECT_FILE, __LINE__, __func__, "DHCPv6 CLIENT: " fmt, ##__VA_ARGS__)
93 #define log_dhcp6_client(p, fmt, ...) log_dhcp6_client_errno(p, 0, fmt, ##__VA_ARGS__)
95 int dhcp6_option_append(uint8_t **buf
, size_t *buflen
, uint16_t code
,
96 size_t optlen
, const void *optval
);
97 int dhcp6_option_append_ia(uint8_t **buf
, size_t *buflen
, const DHCP6IA
*ia
);
98 int dhcp6_option_append_pd(uint8_t *buf
, size_t len
, const DHCP6IA
*pd
, DHCP6Address
*hint_pd_prefix
);
99 int dhcp6_option_append_fqdn(uint8_t **buf
, size_t *buflen
, const char *fqdn
);
100 int dhcp6_option_append_user_class(uint8_t **buf
, size_t *buflen
, char **user_class
);
101 int dhcp6_option_append_vendor_class(uint8_t **buf
, size_t *buflen
, char **user_class
);
102 int dhcp6_option_parse(uint8_t **buf
, size_t *buflen
, uint16_t *optcode
,
103 size_t *optlen
, uint8_t **optvalue
);
104 int dhcp6_option_parse_status(DHCP6Option
*option
, size_t len
);
105 int dhcp6_option_parse_ia(DHCP6Option
*iaoption
, DHCP6IA
*ia
);
106 int dhcp6_option_parse_ip6addrs(uint8_t *optval
, uint16_t optlen
,
107 struct in6_addr
**addrs
, size_t count
,
109 int dhcp6_option_parse_domainname(const uint8_t *optval
, uint16_t optlen
,
112 int dhcp6_network_bind_udp_socket(int index
, struct in6_addr
*address
);
113 int dhcp6_network_send_udp_socket(int s
, struct in6_addr
*address
,
114 const void *packet
, size_t len
);
116 const char *dhcp6_message_type_to_string(int s
) _const_
;
117 int dhcp6_message_type_from_string(const char *s
) _pure_
;
118 const char *dhcp6_message_status_to_string(int s
) _const_
;
119 int dhcp6_message_status_from_string(const char *s
) _pure_
;