lldp.c File Reference

LLDP (Link Layer Discovery Protocol) More...

#include "core/net.h"
#include "lldp/lldp.h"
#include "lldp/lldp_mgmt.h"
#include "lldp/lldp_fsm.h"
#include "lldp/lldp_misc.h"
#include "debug.h"

Go to the source code of this file.

Macros

#define TRACE_LEVEL   LLDP_TRACE_LEVEL
 

Functions

void lldpGetDefaultSettings (LldpAgentSettings *settings)
 Initialize settings with default values. More...
 
error_t lldpInit (LldpAgentContext *context, const LldpAgentSettings *settings)
 LLDP agent initialization. More...
 
error_t lldpStart (LldpAgentContext *context)
 Start LLDP agent. More...
 
error_t lldpStop (LldpAgentContext *context)
 Stop LLDP agent. More...
 
error_t lldpSetPortAddr (LldpAgentContext *context, uint_t portIndex, const MacAddr *macAddr)
 Set port address. More...
 
error_t lldpSetMsgTxInterval (LldpAgentContext *context, uint_t msgTxInterval)
 Set transmit interval. More...
 
error_t lldpSetMsgTxHold (LldpAgentContext *context, uint_t msgTxHold)
 Set transmit hold multiplier. More...
 
error_t lldpSetReinitDelay (LldpAgentContext *context, uint_t reinitDelay)
 Set re-initialization delay. More...
 
error_t lldpSetTxDelay (LldpAgentContext *context, uint_t txDelay)
 Set transmit delay. More...
 
error_t lldpSetAdminStatus (LldpAgentContext *context, uint_t portIndex, LldpAdminStatus adminStatus)
 Set administrative status. More...
 
error_t lldpSetBasicTlvFilter (LldpAgentContext *context, uint_t portIndex, uint8_t mask)
 Set the list of TLVs enabled for transmission. More...
 
error_t lldpSetMgmtAddrFilter (LldpAgentContext *context, uint_t portIndex, uint32_t mask)
 Set the list of management addresses enabled for transmission. More...
 
error_t lldpSetLocalChassisId (LldpAgentContext *context, LldpChassisIdSubtype chassisIdSubtype, const void *chassisId, size_t chassisIdLen)
 Set chassis ID. More...
 
error_t lldpSetLocalPortId (LldpAgentContext *context, uint_t portIndex, LldpPortIdSubtype portIdSubtype, const void *portId, size_t portIdLen)
 Set port ID. More...
 
error_t lldpSetLocalPortDesc (LldpAgentContext *context, uint_t portIndex, const char_t *portDesc)
 Set port description. More...
 
error_t lldpSetLocalSysName (LldpAgentContext *context, const char_t *sysName)
 Set system name. More...
 
error_t lldpSetLocalSysDesc (LldpAgentContext *context, const char_t *sysDesc)
 Set system description. More...
 
error_t lldpSetLocalSysCap (LldpAgentContext *context, uint16_t supportedCap, uint16_t enabledCap)
 Set system capabilities. More...
 
error_t lldpSetLocalMgmtAddr (LldpAgentContext *context, uint_t index, LldpMgmtAddrSubtype mgmtAddrSubtype, const void *mgmtAddr, size_t mgmtAddrLen, LldpIfNumSubtype ifNumSubtype, uint32_t ifNum, const uint8_t *oid, size_t oidLen)
 Set management address. More...
 
error_t lldpDeleteLocalTlv (LldpAgentContext *context, LldpTlvType type)
 Remove all TLVs with specified type. More...
 
void lldpTask (LldpAgentContext *context)
 LLDP agent task. More...
 
void lldpDeinit (LldpAgentContext *context)
 Release LLDP agent context. More...
 

Detailed Description

LLDP (Link Layer Discovery Protocol)

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.

Author
Oryx Embedded SARL (www.oryx-embedded.com)
Version
2.4.0

Definition in file lldp.c.

Macro Definition Documentation

◆ TRACE_LEVEL

#define TRACE_LEVEL   LLDP_TRACE_LEVEL

Definition at line 32 of file lldp.c.

Function Documentation

◆ lldpDeinit()

void lldpDeinit ( LldpAgentContext context)

Release LLDP agent context.

Parameters
[in]contextPointer to the LLDP agent context

Definition at line 1394 of file lldp.c.

◆ lldpDeleteLocalTlv()

error_t lldpDeleteLocalTlv ( LldpAgentContext context,
LldpTlvType  type 
)

Remove all TLVs with specified type.

Parameters
[in]contextPointer to the LLDP agent context
[in]typeTLV type
Returns
Error code

Definition at line 1214 of file lldp.c.

◆ lldpGetDefaultSettings()

void lldpGetDefaultSettings ( LldpAgentSettings settings)

Initialize settings with default values.

Parameters
[out]settingsStructure that contains LLDP agent settings

Definition at line 51 of file lldp.c.

◆ lldpInit()

error_t lldpInit ( LldpAgentContext context,
const LldpAgentSettings settings 
)

LLDP agent initialization.

Parameters
[in]contextPointer to the LLDP agent context
[in]settingsLLDP agent specific settings
Returns
Error code

Definition at line 87 of file lldp.c.

◆ lldpSetAdminStatus()

error_t lldpSetAdminStatus ( LldpAgentContext context,
uint_t  portIndex,
LldpAdminStatus  adminStatus 
)

Set administrative status.

Parameters
[in]contextPointer to the LLDP agent context
[in]portIndexPort index
[in]adminStatusThe administrative status indicates whether or not the local LLDP agent is enabled
Returns
Error code

Definition at line 579 of file lldp.c.

◆ lldpSetBasicTlvFilter()

error_t lldpSetBasicTlvFilter ( LldpAgentContext context,
uint_t  portIndex,
uint8_t  mask 
)

Set the list of TLVs enabled for transmission.

Parameters
[in]contextPointer to the LLDP agent context
[in]portIndexPort index
[in]maskBit-map indicating the TLVs enabled for transmission
Returns
Error code

Definition at line 613 of file lldp.c.

◆ lldpSetLocalChassisId()

error_t lldpSetLocalChassisId ( LldpAgentContext context,
LldpChassisIdSubtype  chassisIdSubtype,
const void *  chassisId,
size_t  chassisIdLen 
)

Set chassis ID.

Parameters
[in]contextPointer to the LLDP agent context
[in]chassisIdSubtypeType of identifier used for the chassis
[in]chassisIdAdministratively assigned name that identifies the chassis
[in]chassisIdLenLength of the chassis ID, in bytes
Returns
Error code

Definition at line 696 of file lldp.c.

◆ lldpSetLocalMgmtAddr()

error_t lldpSetLocalMgmtAddr ( LldpAgentContext context,
uint_t  index,
LldpMgmtAddrSubtype  mgmtAddrSubtype,
const void *  mgmtAddr,
size_t  mgmtAddrLen,
LldpIfNumSubtype  ifNumSubtype,
uint32_t  ifNum,
const uint8_t *  oid,
size_t  oidLen 
)

Set management address.

Parameters
[in]contextPointer to the LLDP agent context
[in]indexZero-based index identifying a management address
[in]mgmtAddrSubtypeType of management address
[in]mgmtAddrOctet string indicating a particular management address
[in]mgmtAddrLenLength of the management address, in bytes
[in]ifNumSubtypeNumbering method used for defining the interface number
[in]ifNumNumber within the system that identifies the specific interface associated with this management address
[in]oidOID that identifies the type of hardware component or protocol entity associated with the indicated management address
[in]oidLenLength of the OID, in bytes
Returns
Error code

Definition at line 1075 of file lldp.c.

◆ lldpSetLocalPortDesc()

error_t lldpSetLocalPortDesc ( LldpAgentContext context,
uint_t  portIndex,
const char_t portDesc 
)

Set port description.

Parameters
[in]contextPointer to the LLDP agent context
[in]portIndexPort index
[in]portDescStation port's description
Returns
Error code

Definition at line 836 of file lldp.c.

◆ lldpSetLocalPortId()

error_t lldpSetLocalPortId ( LldpAgentContext context,
uint_t  portIndex,
LldpPortIdSubtype  portIdSubtype,
const void *  portId,
size_t  portIdLen 
)

Set port ID.

Parameters
[in]contextPointer to the LLDP agent context
[in]portIndexPort index
[in]portIdSubtypeType of identifier used for the port
[in]portIdAdministratively assigned name that identifies the port
[in]portIdLenLength of the port ID, in bytes
Returns
Error code

Definition at line 764 of file lldp.c.

◆ lldpSetLocalSysCap()

error_t lldpSetLocalSysCap ( LldpAgentContext context,
uint16_t  supportedCap,
uint16_t  enabledCap 
)

Set system capabilities.

Parameters
[in]contextPointer to the LLDP agent context
[in]supportedCapBit-map of the capabilities supported by the system
[in]enabledCapBit-map of the capabilities currently enabled
Returns
Error code

Definition at line 1007 of file lldp.c.

◆ lldpSetLocalSysDesc()

error_t lldpSetLocalSysDesc ( LldpAgentContext context,
const char_t sysDesc 
)

Set system description.

Parameters
[in]contextPointer to the LLDP agent context
[in]sysDescTextual description of the network entity
Returns
Error code

Definition at line 952 of file lldp.c.

◆ lldpSetLocalSysName()

error_t lldpSetLocalSysName ( LldpAgentContext context,
const char_t sysName 
)

Set system name.

Parameters
[in]contextPointer to the LLDP agent context
[in]sysNameSystem's administratively assigned name
Returns
Error code

Definition at line 898 of file lldp.c.

◆ lldpSetMgmtAddrFilter()

error_t lldpSetMgmtAddrFilter ( LldpAgentContext context,
uint_t  portIndex,
uint32_t  mask 
)

Set the list of management addresses enabled for transmission.

Parameters
[in]contextPointer to the LLDP agent context
[in]portIndexPort index
[in]maskBit-map indicating the management addresses enabled for transmission
Returns
Error code

Definition at line 648 of file lldp.c.

◆ lldpSetMsgTxHold()

error_t lldpSetMsgTxHold ( LldpAgentContext context,
uint_t  msgTxHold 
)

Set transmit hold multiplier.

Parameters
[in]contextPointer to the LLDP agent context
[in]msgTxHoldMultiplier on the msgTxInterval that determines the actual TTL value used in an LLDPDU
Returns
Error code

Definition at line 481 of file lldp.c.

◆ lldpSetMsgTxInterval()

error_t lldpSetMsgTxInterval ( LldpAgentContext context,
uint_t  msgTxInterval 
)

Set transmit interval.

Parameters
[in]contextPointer to the LLDP agent context
[in]msgTxIntervalTime interval between successive transmit cycles, in seconds
Returns
Error code

Definition at line 448 of file lldp.c.

◆ lldpSetPortAddr()

error_t lldpSetPortAddr ( LldpAgentContext context,
uint_t  portIndex,
const MacAddr macAddr 
)

Set port address.

Parameters
[in]contextPointer to the LLDP agent context
[in]portIndexPort index
[in]macAddrMAC address of the individual MAC entity for the port
Returns
Error code

Definition at line 405 of file lldp.c.

◆ lldpSetReinitDelay()

error_t lldpSetReinitDelay ( LldpAgentContext context,
uint_t  reinitDelay 
)

Set re-initialization delay.

Parameters
[in]contextPointer to the LLDP agent context
[in]reinitDelayDelay before re-initialization will be attempted
Returns
Error code

Definition at line 513 of file lldp.c.

◆ lldpSetTxDelay()

error_t lldpSetTxDelay ( LldpAgentContext context,
uint_t  txDelay 
)

Set transmit delay.

Parameters
[in]contextPointer to the LLDP agent context
[in]txDelayDelay between successive LLDP frame transmissions
Returns
Error code

Definition at line 545 of file lldp.c.

◆ lldpStart()

error_t lldpStart ( LldpAgentContext context)

Start LLDP agent.

Parameters
[in]contextPointer to the LLDP agent context
Returns
Error code

Definition at line 268 of file lldp.c.

◆ lldpStop()

error_t lldpStop ( LldpAgentContext context)

Stop LLDP agent.

Parameters
[in]contextPointer to the LLDP agent context
Returns
Error code

Definition at line 361 of file lldp.c.

◆ lldpTask()

void lldpTask ( LldpAgentContext context)

LLDP agent task.

Parameters
[in]contextPointer to the LLDP agent context

Definition at line 1310 of file lldp.c.