2020-11-09 05:23:58 +01:00
|
|
|
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
2017-05-12 15:48:27 +02:00
|
|
|
#ifndef foosdradvfoo
|
|
|
|
#define foosdradvfoo
|
|
|
|
|
|
|
|
/***
|
2018-06-12 17:15:23 +02:00
|
|
|
Copyright © 2017 Intel Corporation. All rights reserved.
|
2017-05-12 15:48:27 +02:00
|
|
|
|
|
|
|
systemd is free software; you can redistribute it and/or modify it
|
|
|
|
under the terms of the GNU Lesser General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2.1 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
systemd is distributed in the hope that it will be useful, but
|
|
|
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Lesser General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Lesser General Public License
|
|
|
|
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
***/
|
|
|
|
|
|
|
|
#include <inttypes.h>
|
|
|
|
#include <net/ethernet.h>
|
|
|
|
#include <netinet/in.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
|
|
|
#include "_sd-common.h"
|
2018-11-26 22:13:15 +01:00
|
|
|
#include "sd-event.h"
|
|
|
|
#include "sd-ndisc.h"
|
2017-05-12 15:48:27 +02:00
|
|
|
|
|
|
|
_SD_BEGIN_DECLARATIONS;
|
|
|
|
|
2017-09-29 13:23:38 +02:00
|
|
|
#define SD_RADV_DEFAULT_MIN_TIMEOUT_USEC (200*USEC_PER_SEC)
|
|
|
|
#define SD_RADV_DEFAULT_MAX_TIMEOUT_USEC (600*USEC_PER_SEC)
|
|
|
|
|
|
|
|
#define SD_RADV_DEFAULT_DNS_LIFETIME_USEC (3*SD_RADV_DEFAULT_MAX_TIMEOUT_USEC)
|
|
|
|
|
2017-05-12 15:48:31 +02:00
|
|
|
typedef struct sd_radv sd_radv;
|
2017-05-12 15:48:27 +02:00
|
|
|
typedef struct sd_radv_prefix sd_radv_prefix;
|
2019-09-14 13:14:22 +02:00
|
|
|
typedef struct sd_radv_route_prefix sd_radv_route_prefix;
|
2017-05-12 15:48:27 +02:00
|
|
|
|
2018-06-18 22:43:12 +02:00
|
|
|
/* Router Advertisement */
|
2017-05-12 15:48:31 +02:00
|
|
|
int sd_radv_new(sd_radv **ret);
|
|
|
|
sd_radv *sd_radv_ref(sd_radv *ra);
|
|
|
|
sd_radv *sd_radv_unref(sd_radv *ra);
|
|
|
|
|
|
|
|
int sd_radv_attach_event(sd_radv *ra, sd_event *event, int64_t priority);
|
|
|
|
int sd_radv_detach_event(sd_radv *nd);
|
|
|
|
sd_event *sd_radv_get_event(sd_radv *ra);
|
|
|
|
|
|
|
|
int sd_radv_start(sd_radv *ra);
|
2020-07-07 04:06:08 +02:00
|
|
|
int sd_radv_stop(sd_radv *ra);
|
2020-07-19 18:46:57 +02:00
|
|
|
int sd_radv_is_running(sd_radv *ra);
|
2017-05-12 15:48:31 +02:00
|
|
|
|
|
|
|
int sd_radv_set_ifindex(sd_radv *ra, int interface_index);
|
|
|
|
int sd_radv_set_mac(sd_radv *ra, const struct ether_addr *mac_addr);
|
|
|
|
int sd_radv_set_mtu(sd_radv *ra, uint32_t mtu);
|
|
|
|
int sd_radv_set_hop_limit(sd_radv *ra, uint8_t hop_limit);
|
2020-11-09 08:35:24 +01:00
|
|
|
int sd_radv_set_router_lifetime(sd_radv *ra, uint16_t router_lifetime);
|
2017-05-12 15:48:31 +02:00
|
|
|
int sd_radv_set_managed_information(sd_radv *ra, int managed);
|
|
|
|
int sd_radv_set_other_information(sd_radv *ra, int other);
|
|
|
|
int sd_radv_set_preference(sd_radv *ra, unsigned preference);
|
2018-11-26 22:13:15 +01:00
|
|
|
int sd_radv_add_prefix(sd_radv *ra, sd_radv_prefix *p, int dynamic);
|
2019-09-14 13:14:22 +02:00
|
|
|
int sd_radv_add_route_prefix(sd_radv *ra, sd_radv_route_prefix *p, int dynamic);
|
2018-06-13 17:34:41 +02:00
|
|
|
sd_radv_prefix *sd_radv_remove_prefix(sd_radv *ra, const struct in6_addr *prefix,
|
|
|
|
unsigned char prefixlen);
|
2017-08-14 11:53:11 +02:00
|
|
|
int sd_radv_set_rdnss(sd_radv *ra, uint32_t lifetime,
|
|
|
|
const struct in6_addr *dns, size_t n_dns);
|
2017-08-21 12:41:20 +02:00
|
|
|
int sd_radv_set_dnssl(sd_radv *ra, uint32_t lifetime, char **search_list);
|
2017-05-12 15:48:31 +02:00
|
|
|
|
2017-05-12 15:48:27 +02:00
|
|
|
/* Advertised prefixes */
|
|
|
|
int sd_radv_prefix_new(sd_radv_prefix **ret);
|
|
|
|
sd_radv_prefix *sd_radv_prefix_ref(sd_radv_prefix *ra);
|
|
|
|
sd_radv_prefix *sd_radv_prefix_unref(sd_radv_prefix *ra);
|
|
|
|
|
2018-06-13 17:34:41 +02:00
|
|
|
int sd_radv_prefix_set_prefix(sd_radv_prefix *p, const struct in6_addr *in6_addr,
|
2017-05-12 15:48:27 +02:00
|
|
|
unsigned char prefixlen);
|
2020-02-27 13:31:09 +01:00
|
|
|
int sd_radv_prefix_get_prefix(sd_radv_prefix *p, struct in6_addr *ret_in6_addr,
|
|
|
|
unsigned char *ret_prefixlen);
|
2017-05-12 15:48:27 +02:00
|
|
|
int sd_radv_prefix_set_onlink(sd_radv_prefix *p, int onlink);
|
|
|
|
int sd_radv_prefix_set_address_autoconfiguration(sd_radv_prefix *p,
|
|
|
|
int address_autoconfiguration);
|
|
|
|
int sd_radv_prefix_set_valid_lifetime(sd_radv_prefix *p,
|
|
|
|
uint32_t valid_lifetime);
|
|
|
|
int sd_radv_prefix_set_preferred_lifetime(sd_radv_prefix *p,
|
|
|
|
uint32_t preferred_lifetime);
|
|
|
|
|
2019-09-14 13:14:22 +02:00
|
|
|
int sd_radv_route_prefix_new(sd_radv_route_prefix **ret);
|
|
|
|
sd_radv_route_prefix *sd_radv_route_prefix_ref(sd_radv_route_prefix *ra);
|
|
|
|
sd_radv_route_prefix *sd_radv_route_prefix_unref(sd_radv_route_prefix *ra);
|
|
|
|
|
|
|
|
int sd_radv_prefix_set_route_prefix(sd_radv_route_prefix *p, const struct in6_addr *in6_addr, unsigned char prefixlen);
|
|
|
|
int sd_radv_route_prefix_set_lifetime(sd_radv_route_prefix *p, uint32_t valid_lifetime);
|
|
|
|
|
2017-05-12 15:48:27 +02:00
|
|
|
_SD_DEFINE_POINTER_CLEANUP_FUNC(sd_radv, sd_radv_unref);
|
|
|
|
_SD_DEFINE_POINTER_CLEANUP_FUNC(sd_radv_prefix, sd_radv_prefix_unref);
|
2019-09-14 13:14:22 +02:00
|
|
|
_SD_DEFINE_POINTER_CLEANUP_FUNC(sd_radv_route_prefix, sd_radv_route_prefix_unref);
|
2017-05-12 15:48:27 +02:00
|
|
|
|
|
|
|
_SD_END_DECLARATIONS;
|
|
|
|
|
|
|
|
#endif
|