lldp_misc.h
Go to the documentation of this file.
1 /**
2  * @file lldp_misc.h
3  * @brief Helper functions for LLDP
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2010-2024 Oryx Embedded SARL. All rights reserved.
10  *
11  * This file is part of CycloneTCP Open.
12  *
13  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2
16  * of the License, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software Foundation,
25  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26  *
27  * @author Oryx Embedded SARL (www.oryx-embedded.com)
28  * @version 2.4.0
29  **/
30 
31 #ifndef _LLDP_MISC_H
32 #define _LLDP_MISC_H
33 
34 //Dependencies
35 #include "core/net.h"
36 #include "lldp/lldp.h"
37 
38 //C++ guard
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42 
43 //LLDP multicast address (refer to IEEE Std 802.1AB-2005, section 8.1)
44 extern const MacAddr LLDP_MULTICAST_ADDR;
45 
46 //LLDP agent related functions
47 void lldpTick(LldpAgentContext *context);
48 
49 void lldpProcessFrame(LldpAgentContext *context);
50 
52 
54 
56  LldpDataUnit *lldpdu);
57 
59 
60 bool_t lldpGetLinkState(LldpAgentContext *context, uint_t portIndex);
61 
64 
66 
68 bool_t lldpCompareMsapId(const LldpMsapId *msapId1, const LldpMsapId *msapId2);
69 
72 
73 //C++ guard
74 #ifdef __cplusplus
75 }
76 #endif
77 
78 #endif
unsigned int uint_t
Definition: compiler_port.h:50
int bool_t
Definition: compiler_port.h:53
uint16_t port
Definition: dns_common.h:267
error_t
Error codes.
Definition: error.h:43
MacAddr
Definition: ethernet.h:195
LLDP (Link Layer Discovery Protocol)
#define LldpPortEntry
Definition: lldp.h:44
#define LldpDataUnit
Definition: lldp.h:36
#define LldpAgentContext
Definition: lldp.h:40
uint8_t x
Definition: lldp_ext_med.h:211
void lldpDeleteNeighborEntry(LldpNeighborEntry *entry)
Remove an entry from the remote systems MIB.
Definition: lldp_misc.c:528
void lldpProcessFrame(LldpAgentContext *context)
Process incoming LLDP frame.
Definition: lldp_misc.c:170
void lldpDecrementTimer(uint_t *x)
Decrement timer value.
Definition: lldp_misc.c:825
bool_t lldpCompareMsapId(const LldpMsapId *msapId1, const LldpMsapId *msapId2)
Compare MSAP identifiers.
Definition: lldp_misc.c:768
void lldpGeneratePortAddr(LldpPortEntry *port)
Port's MAC address generation.
Definition: lldp_misc.c:689
void lldpSomethingChangedLocal(LldpAgentContext *context)
Notify LLDP that an object in the LLDP local system MIB has changed.
Definition: lldp_misc.c:806
error_t lldpDropMulticastAddr(LldpAgentContext *context)
Remove the LLDP multicast address from the static MAC table.
Definition: lldp_misc.c:635
error_t lldpGetMsapId(LldpDataUnit *lldpdu, LldpMsapId *msapId)
Extract MSAP identifier.
Definition: lldp_misc.c:740
bool_t lldpGetLinkState(LldpAgentContext *context, uint_t portIndex)
Get link state.
Definition: lldp_misc.c:544
void lldpTick(LldpAgentContext *context)
LLDP agent timer handler.
Definition: lldp_misc.c:58
LldpNeighborEntry * lldpFindNeighborEntry(LldpAgentContext *context, LldpDataUnit *lldpdu)
Search the remote systems MIB for a matching MSAP identifier.
Definition: lldp_misc.c:476
error_t lldpAcceptMulticastAddr(LldpAgentContext *context)
Add the LLDP multicast address to the static MAC table.
Definition: lldp_misc.c:580
const MacAddr LLDP_MULTICAST_ADDR
Definition: lldp_misc.c:46
error_t lldpCheckDataUnit(LldpPortEntry *port, LldpDataUnit *lldpdu)
LLDP data unit validation.
Definition: lldp_misc.c:242
LldpNeighborEntry * lldpCreateNeighborEntry(LldpAgentContext *context)
Create a new entry in the remote systems MIB.
Definition: lldp_misc.c:444
TCP/IP stack core.
MSAP identifier.
Definition: lldp.h:247
LLDP neighbor entry.
Definition: lldp.h:260