]>
Commit | Line | Data |
---|---|---|
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 | ||
7a6f1457 TG |
30 | #include "util.h" |
31 | ||
ad1ad5c8 SS |
32 | typedef struct lldp_port lldp_port; |
33 | ||
8955cf0a DH |
34 | typedef enum LLDPPortStatus { |
35 | LLDP_PORT_STATUS_NONE, | |
36 | LLDP_PORT_STATUS_ENABLED, | |
37 | LLDP_PORT_STATUS_DISABLED, | |
38 | _LLDP_PORT_STATUS_MAX, | |
39 | _LLDP_PORT_STATUS_INVALID = -1, | |
40 | } LLDPPortStatus; | |
41 | ||
ad1ad5c8 SS |
42 | struct lldp_port { |
43 | LLDPPortStatus status; | |
44 | ||
45 | int ifindex; | |
46 | char *ifname; | |
47 | ||
48 | struct ether_addr mac; | |
49 | ||
50 | int rawfd; | |
51 | ||
52 | sd_event *event; | |
53 | sd_event_source *lldp_port_rx; | |
54 | ||
55 | int event_priority; | |
56 | ||
57 | void *userdata; | |
58 | }; | |
59 | ||
60 | int lldp_port_new(int ifindex, | |
7a6f1457 | 61 | const char *ifname, |
ad1ad5c8 SS |
62 | const struct ether_addr *addr, |
63 | void *userdata, | |
64 | lldp_port **ret); | |
65 | void lldp_port_free(lldp_port *p); | |
66 | ||
67 | DEFINE_TRIVIAL_CLEANUP_FUNC(lldp_port*, lldp_port_free); | |
68 | #define _cleanup_lldp_port_free_ _cleanup_(lldp_port_freep) | |
69 | ||
70 | int lldp_port_start(lldp_port *p); | |
71 | int lldp_port_stop(lldp_port *p); |