Go to the documentation of this file.
32 #define TRACE_LEVEL LLDP_TRACE_LEVEL
42 #if (LLDP_SUPPORT == ENABLED)
127 osMemmove(lldpdu->data + tlv.
pos + newLen, lldpdu->data + tlv.
pos + oldLen,
128 lldpdu->length - tlv.
pos - oldLen);
132 lldpdu->length -= oldLen;
150 if(tlv.
pos < lldpdu->length)
153 lldpdu->length - tlv.
pos);
172 header->lengthH = (
length >> 8) & 0x01;
173 header->lengthL =
length & 0xFF;
270 tlv->
pos = lldpdu->pos;
276 if(lldpdu->pos >= lldpdu->length)
288 n = (header->lengthH << 8) | header->lengthL;
299 tlv->
pos = lldpdu->pos;
300 tlv->
type = header->type;
301 tlv->
value = header->value;
342 osMemmove(lldpdu->data + tlv.
pos, lldpdu->data + lldpdu->pos,
343 lldpdu->length - lldpdu->pos);
346 lldpdu->length -= tlv.
length;
402 part1->mgmtAddrLen - 1) >
length)
418 part1->mgmtAddrLen - 1 + part2->oidLen) >
length)
424 if(mgmtAddr1 != NULL)
430 if(mgmtAddr2 != NULL)
490 if(orgDefTlv->subtype ==
subtype)
499 else if(orgDefTlv->subtype >
subtype)
563 osMemmove(lldpdu->data + tlv.
pos + newLen, lldpdu->data + tlv.
pos + oldLen,
564 lldpdu->length - tlv.
pos - oldLen);
568 lldpdu->length -= oldLen;
586 if(tlv.
pos < lldpdu->length)
589 lldpdu->length - tlv.
pos);
611 header->lengthH = (
n >> 8) & 0x01;
612 header->lengthL =
n & 0xFF;
685 if(orgDefTlv->subtype ==
subtype)
753 if(orgDefTlv->subtype ==
subtype)
759 osMemmove(lldpdu->data + tlv.
pos, lldpdu->data + lldpdu->pos,
760 lldpdu->length - lldpdu->pos);
763 lldpdu->length -= tlv.
length;
error_t lldpGetFirstTlv(LldpDataUnit *lldpdu, LldpTlv *tlv)
Extract the first TLV from an LLDPDU.
__start_packed struct @0 LldpTlvHeader
TLV header.
error_t lldpDeleteTlv(LldpDataUnit *lldpdu, uint8_t type, uint_t index)
Remove a TLV from a LLDPDU.
error_t lldpGetNextTlv(LldpDataUnit *lldpdu, LldpTlv *tlv)
Extract the next TLV from an LLDPDU.
@ LLDP_TLV_TYPE_ORG_DEFINED
Organizationally Specific TLVs.
#define LLDP_MAX_LLDPDU_SIZE
error_t lldpSetTlv(LldpDataUnit *lldpdu, uint8_t type, uint_t index, const uint8_t *value, size_t length, bool_t replace)
Add or replace a TLV.
#define LLDP_MIN_MGMT_ADDR_LEN
@ LLDP_TLV_TYPE_END_OF_LLDPDU
End Of LLDPDU.
Data logging functions for debugging purpose (LLDP)
#define osMemcpy(dest, src, length)
uint8_t oui[LLDP_OUI_SIZE]
error_t lldpGetOrgDefTlv(LldpDataUnit *lldpdu, uint32_t oui, uint8_t subtype, uint_t index, const uint8_t **value, size_t *length)
Search an LLDPDU for an organizationally specific TLV.
error_t lldpGetTlv(LldpDataUnit *lldpdu, uint8_t type, uint_t index, const uint8_t **value, size_t *length)
Search a LLDPDU for a given TLV.
__start_packed struct @6 LldpMgmtAddrTlv2
Management Address TLV (part 2)
TLV parsing and formatting.
error_t lldpDeleteOrgDefTlv(LldpDataUnit *lldpdu, uint32_t oui, uint8_t subtype, uint_t index)
Remove an organizationally specific TLV from a LLDPDU.
__start_packed struct @5 LldpMgmtAddrTlv1
Management Address TLV (part 1)
__start_packed struct @7 LldpOrgDefTlv
Organizationally Specific TLV.
error_t lldpDecodeMgmtAddrTlv(const uint8_t *value, size_t length, const LldpMgmtAddrTlv1 **mgmtAddr1, const LldpMgmtAddrTlv2 **mgmtAddr2)
Decode the contents of a Management Address TLV.
error_t lldpSetOrgDefTlv(LldpDataUnit *lldpdu, uint32_t oui, uint8_t subtype, uint_t index, const uint8_t *value, size_t length, bool_t replace)
Add or replace an organizationally specific TLV.
LLDP (Link Layer Discovery Protocol)
#define LLDP_MAX_MGMT_ADDR_LEN
#define osMemmove(dest, src, length)