X-Git-Url: https://git.decadent.org.uk/gitweb/?p=odhcp6c.git;a=blobdiff_plain;f=src%2Fodhcp6c.h;h=183ed44a36725acf24ad2fb5fe77561642fb31c9;hp=b6f0ff2331d33588b39d9ee0273d6e4a066b8c43;hb=d77cbea57d1b7dd9c25421bb13c90e65bb54a6bc;hpb=d2c90000292f62962276579fa6b2eac1ff4b76e6 diff --git a/src/odhcp6c.h b/src/odhcp6c.h index b6f0ff2..183ed44 100644 --- a/src/odhcp6c.h +++ b/src/odhcp6c.h @@ -81,11 +81,17 @@ enum dhcpv6_msg { }; enum dhcpv6_status { + DHCPV6_Success = 0, + DHCPV6_UnspecFail = 1, DHCPV6_NoAddrsAvail = 2, + DHCPV6_NoBinding = 3, + DHCPV6_NotOnLink = 4, + DHCPV6_UseMulticast = 5, DHCPV6_NoPrefixAvail = 6, + _DHCPV6_Status_Max }; -typedef int(reply_handler)(enum dhcpv6_msg orig, +typedef int(reply_handler)(enum dhcpv6_msg orig, const int rc, const void *opt, const void *end); // retransmission strategy @@ -93,12 +99,12 @@ struct dhcpv6_retx { bool delay; uint8_t init_timeo; uint16_t max_timeo; + uint8_t max_rc; char name[8]; reply_handler *handler_reply; int(*handler_finish)(void); }; - // DHCPv6 Protocol Headers struct dhcpv6_header { uint8_t msg_type; @@ -219,11 +225,13 @@ struct odhcp6c_entry { struct in6_addr target; uint32_t valid; uint32_t preferred; + uint32_t t1; + uint32_t t2; uint16_t class; }; -int init_dhcpv6(const char *ifname, int request_pd); +int init_dhcpv6(const char *ifname, int request_pd, int sol_timeout); void dhcpv6_set_ia_mode(enum odhcp6c_ia_mode na, enum odhcp6c_ia_mode pd); int dhcpv6_request(enum dhcpv6_msg type); int dhcpv6_poll_reconfigure(void); @@ -240,6 +248,7 @@ 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); +bool odhcp6c_is_bound(void); // State manipulation void odhcp6c_clear_state(enum odhcp6c_state state); @@ -250,8 +259,8 @@ 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); +bool odhcp6c_update_entry(enum odhcp6c_state state, struct odhcp6c_entry *new); +bool odhcp6c_update_entry_safe(enum odhcp6c_state state, struct odhcp6c_entry *new, uint32_t safe); void odhcp6c_expire(void); uint32_t odhcp6c_elapsed(void);