diff options
author | Tom Gundersen <teg@jklm.no> | 2015-10-19 22:15:50 +0200 |
---|---|---|
committer | Tom Gundersen <teg@jklm.no> | 2015-11-11 15:42:38 +0100 |
commit | 9d96e6c3efbe5ef52b2855612d51db52c469beb2 (patch) | |
tree | 8398fd74f30954af3e427be8e19e93b58545889e /src/systemd | |
parent | cb53894d3b6e90edaee4219fe716850d01242f46 (diff) | |
download | systemd-9d96e6c3efbe5ef52b2855612d51db52c469beb2.tar.gz |
sd-ndisc: introduce separate callbacks
As the data passed is very different, we introduce four different callbacks:
- Generic - router discovery timed out or state machine stopped
- Router - router and link configuration received
- Prefix onlink - configuration for an onlink prefix received
- Prefix autonomous - configuration for to configure a SLAAC address for a prefix received
Diffstat (limited to 'src/systemd')
-rw-r--r-- | src/systemd/sd-ndisc.h | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/src/systemd/sd-ndisc.h b/src/systemd/sd-ndisc.h index d0dd098560..80e24325f7 100644 --- a/src/systemd/sd-ndisc.h +++ b/src/systemd/sd-ndisc.h @@ -31,20 +31,25 @@ _SD_BEGIN_DECLARATIONS; enum { - SD_NDISC_EVENT_ROUTER_ADVERTISMENT_NONE = 0, - SD_NDISC_EVENT_ROUTER_ADVERTISMENT_TIMEOUT = 1, - SD_NDISC_EVENT_ROUTER_ADVERTISMENT_OTHER = 2, - SD_NDISC_EVENT_ROUTER_ADVERTISMENT_MANAGED = 3, - SD_NDISC_EVENT_STOP = 4, + SD_NDISC_EVENT_STOP = 0, + SD_NDISC_EVENT_TIMEOUT = 1, }; typedef struct sd_ndisc sd_ndisc; -typedef void(*sd_ndisc_callback_t)(sd_ndisc *nd, int event, - void *userdata); - -int sd_ndisc_set_callback(sd_ndisc *nd, sd_ndisc_callback_t cb, - void *userdata); +typedef void(*sd_ndisc_router_callback_t)(sd_ndisc *nd, uint8_t flags, const struct in6_addr *gateway, unsigned lifetime, int pref, void *userdata); +typedef void(*sd_ndisc_prefix_onlink_callback_t)(sd_ndisc *nd, const struct in6_addr *prefix, unsigned prefixlen, + unsigned lifetime, void *userdata); +typedef void(*sd_ndisc_prefix_autonomous_callback_t)(sd_ndisc *nd, const struct in6_addr *prefix, unsigned prefixlen, + unsigned lifetime_prefered, unsigned lifetime_valid, void *userdata); +typedef void(*sd_ndisc_callback_t)(sd_ndisc *nd, int event, void *userdata); + +int sd_ndisc_set_callback(sd_ndisc *nd, + sd_ndisc_router_callback_t rcb, + sd_ndisc_prefix_onlink_callback_t plcb, + sd_ndisc_prefix_autonomous_callback_t pacb, + sd_ndisc_callback_t cb, + void *userdata); int sd_ndisc_set_index(sd_ndisc *nd, int interface_index); int sd_ndisc_set_mac(sd_ndisc *nd, const struct ether_addr *mac_addr); |