lldp_misc.c File Reference

Helper functions for LLDP. More...

#include "core/net.h"
#include "lldp/lldp.h"
#include "lldp/lldp_fsm.h"
#include "lldp/lldp_misc.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

void lldpTick (LldpAgentContext *context)
 LLDP agent timer handler. More...
 
void lldpProcessFrame (LldpAgentContext *context)
 Process incoming LLDP frame. More...
 
error_t lldpCheckDataUnit (LldpPortEntry *port, LldpDataUnit *lldpdu)
 LLDP data unit validation. More...
 
LldpNeighborEntrylldpCreateNeighborEntry (LldpAgentContext *context)
 Create a new entry in the remote systems MIB. More...
 
LldpNeighborEntrylldpFindNeighborEntry (LldpAgentContext *context, LldpDataUnit *lldpdu)
 Search the remote systems MIB for a matching MSAP identifier. More...
 
void lldpDeleteNeighborEntry (LldpNeighborEntry *entry)
 Remove an entry from the remote systems MIB. More...
 
bool_t lldpGetLinkState (LldpAgentContext *context, uint_t portIndex)
 Get link state. More...
 
error_t lldpAcceptMulticastAddr (LldpAgentContext *context)
 Add the LLDP multicast address to the static MAC table. More...
 
error_t lldpDropMulticastAddr (LldpAgentContext *context)
 Remove the LLDP multicast address from the static MAC table. More...
 
void lldpGeneratePortAddr (LldpPortEntry *port)
 Port's MAC address generation. More...
 
error_t lldpGetMsapId (LldpDataUnit *lldpdu, LldpMsapId *msapId)
 Extract MSAP identifier. More...
 
bool_t lldpCompareMsapId (const LldpMsapId *msapId1, const LldpMsapId *msapId2)
 Compare MSAP identifiers. More...
 
void lldpSomethingChangedLocal (LldpAgentContext *context)
 Notify LLDP that an object in the LLDP local system MIB has changed. More...
 
void lldpDecrementTimer (uint_t *x)
 Decrement timer value. More...
 

Variables

const MacAddr LLDP_MULTICAST_ADDR = {{{0x01, 0x80, 0xC2, 0x00, 0x00, 0x0E}}}
 

Detailed Description

Helper functions for LLDP.

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_misc.c.

Macro Definition Documentation

◆ TRACE_LEVEL

#define TRACE_LEVEL   LLDP_TRACE_LEVEL

Definition at line 32 of file lldp_misc.c.

Function Documentation

◆ lldpAcceptMulticastAddr()

error_t lldpAcceptMulticastAddr ( LldpAgentContext context)

Add the LLDP multicast address to the static MAC table.

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

Definition at line 580 of file lldp_misc.c.

◆ lldpCheckDataUnit()

error_t lldpCheckDataUnit ( LldpPortEntry port,
LldpDataUnit lldpdu 
)

LLDP data unit validation.

Parameters
[in]portPointer to the port context
[in]lldpduPointer to the received LLDP data unit
Returns
Error code

Definition at line 242 of file lldp_misc.c.

◆ lldpCompareMsapId()

bool_t lldpCompareMsapId ( const LldpMsapId msapId1,
const LldpMsapId msapId2 
)

Compare MSAP identifiers.

Parameters
[in]msapId1Pointer to the first MSAP identifier
[in]msapId2Pointer to the second MSAP identifier
Returns
TRUE if the MSAP identifiers match, else FALSE

Definition at line 768 of file lldp_misc.c.

◆ lldpCreateNeighborEntry()

LldpNeighborEntry* lldpCreateNeighborEntry ( LldpAgentContext context)

Create a new entry in the remote systems MIB.

Parameters
[in]contextPointer to the LLDP agent context
Returns
Pointer to the newly created entry

Definition at line 444 of file lldp_misc.c.

◆ lldpDecrementTimer()

void lldpDecrementTimer ( uint_t x)

Decrement timer value.

Parameters
[in,out]xActual timer value

Definition at line 825 of file lldp_misc.c.

◆ lldpDeleteNeighborEntry()

void lldpDeleteNeighborEntry ( LldpNeighborEntry entry)

Remove an entry from the remote systems MIB.

Parameters
[in]entryPointer to a given entry

Definition at line 528 of file lldp_misc.c.

◆ lldpDropMulticastAddr()

error_t lldpDropMulticastAddr ( LldpAgentContext context)

Remove the LLDP multicast address from the static MAC table.

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

Definition at line 635 of file lldp_misc.c.

◆ lldpFindNeighborEntry()

LldpNeighborEntry* lldpFindNeighborEntry ( LldpAgentContext context,
LldpDataUnit lldpdu 
)

Search the remote systems MIB for a matching MSAP identifier.

Parameters
[in]contextPointer to the LLDP agent context
[in]lldpduPointer to the received LLDP data unit
Returns
Pointer to the matching entry, if any

Definition at line 476 of file lldp_misc.c.

◆ lldpGeneratePortAddr()

void lldpGeneratePortAddr ( LldpPortEntry port)

Port's MAC address generation.

Parameters
[in]portPointer to the port context

Definition at line 689 of file lldp_misc.c.

◆ lldpGetLinkState()

bool_t lldpGetLinkState ( LldpAgentContext context,
uint_t  portIndex 
)

Get link state.

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

Definition at line 544 of file lldp_misc.c.

◆ lldpGetMsapId()

error_t lldpGetMsapId ( LldpDataUnit lldpdu,
LldpMsapId msapId 
)

Extract MSAP identifier.

Parameters
[in]lldpduPointer to the LLDP data unit
[out]msapIdMSAP identifier
Returns
Error code

Definition at line 740 of file lldp_misc.c.

◆ lldpProcessFrame()

void lldpProcessFrame ( LldpAgentContext context)

Process incoming LLDP frame.

Parameters
[in]contextPointer to the LLDP agent context

Definition at line 170 of file lldp_misc.c.

◆ lldpSomethingChangedLocal()

void lldpSomethingChangedLocal ( LldpAgentContext context)

Notify LLDP that an object in the LLDP local system MIB has changed.

Parameters
[in]contextPointer to the LLDP agent context

Definition at line 806 of file lldp_misc.c.

◆ lldpTick()

void lldpTick ( LldpAgentContext context)

LLDP agent timer handler.

This routine must be periodically called by the TCP/IP stack to manage LLDP agent operation

Parameters
[in]contextPointer to the LLDP agent context

Definition at line 58 of file lldp_misc.c.

Variable Documentation

◆ LLDP_MULTICAST_ADDR

const MacAddr LLDP_MULTICAST_ADDR = {{{0x01, 0x80, 0xC2, 0x00, 0x00, 0x0E}}}

Definition at line 46 of file lldp_misc.c.