router: add extra syslog tracing
[project/odhcpd.git] / src / dhcpv6.h
index 08dac6c7282558b080124b2b923f28677e687f24..aaf919cc3bd0c0030cb5d8b2fe1ba5ce75430e0e 100644 (file)
  */
 #pragma once
 
-#include <libubox/ustream.h>
 #include "odhcpd.h"
 
-#define ALL_DHCPV6_RELAYS {{{0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
-               0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02}}}
+#define ALL_DHCPV6_RELAYS "ff02::1:2"
 
-#define ALL_DHCPV6_SERVERS {{{0xff, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
-               0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x03}}}
+#define ALL_DHCPV6_SERVERS "ff05::1:3"
 
 #define DHCPV6_CLIENT_PORT 546
 #define DHCPV6_SERVER_PORT 547
@@ -47,6 +44,7 @@
 #define DHCPV6_OPT_STATUS 13
 #define DHCPV6_OPT_RELAY_MSG 9
 #define DHCPV6_OPT_AUTH 11
+#define DHCPV6_OPT_RAPID_COMMIT 14
 #define DHCPV6_OPT_USER_CLASS 15
 #define DHCPV6_OPT_INTERFACE_ID 18
 #define DHCPV6_OPT_RECONF_MSG 19
@@ -140,35 +138,6 @@ struct dhcpv6_ia_addr {
        uint32_t valid;
 } _packed;
 
-struct dhcpv6_assignment {
-       struct list_head head;
-       struct interface *iface;
-
-       struct sockaddr_in6 peer;
-       time_t valid_until;
-
-       struct uloop_timeout reconf_timer;
-       bool accept_reconf;
-       int reconf_cnt;
-       uint8_t key[16];
-
-       char *hostname;
-       uint32_t assigned;
-       uint32_t iaid;
-       uint8_t mac[6];
-       uint8_t length; // length == 128 -> IA_NA, length <= 64 -> IA_PD
-
-       struct odhcpd_ipaddr *managed;
-       ssize_t managed_size;
-       struct ustream_fd managed_sock;
-
-       uint32_t leasetime;
-       unsigned int flags;
-
-       uint8_t clid_len;
-       uint8_t clid_data[];
-};
-
 struct dhcpv6_cer_id {
        uint16_t type;
        uint16_t len;
@@ -178,21 +147,8 @@ struct dhcpv6_cer_id {
        struct in6_addr addr;
 };
 
-typedef void (*dhcpv6_binding_cb_handler_t)(struct in6_addr *addr, int prefix,
-                                               uint32_t pref, uint32_t valid,
-                                               void *arg);
-
 #define dhcpv6_for_each_option(start, end, otype, olen, odata)\
        for (uint8_t *_o = (uint8_t*)(start); _o + 4 <= (end) &&\
                ((otype) = _o[0] << 8 | _o[1]) && ((odata) = (void*)&_o[4]) &&\
                ((olen) = _o[2] << 8 | _o[3]) + (odata) <= (end); \
                _o += 4 + (_o[2] << 8 | _o[3]))
-
-int dhcpv6_init_ia(struct interface *iface, int socket);
-ssize_t dhcpv6_handle_ia(uint8_t *buf, size_t buflen, struct interface *iface,
-               const struct sockaddr_in6 *addr, const void *data, const uint8_t *end);
-int dhcpv6_ia_init(void);
-int dhcpv6_setup_ia_interface(struct interface *iface, bool enable);
-void dhcpv6_enum_ia_addrs(struct interface *iface, struct dhcpv6_assignment *c, time_t now,
-                               dhcpv6_binding_cb_handler_t func, void *arg);
-void dhcpv6_write_statefile(void);