]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/systemd/sd-ndisc.h
man/systemd-sysext.xml: document mutable extensions
[thirdparty/systemd.git] / src / systemd / sd-ndisc.h
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 #ifndef foosdndiscfoo
3 #define foosdndiscfoo
4
5 /***
6 Copyright © 2014 Intel Corporation. All rights reserved.
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
19 along with systemd; If not, see <https://www.gnu.org/licenses/>.
20 ***/
21
22 #include <errno.h>
23 #include <inttypes.h>
24 #include <net/ethernet.h>
25 #include <netinet/in.h>
26 #include <sys/types.h>
27
28 #include "sd-event.h"
29 #include "sd-ndisc-protocol.h"
30 #include "sd-ndisc-router.h"
31
32 #include "_sd-common.h"
33
34 _SD_BEGIN_DECLARATIONS;
35
36 typedef struct sd_ndisc sd_ndisc;
37
38 __extension__ typedef enum sd_ndisc_event_t {
39 SD_NDISC_EVENT_TIMEOUT,
40 SD_NDISC_EVENT_ROUTER,
41 _SD_NDISC_EVENT_MAX,
42 _SD_NDISC_EVENT_INVALID = -EINVAL,
43 _SD_ENUM_FORCE_S64(NDISC_EVENT)
44 } sd_ndisc_event_t;
45
46 typedef void (*sd_ndisc_callback_t)(sd_ndisc *nd, sd_ndisc_event_t event, sd_ndisc_router *rt, void *userdata);
47
48 int sd_ndisc_new(sd_ndisc **ret);
49 sd_ndisc *sd_ndisc_ref(sd_ndisc *nd);
50 sd_ndisc *sd_ndisc_unref(sd_ndisc *nd);
51 _SD_DEFINE_POINTER_CLEANUP_FUNC(sd_ndisc, sd_ndisc_unref);
52
53 int sd_ndisc_start(sd_ndisc *nd);
54 int sd_ndisc_stop(sd_ndisc *nd);
55 int sd_ndisc_is_running(sd_ndisc *nd);
56
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);
63 int sd_ndisc_set_ifname(sd_ndisc *nd, const char *interface_name);
64 int sd_ndisc_get_ifname(sd_ndisc *nd, const char **ret);
65 int sd_ndisc_set_mac(sd_ndisc *nd, const struct ether_addr *mac_addr);
66
67 _SD_END_DECLARATIONS;
68
69 #endif