]>
Commit | Line | Data |
---|---|---|
db9ecf05 | 1 | /* SPDX-License-Identifier: LGPL-2.1-or-later */ |
3ad0c5d8 TG |
2 | #ifndef foosdndiscfoo |
3 | #define foosdndiscfoo | |
e3169126 PF |
4 | |
5 | /*** | |
810adae9 | 6 | Copyright © 2014 Intel Corporation. All rights reserved. |
e3169126 PF |
7 | |
8 | systemd is free software; you can redistribute it and/or modify it | |
9 | under the terms of the GNU Lesser General Public License as published by | |
10 | the Free Software Foundation; either version 2.1 of the License, or | |
11 | (at your option) any later version. | |
12 | ||
13 | systemd is distributed in the hope that it will be useful, but | |
14 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
16 | Lesser General Public License for more details. | |
17 | ||
18 | You should have received a copy of the GNU Lesser General Public License | |
85fce6f4 | 19 | along with systemd; If not, see <https://www.gnu.org/licenses/>. |
e3169126 PF |
20 | ***/ |
21 | ||
2d93c20e | 22 | #include <errno.h> |
04c01369 | 23 | #include <inttypes.h> |
e3169126 | 24 | #include <net/ethernet.h> |
1e7a0e21 LP |
25 | #include <netinet/in.h> |
26 | #include <sys/types.h> | |
e3169126 PF |
27 | |
28 | #include "sd-event.h" | |
ca34b434 YW |
29 | #include "sd-ndisc-protocol.h" |
30 | #include "sd-ndisc-router.h" | |
71d35b6b | 31 | |
04c01369 LP |
32 | #include "_sd-common.h" |
33 | ||
34 | _SD_BEGIN_DECLARATIONS; | |
e3169126 | 35 | |
4d7b83da | 36 | typedef struct sd_ndisc sd_ndisc; |
e3169126 | 37 | |
5476cb98 | 38 | __extension__ typedef enum sd_ndisc_event_t { |
a2dcda32 YW |
39 | SD_NDISC_EVENT_TIMEOUT, |
40 | SD_NDISC_EVENT_ROUTER, | |
41 | _SD_NDISC_EVENT_MAX, | |
2d93c20e | 42 | _SD_NDISC_EVENT_INVALID = -EINVAL, |
5476cb98 | 43 | _SD_ENUM_FORCE_S64(NDISC_EVENT) |
2324fd3a | 44 | } sd_ndisc_event_t; |
e3169126 | 45 | |
28eef158 | 46 | typedef void (*sd_ndisc_callback_t)(sd_ndisc *nd, sd_ndisc_event_t event, void *message, void *userdata); |
e3169126 | 47 | |
1e7a0e21 | 48 | int sd_ndisc_new(sd_ndisc **ret); |
4d7b83da TG |
49 | sd_ndisc *sd_ndisc_ref(sd_ndisc *nd); |
50 | sd_ndisc *sd_ndisc_unref(sd_ndisc *nd); | |
ca34b434 | 51 | _SD_DEFINE_POINTER_CLEANUP_FUNC(sd_ndisc, sd_ndisc_unref); |
d14b5bc6 | 52 | |
1e7a0e21 | 53 | int sd_ndisc_start(sd_ndisc *nd); |
4d7b83da | 54 | int sd_ndisc_stop(sd_ndisc *nd); |
787e71e4 | 55 | int sd_ndisc_is_running(sd_ndisc *nd); |
e3169126 | 56 | |
1e7a0e21 LP |
57 | int sd_ndisc_attach_event(sd_ndisc *nd, sd_event *event, int64_t priority); |
58 | int sd_ndisc_detach_event(sd_ndisc *nd); | |
59 | sd_event *sd_ndisc_get_event(sd_ndisc *nd); | |
60 | ||
61 | int sd_ndisc_set_callback(sd_ndisc *nd, sd_ndisc_callback_t cb, void *userdata); | |
62 | int sd_ndisc_set_ifindex(sd_ndisc *nd, int interface_index); | |
61a9fa8f | 63 | int sd_ndisc_set_ifname(sd_ndisc *nd, const char *interface_name); |
5977b71f | 64 | int sd_ndisc_get_ifname(sd_ndisc *nd, const char **ret); |
1e7a0e21 | 65 | int sd_ndisc_set_mac(sd_ndisc *nd, const struct ether_addr *mac_addr); |
d77bde34 | 66 | |
04c01369 LP |
67 | _SD_END_DECLARATIONS; |
68 | ||
e3169126 | 69 | #endif |