snmp_mib_module.h
Go to the documentation of this file.
1 /**
2  * @file snmp_mib_module.h
3  * @brief SNMP MIB module
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 _SNMP_MIB_MODULE_H
32 #define _SNMP_MIB_MODULE_H
33 
34 //Dependencies
35 #include "mibs/mib_common.h"
36 #include "snmp/snmp_agent.h"
37 
38 //SNMP MIB module support
39 #ifndef SNMP_MIB_SUPPORT
40  #define SNMP_MIB_SUPPORT DISABLED
41 #elif (SNMP_MIB_SUPPORT != ENABLED && SNMP_MIB_SUPPORT != DISABLED)
42  #error SNMP_MIB_SUPPORT parameter is not valid
43 #endif
44 
45 //Size of sysDescr object
46 #ifndef SNMP_MIB_SYS_DESCR_SIZE
47  #define SNMP_MIB_SYS_DESCR_SIZE 16
48 #elif (SNMP_MIB_SYS_DESCR_SIZE < 0)
49  #error SNMP_MIB_SYS_DESCR_SIZE parameter is not valid
50 #endif
51 
52 //Size of sysObjectID object
53 #ifndef SNMP_MIB_SYS_OBJECT_ID_SIZE
54  #define SNMP_MIB_SYS_OBJECT_ID_SIZE 16
55 #elif (SNMP_MIB_SYS_OBJECT_ID_SIZE < 0)
56  #error SNMP_MIB_SYS_OBJECT_ID_SIZE parameter is not valid
57 #endif
58 
59 //Size of sysContact object
60 #ifndef SNMP_MIB_SYS_CONTACT_SIZE
61  #define SNMP_MIB_SYS_CONTACT_SIZE 16
62 #elif (SNMP_MIB_SYS_CONTACT_SIZE < 0)
63  #error SNMP_MIB_SYS_CONTACT_SIZE parameter is not valid
64 #endif
65 
66 //Size of sysName object
67 #ifndef SNMP_MIB_SYS_NAME_SIZE
68  #define SNMP_MIB_SYS_NAME_SIZE 16
69 #elif (SNMP_MIB_SYS_NAME_SIZE < 0)
70  #error SNMP_MIB_SYS_NAME_SIZE parameter is not valid
71 #endif
72 
73 //Size of sysLocation object
74 #ifndef SNMP_MIB_SYS_LOCATION_SIZE
75  #define SNMP_MIB_SYS_LOCATION_SIZE 16
76 #elif (SNMP_MIB_SYS_LOCATION_SIZE < 0)
77  #error SNMP_MIB_SYS_LOCATION_SIZE parameter is not valid
78 #endif
79 
80 //Macro definitions
81 #if (SNMP_MIB_SUPPORT == ENABLED)
82  #define SNMP_MIB_INC_COUNTER32(name, value) snmpMibBase.name += value
83 #else
84  #define SNMP_MIB_INC_COUNTER32(name, value)
85 #endif
86 
87 //C++ guard
88 #ifdef __cplusplus
89 extern "C" {
90 #endif
91 
92 
93 /**
94  * @brief System services
95  **/
96 
97 typedef enum
98 {
105 
106 
107 /**
108  * @brief Enabled/disabled state of authentication failure traps
109  **/
110 
111 typedef enum
112 {
116 
117 
118 /**
119  * @brief System group
120  **/
121 
122 typedef struct
123 {
124 #if (SNMP_MIB_SYS_DESCR_SIZE > 0)
126  size_t sysDescrLen;
127 #endif
128 #if (SNMP_MIB_SYS_OBJECT_ID_SIZE > 0)
129  uint8_t sysObjectID[SNMP_MIB_SYS_OBJECT_ID_SIZE];
131 #endif
132  uint32_t sysUpTime;
133 #if (SNMP_MIB_SYS_CONTACT_SIZE > 0)
136 #endif
137 #if (SNMP_MIB_SYS_NAME_SIZE > 0)
139  size_t sysNameLen;
140 #endif
141 #if (SNMP_MIB_SYS_LOCATION_SIZE > 0)
144 #endif
145  int32_t sysServices;
146  uint32_t sysORLastChange;
148 
149 
150 /**
151  * @brief SNMP group
152  **/
153 
154 typedef struct
155 {
156  uint32_t snmpInPkts;
162  uint32_t snmpSilentDrops;
163  uint32_t snmpProxyDrops;
165 
166 
167 /**
168  * @brief Set group
169  **/
170 
171 typedef struct
172 {
175 
176 
177 /**
178  * @brief SNMP MIB base
179  **/
180 
181 typedef struct
182 {
187 } SnmpMibBase;
188 
189 
190 //SNMP MIB related constants
191 extern SnmpMibBase snmpMibBase;
192 extern const MibObject snmpMibObjects[];
193 extern const MibModule snmpMibModule;
194 
195 //C++ guard
196 #ifdef __cplusplus
197 }
198 #endif
199 
200 #endif
char char_t
Definition: compiler_port.h:48
Common definitions for MIB modules.
#define MibObject
Definition: mib_common.h:46
SNMP agent (Simple Network Management Protocol)
#define SnmpAgentContext
Definition: snmp_agent.h:36
SnmpMibEnableAuthenTraps
Enabled/disabled state of authentication failure traps.
@ SNMP_MIB_AUTHEN_TRAPS_ENABLED
@ SNMP_MIB_AUTHEN_TRAPS_DISABLED
SnmpMibSysService
System services.
@ SNMP_MIB_SYS_SERVICE_END_TO_END
@ SNMP_MIB_SYS_SERVICE_APPLICATIONS
@ SNMP_MIB_SYS_SERVICE_DATALINK
@ SNMP_MIB_SYS_SERVICE_INTERNET
@ SNMP_MIB_SYS_SERVICE_PHYSICAL
#define SNMP_MIB_SYS_OBJECT_ID_SIZE
const MibModule snmpMibModule
SNMP MIB module.
const MibObject snmpMibObjects[]
SNMP MIB objects.
SnmpMibBase snmpMibBase
SNMP MIB base.
#define SNMP_MIB_SYS_LOCATION_SIZE
#define SNMP_MIB_SYS_DESCR_SIZE
#define SNMP_MIB_SYS_CONTACT_SIZE
#define SNMP_MIB_SYS_NAME_SIZE
MIB module.
Definition: mib_common.h:292
SNMP MIB base.
SnmpAgentContext * context
SnmpMibSysGroup sysGroup
SnmpMibSetGroup setGroup
SnmpMibSnmpGroup snmpGroup
uint32_t snmpInBadCommunityUses
uint32_t snmpInASNParseErrs
uint32_t snmpInBadVersions
uint32_t snmpInBadCommunityNames
int32_t snmpEnableAuthenTraps
uint32_t snmpSilentDrops
System group.
uint32_t sysORLastChange