]>
Commit | Line | Data |
---|---|---|
db9ecf05 | 1 | /* SPDX-License-Identifier: LGPL-2.1-or-later */ |
0ef6f454 LP |
2 | #pragma once |
3 | ||
07630cea | 4 | #include "sd-event.h" |
34437b4f | 5 | #include "sd-lldp.h" |
07630cea | 6 | |
34437b4f | 7 | #include "hashmap.h" |
35388783 | 8 | #include "log-link.h" |
ad1ad5c8 SS |
9 | #include "prioq.h" |
10 | ||
34437b4f | 11 | struct sd_lldp { |
fc6a313b LP |
12 | unsigned n_ref; |
13 | ||
34437b4f | 14 | int ifindex; |
61a9fa8f | 15 | char *ifname; |
34437b4f | 16 | int fd; |
ad1ad5c8 | 17 | |
34437b4f LP |
18 | sd_event *event; |
19 | int64_t event_priority; | |
20 | sd_event_source *io_event_source; | |
21 | sd_event_source *timer_event_source; | |
ad1ad5c8 | 22 | |
34437b4f LP |
23 | Prioq *neighbor_by_expiry; |
24 | Hashmap *neighbor_by_id; | |
ad1ad5c8 | 25 | |
34437b4f | 26 | uint64_t neighbors_max; |
ad1ad5c8 | 27 | |
34437b4f LP |
28 | sd_lldp_callback_t callback; |
29 | void *userdata; | |
ad1ad5c8 | 30 | |
34437b4f | 31 | uint16_t capability_mask; |
b553a6b1 LP |
32 | |
33 | struct ether_addr filter_address; | |
ad1ad5c8 SS |
34 | }; |
35 | ||
2324fd3a LP |
36 | const char* lldp_event_to_string(sd_lldp_event_t e) _const_; |
37 | sd_lldp_event_t lldp_event_from_string(const char *s) _pure_; | |
35388783 YW |
38 | |
39 | #define log_lldp_errno(lldp, error, fmt, ...) \ | |
40 | ({ \ | |
41 | int _e = (error); \ | |
42 | if (DEBUG_LOGGING) \ | |
43 | log_interface_full_errno( \ | |
44 | sd_lldp_get_ifname(lldp), \ | |
45 | LOG_DEBUG, _e, "LLDP: " fmt, \ | |
46 | ##__VA_ARGS__); \ | |
47 | -ERRNO_VALUE(_e); \ | |
48 | }) | |
49 | #define log_lldp(lldp, fmt, ...) \ | |
50 | log_lldp_errno(lldp, 0, fmt, ##__VA_ARGS__) |