/**
- * 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
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 {
};
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 {
uint16_t max_timeo;
char name[8];
reply_handler *handler_reply;
- int(*handler_finish)(uint32_t elapsed);
+ int(*handler_finish)(void);
};
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) &&\
STATE_SNTP_FQDN,
STATE_SIP_IP,
STATE_SIP_FQDN,
+ STATE_RA_ROUTE,
+ STATE_RA_PREFIX,
+ STATE_RA_DNS,
+ STATE_AFTR_NAME,
_STATE_MAX
};
};
+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);
+uint32_t odhcp6c_elapsed(void);