1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 #ifndef foosdndiscrouterfoo
3 #define foosdndiscrouterfoo
6 systemd is free software; you can redistribute it and/or modify it
7 under the terms of the GNU Lesser General Public License as published by
8 the Free Software Foundation; either version 2.1 of the License, or
9 (at your option) any later version.
11 systemd is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public License
17 along with systemd; If not, see <https://www.gnu.org/licenses/>.
21 #include <netinet/in.h>
22 #include <sys/types.h>
25 #include "_sd-common.h"
27 _SD_BEGIN_DECLARATIONS
;
29 typedef struct sd_ndisc_router sd_ndisc_router
;
31 sd_ndisc_router
*sd_ndisc_router_ref(sd_ndisc_router
*rt
);
32 sd_ndisc_router
*sd_ndisc_router_unref(sd_ndisc_router
*rt
);
33 _SD_DEFINE_POINTER_CLEANUP_FUNC(sd_ndisc_router
, sd_ndisc_router_unref
);
35 int sd_ndisc_router_get_address(sd_ndisc_router
*rt
, struct in6_addr
*ret
);
36 int sd_ndisc_router_get_timestamp(sd_ndisc_router
*rt
, clockid_t clock
, uint64_t *ret
);
37 int sd_ndisc_router_get_raw(sd_ndisc_router
*rt
, const void **ret
, size_t *ret_size
);
39 int sd_ndisc_router_get_hop_limit(sd_ndisc_router
*rt
, uint8_t *ret
);
40 int sd_ndisc_router_get_flags(sd_ndisc_router
*rt
, uint64_t *ret
);
41 int sd_ndisc_router_get_preference(sd_ndisc_router
*rt
, unsigned *ret
);
42 int sd_ndisc_router_get_lifetime(sd_ndisc_router
*rt
, uint64_t *ret
);
43 int sd_ndisc_router_get_lifetime_timestamp(sd_ndisc_router
*rt
, clockid_t clock
, uint64_t *ret
);
44 int sd_ndisc_router_get_reachable_time(sd_ndisc_router
*rt
, uint64_t *ret
);
45 int sd_ndisc_router_get_retransmission_time(sd_ndisc_router
*rt
, uint64_t *ret
);
46 int sd_ndisc_router_get_mtu(sd_ndisc_router
*rt
, uint32_t *ret
);
48 /* Generic option access */
49 int sd_ndisc_router_option_rewind(sd_ndisc_router
*rt
);
50 int sd_ndisc_router_option_next(sd_ndisc_router
*rt
);
51 int sd_ndisc_router_option_get_type(sd_ndisc_router
*rt
, uint8_t *ret
);
52 int sd_ndisc_router_option_is_type(sd_ndisc_router
*rt
, uint8_t type
);
53 int sd_ndisc_router_option_get_raw(sd_ndisc_router
*rt
, const void **ret
, size_t *ret_size
);
55 /* Specific option access: SD_NDISC_OPTION_PREFIX_INFORMATION */
56 int sd_ndisc_router_prefix_get_valid_lifetime(sd_ndisc_router
*rt
, uint64_t *ret
);
57 int sd_ndisc_router_prefix_get_valid_lifetime_timestamp(sd_ndisc_router
*rt
, clockid_t clock
, uint64_t *ret
);
58 int sd_ndisc_router_prefix_get_preferred_lifetime(sd_ndisc_router
*rt
, uint64_t *ret
);
59 int sd_ndisc_router_prefix_get_preferred_lifetime_timestamp(sd_ndisc_router
*rt
, clockid_t clock
, uint64_t *ret
);
60 int sd_ndisc_router_prefix_get_flags(sd_ndisc_router
*rt
, uint8_t *ret
);
61 int sd_ndisc_router_prefix_get_address(sd_ndisc_router
*rt
, struct in6_addr
*ret
);
62 int sd_ndisc_router_prefix_get_prefixlen(sd_ndisc_router
*rt
, unsigned *ret
);
64 /* Specific option access: SD_NDISC_OPTION_ROUTE_INFORMATION */
65 int sd_ndisc_router_route_get_lifetime(sd_ndisc_router
*rt
, uint64_t *ret
);
66 int sd_ndisc_router_route_get_lifetime_timestamp(sd_ndisc_router
*rt
, clockid_t clock
, uint64_t *ret
);
67 int sd_ndisc_router_route_get_address(sd_ndisc_router
*rt
, struct in6_addr
*ret
);
68 int sd_ndisc_router_route_get_prefixlen(sd_ndisc_router
*rt
, unsigned *ret
);
69 int sd_ndisc_router_route_get_preference(sd_ndisc_router
*rt
, unsigned *ret
);
71 /* Specific option access: SD_NDISC_OPTION_RDNSS */
72 int sd_ndisc_router_rdnss_get_addresses(sd_ndisc_router
*rt
, const struct in6_addr
**ret
);
73 int sd_ndisc_router_rdnss_get_lifetime(sd_ndisc_router
*rt
, uint64_t *ret
);
74 int sd_ndisc_router_rdnss_get_lifetime_timestamp(sd_ndisc_router
*rt
, clockid_t clock
, uint64_t *ret
);
76 /* Specific option access: SD_NDISC_OPTION_DNSSL */
77 int sd_ndisc_router_dnssl_get_domains(sd_ndisc_router
*rt
, char ***ret
);
78 int sd_ndisc_router_dnssl_get_lifetime(sd_ndisc_router
*rt
, uint64_t *ret
);
79 int sd_ndisc_router_dnssl_get_lifetime_timestamp(sd_ndisc_router
*rt
, clockid_t clock
, uint64_t *ret
);
81 /* Specific option access: SD_NDISC_OPTION_CAPTIVE_PORTAL */
82 int sd_ndisc_router_captive_portal_get_uri(sd_ndisc_router
*rt
, const char **ret
, size_t *ret_size
);
84 /* Specific option access: SD_NDISC_OPTION_PREF64 */
85 int sd_ndisc_router_prefix64_get_prefix(sd_ndisc_router
*rt
, struct in6_addr
*ret
);
86 int sd_ndisc_router_prefix64_get_prefixlen(sd_ndisc_router
*rt
, unsigned *ret
);
87 int sd_ndisc_router_prefix64_get_lifetime(sd_ndisc_router
*rt
, uint64_t *ret
);
88 int sd_ndisc_router_prefix64_get_lifetime_timestamp(sd_ndisc_router
*rt
, clockid_t clock
, uint64_t *ret
);