lldp_mib_impl.c
Go to the documentation of this file.
1 /**
2  * @file lldp_mib_impl.c
3  * @brief LLDP MIB module implementation
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 //Switch to the appropriate trace level
32 #define TRACE_LEVEL SNMP_TRACE_LEVEL
33 
34 //Dependencies
35 #include "core/net.h"
36 #include "mibs/mib_common.h"
37 #include "mibs/lldp_mib_module.h"
38 #include "mibs/lldp_mib_impl.h"
39 #include "core/crypto.h"
40 #include "encoding/asn1.h"
41 #include "encoding/oid.h"
42 #include "lldp/lldp_mgmt.h"
43 #include "debug.h"
44 
45 //Check TCP/IP stack configuration
46 #if (LLDP_MIB_SUPPORT == ENABLED)
47 
48 
49 /**
50  * @brief LLDP MIB module initialization
51  * @return Error code
52  **/
53 
55 {
56  //Debug message
57  TRACE_INFO("Initializing LLDP MIB base...\r\n");
58 
59  //Clear LLDP MIB base
60  memset(&lldpMibBase, 0, sizeof(lldpMibBase));
61 
62  //Successful processing
63  return NO_ERROR;
64 }
65 
66 
67 /**
68  * @brief Lock LLDP MIB base
69  **/
70 
71 void lldpMibLock(void)
72 {
73  //Acquire exclusive access to the LLDP agent context
75 }
76 
77 
78 /**
79  * @brief Unlock LLDP MIB base
80  **/
81 
82 void lldpMibUnlock(void)
83 {
84  //Release exclusive access to the LLDP agent context
86 }
87 
88 
89 /**
90  * @brief Attach LLDP agent context
91  * @param[in] context Pointer to the LLDP agent context
92  * @return Error code
93  **/
94 
96 {
97  //Attach LLDP agent context
98  lldpMibBase.lldpAgentContext = context;
99 
100  //Successful processing
101  return NO_ERROR;
102 }
103 
104 #endif
ASN.1 (Abstract Syntax Notation One)
General definitions for cryptographic algorithms.
Debugging facilities.
#define TRACE_INFO(...)
Definition: debug.h:95
error_t
Error codes.
Definition: error.h:43
@ NO_ERROR
Success.
Definition: error.h:44
#define LldpAgentContext
Definition: lldp.h:40
void lldpMgmtLock(LldpAgentContext *context)
Acquire exclusive access to the LLDP agent context.
Definition: lldp_mgmt.c:51
void lldpMgmtUnlock(LldpAgentContext *context)
Release exclusive access to the LLDP agent context.
Definition: lldp_mgmt.c:63
Management of the LLDP agent.
void lldpMibUnlock(void)
Unlock LLDP MIB base.
Definition: lldp_mib_impl.c:82
error_t lldpMibSetLldpAgentContext(LldpAgentContext *context)
Attach LLDP agent context.
Definition: lldp_mib_impl.c:95
error_t lldpMibInit(void)
LLDP MIB module initialization.
Definition: lldp_mib_impl.c:54
void lldpMibLock(void)
Lock LLDP MIB base.
Definition: lldp_mib_impl.c:71
LLDP MIB module implementation.
LldpMibBase lldpMibBase
LLDP MIB base.
LLDP MIB module.
Common definitions for MIB modules.
TCP/IP stack core.
OID (Object Identifier)
LldpAgentContext * lldpAgentContext