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 /* Common option header */
18 typedef struct DHCP6Option
{
22 } _packed_ DHCP6Option
;
26 struct in6_addr address
;
27 be32_t lifetime_preferred
;
28 be32_t lifetime_valid
;
31 /* Prefix Delegation Prefix option */
33 be32_t lifetime_preferred
;
34 be32_t lifetime_valid
;
36 struct in6_addr address
;
39 typedef struct DHCP6Address DHCP6Address
;
42 LIST_FIELDS(DHCP6Address
, addresses
);
46 struct iapdprefix iapdprefix
;
50 /* Non-temporary Address option */
57 /* Prefix Delegation option */
64 /* Temporary Address option */
77 LIST_HEAD(DHCP6Address
, addresses
);
80 typedef struct DHCP6IA DHCP6IA
;
82 #define log_dhcp6_client_errno(p, error, fmt, ...) log_internal(LOG_DEBUG, error, __FILE__, __LINE__, __func__, "DHCPv6 CLIENT: " fmt, ##__VA_ARGS__)
83 #define log_dhcp6_client(p, fmt, ...) log_dhcp6_client_errno(p, 0, fmt, ##__VA_ARGS__)
85 int dhcp6_option_append(uint8_t **buf
, size_t *buflen
, uint16_t code
,
86 size_t optlen
, const void *optval
);
87 int dhcp6_option_append_ia(uint8_t **buf
, size_t *buflen
, DHCP6IA
*ia
);
88 int dhcp6_option_append_pd(uint8_t *buf
, size_t len
, DHCP6IA
*pd
);
89 int dhcp6_option_append_fqdn(uint8_t **buf
, size_t *buflen
, const char *fqdn
);
90 int dhcp6_option_parse(uint8_t **buf
, size_t *buflen
, uint16_t *optcode
,
91 size_t *optlen
, uint8_t **optvalue
);
92 int dhcp6_option_parse_status(DHCP6Option
*option
);
93 int dhcp6_option_parse_ia(DHCP6Option
*iaoption
, DHCP6IA
*ia
);
94 int dhcp6_option_parse_ip6addrs(uint8_t *optval
, uint16_t optlen
,
95 struct in6_addr
**addrs
, size_t count
,
97 int dhcp6_option_parse_domainname(const uint8_t *optval
, uint16_t optlen
,
100 int dhcp6_network_bind_udp_socket(int index
, struct in6_addr
*address
);
101 int dhcp6_network_send_udp_socket(int s
, struct in6_addr
*address
,
102 const void *packet
, size_t len
);
104 const char *dhcp6_message_type_to_string(int s
) _const_
;
105 int dhcp6_message_type_from_string(const char *s
) _pure_
;
106 const char *dhcp6_message_status_to_string(int s
) _const_
;
107 int dhcp6_message_status_from_string(const char *s
) _pure_
;