]> git.ipfire.org Git - thirdparty/lldpd.git/blob - src/lldp.h
06a15d67cf451fb558697bb834a7148674abebae
[thirdparty/lldpd.git] / src / lldp.h
1 /*
2 * Copyright (c) 2008 Vincent Bernat <bernat@luffy.cx>
3 *
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17 #ifndef _LLDP_H
18 #define _LLDP_H
19
20 /* Should be defined in net/ethertypes.h */
21 #ifndef ETHERTYPE_LLDP
22 #define ETHERTYPE_LLDP 0x88cc
23 #endif
24
25 #define LLDP_MULTICAST_ADDR { \
26 0x01, 0x80, 0xc2, 0x00, 0x00, 0x0e \
27 }
28
29 enum {
30 LLDP_TLV_END = 0,
31 LLDP_TLV_CHASSIS_ID = 1,
32 LLDP_TLV_PORT_ID = 2,
33 LLDP_TLV_TTL = 3,
34 LLDP_TLV_PORT_DESCR = 4,
35 LLDP_TLV_SYSTEM_NAME = 5,
36 LLDP_TLV_SYSTEM_DESCR = 6,
37 LLDP_TLV_SYSTEM_CAP = 7,
38 LLDP_TLV_MGMT_ADDR = 8,
39 LLDP_TLV_ORG = 127
40 };
41
42 #define LLDP_TLV_ORG_DOT1 {0x00, 0x80, 0xc2}
43 #define LLDP_TLV_ORG_DOT3 {0x00, 0x12, 0x0f}
44 #define LLDP_TLV_ORG_MED {0x00, 0x12, 0xbb}
45
46 enum {
47 LLDP_TLV_DOT1_PVID = 1,
48 LLDP_TLV_DOT1_PPVID = 2,
49 LLDP_TLV_DOT1_VLANNAME = 3,
50 LLDP_TLV_DOT1_PI = 4
51 };
52
53 enum {
54 LLDP_TLV_DOT3_MAC = 1,
55 LLDP_TLV_DOT3_POWER = 2,
56 LLDP_TLV_DOT3_LA = 3,
57 LLDP_TLV_DOT3_MFS = 4
58 };
59
60 enum {
61 LLDP_CHASSISID_SUBTYPE_CHASSIS = 1,
62 LLDP_CHASSISID_SUBTYPE_IFALIAS = 2,
63 LLDP_CHASSISID_SUBTYPE_PORT = 3,
64 LLDP_CHASSISID_SUBTYPE_LLADDR = 4,
65 LLDP_CHASSISID_SUBTYPE_ADDR = 5,
66 LLDP_CHASSISID_SUBTYPE_IFNAME = 6,
67 LLDP_CHASSISID_SUBTYPE_LOCAL = 7
68 };
69
70 enum {
71 LLDP_PORTID_SUBTYPE_IFALIAS = 1,
72 LLDP_PORTID_SUBTYPE_PORT = 2,
73 LLDP_PORTID_SUBTYPE_LLADDR = 3,
74 LLDP_PORTID_SUBTYPE_ADDR = 4,
75 LLDP_PORTID_SUBTYPE_IFNAME = 5,
76 LLDP_PORTID_SUBTYPE_AGENTCID = 6,
77 LLDP_PORTID_SUBTYPE_LOCAL = 7
78 };
79
80 /* Operational MAU Type field, from RFC 3636 */
81 #define LLDP_DOT3_MAU_AUI 1
82 #define LLDP_DOT3_MAU_10BASE5 2
83 #define LLDP_DOT3_MAU_FOIRL 3
84 #define LLDP_DOT3_MAU_10BASE2 4
85 #define LLDP_DOT3_MAU_10BASET 5
86 #define LLDP_DOT3_MAU_10BASEFP 6
87 #define LLDP_DOT3_MAU_10BASEFB 7
88 #define LLDP_DOT3_MAU_10BASEFL 8
89 #define LLDP_DOT3_MAU_10BROAD36 9
90 #define LLDP_DOT3_MAU_10BASETHD 10
91 #define LLDP_DOT3_MAU_10BASETFD 11
92 #define LLDP_DOT3_MAU_10BASEFLHD 12
93 #define LLDP_DOT3_MAU_10BASEFLDF 13
94 #define LLDP_DOT3_MAU_10BASET4 14
95 #define LLDP_DOT3_MAU_100BASETXHD 15
96 #define LLDP_DOT3_MAU_100BASETXFD 16
97 #define LLDP_DOT3_MAU_100BASEFXHD 17
98 #define LLDP_DOT3_MAU_100BASEFXFD 18
99 #define LLDP_DOT3_MAU_100BASET2HD 19
100 #define LLDP_DOT3_MAU_100BASET2DF 20
101 #define LLDP_DOT3_MAU_1000BASEXHD 21
102 #define LLDP_DOT3_MAU_1000BASEXFD 22
103 #define LLDP_DOT3_MAU_1000BASELXHD 23
104 #define LLDP_DOT3_MAU_1000BASELXFD 24
105 #define LLDP_DOT3_MAU_1000BASESXHD 25
106 #define LLDP_DOT3_MAU_1000BASESXFD 26
107 #define LLDP_DOT3_MAU_1000BASECXHD 27
108 #define LLDP_DOT3_MAU_1000BASECXFD 28
109 #define LLDP_DOT3_MAU_1000BASETHD 29
110 #define LLDP_DOT3_MAU_1000BASETFD 30
111 #define LLDP_DOT3_MAU_10GIGBASEX 31
112 #define LLDP_DOT3_MAU_10GIGBASELX4 32
113 #define LLDP_DOT3_MAU_10GIGBASER 33
114 #define LLDP_DOT3_MAU_10GIGBASEER 34
115 #define LLDP_DOT3_MAU_10GIGBASELR 35
116 #define LLDP_DOT3_MAU_10GIGBASESR 36
117 #define LLDP_DOT3_MAU_10GIGBASEW 37
118 #define LLDP_DOT3_MAU_10GIGBASEEW 38
119 #define LLDP_DOT3_MAU_10GIGBASELW 39
120 #define LLDP_DOT3_MAU_10GIGBASESW 40
121
122 /* Dot3 Power Devicetype */
123 #define LLDP_DOT3_POWER_PSE 1
124 #define LLDP_DOT3_POWER_PD 2
125
126 /* Dot3 Power Pairs (RFC 3621) */
127 #define LLDP_DOT3_POWERPAIRS_SIGNAL 1
128 #define LLDP_DOT3_POWERPAIRS_SPARE 2
129
130 /* Dot3 Power type (for 802.3at) */
131 #define LLDP_DOT3_POWER_8023AT_OFF 0
132 #define LLDP_DOT3_POWER_8023AT_TYPE1 1
133 #define LLDP_DOT3_POWER_8023AT_TYPE2 2
134
135 /* Dot3 power source */
136 #define LLDP_DOT3_POWER_SOURCE_UNKNOWN 0
137 #define LLDP_DOT3_POWER_SOURCE_PRIMARY 1
138 #define LLDP_DOT3_POWER_SOURCE_PSE 1
139 #define LLDP_DOT3_POWER_SOURCE_BACKUP 2
140 #define LLDP_DOT3_POWER_SOURCE_BOTH 3
141
142 /* Dot3 power priority */
143 #define LLDP_DOT3_POWER_PRIO_UNKNOWN 0
144 #define LLDP_DOT3_POWER_PRIO_CRITICAL 1
145 #define LLDP_DOT3_POWER_PRIO_HIGH 2
146 #define LLDP_DOT3_POWER_PRIO_LOW 3
147
148 /* PMD Auto-Negotiation Advertised Capability field, from RFC 3636 */
149 #define LLDP_DOT3_LINK_AUTONEG_OTHER 0x8000
150 #define LLDP_DOT3_LINK_AUTONEG_10BASE_T 0x4000
151 #define LLDP_DOT3_LINK_AUTONEG_10BASET_FD 0x2000
152 #define LLDP_DOT3_LINK_AUTONEG_100BASE_T4 0x1000
153 #define LLDP_DOT3_LINK_AUTONEG_100BASE_TX 0x0800
154 #define LLDP_DOT3_LINK_AUTONEG_100BASE_TXFD 0x0400
155 #define LLDP_DOT3_LINK_AUTONEG_100BASE_T2 0x0200
156 #define LLDP_DOT3_LINK_AUTONEG_100BASE_T2FD 0x0100
157 #define LLDP_DOT3_LINK_AUTONEG_FDX_PAUSE 0x0080
158 #define LLDP_DOT3_LINK_AUTONEG_FDX_APAUSE 0x0040
159 #define LLDP_DOT3_LINK_AUTONEG_FDX_SPAUSE 0x0020
160 #define LLDP_DOT3_LINK_AUTONEG_FDX_BPAUSE 0x0010
161 #define LLDP_DOT3_LINK_AUTONEG_1000BASE_X 0x0008
162 #define LLDP_DOT3_LINK_AUTONEG_1000BASE_XFD 0x0004
163 #define LLDP_DOT3_LINK_AUTONEG_1000BASE_T 0x0002
164 #define LLDP_DOT3_LINK_AUTONEG_1000BASE_TFD 0x0001
165
166 #define LLDP_CAP_OTHER 0x01
167 #define LLDP_CAP_REPEATER 0x02
168 #define LLDP_CAP_BRIDGE 0x04
169 #define LLDP_CAP_WLAN 0x08
170 #define LLDP_CAP_ROUTER 0x10
171 #define LLDP_CAP_TELEPHONE 0x20
172 #define LLDP_CAP_DOCSIS 0x40
173 #define LLDP_CAP_STATION 0x80
174
175 /* see http://www.iana.org/assignments/address-family-numbers */
176 enum {
177 LLDP_MGMT_ADDR_IP4 = 1,
178 LLDP_MGMT_ADDR_IP6 = 2
179 };
180
181 enum {
182 LLDP_MGMT_IFACE_UNKNOWN = 1,
183 LLDP_MGMT_IFACE_IFINDEX = 2,
184 LLDP_MGMT_IFACE_SYSPORT = 3
185 };
186
187 #ifdef ENABLE_LLDPMED
188 enum {
189 LLDP_TLV_MED_CAP = 1,
190 LLDP_TLV_MED_POLICY = 2,
191 LLDP_TLV_MED_LOCATION = 3,
192 LLDP_TLV_MED_MDI = 4,
193 LLDP_TLV_MED_IV_HW = 5,
194 LLDP_TLV_MED_IV_FW = 6,
195 LLDP_TLV_MED_IV_SW = 7,
196 LLDP_TLV_MED_IV_SN = 8,
197 LLDP_TLV_MED_IV_MANUF = 9,
198 LLDP_TLV_MED_IV_MODEL = 10,
199 LLDP_TLV_MED_IV_ASSET = 11
200 };
201
202 #define LLDPMED_CLASS_I 1
203 #define LLDPMED_CLASS_II 2
204 #define LLDPMED_CLASS_III 3
205 #define LLDPMED_NETWORK_DEVICE 4
206
207 #define LLDPMED_APPTYPE_VOICE 1
208 #define LLDPMED_APPTYPE_VOICESIGNAL 2
209 #define LLDPMED_APPTYPE_GUESTVOICE 3
210 #define LLDPMED_APPTYPE_GUESTVOICESIGNAL 4
211 #define LLDPMED_APPTYPE_SOFTPHONEVOICE 5
212 #define LLDPMED_APPTYPE_VIDEOCONFERENCE 6
213 #define LLDPMED_APPTYPE_VIDEOSTREAM 7
214 #define LLDPMED_APPTYPE_VIDEOSIGNAL 8
215 #define LLDPMED_APPTYPE_LAST LLDPMED_APPTYPE_VIDEOSIGNAL
216
217 #define LLDPMED_LOCFORMAT_COORD 1
218 #define LLDPMED_LOCFORMAT_CIVIC 2
219 #define LLDPMED_LOCFORMAT_ELIN 3
220 #define LLDPMED_LOCFORMAT_LAST LLDPMED_LOCFORMAT_ELIN
221
222 #define LLDPMED_POW_TYPE_PSE 1
223 #define LLDPMED_POW_TYPE_PD 2
224 #define LLDPMED_POW_TYPE_RESERVED 3
225
226 #define LLDPMED_POW_SOURCE_UNKNOWN 1
227 #define LLDPMED_POW_SOURCE_PRIMARY 2
228 #define LLDPMED_POW_SOURCE_BACKUP 3
229 #define LLDPMED_POW_SOURCE_RESERVED 4
230 #define LLDPMED_POW_SOURCE_PSE 5
231 #define LLDPMED_POW_SOURCE_LOCAL 6
232 #define LLDPMED_POW_SOURCE_BOTH 7
233
234 #define LLDPMED_POW_PRIO_UNKNOWN 0
235 #define LLDPMED_POW_PRIO_CRITICAL 1
236 #define LLDPMED_POW_PRIO_HIGH 2
237 #define LLDPMED_POW_PRIO_LOW 3
238
239 #define LLDPMED_CAP_CAP 0x01
240 #define LLDPMED_CAP_POLICY 0x02
241 #define LLDPMED_CAP_LOCATION 0x04
242 #define LLDPMED_CAP_MDI_PSE 0x08
243 #define LLDPMED_CAP_MDI_PD 0x10
244 #define LLDPMED_CAP_IV 0x20
245
246 #endif /* ENABLE_LLDPMED */
247
248 #endif /* _LLDP_H */