1 /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
3 #ifndef foosdicmp6ndfoo
4 #define foosdicmp6ndfoo
7 This file is part of systemd.
9 Copyright (C) 2014 Intel Corporation. All rights reserved.
11 systemd is free software; you can redistribute it and/or modify it
12 under the terms of the GNU Lesser General Public License as published by
13 the Free Software Foundation; either version 2.1 of the License, or
14 (at your option) any later version.
16 systemd is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 Lesser General Public License for more details.
21 You should have received a copy of the GNU Lesser General Public License
22 along with systemd; If not, see <http://www.gnu.org/licenses/>.
25 #include <net/ethernet.h>
30 SD_ICMP6_ND_EVENT_ROUTER_ADVERTISMENT_NONE
= 0,
31 SD_ICMP6_ND_EVENT_ROUTER_ADVERTISMENT_TIMEOUT
= 1,
32 SD_ICMP6_ND_EVENT_ROUTER_ADVERTISMENT_OTHER
= 2,
33 SD_ICMP6_ND_EVENT_ROUTER_ADVERTISMENT_MANAGED
= 3,
34 SD_ICMP6_ND_EVENT_ROUTER_ADVERTISMENT_PREFIX_EXPIRED
= 4,
37 typedef struct sd_icmp6_nd sd_icmp6_nd
;
39 typedef void(*sd_icmp6_nd_callback_t
)(sd_icmp6_nd
*nd
, int event
,
42 int sd_icmp6_nd_set_callback(sd_icmp6_nd
*nd
, sd_icmp6_nd_callback_t cb
,
44 int sd_icmp6_nd_set_index(sd_icmp6_nd
*nd
, int interface_index
);
45 int sd_icmp6_nd_set_mac(sd_icmp6_nd
*nd
, const struct ether_addr
*mac_addr
);
47 int sd_icmp6_nd_attach_event(sd_icmp6_nd
*nd
, sd_event
*event
, int priority
);
48 int sd_icmp6_nd_detach_event(sd_icmp6_nd
*nd
);
49 sd_event
*sd_icmp6_nd_get_event(sd_icmp6_nd
*nd
);
51 sd_icmp6_nd
*sd_icmp6_nd_ref(sd_icmp6_nd
*nd
);
52 sd_icmp6_nd
*sd_icmp6_nd_unref(sd_icmp6_nd
*nd
);
53 int sd_icmp6_nd_new(sd_icmp6_nd
**ret
);
55 int sd_icmp6_prefix_match(struct in6_addr
*prefix
, uint8_t prefixlen
,
56 struct in6_addr
*addr
);
58 int sd_icmp6_ra_get_mtu(sd_icmp6_nd
*nd
, uint32_t *mtu
);
59 int sd_icmp6_ra_get_prefixlen(sd_icmp6_nd
*nd
, const struct in6_addr
*addr
,
61 int sd_icmp6_ra_get_expired_prefix(sd_icmp6_nd
*nd
, struct in6_addr
**addr
,
64 int sd_icmp6_nd_stop(sd_icmp6_nd
*nd
);
65 int sd_icmp6_router_solicitation_start(sd_icmp6_nd
*nd
);
67 #define SD_ICMP6_ND_ADDRESS_FORMAT_STR "%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x"
69 #define SD_ICMP6_ND_ADDRESS_FORMAT_VAL(address) \
70 be16toh((address).s6_addr16[0]), \
71 be16toh((address).s6_addr16[1]), \
72 be16toh((address).s6_addr16[2]), \
73 be16toh((address).s6_addr16[3]), \
74 be16toh((address).s6_addr16[4]), \
75 be16toh((address).s6_addr16[5]), \
76 be16toh((address).s6_addr16[6]), \
77 be16toh((address).s6_addr16[7])