mikroSDK Reference Manual
lldp_ext_med.h
Go to the documentation of this file.
1
31#ifndef _LLDP_EXT_MED_H
32#define _LLDP_EXT_MED_H
33
34//Dependencies
35#include "core/net.h"
36#include "lldp/lldp.h"
37
38//Minimum length of hardware revision
39#define LLDP_MED_MIN_INVENTORY_STRING_LEN 0
40//Maximum length of hardware revision
41#define LLDP_MED_MAX_INVENTORY_STRING_LEN 32
42
43//C++ guard
44#ifdef __cplusplus
45extern "C" {
46#endif
47
48
68
69
83
84
97
98
115
116
128
129
141
142
158
159
171
172
173//CodeWarrior or Win32 compiler?
174#if defined(__CWCC__) || defined(_WIN32)
175 #pragma pack(push, 1)
176#endif
177
178
184{
185 uint16_t capabilities; //0-1
186 uint8_t deviceType; //2
187} LldpMedCapTlv;
188
189
194typedef __packed_struct
195{
196#if defined(_CPU_BIG_ENDIAN) && !defined(__ICCRX__)
197 uint8_t appType; //0
198 uint8_t u : 1; //1
199 uint8_t t : 1;
200 uint8_t x : 1;
201 uint8_t vlanIdH : 5;
202 uint8_t vlanIdL : 7; //2
203 uint8_t l2PriorityH : 1;
204 uint8_t l2PriorityL : 2; //3
205 uint8_t dscpValue : 6;
206#else
207 uint8_t appType; //0
208 uint8_t vlanIdH : 5; //1
209 uint8_t x : 1;
210 uint8_t t : 1;
211 uint8_t u : 1;
212 uint8_t l2PriorityH : 1; //2
213 uint8_t vlanIdL : 7;
214 uint8_t dscpValue : 6; //3
215 uint8_t l2PriorityL : 2;
216#endif
217} LldpMedNetworkPolicyTlv;
218
219
224typedef __packed_struct
225{
226 uint8_t locationDataFormat; //0-1
227 uint8_t locationId[]; //2
228} LldpMedLocationIdTlv;
229
230
235typedef __packed_struct
236{
237#if defined(_CPU_BIG_ENDIAN) && !defined(__ICCRX__)
238 uint8_t powerType : 2; //0
239 uint8_t powerSource : 2;
240 uint8_t powerPriority : 4;
241 uint16_t powerValue; //1-2
242#else
243 uint8_t powerPriority : 4; //0
244 uint8_t powerSource : 2;
245 uint8_t powerType : 2;
246 uint16_t powerValue; //1-2
247#endif
248} LldpMedExtPowerViaMdiTlv;
249
250
251//CodeWarrior or Win32 compiler?
252#if defined(__CWCC__) || defined(_WIN32)
253 #pragma pack(pop)
254#endif
255
256//LLDP-MED related functions
257error_t lldpMedSetLocalCap(LldpAgentContext *context, uint16_t capabilities,
258 LldpMedDeviceType deviceType);
259
260error_t lldpMedSetLocalNetworkPolicy(LldpAgentContext *context,
261 uint_t portIndex, LldpMedAppType appType, bool_t u, bool_t t,
262 uint16_t vlanId, uint8_t l2Priority, uint8_t dscpValue);
263
264error_t lldpMedSetLocalLocationId(LldpAgentContext *context,
265 uint_t portIndex, LldpMedLocationDataFormat locationDataFormat,
266 const void *locationId, size_t locationIdLen);
267
268error_t lldpMedSetLocalExtPowerViaMdi(LldpAgentContext *context,
269 uint_t portIndex, LldpMedPowerType powerType, LldpMedPowerSource powerSource,
270 LldpMedPowerPriority powerPriority, uint16_t powerValue);
271
272error_t lldpMedSetLocalHardwareRevision(LldpAgentContext *context,
273 const char_t *hardwareRevision);
274
275error_t lldpMedSetLocalFirmwareRevision(LldpAgentContext *context,
276 const char_t *firmwareRevision);
277
278error_t lldpMedSetLocalSoftwareRevision(LldpAgentContext *context,
279 const char_t *softwareRevision);
280
281error_t lldpMedSetLocalSerialNumber(LldpAgentContext *context,
282 const char_t *serialNumber);
283
284error_t lldpMedSetLocalManufacturerName(LldpAgentContext *context,
285 const char_t *manufacturerName);
286
287error_t lldpMedSetLocalModelName(LldpAgentContext *context,
288 const char_t *modelName);
289
290error_t lldpMedSetLocalAssetId(LldpAgentContext *context,
291 const char_t *assetId);
292
293error_t lldpMedDeleteLocalTlv(LldpAgentContext *context,
294 LldpMedSubtype subtype);
295
296//C++ guard
297#ifdef __cplusplus
298}
299#endif
300
301#endif
error_t
Error codes.
Definition error.h:43
LLDP (Link Layer Discovery Protocol)
LldpMedCap
LLDP-MED capabilities.
Definition lldp_ext_med.h:75
@ LLDP_MED_CAP_NETWORK_POLICY
Network policy.
Definition lldp_ext_med.h:77
@ LLDP_MED_CAP
LLDP-MED capabilities.
Definition lldp_ext_med.h:76
@ LLDP_MED_CAP_INVENTORY
Inventory.
Definition lldp_ext_med.h:81
@ LLDP_MED_CAP_EXTENDED_PSE
Extended power via MDI - PSE.
Definition lldp_ext_med.h:79
@ LLDP_MED_CAP_EXTENDED_PD
Extended power via MDI - PD.
Definition lldp_ext_med.h:80
@ LLDP_MED_CAP_LOCATION
Location identification.
Definition lldp_ext_med.h:78
LldpMedAppType
Application type.
Definition lldp_ext_med.h:104
@ LLDP_MED_APP_TYPE_VOICE_SIGNALING
Voice signaling.
Definition lldp_ext_med.h:107
@ LLDP_MED_APP_TYPE_GUEST_VOICE_SIGNALING
Guest Voice Signaling.
Definition lldp_ext_med.h:109
@ LLDP_MED_APP_TYPE_STREAMING_VIDEO
Streaming Video.
Definition lldp_ext_med.h:112
@ LLDP_MED_APP_TYPE_RESERVED
Reserved.
Definition lldp_ext_med.h:105
@ LLDP_MED_APP_TYPE_GUEST_VOICE
Guest Voice.
Definition lldp_ext_med.h:108
@ LLDP_MED_APP_TYPE_VIDEO_CONFERENCING
Video Conferencing.
Definition lldp_ext_med.h:111
@ LLDP_MED_APP_TYPE_SOFTPHONE_VOICE
Softphone Voice.
Definition lldp_ext_med.h:110
@ LLDP_MED_APP_TYPE_VOICE
Voice.
Definition lldp_ext_med.h:106
@ LLDP_MED_APP_TYPE_VIDEO_SIGNALING
Video signaling.
Definition lldp_ext_med.h:113
LldpMedPowerPriority
Power priority.
Definition lldp_ext_med.h:165
@ LLDP_MED_POWER_PRIORITY_HIGH
High.
Definition lldp_ext_med.h:168
@ LLDP_MED_POWER_PRIORITY_CRITICAL
Critical.
Definition lldp_ext_med.h:167
@ LLDP_MED_POWER_PRIORITY_UNKNOWN
Unknown.
Definition lldp_ext_med.h:166
@ LLDP_MED_POWER_PRIORITY_LOW
Low.
Definition lldp_ext_med.h:169
LldpMedSubtype
LLDP-MED subtypes.
Definition lldp_ext_med.h:54
@ LLDP_MED_SUBTYPE_FIRMWARE_REVISION
Inventory - Firmware Revision.
Definition lldp_ext_med.h:61
@ LLDP_MED_SUBTYPE_HARDWARE_REVISION
Inventory - Hardware Revision.
Definition lldp_ext_med.h:60
@ LLDP_MED_SUBTYPE_ASSET_ID
Inventory - Asset ID.
Definition lldp_ext_med.h:66
@ LLDP_MED_SUBTYPE_SOFTWARE_REVISION
Inventory - Software Revision.
Definition lldp_ext_med.h:62
@ LLDP_MED_SUBTYPE_NETWORK_POLICY
Network Policy.
Definition lldp_ext_med.h:57
@ LLDP_MED_SUBTYPE_SERIAL_NUMBER
Inventory - Serial Number.
Definition lldp_ext_med.h:63
@ LLDP_MED_SUBTYPE_LLDP_MED_CAP
LLDP-MED Capabilities.
Definition lldp_ext_med.h:56
@ LLDP_MED_SUBTYPE_EXT_POWER_VIA_MDI
Extended Power-via-MDI.
Definition lldp_ext_med.h:59
@ LLDP_MED_SUBTYPE_MODEL_NAME
Inventory - Model Name.
Definition lldp_ext_med.h:65
@ LLDP_MED_SUBTYPE_LOCATION_ID
Location Identification.
Definition lldp_ext_med.h:58
@ LLDP_MED_SUBTYPE_RESERVED
Reserved.
Definition lldp_ext_med.h:55
@ LLDP_MED_SUBTYPE_MANUFACTURER_NAME
Inventory - Manufacturer Name.
Definition lldp_ext_med.h:64
LldpMedLocationDataFormat
Location data format.
Definition lldp_ext_med.h:122
@ LLDP_MED_LOCATION_DATA_FORMAT_COORD_BASED_LCI
Coordinate-based LCI.
Definition lldp_ext_med.h:124
@ LLDP_MED_LOCATION_DATA_FORMAT_ECS_ELIN
ECS ELIN.
Definition lldp_ext_med.h:126
@ LLDP_MED_LOCATION_DATA_FORMAT_CIVIC_ADDR_LCI
Civic Address LCI.
Definition lldp_ext_med.h:125
@ LLDP_MED_LOCATION_DATA_FORMAT_INVALID
Invalid.
Definition lldp_ext_med.h:123
LldpMedPowerType
Power type.
Definition lldp_ext_med.h:135
@ LLDP_MED_POWER_TYPE_RESERVED_2
Reserved.
Definition lldp_ext_med.h:139
@ LLDP_MED_POWER_TYPE_RESERVED_1
Reserved.
Definition lldp_ext_med.h:138
@ LLDP_MED_POWER_TYPE_PSE_DEVICE
PSE Device.
Definition lldp_ext_med.h:136
@ LLDP_MED_POWER_TYPE_PD_DEVICE
PD Device.
Definition lldp_ext_med.h:137
LldpMedDeviceType
LLDP-MED device type.
Definition lldp_ext_med.h:90
@ LLDP_MED_DEVICE_TYPE_ENDPOINT_CLASS_2
Endpoint class II.
Definition lldp_ext_med.h:93
@ LLDP_MED_DEVICE_TYPE_NETWORK_CONNECTIVITY
Network connectivity.
Definition lldp_ext_med.h:95
@ LLDP_MED_DEVICE_TYPE_NOT_DEFINED
Type not defined.
Definition lldp_ext_med.h:91
@ LLDP_MED_DEVICE_TYPE_ENDPOINT_CLASS_1
Endpoint class I.
Definition lldp_ext_med.h:92
@ LLDP_MED_DEVICE_TYPE_ENDPOINT_CLASS_3
Endpoint class III.
Definition lldp_ext_med.h:94
LldpMedPowerSource
Power source.
Definition lldp_ext_med.h:148
@ LLDP_MED_PSE_POWER_SOURCE_RESERVED
Reserved (PSE device type)
Definition lldp_ext_med.h:156
@ LLDP_MED_PD_POWER_SOURCE_UNKNOWN
Unknown (PD device type)
Definition lldp_ext_med.h:149
@ LLDP_MED_PD_POWER_SOURCE_LOCAL
Local (PD device type)
Definition lldp_ext_med.h:151
@ LLDP_MED_PSE_POWER_SOURCE_PRIMARY
Primary Power Source (PSE device type)
Definition lldp_ext_med.h:154
@ LLDP_MED_PSE_POWER_SOURCE_UNKNOWN
Unknown (PSE device type)
Definition lldp_ext_med.h:153
@ LLDP_MED_PD_POWER_SOURCE_PSE_AND_LOCAL
PSE and local (PD device type)
Definition lldp_ext_med.h:152
@ LLDP_MED_PSE_POWER_SOURCE_BACKUP
Backup Power Source (PSE device type)
Definition lldp_ext_med.h:155
@ LLDP_MED_PD_POWER_SOURCE_PSE
PSE (PD device type)
Definition lldp_ext_med.h:150
typedef __packed_struct
LLDP-MED Capabilities TLV.
Definition lldp_ext_med.h:184
TCP/IP stack core.