1 /* SPDX-License-Identifier: LGPL-2.1-or-later */ 2 #pragma once 3 4 #include "sd-event.h" 5 #include "sd-lldp-rx.h" 6 7 #include "hashmap.h" 8 #include "network-common.h" 9 #include "prioq.h" 10 11 struct sd_lldp_rx { 12 unsigned n_ref; 13 14 int ifindex; 15 char *ifname; 16 int fd; 17 18 sd_event *event; 19 int64_t event_priority; 20 sd_event_source *io_event_source; 21 sd_event_source *timer_event_source; 22 23 Prioq *neighbor_by_expiry; 24 Hashmap *neighbor_by_id; 25 26 uint64_t neighbors_max; 27 28 sd_lldp_rx_callback_t callback; 29 void *userdata; 30 31 uint16_t capability_mask; 32 33 struct ether_addr filter_address; 34 }; 35 36 const char* lldp_rx_event_to_string(sd_lldp_rx_event_t e) _const_; 37 sd_lldp_rx_event_t lldp_rx_event_from_string(const char *s) _pure_; 38 39 #define log_lldp_rx_errno(lldp_rx, error, fmt, ...) \ 40 log_interface_prefix_full_errno( \ 41 "LLDP Rx: ", \ 42 sd_lldp_rx, lldp_rx, \ 43 error, fmt, ##__VA_ARGS__) 44 #define log_lldp_rx(lldp_rx, fmt, ...) \ 45 log_interface_prefix_full_errno_zerook( \ 46 "LLDP Rx: ", \ 47 sd_lldp_rx, lldp_rx, \ 48 0, fmt, ##__VA_ARGS__) 49