]>
Commit | Line | Data |
---|---|---|
04c01369 LP |
1 | #ifndef foosdlldphfoo |
2 | #define foosdlldphfoo | |
3 | ||
ad1ad5c8 SS |
4 | /*** |
5 | This file is part of systemd. | |
6 | ||
7 | Copyright (C) 2014 Tom Gundersen | |
8 | Copyright (C) 2014 Susant Sahani | |
9 | ||
10 | systemd is free software; you can redistribute it and/or modify it | |
11 | under the terms of the GNU Lesser General Public License as published by | |
12 | the Free Software Foundation; either version 2.1 of the License, or | |
13 | (at your option) any later version. | |
14 | ||
15 | systemd is distributed in the hope that it will be useful, but | |
16 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
18 | Lesser General Public License for more details. | |
19 | ||
20 | You should have received a copy of the GNU Lesser General Public License | |
21 | along with systemd; If not, see <http://www.gnu.org/licenses/>. | |
22 | ***/ | |
23 | ||
04c01369 | 24 | #include <inttypes.h> |
71d35b6b | 25 | #include <net/ethernet.h> |
07630cea | 26 | |
ad1ad5c8 | 27 | #include "sd-event.h" |
71d35b6b | 28 | |
04c01369 LP |
29 | #include "_sd-common.h" |
30 | ||
31 | _SD_BEGIN_DECLARATIONS; | |
ad1ad5c8 | 32 | |
9ef61f2e DH |
33 | enum { |
34 | SD_LLDP_EVENT_UPDATE_INFO = 0, | |
35 | }; | |
36 | ||
4fc6de5d BG |
37 | enum { |
38 | SD_LLDP_DESTINATION_TYPE_NEAREST_BRIDGE, | |
39 | SD_LLDP_DESTINATION_TYPE_NEAREST_NON_TPMR_BRIDGE, | |
40 | SD_LLDP_DESTINATION_TYPE_NEAREST_CUSTOMER_BRIDGE, | |
41 | }; | |
42 | ||
ad1ad5c8 | 43 | typedef struct sd_lldp sd_lldp; |
adf88a70 | 44 | typedef struct sd_lldp_packet sd_lldp_packet; |
ad1ad5c8 | 45 | |
ccf86354 | 46 | typedef void (*sd_lldp_callback_t)(sd_lldp *lldp, int event, void *userdata); |
49699bac | 47 | |
7a6f1457 | 48 | int sd_lldp_new(int ifindex, const char *ifname, const struct ether_addr *mac, sd_lldp **ret); |
4afd3348 | 49 | sd_lldp* sd_lldp_unref(sd_lldp *lldp); |
ad1ad5c8 | 50 | |
ad1ad5c8 SS |
51 | int sd_lldp_start(sd_lldp *lldp); |
52 | int sd_lldp_stop(sd_lldp *lldp); | |
53 | ||
54 | int sd_lldp_attach_event(sd_lldp *lldp, sd_event *event, int priority); | |
55 | int sd_lldp_detach_event(sd_lldp *lldp); | |
56 | ||
ccf86354 | 57 | int sd_lldp_set_callback(sd_lldp *lldp, sd_lldp_callback_t cb, void *userdata); |
49699bac | 58 | int sd_lldp_save(sd_lldp *lldp, const char *file); |
176c355b BG |
59 | |
60 | int sd_lldp_packet_read_chassis_id(sd_lldp_packet *tlv, uint8_t *type, uint8_t **data, uint16_t *length); | |
61 | int sd_lldp_packet_read_port_id(sd_lldp_packet *tlv, uint8_t *type, uint8_t **data, uint16_t *length); | |
62 | int sd_lldp_packet_read_ttl(sd_lldp_packet *tlv, uint16_t *ttl); | |
63 | int sd_lldp_packet_read_system_name(sd_lldp_packet *tlv, char **data, uint16_t *length); | |
64 | int sd_lldp_packet_read_system_description(sd_lldp_packet *tlv, char **data, uint16_t *length); | |
65 | int sd_lldp_packet_read_system_capability(sd_lldp_packet *tlv, uint16_t *data); | |
66 | int sd_lldp_packet_read_port_description(sd_lldp_packet *tlv, char **data, uint16_t *length); | |
67 | ||
d8c89d61 BG |
68 | /* IEEE 802.1 organizationally specific TLVs */ |
69 | int sd_lldp_packet_read_port_vlan_id(sd_lldp_packet *tlv, uint16_t *id); | |
70 | int sd_lldp_packet_read_port_protocol_vlan_id(sd_lldp_packet *tlv, uint8_t *flags, uint16_t *id); | |
71 | int sd_lldp_packet_read_vlan_name(sd_lldp_packet *tlv, uint16_t *vlan_id, char **name, uint16_t *length); | |
72 | int sd_lldp_packet_read_management_vid(sd_lldp_packet *tlv, uint16_t *id); | |
73 | int sd_lldp_packet_read_link_aggregation(sd_lldp_packet *tlv, uint8_t *status, uint32_t *id); | |
74 | ||
176c355b BG |
75 | sd_lldp_packet *sd_lldp_packet_ref(sd_lldp_packet *tlv); |
76 | sd_lldp_packet *sd_lldp_packet_unref(sd_lldp_packet *tlv); | |
7434883c | 77 | |
4fc6de5d BG |
78 | int sd_lldp_packet_get_destination_type(sd_lldp_packet *tlv, int *dest); |
79 | ||
7434883c | 80 | int sd_lldp_get_packets(sd_lldp *lldp, sd_lldp_packet ***tlvs); |
04c01369 | 81 | |
4afd3348 LP |
82 | _SD_DEFINE_POINTER_CLEANUP_FUNC(sd_lldp, sd_lldp_unref); |
83 | _SD_DEFINE_POINTER_CLEANUP_FUNC(sd_lldp_packet, sd_lldp_packet_unref); | |
84 | ||
04c01369 LP |
85 | _SD_END_DECLARATIONS; |
86 | ||
87 | #endif |