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