1 /* -*- mode: c; c-file-style: "openbsd" -*- */
3 * Copyright (c) 2008 Vincent Bernat <bernat@luffy.cx>
5 * Permission to use, copy, modify, and/or distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
21 /* Definitions prefixed by `LLDP_` are constants from LLDP
22 * specifications. Definitions prefixed by `LLDPD_` are custom
23 * constants that are useful in the context of lldpd and its clients.
26 /* Chassis ID subtype */
27 #define LLDP_CHASSISID_SUBTYPE_CHASSIS 1
28 #define LLDP_CHASSISID_SUBTYPE_IFALIAS 2
29 #define LLDP_CHASSISID_SUBTYPE_PORT 3
30 #define LLDP_CHASSISID_SUBTYPE_LLADDR 4
31 #define LLDP_CHASSISID_SUBTYPE_ADDR 5
32 #define LLDP_CHASSISID_SUBTYPE_IFNAME 6
33 #define LLDP_CHASSISID_SUBTYPE_LOCAL 7
36 #define LLDP_PORTID_SUBTYPE_UNKNOWN 0
37 #define LLDP_PORTID_SUBTYPE_IFALIAS 1
38 #define LLDP_PORTID_SUBTYPE_PORT 2
39 #define LLDP_PORTID_SUBTYPE_LLADDR 3
40 #define LLDP_PORTID_SUBTYPE_ADDR 4
41 #define LLDP_PORTID_SUBTYPE_IFNAME 5
42 #define LLDP_PORTID_SUBTYPE_AGENTCID 6
43 #define LLDP_PORTID_SUBTYPE_LOCAL 7
44 #define LLDP_PORTID_SUBTYPE_MAX LLDP_PORTID_SUBTYPE_LOCAL
46 /* Operational MAU Type field, from RFC 3636 */
47 #define LLDP_DOT3_MAU_AUI 1
48 #define LLDP_DOT3_MAU_10BASE5 2
49 #define LLDP_DOT3_MAU_FOIRL 3
50 #define LLDP_DOT3_MAU_10BASE2 4
51 #define LLDP_DOT3_MAU_10BASET 5
52 #define LLDP_DOT3_MAU_10BASEFP 6
53 #define LLDP_DOT3_MAU_10BASEFB 7
54 #define LLDP_DOT3_MAU_10BASEFL 8
55 #define LLDP_DOT3_MAU_10BROAD36 9
56 #define LLDP_DOT3_MAU_10BASETHD 10
57 #define LLDP_DOT3_MAU_10BASETFD 11
58 #define LLDP_DOT3_MAU_10BASEFLHD 12
59 #define LLDP_DOT3_MAU_10BASEFLFD 13
60 #define LLDP_DOT3_MAU_10BASET4 14
61 #define LLDP_DOT3_MAU_100BASETXHD 15
62 #define LLDP_DOT3_MAU_100BASETXFD 16
63 #define LLDP_DOT3_MAU_100BASEFXHD 17
64 #define LLDP_DOT3_MAU_100BASEFXFD 18
65 #define LLDP_DOT3_MAU_100BASET2HD 19
66 #define LLDP_DOT3_MAU_100BASET2FD 20
67 #define LLDP_DOT3_MAU_1000BASEXHD 21
68 #define LLDP_DOT3_MAU_1000BASEXFD 22
69 #define LLDP_DOT3_MAU_1000BASELXHD 23
70 #define LLDP_DOT3_MAU_1000BASELXFD 24
71 #define LLDP_DOT3_MAU_1000BASESXHD 25
72 #define LLDP_DOT3_MAU_1000BASESXFD 26
73 #define LLDP_DOT3_MAU_1000BASECXHD 27
74 #define LLDP_DOT3_MAU_1000BASECXFD 28
75 #define LLDP_DOT3_MAU_1000BASETHD 29
76 #define LLDP_DOT3_MAU_1000BASETFD 30
77 #define LLDP_DOT3_MAU_10GIGBASEX 31
78 #define LLDP_DOT3_MAU_10GIGBASELX4 32
79 #define LLDP_DOT3_MAU_10GIGBASER 33
80 #define LLDP_DOT3_MAU_10GIGBASEER 34
81 #define LLDP_DOT3_MAU_10GIGBASELR 35
82 #define LLDP_DOT3_MAU_10GIGBASESR 36
83 #define LLDP_DOT3_MAU_10GIGBASEW 37
84 #define LLDP_DOT3_MAU_10GIGBASEEW 38
85 #define LLDP_DOT3_MAU_10GIGBASELW 39
86 #define LLDP_DOT3_MAU_10GIGBASESW 40
88 /* Dot3 Power Devicetype */
89 #define LLDP_DOT3_POWER_PSE 1
90 #define LLDP_DOT3_POWER_PD 2
92 /* Dot3 Power Pairs (RFC 3621) */
93 #define LLDP_DOT3_POWERPAIRS_SIGNAL 1
94 #define LLDP_DOT3_POWERPAIRS_SPARE 2
96 /* Dot3 Power type (for 802.3at) */
97 #define LLDP_DOT3_POWER_8023AT_OFF 0
98 #define LLDP_DOT3_POWER_8023AT_TYPE1 1
99 #define LLDP_DOT3_POWER_8023AT_TYPE2 2
101 /* Dot3 power source */
102 #define LLDP_DOT3_POWER_SOURCE_UNKNOWN 0
103 #define LLDP_DOT3_POWER_SOURCE_PRIMARY 1
104 #define LLDP_DOT3_POWER_SOURCE_PSE 1
105 #define LLDP_DOT3_POWER_SOURCE_BACKUP 2
106 #define LLDP_DOT3_POWER_SOURCE_LOCAL 2
107 #define LLDP_DOT3_POWER_SOURCE_BOTH 3
109 /* Dot3 power priority */
110 #define LLDP_DOT3_POWER_PRIO_UNKNOWN 0
111 #define LLDP_DOT3_POWER_PRIO_CRITICAL 1
112 #define LLDP_DOT3_POWER_PRIO_HIGH 2
113 #define LLDP_DOT3_POWER_PRIO_LOW 3
115 /* PMD Auto-Negotiation Advertised Capability field, from RFC 3636 */
116 #define LLDP_DOT3_LINK_AUTONEG_OTHER 0x8000
117 #define LLDP_DOT3_LINK_AUTONEG_10BASE_T 0x4000
118 #define LLDP_DOT3_LINK_AUTONEG_10BASET_FD 0x2000
119 #define LLDP_DOT3_LINK_AUTONEG_100BASE_T4 0x1000
120 #define LLDP_DOT3_LINK_AUTONEG_100BASE_TX 0x0800
121 #define LLDP_DOT3_LINK_AUTONEG_100BASE_TXFD 0x0400
122 #define LLDP_DOT3_LINK_AUTONEG_100BASE_T2 0x0200
123 #define LLDP_DOT3_LINK_AUTONEG_100BASE_T2FD 0x0100
124 #define LLDP_DOT3_LINK_AUTONEG_FDX_PAUSE 0x0080
125 #define LLDP_DOT3_LINK_AUTONEG_FDX_APAUSE 0x0040
126 #define LLDP_DOT3_LINK_AUTONEG_FDX_SPAUSE 0x0020
127 #define LLDP_DOT3_LINK_AUTONEG_FDX_BPAUSE 0x0010
128 #define LLDP_DOT3_LINK_AUTONEG_1000BASE_X 0x0008
129 #define LLDP_DOT3_LINK_AUTONEG_1000BASE_XFD 0x0004
130 #define LLDP_DOT3_LINK_AUTONEG_1000BASE_T 0x0002
131 #define LLDP_DOT3_LINK_AUTONEG_1000BASE_TFD 0x0001
134 #define LLDP_CAP_OTHER 0x01
135 #define LLDP_CAP_REPEATER 0x02
136 #define LLDP_CAP_BRIDGE 0x04
137 #define LLDP_CAP_WLAN 0x08
138 #define LLDP_CAP_ROUTER 0x10
139 #define LLDP_CAP_TELEPHONE 0x20
140 #define LLDP_CAP_DOCSIS 0x40
141 #define LLDP_CAP_STATION 0x80
143 #define LLDP_PPVID_CAP_SUPPORTED (1 << 1)
144 #define LLDP_PPVID_CAP_ENABLED (1 << 2)
146 /* see http://www.iana.org/assignments/address-family-numbers */
147 #define LLDP_MGMT_ADDR_NONE 0
148 #define LLDP_MGMT_ADDR_IP4 1
149 #define LLDP_MGMT_ADDR_IP6 2
151 #define LLDP_MGMT_IFACE_UNKNOWN 1
152 #define LLDP_MGMT_IFACE_IFINDEX 2
153 #define LLDP_MGMT_IFACE_SYSPORT 3
155 #define LLDP_MED_CLASS_I 1
156 #define LLDP_MED_CLASS_II 2
157 #define LLDP_MED_CLASS_III 3
158 #define LLDP_MED_NETWORK_DEVICE 4
160 /* LLDP MED application ttpes */
161 #define LLDP_MED_APPTYPE_UNDEFINED 0
162 #define LLDP_MED_APPTYPE_VOICE 1
163 #define LLDP_MED_APPTYPE_VOICESIGNAL 2
164 #define LLDP_MED_APPTYPE_GUESTVOICE 3
165 #define LLDP_MED_APPTYPE_GUESTVOICESIGNAL 4
166 #define LLDP_MED_APPTYPE_SOFTPHONEVOICE 5
167 #define LLDP_MED_APPTYPE_VIDEOCONFERENCE 6
168 #define LLDP_MED_APPTYPE_VIDEOSTREAM 7
169 #define LLDP_MED_APPTYPE_VIDEOSIGNAL 8
170 #define LLDP_MED_APPTYPE_LAST LLDP_MED_APPTYPE_VIDEOSIGNAL
172 /* LLDP MED location formats */
173 #define LLDP_MED_LOCFORMAT_COORD 1
174 #define LLDP_MED_LOCFORMAT_CIVIC 2
175 #define LLDP_MED_LOCFORMAT_ELIN 3
176 #define LLDP_MED_LOCFORMAT_LAST LLDP_MED_LOCFORMAT_ELIN
178 #define LLDP_MED_LOCATION_GEOID_WGS84 1
179 #define LLDP_MED_LOCATION_GEOID_NAD83 2
180 #define LLDP_MED_LOCATION_GEOID_NAD83_MLLW 3
182 #define LLDP_MED_LOCATION_ALTITUDE_UNIT_METER 1
183 #define LLDP_MED_LOCATION_ALTITUDE_UNIT_FLOOR 2
185 /* LLDP MED power related constants */
186 #define LLDP_MED_POW_TYPE_PSE 1
187 #define LLDP_MED_POW_TYPE_PD 2
188 #define LLDP_MED_POW_TYPE_RESERVED 3
190 #define LLDP_MED_POW_SOURCE_UNKNOWN 1
191 #define LLDP_MED_POW_SOURCE_PRIMARY 2
192 #define LLDP_MED_POW_SOURCE_BACKUP 3
193 #define LLDP_MED_POW_SOURCE_RESERVED 4
194 #define LLDP_MED_POW_SOURCE_PSE 5
195 #define LLDP_MED_POW_SOURCE_LOCAL 6
196 #define LLDP_MED_POW_SOURCE_BOTH 7
198 #define LLDP_MED_POW_PRIO_UNKNOWN 0
199 #define LLDP_MED_POW_PRIO_CRITICAL 1
200 #define LLDP_MED_POW_PRIO_HIGH 2
201 #define LLDP_MED_POW_PRIO_LOW 3
203 /* LLDP MED capabilities */
204 #define LLDP_MED_CAP_CAP 0x01
205 #define LLDP_MED_CAP_POLICY 0x02
206 #define LLDP_MED_CAP_LOCATION 0x04
207 #define LLDP_MED_CAP_MDI_PSE 0x08
208 #define LLDP_MED_CAP_MDI_PD 0x10
209 #define LLDP_MED_CAP_IV 0x20
211 /* Protocol constants for multi-protocol lldpd */
212 #define LLDPD_MODE_LLDP 1
213 #define LLDPD_MODE_CDPV1 2
214 #define LLDPD_MODE_CDPV2 3
215 #define LLDPD_MODE_SONMP 4
216 #define LLDPD_MODE_EDP 5
217 #define LLDPD_MODE_FDP 6
218 #define LLDPD_MODE_MAX LLDPD_MODE_FDP
221 /* Bond slave src mac type constants */
222 #define LLDP_BOND_SLAVE_SRC_MAC_TYPE_UNKNOWN 0
223 #define LLDP_BOND_SLAVE_SRC_MAC_TYPE_REAL 1
224 #define LLDP_BOND_SLAVE_SRC_MAC_TYPE_ZERO 2
225 #define LLDP_BOND_SLAVE_SRC_MAC_TYPE_FIXED 3
226 #define LLDP_BOND_SLAVE_SRC_MAC_TYPE_LOCALLY_ADMINISTERED 4
227 #define LLDP_BOND_SLAVE_SRC_MAC_TYPE_MAX \
228 LLDP_BOND_SLAVE_SRC_MAC_TYPE_LOCALLY_ADMINISTERED