TLV parsing and formatting. More...
#include "core/net.h"
#include "lldp/lldp.h"
#include "lldp/lldp_tlv.h"
#include "lldp/lldp_debug.h"
#include "debug.h"
Go to the source code of this file.
Macros | |
#define | TRACE_LEVEL LLDP_TRACE_LEVEL |
Functions | |
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. More... | |
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. More... | |
error_t | lldpGetFirstTlv (LldpDataUnit *lldpdu, LldpTlv *tlv) |
Extract the first TLV from an LLDPDU. More... | |
error_t | lldpGetNextTlv (LldpDataUnit *lldpdu, LldpTlv *tlv) |
Extract the next TLV from an LLDPDU. More... | |
error_t | lldpDeleteTlv (LldpDataUnit *lldpdu, uint8_t type, uint_t index) |
Remove a TLV from a LLDPDU. More... | |
error_t | lldpDecodeMgmtAddrTlv (const uint8_t *value, size_t length, const LldpMgmtAddrTlv1 **mgmtAddr1, const LldpMgmtAddrTlv2 **mgmtAddr2) |
Decode the contents of a Management Address TLV. More... | |
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. More... | |
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. More... | |
error_t | lldpDeleteOrgDefTlv (LldpDataUnit *lldpdu, uint32_t oui, uint8_t subtype, uint_t index) |
Remove an organizationally specific TLV from a LLDPDU. More... | |
Detailed Description
TLV parsing and formatting.
License
SPDX-License-Identifier: GPL-2.0-or-later
Copyright (C) 2010-2024 Oryx Embedded SARL. All rights reserved.
This file is part of CycloneTCP Open.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- Version
- 2.4.4
Definition in file lldp_tlv.c.
Macro Definition Documentation
◆ TRACE_LEVEL
#define TRACE_LEVEL LLDP_TRACE_LEVEL |
Definition at line 32 of file lldp_tlv.c.
Function Documentation
◆ lldpDecodeMgmtAddrTlv()
error_t lldpDecodeMgmtAddrTlv | ( | const uint8_t * | value, |
size_t | length, | ||
const LldpMgmtAddrTlv1 ** | mgmtAddr1, | ||
const LldpMgmtAddrTlv2 ** | mgmtAddr2 | ||
) |
Decode the contents of a Management Address TLV.
- Parameters
-
[in] value Pointer to the TLV value to decode [in] length Length of the TLV value, in bytes [out] mgmtAddr1 First part of the Management Address TLV [out] mgmtAddr2 Second part of the Management Address TLV
- Returns
- Error code
Definition at line 380 of file lldp_tlv.c.
◆ lldpDeleteOrgDefTlv()
error_t lldpDeleteOrgDefTlv | ( | LldpDataUnit * | lldpdu, |
uint32_t | oui, | ||
uint8_t | subtype, | ||
uint_t | index | ||
) |
Remove an organizationally specific TLV from a LLDPDU.
- Parameters
-
[in] lldpdu Pointer to the LLDP data unit [in] oui Organizationally unique identifier [in] subtype Organizationally defined subtype [in] index TLV occurrence index
- Returns
- Error code
Definition at line 719 of file lldp_tlv.c.
◆ lldpDeleteTlv()
error_t lldpDeleteTlv | ( | LldpDataUnit * | lldpdu, |
uint8_t | type, | ||
uint_t | index | ||
) |
Remove a TLV from a LLDPDU.
- Parameters
-
[in] lldpdu Pointer to the LLDP data unit [in] type TLV type [in] index TLV occurrence index
- Returns
- Error code
Definition at line 320 of file lldp_tlv.c.
◆ lldpGetFirstTlv()
error_t lldpGetFirstTlv | ( | LldpDataUnit * | lldpdu, |
LldpTlv * | tlv | ||
) |
Extract the first TLV from an LLDPDU.
- Parameters
-
[in] lldpdu Pointer to the LLDP data unit [out] tlv Next TLV
- Returns
- Error code
Definition at line 247 of file lldp_tlv.c.
◆ lldpGetNextTlv()
error_t lldpGetNextTlv | ( | LldpDataUnit * | lldpdu, |
LldpTlv * | tlv | ||
) |
Extract the next TLV from an LLDPDU.
- Parameters
-
[in] lldpdu Pointer to the LLDP data unit [out] tlv Next TLV
- Returns
- Error code
Definition at line 264 of file lldp_tlv.c.
◆ lldpGetOrgDefTlv()
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.
- Parameters
-
[in] lldpdu Pointer to the LLDP data unit [in] oui Organizationally unique identifier [in] subtype Organizationally defined subtype [in] index TLV occurrence index [out] value Organizationally defined information string [out] length Length of the information string, in bytes
- Returns
- Error code
Definition at line 651 of file lldp_tlv.c.
◆ lldpGetTlv()
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.
- Parameters
-
[in] lldpdu Pointer to the LLDP data unit [in] type TLV type [in] index TLV occurrence index [out] value TLV information string [out] length Length of the information string, in bytes
- Returns
- Error code
Definition at line 200 of file lldp_tlv.c.
◆ lldpSetOrgDefTlv()
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.
- Parameters
-
[in] lldpdu Pointer to the LLDP data unit [in] oui Organizationally unique identifier [in] subtype Organizationally defined subtype [in] index TLV occurrence index [in] value Organizationally defined information string [in] length Length of the information string, in bytes [in] replace Replace the existing TLV if a match is found
- Returns
- Error code
Definition at line 452 of file lldp_tlv.c.
◆ lldpSetTlv()
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.
- Parameters
-
[in] lldpdu Pointer to the LLDP data unit [in] type TLV type [in] index TLV occurrence index [in] value TLV information string [in] length Length of the information string, in bytes [in] replace Replace the existing TLV if a match is found
- Returns
- Error code
Definition at line 56 of file lldp_tlv.c.