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-2019 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 1.9.6
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 System group
109  **/
110 
111 typedef struct
112 {
113 #if (SNMP_MIB_SYS_DESCR_SIZE > 0)
115  size_t sysDescrLen;
116 #endif
117 #if (SNMP_MIB_SYS_OBJECT_ID_SIZE > 0)
118  uint8_t sysObjectID[SNMP_MIB_SYS_OBJECT_ID_SIZE];
120 #endif
121  uint32_t sysUpTime;
122 #if (SNMP_MIB_SYS_CONTACT_SIZE > 0)
125 #endif
126 #if (SNMP_MIB_SYS_NAME_SIZE > 0)
128  size_t sysNameLen;
129 #endif
130 #if (SNMP_MIB_SYS_LOCATION_SIZE > 0)
133 #endif
134  int32_t sysServices;
135  uint32_t sysORLastChange;
137 
138 
139 /**
140  * @brief SNMP group
141  **/
142 
143 typedef struct
144 {
145  uint32_t snmpInPkts;
151  uint32_t snmpSilentDrops;
152  uint32_t snmpProxyDrops;
154 
155 
156 /**
157  * @brief Set group
158  **/
159 
160 typedef struct
161 {
164 
165 
166 /**
167  * @brief SNMP MIB base
168  **/
169 
170 typedef struct
171 {
176 } SnmpMibBase;
177 
178 
179 //SNMP MIB related constants
180 extern SnmpMibBase snmpMibBase;
181 extern const MibObject snmpMibObjects[];
182 extern const MibModule snmpMibModule;
183 
184 //C++ guard
185 #ifdef __cplusplus
186 }
187 #endif
188 
189 #endif
@ SNMP_MIB_SYS_SERVICE_APPLICATIONS
SnmpMibSysGroup sysGroup
uint32_t snmpInBadCommunityNames
SnmpMibSetGroup setGroup
uint32_t snmpInBadVersions
@ SNMP_MIB_SYS_SERVICE_INTERNET
@ SNMP_MIB_SYS_SERVICE_END_TO_END
#define SNMP_MIB_SYS_LOCATION_SIZE
uint32_t sysORLastChange
#define SNMP_MIB_SYS_CONTACT_SIZE
SNMP agent (Simple Network Management Protocol)
SNMP MIB base.
SnmpAgentContext * context
#define SNMP_MIB_SYS_OBJECT_ID_SIZE
const MibModule snmpMibModule
SNMP MIB module.
#define SNMP_MIB_SYS_DESCR_SIZE
SnmpMibSysService
System services.
SnmpMibSnmpGroup snmpGroup
System group.
uint32_t snmpInBadCommunityUses
MIB module.
Definition: mib_common.h:287
const MibObject snmpMibObjects[]
SNMP MIB objects.
#define SNMP_MIB_SYS_NAME_SIZE
uint32_t snmpInASNParseErrs
@ SNMP_MIB_SYS_SERVICE_DATALINK
char char_t
Definition: compiler_port.h:43
Common definitions for MIB modules.
int32_t snmpEnableAuthenTraps
#define MibObject
Definition: mib_common.h:46
uint32_t snmpSilentDrops
@ SNMP_MIB_SYS_SERVICE_PHYSICAL
#define SnmpAgentContext
Definition: snmp_agent.h:36
SnmpMibBase snmpMibBase
SNMP MIB base.