]>
Commit | Line | Data |
---|---|---|
e735f4d4 MP |
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 | #define LLDP_MULTICAST_ADDR { 0x01, 0x80, 0xc2, 0x00, 0x00, 0x0e } | |
26 | ||
27 | #define ETHERTYPE_LLDP 0x88cc | |
28 | ||
29 | /* IEEE 802.3AB Clause 9: TLV Types */ | |
30 | typedef enum LLDPTypes { | |
31 | LLDP_TYPE_END = 0, | |
32 | LLDP_TYPE_CHASSIS_ID = 1, | |
33 | LLDP_TYPE_PORT_ID = 2, | |
34 | LLDP_TYPE_TTL = 3, | |
35 | LLDP_TYPE_PORT_DESCRIPTION = 4, | |
36 | LLDP_TYPE_SYSTEM_NAME = 5, | |
37 | LLDP_TYPE_SYSTEM_DESCRIPTION = 6, | |
38 | LLDP_TYPE_SYSTEM_CAPABILITIES = 7, | |
39 | LLDP_TYPE_MGMT_ADDRESS = 8, | |
40 | LLDP_TYPE_PRIVATE = 127, | |
41 | _LLDP_TYPE_MAX, | |
42 | _LLDP_TYPE_INVALID = -1, | |
43 | } LLDPTypes; | |
44 | ||
45 | /* IEEE 802.3AB Clause 9.5.2: Chassis subtypes */ | |
46 | typedef enum LLDPChassisSubtypes { | |
47 | LLDP_CHASSIS_SUBTYPE_RESERVED = 0, | |
48 | LLDP_CHASSIS_SUBTYPE_CHASSIS_COMPONENT = 1, | |
49 | LLDP_CHASSIS_SUBTYPE_INTERFACE_ALIAS = 2, | |
50 | LLDP_CHASSIS_SUBTYPE_PORT_COMPONENT = 3, | |
51 | LLDP_CHASSIS_SUBTYPE_MAC_ADDRESS = 4, | |
52 | LLDP_CHASSIS_SUBTYPE_NETWORK_ADDRESS = 5, | |
53 | LLDP_CHASSIS_SUBTYPE_INTERFACE_NAME = 6, | |
54 | LLDP_CHASSIS_SUBTYPE_LOCALLY_ASSIGNED = 7, | |
55 | _LLDP_CHASSIS_SUBTYPE_MAX, | |
56 | _LLDP_CHASSIS_SUBTYPE_INVALID = -1, | |
57 | } LLDPChassisSubtypes; | |
58 | ||
59 | /* IEEE 802.3AB Clause 9.5.3: Port subtype */ | |
60 | typedef enum LLDPPortSubtypes { | |
61 | LLDP_PORT_SUBTYPE_RESERVED = 0, | |
62 | LLDP_PORT_SUBTYPE_INTERFACE_ALIAS = 1, | |
63 | LLDP_PORT_SUBTYPE_PORT_COMPONENT = 2, | |
64 | LLDP_PORT_SUBTYPE_MAC_ADDRESS = 3, | |
65 | LLDP_PORT_SUBTYPE_NETWORK = 4, | |
66 | LLDP_PORT_SUBTYPE_INTERFACE_NAME = 5, | |
67 | LLDP_PORT_SUBTYPE_AGENT_CIRCUIT_ID = 6, | |
68 | LLDP_PORT_SUBTYPE_LOCALLY_ASSIGNED = 7, | |
69 | _LLDP_PORT_SUBTYPE_MAX, | |
70 | _LLDP_PORT_SUBTYPE_INVALID = -1 | |
71 | } LLDPPortSubtypes; | |
72 | ||
73 | typedef enum LLDPSystemCapabilities { | |
74 | LLDP_SYSTEM_CAPABILITIES_OTHER = 1 << 0, | |
75 | LLDP_SYSTEM_CAPABILITIES_REPEATER = 1 << 1, | |
76 | LLDP_SYSTEM_CAPABILITIES_BRIDGE = 1 << 2, | |
77 | LLDP_SYSTEM_CAPABILITIES_WLAN_AP = 1 << 3, | |
78 | LLDP_SYSTEM_CAPABILITIES_ROUTER = 1 << 4, | |
79 | LLDP_SYSTEM_CAPABILITIES_PHONE = 1 << 5, | |
80 | LLDP_SYSTEM_CAPABILITIES_DOCSIS = 1 << 6, | |
81 | LLDP_SYSTEM_CAPABILITIES_STATION = 1 << 7, | |
82 | LLDP_SYSTEM_CAPABILITIES_CVLAN = 1 << 8, | |
83 | LLDP_SYSTEM_CAPABILITIES_SVLAN = 1 << 9, | |
84 | LLDP_SYSTEM_CAPABILITIES_TPMR = 1 << 10, | |
85 | _LLDP_SYSTEM_CAPABILITIES_MAX, | |
86 | _LLDP_SYSTEM_CAPABILITIES_INVALID = -1, | |
87 | } LLDPSystemCapabilities; | |
88 | ||
89 | typedef enum LLDPMedSubtype { | |
90 | LLDP_MED_SUBTYPE_RESERVED = 0, | |
91 | LLDP_MED_SUBTYPE_CAPABILITIES = 1, | |
92 | LLDP_MED_SUBTYPE_NETWORK_POLICY = 2, | |
93 | LLDP_MED_SUBTYPE_LOCATION_ID = 3, | |
94 | LLDP_MED_SUBTYPE_EXTENDED_PVMDI = 4, | |
95 | LLDP_MED_SUBTYPE_INV_HWREV = 5, | |
96 | LLDP_MED_SUBTYPE_INV_FWREV = 6, | |
97 | LLDP_MED_SUBTYPE_INV_SWREV = 7, | |
98 | LLDP_MED_SUBTYPE_INV_SERIAL = 8, | |
99 | LLDP_MED_SUBTYPE_INV_MANUFACTURER = 9, | |
100 | LLDP_MED_SUBTYPE_INV_MODELNAME = 10, | |
101 | LLDP_MED_SUBTYPE_INV_ASSETID = 11, | |
102 | _LLDP_MED_SUBTYPE_MAX, | |
103 | _LLDP_MED_SUBTYPE_INVALID = -1, | |
104 | } LLDPMedSubtype; | |
105 | ||
106 | typedef enum LLDPMedCapability { | |
107 | LLDP_MED_CAPABILITY_CAPAPILITIES = 1 << 0, | |
108 | LLDP_MED_CAPABILITY_NETWORK_POLICY = 1 << 1, | |
109 | LLDP_MED_CAPABILITY_LOCATION_ID = 1 << 2, | |
110 | LLDP_MED_CAPABILITY_EXTENDED_PSE = 1 << 3, | |
111 | LLDP_MED_CAPABILITY_EXTENDED_PD = 1 << 4, | |
112 | LLDP_MED_CAPABILITY_INVENTORY = 1 << 5, | |
113 | LLDP_MED_CAPABILITY_MAX, | |
114 | LLDP_MED_CAPABILITY_INVALID = -1, | |
115 | } LLDPMedCapability; | |
6300502b MP |
116 | |
117 | #define LLDP_OUI_802_1 (uint8_t[]) { 0x00, 0x80, 0xc2 } | |
118 | #define LLDP_OUI_802_3 (uint8_t[]) { 0x00, 0x12, 0x0f } | |
119 | ||
120 | enum { | |
121 | LLDP_OUI_SUBTYPE_802_1_PORT_VLAN_ID = 1, | |
122 | LLDP_OUI_SUBTYPE_802_1_PORT_PROTOCOL_VLAN_ID = 2, | |
123 | LLDP_OUI_SUBTYPE_802_1_VLAN_NAME = 3, | |
124 | LLDP_OUI_SUBTYPE_802_1_PROTOCOL_IDENTITY = 4, | |
125 | LLDP_OUI_SUBTYPE_802_1_VID_USAGE_DIGEST = 5, | |
126 | LLDP_OUI_SUBTYPE_802_1_MANAGEMENT_VID = 6, | |
127 | LLDP_OUI_SUBTYPE_802_1_LINK_AGGREGATION = 7, | |
128 | }; |