]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/systemd/sd-lldp.h
Merge pull request #1945 from phomes/indentation-fix
[thirdparty/systemd.git] / src / systemd / sd-lldp.h
CommitLineData
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
07630cea 26#include <net/ethernet.h>
04c01369 27#include <inttypes.h>
07630cea 28
ad1ad5c8 29#include "sd-event.h"
04c01369
LP
30#include "_sd-common.h"
31
32_SD_BEGIN_DECLARATIONS;
ad1ad5c8 33
9ef61f2e
DH
34enum {
35 SD_LLDP_EVENT_UPDATE_INFO = 0,
36};
37
4fc6de5d
BG
38enum {
39 SD_LLDP_DESTINATION_TYPE_NEAREST_BRIDGE,
40 SD_LLDP_DESTINATION_TYPE_NEAREST_NON_TPMR_BRIDGE,
41 SD_LLDP_DESTINATION_TYPE_NEAREST_CUSTOMER_BRIDGE,
42};
43
ad1ad5c8 44typedef struct sd_lldp sd_lldp;
adf88a70 45typedef struct sd_lldp_packet sd_lldp_packet;
ad1ad5c8 46
49699bac
SS
47typedef void (*sd_lldp_cb_t)(sd_lldp *lldp, int event, void *userdata);
48
7a6f1457 49int sd_lldp_new(int ifindex, const char *ifname, const struct ether_addr *mac, sd_lldp **ret);
ad1ad5c8
SS
50void sd_lldp_free(sd_lldp *lldp);
51
ad1ad5c8
SS
52int sd_lldp_start(sd_lldp *lldp);
53int sd_lldp_stop(sd_lldp *lldp);
54
55int sd_lldp_attach_event(sd_lldp *lldp, sd_event *event, int priority);
56int sd_lldp_detach_event(sd_lldp *lldp);
57
49699bac
SS
58int sd_lldp_set_callback(sd_lldp *lldp, sd_lldp_cb_t cb, void *userdata);
59int sd_lldp_save(sd_lldp *lldp, const char *file);
176c355b
BG
60
61int sd_lldp_packet_read_chassis_id(sd_lldp_packet *tlv, uint8_t *type, uint8_t **data, uint16_t *length);
62int sd_lldp_packet_read_port_id(sd_lldp_packet *tlv, uint8_t *type, uint8_t **data, uint16_t *length);
63int sd_lldp_packet_read_ttl(sd_lldp_packet *tlv, uint16_t *ttl);
64int sd_lldp_packet_read_system_name(sd_lldp_packet *tlv, char **data, uint16_t *length);
65int sd_lldp_packet_read_system_description(sd_lldp_packet *tlv, char **data, uint16_t *length);
66int sd_lldp_packet_read_system_capability(sd_lldp_packet *tlv, uint16_t *data);
67int sd_lldp_packet_read_port_description(sd_lldp_packet *tlv, char **data, uint16_t *length);
68
d8c89d61
BG
69/* IEEE 802.1 organizationally specific TLVs */
70int sd_lldp_packet_read_port_vlan_id(sd_lldp_packet *tlv, uint16_t *id);
71int sd_lldp_packet_read_port_protocol_vlan_id(sd_lldp_packet *tlv, uint8_t *flags, uint16_t *id);
72int sd_lldp_packet_read_vlan_name(sd_lldp_packet *tlv, uint16_t *vlan_id, char **name, uint16_t *length);
73int sd_lldp_packet_read_management_vid(sd_lldp_packet *tlv, uint16_t *id);
74int sd_lldp_packet_read_link_aggregation(sd_lldp_packet *tlv, uint8_t *status, uint32_t *id);
75
176c355b
BG
76sd_lldp_packet *sd_lldp_packet_ref(sd_lldp_packet *tlv);
77sd_lldp_packet *sd_lldp_packet_unref(sd_lldp_packet *tlv);
7434883c 78
4fc6de5d
BG
79int sd_lldp_packet_get_destination_type(sd_lldp_packet *tlv, int *dest);
80
7434883c 81int sd_lldp_get_packets(sd_lldp *lldp, sd_lldp_packet ***tlvs);
04c01369
LP
82
83_SD_END_DECLARATIONS;
84
85#endif