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