]> git.decadent.org.uk Git - odhcp6c.git/blobdiff - src/odhcp6c.h
Export AFTR-IP as well and update README
[odhcp6c.git] / src / odhcp6c.h
index 04a32ecf8a26a7cf2328ced475e1759e2552cfec..b0a198046df6c48c06115b18d8cf5191af85dc16 100644 (file)
@@ -1,5 +1,5 @@
 /**
- * Copyright (C) 2012 Steven Barth <steven@midlink.org>
+ * Copyright (C) 2012-2013 Steven Barth <steven@midlink.org>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License v2 as published by
@@ -51,6 +51,8 @@ enum dhcvp6_opt {
        DHCPV6_OPT_NTP_SERVER = 56,
        DHCPV6_OPT_SIP_SERVER_D = 21,
        DHCPV6_OPT_SIP_SERVER_A = 22,
+       DHCPV6_OPT_AFTR_NAME = 64,
+       DHCPV6_OPT_PD_EXCLUDE = 67,
 };
 
 enum dhcpv6_opt_npt {
@@ -80,7 +82,7 @@ enum dhcpv6_status {
 };
 
 typedef int(reply_handler)(enum dhcpv6_msg orig,
-               const void *opt, const void *end, uint32_t elapsed);
+               const void *opt, const void *end);
 
 // retransmission strategy
 struct dhcpv6_retx {
@@ -89,7 +91,7 @@ struct dhcpv6_retx {
        uint16_t max_timeo;
        char name[8];
        reply_handler *handler_reply;
-       int(*handler_finish)(uint32_t elapsed);
+       int(*handler_finish)(void);
 };
 
 
@@ -131,6 +133,17 @@ struct dhcpv6_duid {
        uint8_t data[128];
 } _packed;
 
+struct dhcpv6_auth_reconfigure {
+       uint16_t type;
+       uint16_t len;
+       uint8_t protocol;
+       uint8_t algorithm;
+       uint8_t rdm;
+       uint64_t replay;
+       uint8_t reconf_type;
+       uint8_t key[16];
+} _packed;
+
 
 #define dhcpv6_for_each_option(start, end, otype, olen, odata)\
        for (uint8_t *_o = (uint8_t*)(start); _o + 4 <= (uint8_t*)(end) &&\
@@ -162,6 +175,10 @@ enum odhcp6c_state {
        STATE_SNTP_FQDN,
        STATE_SIP_IP,
        STATE_SIP_FQDN,
+       STATE_RA_ROUTE,
+       STATE_RA_PREFIX,
+       STATE_RA_DNS,
+       STATE_AFTR_NAME,
        _STATE_MAX
 };
 
@@ -187,27 +204,43 @@ enum odhcp6c_ia_mode {
 };
 
 
+struct odhcp6c_entry {
+       struct in6_addr router;
+       uint16_t length;
+       int16_t priority;
+       struct in6_addr target;
+       uint32_t valid;
+       uint32_t preferred;
+};
+
+
 int init_dhcpv6(const char *ifname, int request_pd);
 void dhcpv6_set_ia_na_mode(enum odhcp6c_ia_mode mode);
 int dhcpv6_request(enum dhcpv6_msg type);
 int dhcpv6_poll_reconfigure(void);
-void dhcpv6_remove_addrs(void);
 
 int init_rtnetlink(void);
 int set_rtnetlink_addr(int ifindex, const struct in6_addr *addr,
-               time_t pref, time_t valid);
+               uint32_t pref, uint32_t valid);
 
 int script_init(const char *path, const char *ifname);
 ssize_t script_unhexlify(uint8_t *dst, size_t len, const char *src);
 void script_call(const char *status);
+void script_delay_call(const char *status, int timeout);
 
+bool odhcp6c_signal_process(void);
+uint64_t odhcp6c_get_milli_time(void);
+void odhcp6c_random(void *buf, size_t len);
 
 // State manipulation
-bool odhcp6c_signal_is_pending(void);
-uint64_t odhcp6c_get_milli_time(void);
 void odhcp6c_clear_state(enum odhcp6c_state state);
 void odhcp6c_add_state(enum odhcp6c_state state, const void *data, size_t len);
 size_t odhcp6c_remove_state(enum odhcp6c_state state, size_t offset, size_t len);
-bool odhcp6c_commit_state(enum odhcp6c_state state, size_t old_len);
 void* odhcp6c_get_state(enum odhcp6c_state state, size_t *len);
 
+// Entry manipulation
+struct odhcp6c_entry* odhcp6c_find_entry(enum odhcp6c_state state, const struct odhcp6c_entry *new);
+void odhcp6c_update_entry(enum odhcp6c_state state, struct odhcp6c_entry *new);
+void odhcp6c_update_entry_safe(enum odhcp6c_state state, struct odhcp6c_entry *new, uint32_t safe);
+
+void odhcp6c_expire(void);