]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/systemd/sd-radv.h
Add SPDX license identifiers to source files under the LGPL
[thirdparty/systemd.git] / src / systemd / sd-radv.h
1 /* SPDX-License-Identifier: LGPL-2.1+ */
2 #ifndef foosdradvfoo
3 #define foosdradvfoo
4
5 /***
6 This file is part of systemd.
7
8 Copyright (C) 2017 Intel Corporation. All rights reserved.
9
10 systemd is free software; you can redistribute it and/or modify it
11 under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
13 (at your option) any later version.
14
15 systemd is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Lesser General Public License for more details.
19
20 You should have received a copy of the GNU Lesser General Public License
21 along with systemd; If not, see <http://www.gnu.org/licenses/>.
22 ***/
23
24 #include <inttypes.h>
25 #include <net/ethernet.h>
26 #include <netinet/in.h>
27 #include <sys/types.h>
28
29 #include "sd-ndisc.h"
30
31 #include "sd-event.h"
32
33 #include "_sd-common.h"
34
35 _SD_BEGIN_DECLARATIONS;
36
37 #define SD_RADV_DEFAULT_MIN_TIMEOUT_USEC (200*USEC_PER_SEC)
38 #define SD_RADV_DEFAULT_MAX_TIMEOUT_USEC (600*USEC_PER_SEC)
39
40 #define SD_RADV_DEFAULT_DNS_LIFETIME_USEC (3*SD_RADV_DEFAULT_MAX_TIMEOUT_USEC)
41
42 typedef struct sd_radv sd_radv;
43 typedef struct sd_radv_prefix sd_radv_prefix;
44
45 /* Router Advertisment */
46 int sd_radv_new(sd_radv **ret);
47 sd_radv *sd_radv_ref(sd_radv *ra);
48 sd_radv *sd_radv_unref(sd_radv *ra);
49
50 int sd_radv_attach_event(sd_radv *ra, sd_event *event, int64_t priority);
51 int sd_radv_detach_event(sd_radv *nd);
52 sd_event *sd_radv_get_event(sd_radv *ra);
53
54 int sd_radv_start(sd_radv *ra);
55 int sd_radv_stop(sd_radv *ra);
56
57 int sd_radv_set_ifindex(sd_radv *ra, int interface_index);
58 int sd_radv_set_mac(sd_radv *ra, const struct ether_addr *mac_addr);
59 int sd_radv_set_mtu(sd_radv *ra, uint32_t mtu);
60 int sd_radv_set_hop_limit(sd_radv *ra, uint8_t hop_limit);
61 int sd_radv_set_router_lifetime(sd_radv *ra, uint32_t router_lifetime);
62 int sd_radv_set_managed_information(sd_radv *ra, int managed);
63 int sd_radv_set_other_information(sd_radv *ra, int other);
64 int sd_radv_set_preference(sd_radv *ra, unsigned preference);
65 int sd_radv_add_prefix(sd_radv *ra, sd_radv_prefix *p);
66 int sd_radv_set_rdnss(sd_radv *ra, uint32_t lifetime,
67 const struct in6_addr *dns, size_t n_dns);
68 int sd_radv_set_dnssl(sd_radv *ra, uint32_t lifetime, char **search_list);
69
70 /* Advertised prefixes */
71 int sd_radv_prefix_new(sd_radv_prefix **ret);
72 sd_radv_prefix *sd_radv_prefix_ref(sd_radv_prefix *ra);
73 sd_radv_prefix *sd_radv_prefix_unref(sd_radv_prefix *ra);
74
75 int sd_radv_prefix_set_prefix(sd_radv_prefix *p, struct in6_addr *in6_addr,
76 unsigned char prefixlen);
77 int sd_radv_prefix_set_onlink(sd_radv_prefix *p, int onlink);
78 int sd_radv_prefix_set_address_autoconfiguration(sd_radv_prefix *p,
79 int address_autoconfiguration);
80 int sd_radv_prefix_set_valid_lifetime(sd_radv_prefix *p,
81 uint32_t valid_lifetime);
82 int sd_radv_prefix_set_preferred_lifetime(sd_radv_prefix *p,
83 uint32_t preferred_lifetime);
84
85 _SD_DEFINE_POINTER_CLEANUP_FUNC(sd_radv, sd_radv_unref);
86 _SD_DEFINE_POINTER_CLEANUP_FUNC(sd_radv_prefix, sd_radv_prefix_unref);
87
88 _SD_END_DECLARATIONS;
89
90 #endif