X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=src%2Fodhcp6c.h;h=aa0bc224169221e12a2300e6db1c69e64cdbc7cf;hb=3fb3c327d889a8c5e0370259c4c6360c7d3106cb;hp=04a32ecf8a26a7cf2328ced475e1759e2552cfec;hpb=dd5f1f8ca0a24d23dc426d6e89d9855a7b97fcec;p=odhcp6c.git diff --git a/src/odhcp6c.h b/src/odhcp6c.h index 04a32ec..aa0bc22 100644 --- a/src/odhcp6c.h +++ b/src/odhcp6c.h @@ -1,5 +1,5 @@ /** - * Copyright (C) 2012 Steven Barth + * Copyright (C) 2012-2013 Steven Barth * * 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,7 @@ enum dhcvp6_opt { DHCPV6_OPT_NTP_SERVER = 56, DHCPV6_OPT_SIP_SERVER_D = 21, DHCPV6_OPT_SIP_SERVER_A = 22, + DHCPV6_OPT_PD_EXCLUDE = 67, }; enum dhcpv6_opt_npt { @@ -80,7 +81,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 +90,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 +132,18 @@ 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 auth; + 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,9 @@ enum odhcp6c_state { STATE_SNTP_FQDN, STATE_SIP_IP, STATE_SIP_FQDN, + STATE_RA_ROUTE, + STATE_RA_PREFIX, + STATE_RA_DNS, _STATE_MAX }; @@ -187,27 +203,42 @@ 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); +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);