]> git.ipfire.org Git - thirdparty/lldpd.git/blame - src/lldp-const.h
fixedpoint: fix buffer overflow in fixed point computations
[thirdparty/lldpd.git] / src / lldp-const.h
CommitLineData
4b292b55
VB
1/* -*- mode: c; c-file-style: "openbsd" -*- */
2/*
3 * Copyright (c) 2008 Vincent Bernat <bernat@luffy.cx>
4 *
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.
8 *
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.
16 */
17
18#ifndef _LLDP_H
19#define _LLDP_H
20
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.
24 */
25
b1bebd3f 26#define LLDP_TLV_ORG 127
cd5de7a2
AA
27#define LLDP_TLV_ORG_OUI_LEN 3
28#define LLDP_TLV_ORG_OUI_INFO_MAXLEN 507
b1bebd3f 29
4b292b55
VB
30/* Chassis ID subtype */
31#define LLDP_CHASSISID_SUBTYPE_CHASSIS 1
32#define LLDP_CHASSISID_SUBTYPE_IFALIAS 2
33#define LLDP_CHASSISID_SUBTYPE_PORT 3
34#define LLDP_CHASSISID_SUBTYPE_LLADDR 4
35#define LLDP_CHASSISID_SUBTYPE_ADDR 5
36#define LLDP_CHASSISID_SUBTYPE_IFNAME 6
37#define LLDP_CHASSISID_SUBTYPE_LOCAL 7
38
39/* Port ID subtype */
8fbd3195 40#define LLDP_PORTID_SUBTYPE_UNKNOWN 0
4b292b55
VB
41#define LLDP_PORTID_SUBTYPE_IFALIAS 1
42#define LLDP_PORTID_SUBTYPE_PORT 2
43#define LLDP_PORTID_SUBTYPE_LLADDR 3
44#define LLDP_PORTID_SUBTYPE_ADDR 4
45#define LLDP_PORTID_SUBTYPE_IFNAME 5
46#define LLDP_PORTID_SUBTYPE_AGENTCID 6
47#define LLDP_PORTID_SUBTYPE_LOCAL 7
8fbd3195 48#define LLDP_PORTID_SUBTYPE_MAX LLDP_PORTID_SUBTYPE_LOCAL
4b292b55
VB
49
50/* Operational MAU Type field, from RFC 3636 */
51#define LLDP_DOT3_MAU_AUI 1
52#define LLDP_DOT3_MAU_10BASE5 2
53#define LLDP_DOT3_MAU_FOIRL 3
54#define LLDP_DOT3_MAU_10BASE2 4
55#define LLDP_DOT3_MAU_10BASET 5
56#define LLDP_DOT3_MAU_10BASEFP 6
57#define LLDP_DOT3_MAU_10BASEFB 7
58#define LLDP_DOT3_MAU_10BASEFL 8
59#define LLDP_DOT3_MAU_10BROAD36 9
60#define LLDP_DOT3_MAU_10BASETHD 10
61#define LLDP_DOT3_MAU_10BASETFD 11
62#define LLDP_DOT3_MAU_10BASEFLHD 12
fda729fd 63#define LLDP_DOT3_MAU_10BASEFLFD 13
4b292b55
VB
64#define LLDP_DOT3_MAU_10BASET4 14
65#define LLDP_DOT3_MAU_100BASETXHD 15
66#define LLDP_DOT3_MAU_100BASETXFD 16
67#define LLDP_DOT3_MAU_100BASEFXHD 17
68#define LLDP_DOT3_MAU_100BASEFXFD 18
69#define LLDP_DOT3_MAU_100BASET2HD 19
5fa8eaa5 70#define LLDP_DOT3_MAU_100BASET2FD 20
4b292b55
VB
71#define LLDP_DOT3_MAU_1000BASEXHD 21
72#define LLDP_DOT3_MAU_1000BASEXFD 22
73#define LLDP_DOT3_MAU_1000BASELXHD 23
74#define LLDP_DOT3_MAU_1000BASELXFD 24
75#define LLDP_DOT3_MAU_1000BASESXHD 25
76#define LLDP_DOT3_MAU_1000BASESXFD 26
77#define LLDP_DOT3_MAU_1000BASECXHD 27
78#define LLDP_DOT3_MAU_1000BASECXFD 28
79#define LLDP_DOT3_MAU_1000BASETHD 29
80#define LLDP_DOT3_MAU_1000BASETFD 30
81#define LLDP_DOT3_MAU_10GIGBASEX 31
82#define LLDP_DOT3_MAU_10GIGBASELX4 32
83#define LLDP_DOT3_MAU_10GIGBASER 33
84#define LLDP_DOT3_MAU_10GIGBASEER 34
85#define LLDP_DOT3_MAU_10GIGBASELR 35
86#define LLDP_DOT3_MAU_10GIGBASESR 36
87#define LLDP_DOT3_MAU_10GIGBASEW 37
88#define LLDP_DOT3_MAU_10GIGBASEEW 38
89#define LLDP_DOT3_MAU_10GIGBASELW 39
90#define LLDP_DOT3_MAU_10GIGBASESW 40
91
92/* Dot3 Power Devicetype */
93#define LLDP_DOT3_POWER_PSE 1
94#define LLDP_DOT3_POWER_PD 2
95
96/* Dot3 Power Pairs (RFC 3621) */
97#define LLDP_DOT3_POWERPAIRS_SIGNAL 1
98#define LLDP_DOT3_POWERPAIRS_SPARE 2
99
100/* Dot3 Power type (for 802.3at) */
101#define LLDP_DOT3_POWER_8023AT_OFF 0
102#define LLDP_DOT3_POWER_8023AT_TYPE1 1
103#define LLDP_DOT3_POWER_8023AT_TYPE2 2
104
105/* Dot3 power source */
106#define LLDP_DOT3_POWER_SOURCE_UNKNOWN 0
107#define LLDP_DOT3_POWER_SOURCE_PRIMARY 1
108#define LLDP_DOT3_POWER_SOURCE_PSE 1
109#define LLDP_DOT3_POWER_SOURCE_BACKUP 2
6fcf11ca 110#define LLDP_DOT3_POWER_SOURCE_LOCAL 2
4b292b55
VB
111#define LLDP_DOT3_POWER_SOURCE_BOTH 3
112
113/* Dot3 power priority */
114#define LLDP_DOT3_POWER_PRIO_UNKNOWN 0
115#define LLDP_DOT3_POWER_PRIO_CRITICAL 1
116#define LLDP_DOT3_POWER_PRIO_HIGH 2
117#define LLDP_DOT3_POWER_PRIO_LOW 3
118
119/* PMD Auto-Negotiation Advertised Capability field, from RFC 3636 */
120#define LLDP_DOT3_LINK_AUTONEG_OTHER 0x8000
121#define LLDP_DOT3_LINK_AUTONEG_10BASE_T 0x4000
122#define LLDP_DOT3_LINK_AUTONEG_10BASET_FD 0x2000
123#define LLDP_DOT3_LINK_AUTONEG_100BASE_T4 0x1000
124#define LLDP_DOT3_LINK_AUTONEG_100BASE_TX 0x0800
125#define LLDP_DOT3_LINK_AUTONEG_100BASE_TXFD 0x0400
126#define LLDP_DOT3_LINK_AUTONEG_100BASE_T2 0x0200
127#define LLDP_DOT3_LINK_AUTONEG_100BASE_T2FD 0x0100
128#define LLDP_DOT3_LINK_AUTONEG_FDX_PAUSE 0x0080
129#define LLDP_DOT3_LINK_AUTONEG_FDX_APAUSE 0x0040
130#define LLDP_DOT3_LINK_AUTONEG_FDX_SPAUSE 0x0020
131#define LLDP_DOT3_LINK_AUTONEG_FDX_BPAUSE 0x0010
132#define LLDP_DOT3_LINK_AUTONEG_1000BASE_X 0x0008
133#define LLDP_DOT3_LINK_AUTONEG_1000BASE_XFD 0x0004
134#define LLDP_DOT3_LINK_AUTONEG_1000BASE_T 0x0002
135#define LLDP_DOT3_LINK_AUTONEG_1000BASE_TFD 0x0001
136
137/* Capabilities */
138#define LLDP_CAP_OTHER 0x01
139#define LLDP_CAP_REPEATER 0x02
140#define LLDP_CAP_BRIDGE 0x04
141#define LLDP_CAP_WLAN 0x08
142#define LLDP_CAP_ROUTER 0x10
143#define LLDP_CAP_TELEPHONE 0x20
144#define LLDP_CAP_DOCSIS 0x40
145#define LLDP_CAP_STATION 0x80
146
147#define LLDP_PPVID_CAP_SUPPORTED (1 << 1)
148#define LLDP_PPVID_CAP_ENABLED (1 << 2)
149
150/* see http://www.iana.org/assignments/address-family-numbers */
151#define LLDP_MGMT_ADDR_NONE 0
152#define LLDP_MGMT_ADDR_IP4 1
153#define LLDP_MGMT_ADDR_IP6 2
154
155#define LLDP_MGMT_IFACE_UNKNOWN 1
156#define LLDP_MGMT_IFACE_IFINDEX 2
157#define LLDP_MGMT_IFACE_SYSPORT 3
158
159#define LLDP_MED_CLASS_I 1
160#define LLDP_MED_CLASS_II 2
161#define LLDP_MED_CLASS_III 3
162#define LLDP_MED_NETWORK_DEVICE 4
163
164/* LLDP MED application ttpes */
165#define LLDP_MED_APPTYPE_UNDEFINED 0
166#define LLDP_MED_APPTYPE_VOICE 1
167#define LLDP_MED_APPTYPE_VOICESIGNAL 2
168#define LLDP_MED_APPTYPE_GUESTVOICE 3
169#define LLDP_MED_APPTYPE_GUESTVOICESIGNAL 4
170#define LLDP_MED_APPTYPE_SOFTPHONEVOICE 5
171#define LLDP_MED_APPTYPE_VIDEOCONFERENCE 6
172#define LLDP_MED_APPTYPE_VIDEOSTREAM 7
173#define LLDP_MED_APPTYPE_VIDEOSIGNAL 8
174#define LLDP_MED_APPTYPE_LAST LLDP_MED_APPTYPE_VIDEOSIGNAL
175
176/* LLDP MED location formats */
177#define LLDP_MED_LOCFORMAT_COORD 1
178#define LLDP_MED_LOCFORMAT_CIVIC 2
179#define LLDP_MED_LOCFORMAT_ELIN 3
180#define LLDP_MED_LOCFORMAT_LAST LLDP_MED_LOCFORMAT_ELIN
181
182#define LLDP_MED_LOCATION_GEOID_WGS84 1
183#define LLDP_MED_LOCATION_GEOID_NAD83 2
184#define LLDP_MED_LOCATION_GEOID_NAD83_MLLW 3
185
186#define LLDP_MED_LOCATION_ALTITUDE_UNIT_METER 1
187#define LLDP_MED_LOCATION_ALTITUDE_UNIT_FLOOR 2
188
189/* LLDP MED power related constants */
190#define LLDP_MED_POW_TYPE_PSE 1
191#define LLDP_MED_POW_TYPE_PD 2
192#define LLDP_MED_POW_TYPE_RESERVED 3
193
194#define LLDP_MED_POW_SOURCE_UNKNOWN 1
195#define LLDP_MED_POW_SOURCE_PRIMARY 2
196#define LLDP_MED_POW_SOURCE_BACKUP 3
197#define LLDP_MED_POW_SOURCE_RESERVED 4
198#define LLDP_MED_POW_SOURCE_PSE 5
199#define LLDP_MED_POW_SOURCE_LOCAL 6
200#define LLDP_MED_POW_SOURCE_BOTH 7
201
202#define LLDP_MED_POW_PRIO_UNKNOWN 0
203#define LLDP_MED_POW_PRIO_CRITICAL 1
204#define LLDP_MED_POW_PRIO_HIGH 2
205#define LLDP_MED_POW_PRIO_LOW 3
206
207/* LLDP MED capabilities */
208#define LLDP_MED_CAP_CAP 0x01
209#define LLDP_MED_CAP_POLICY 0x02
210#define LLDP_MED_CAP_LOCATION 0x04
211#define LLDP_MED_CAP_MDI_PSE 0x08
212#define LLDP_MED_CAP_MDI_PD 0x10
213#define LLDP_MED_CAP_IV 0x20
214
215/* Protocol constants for multi-protocol lldpd */
216#define LLDPD_MODE_LLDP 1
217#define LLDPD_MODE_CDPV1 2
218#define LLDPD_MODE_CDPV2 3
219#define LLDPD_MODE_SONMP 4
220#define LLDPD_MODE_EDP 5
221#define LLDPD_MODE_FDP 6
222#define LLDPD_MODE_MAX LLDPD_MODE_FDP
223
224
dfbd7185
RP
225/* Bond slave src mac type constants */
226#define LLDP_BOND_SLAVE_SRC_MAC_TYPE_UNKNOWN 0
227#define LLDP_BOND_SLAVE_SRC_MAC_TYPE_REAL 1
228#define LLDP_BOND_SLAVE_SRC_MAC_TYPE_ZERO 2
2746d430
VB
229#define LLDP_BOND_SLAVE_SRC_MAC_TYPE_FIXED 3
230#define LLDP_BOND_SLAVE_SRC_MAC_TYPE_LOCALLY_ADMINISTERED 4
dfbd7185
RP
231#define LLDP_BOND_SLAVE_SRC_MAC_TYPE_MAX LLDP_BOND_SLAVE_SRC_MAC_TYPE_LOCALLY_ADMINISTERED
232
4b292b55 233#endif /* _LLDP_H */