1:255.13-alt1
[systemd_ALT.git] / src / systemd / sd-radv.h
blob8ea0838ee654bd00820b107e55ec8053b57780d8
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 #ifndef foosdradvfoo
3 #define foosdradvfoo
5 /***
6 Copyright © 2017 Intel Corporation. All rights reserved.
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.
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.
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 ***/
22 #include <inttypes.h>
23 #include <net/ethernet.h>
24 #include <netinet/in.h>
25 #include <sys/types.h>
27 #include "_sd-common.h"
28 #include "sd-event.h"
29 #include "sd-ndisc.h"
31 _SD_BEGIN_DECLARATIONS;
33 typedef struct sd_radv sd_radv;
34 typedef struct sd_radv_prefix sd_radv_prefix;
35 typedef struct sd_radv_route_prefix sd_radv_route_prefix;
36 typedef struct sd_radv_pref64_prefix sd_radv_pref64_prefix;
38 /* Router Advertisement */
39 int sd_radv_new(sd_radv **ret);
40 sd_radv *sd_radv_ref(sd_radv *ra);
41 sd_radv *sd_radv_unref(sd_radv *ra);
43 int sd_radv_attach_event(sd_radv *ra, sd_event *event, int64_t priority);
44 int sd_radv_detach_event(sd_radv *nd);
45 sd_event *sd_radv_get_event(sd_radv *ra);
47 int sd_radv_start(sd_radv *ra);
48 int sd_radv_stop(sd_radv *ra);
49 int sd_radv_is_running(sd_radv *ra);
51 int sd_radv_set_ifindex(sd_radv *ra, int interface_index);
52 int sd_radv_set_ifname(sd_radv *ra, const char *interface_name);
53 int sd_radv_get_ifname(sd_radv *ra, const char **ret);
54 int sd_radv_set_mac(sd_radv *ra, const struct ether_addr *mac_addr);
55 int sd_radv_set_mtu(sd_radv *ra, uint32_t mtu);
56 int sd_radv_set_hop_limit(sd_radv *ra, uint8_t hop_limit);
57 int sd_radv_set_retransmit(sd_radv *ra, uint64_t usec);
58 int sd_radv_set_router_lifetime(sd_radv *ra, uint64_t usec);
59 int sd_radv_set_managed_information(sd_radv *ra, int managed);
60 int sd_radv_set_other_information(sd_radv *ra, int other);
61 int sd_radv_set_preference(sd_radv *ra, unsigned preference);
62 int sd_radv_add_prefix(sd_radv *ra, sd_radv_prefix *p);
63 int sd_radv_add_route_prefix(sd_radv *ra, sd_radv_route_prefix *p);
64 int sd_radv_add_pref64_prefix(sd_radv *ra, sd_radv_pref64_prefix *p);
65 void sd_radv_remove_prefix(sd_radv *ra, const struct in6_addr *prefix, unsigned char prefixlen);
66 int sd_radv_set_rdnss(sd_radv *ra, uint64_t lifetime_usec,
67 const struct in6_addr *dns, size_t n_dns);
68 int sd_radv_set_dnssl(sd_radv *ra, uint64_t lifetime_usec, char **search_list);
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);
75 int sd_radv_prefix_set_prefix(sd_radv_prefix *p, const struct in6_addr *in6_addr,
76 unsigned char prefixlen);
77 int sd_radv_prefix_get_prefix(sd_radv_prefix *p, struct in6_addr *ret_in6_addr,
78 unsigned char *ret_prefixlen);
79 int sd_radv_prefix_set_onlink(sd_radv_prefix *p, int onlink);
80 int sd_radv_prefix_set_address_autoconfiguration(sd_radv_prefix *p,
81 int address_autoconfiguration);
82 int sd_radv_prefix_set_valid_lifetime(sd_radv_prefix *p, uint64_t lifetime_usec, uint64_t valid_until);
83 int sd_radv_prefix_set_preferred_lifetime(sd_radv_prefix *p, uint64_t lifetime_usec, uint64_t valid_until);
85 int sd_radv_route_prefix_new(sd_radv_route_prefix **ret);
86 sd_radv_route_prefix *sd_radv_route_prefix_ref(sd_radv_route_prefix *ra);
87 sd_radv_route_prefix *sd_radv_route_prefix_unref(sd_radv_route_prefix *ra);
89 int sd_radv_route_prefix_set_prefix(sd_radv_route_prefix *p, const struct in6_addr *in6_addr, unsigned char prefixlen);
90 int sd_radv_route_prefix_set_lifetime(sd_radv_route_prefix *p, uint64_t lifetime_usec, uint64_t valid_until);
92 int sd_radv_pref64_prefix_new(sd_radv_pref64_prefix **ret);
93 int sd_radv_pref64_prefix_set_prefix(sd_radv_pref64_prefix *p, const struct in6_addr *prefix,
94 uint8_t prefixlen, uint64_t lifetime_usec);
95 sd_radv_pref64_prefix *sd_radv_pref64_prefix_ref(sd_radv_pref64_prefix *ra);
96 sd_radv_pref64_prefix *sd_radv_pref64_prefix_unref(sd_radv_pref64_prefix *ra);
98 /* Mobile IPv6 extension: Home Agent Info. */
99 int sd_radv_set_home_agent_information(sd_radv *ra, int home_agent);
100 int sd_radv_set_home_agent_preference(sd_radv *ra, uint16_t preference);
101 int sd_radv_set_home_agent_lifetime(sd_radv *ra, uint64_t usec);
103 _SD_DEFINE_POINTER_CLEANUP_FUNC(sd_radv, sd_radv_unref);
104 _SD_DEFINE_POINTER_CLEANUP_FUNC(sd_radv_prefix, sd_radv_prefix_unref);
105 _SD_DEFINE_POINTER_CLEANUP_FUNC(sd_radv_route_prefix, sd_radv_route_prefix_unref);
106 _SD_DEFINE_POINTER_CLEANUP_FUNC(sd_radv_pref64_prefix, sd_radv_pref64_prefix_unref);
108 _SD_END_DECLARATIONS;
110 #endif