]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/libsystemd-network/lldp-port.h
networkd: Introduce Link Layer Discovery Protocol (LLDP)
[thirdparty/systemd.git] / src / libsystemd-network / lldp-port.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
25#include <net/ethernet.h>
26
27#include "sd-event.h"
28#include "sd-lldp.h"
29
30typedef struct lldp_port lldp_port;
31
32struct lldp_port {
33 LLDPPortStatus status;
34
35 int ifindex;
36 char *ifname;
37
38 struct ether_addr mac;
39
40 int rawfd;
41
42 sd_event *event;
43 sd_event_source *lldp_port_rx;
44
45 int event_priority;
46
47 void *userdata;
48};
49
50int lldp_port_new(int ifindex,
51 char *ifname,
52 const struct ether_addr *addr,
53 void *userdata,
54 lldp_port **ret);
55void lldp_port_free(lldp_port *p);
56
57DEFINE_TRIVIAL_CLEANUP_FUNC(lldp_port*, lldp_port_free);
58#define _cleanup_lldp_port_free_ _cleanup_(lldp_port_freep)
59
60int lldp_port_start(lldp_port *p);
61int lldp_port_stop(lldp_port *p);