1 /* SPDX-License-Identifier: LGPL-2.1-or-later */ 2 #pragma once 3 4 /*** 5 Copyright © 2014 Intel Corporation. All rights reserved. 6 ***/ 7 8 #include "sd-ndisc.h" 9 10 #include "network-common.h" 11 #include "time-util.h" 12 13 #define NDISC_ROUTER_SOLICITATION_INTERVAL (4U * USEC_PER_SEC) 14 #define NDISC_MAX_ROUTER_SOLICITATION_INTERVAL (3600U * USEC_PER_SEC) 15 #define NDISC_MAX_ROUTER_SOLICITATIONS 3U 16 17 struct sd_ndisc { 18 unsigned n_ref; 19 20 int ifindex; 21 char *ifname; 22 int fd; 23 24 sd_event *event; 25 int event_priority; 26 27 struct ether_addr mac_addr; 28 29 sd_event_source *recv_event_source; 30 sd_event_source *timeout_event_source; 31 sd_event_source *timeout_no_ra; 32 33 usec_t retransmit_time; 34 35 sd_ndisc_callback_t callback; 36 void *userdata; 37 }; 38 39 const char* ndisc_event_to_string(sd_ndisc_event_t e) _const_; 40 sd_ndisc_event_t ndisc_event_from_string(const char *s) _pure_; 41 42 #define log_ndisc_errno(ndisc, error, fmt, ...) \ 43 log_interface_prefix_full_errno( \ 44 "NDISC: ", \ 45 sd_ndisc, ndisc, \ 46 error, fmt, ##__VA_ARGS__) 47 #define log_ndisc(ndisc, fmt, ...) \ 48 log_interface_prefix_full_errno_zerook( \ 49 "NDISC: ", \ 50 sd_ndisc, ndisc, \ 51 0, fmt, ##__VA_ARGS__) 52