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  * Copyright (C) 2010-2018 Oryx Embedded SARL. All rights reserved.
8  *
9  * This file is part of CycloneTCP Open.
10  *
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License
13  * as published by the Free Software Foundation; either version 2
14  * of the License, or (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software Foundation,
23  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24  *
25  * @author Oryx Embedded SARL (www.oryx-embedded.com)
26  * @version 1.9.0
27  **/
28 
29 #ifndef _SNMP_MIB_MODULE_H
30 #define _SNMP_MIB_MODULE_H
31 
32 //Dependencies
33 #include "mibs/mib_common.h"
34 #include "snmp/snmp_agent.h"
35 
36 //SNMP MIB module support
37 #ifndef SNMP_MIB_SUPPORT
38  #define SNMP_MIB_SUPPORT DISABLED
39 #elif (SNMP_MIB_SUPPORT != ENABLED && SNMP_MIB_SUPPORT != DISABLED)
40  #error SNMP_MIB_SUPPORT parameter is not valid
41 #endif
42 
43 //Size of sysDescr object
44 #ifndef SNMP_MIB_SYS_DESCR_SIZE
45  #define SNMP_MIB_SYS_DESCR_SIZE 16
46 #elif (SNMP_MIB_SYS_DESCR_SIZE < 0)
47  #error SNMP_MIB_SYS_DESCR_SIZE parameter is not valid
48 #endif
49 
50 //Size of sysObjectID object
51 #ifndef SNMP_MIB_SYS_OBJECT_ID_SIZE
52  #define SNMP_MIB_SYS_OBJECT_ID_SIZE 16
53 #elif (SNMP_MIB_SYS_OBJECT_ID_SIZE < 0)
54  #error SNMP_MIB_SYS_OBJECT_ID_SIZE parameter is not valid
55 #endif
56 
57 //Size of sysContact object
58 #ifndef SNMP_MIB_SYS_CONTACT_SIZE
59  #define SNMP_MIB_SYS_CONTACT_SIZE 16
60 #elif (SNMP_MIB_SYS_CONTACT_SIZE < 0)
61  #error SNMP_MIB_SYS_CONTACT_SIZE parameter is not valid
62 #endif
63 
64 //Size of sysName object
65 #ifndef SNMP_MIB_SYS_NAME_SIZE
66  #define SNMP_MIB_SYS_NAME_SIZE 16
67 #elif (SNMP_MIB_SYS_NAME_SIZE < 0)
68  #error SNMP_MIB_SYS_NAME_SIZE parameter is not valid
69 #endif
70 
71 //Size of sysLocation object
72 #ifndef SNMP_MIB_SYS_LOCATION_SIZE
73  #define SNMP_MIB_SYS_LOCATION_SIZE 16
74 #elif (SNMP_MIB_SYS_LOCATION_SIZE < 0)
75  #error SNMP_MIB_SYS_LOCATION_SIZE parameter is not valid
76 #endif
77 
78 //Macro definitions
79 #if (SNMP_MIB_SUPPORT == ENABLED)
80  #define SNMP_MIB_INC_COUNTER32(name, value) snmpMibBase.name += value
81 #else
82  #define SNMP_MIB_INC_COUNTER32(name, value)
83 #endif
84 
85 //C++ guard
86 #ifdef __cplusplus
87  extern "C" {
88 #endif
89 
90 
91 /**
92  * @brief System services
93  **/
94 
95 typedef enum
96 {
103 
104 
105 /**
106  * @brief System group
107  **/
108 
109 typedef struct
110 {
111 #if (SNMP_MIB_SYS_DESCR_SIZE > 0)
113  size_t sysDescrLen;
114 #endif
115 #if (SNMP_MIB_SYS_OBJECT_ID_SIZE > 0)
116  uint8_t sysObjectID[SNMP_MIB_SYS_OBJECT_ID_SIZE];
118 #endif
119  uint32_t sysUpTime;
120 #if (SNMP_MIB_SYS_CONTACT_SIZE > 0)
123 #endif
124 #if (SNMP_MIB_SYS_NAME_SIZE > 0)
126  size_t sysNameLen;
127 #endif
128 #if (SNMP_MIB_SYS_LOCATION_SIZE > 0)
131 #endif
132  int32_t sysServices;
133  uint32_t sysORLastChange;
135 
136 
137 /**
138  * @brief SNMP group
139  **/
140 
141 typedef struct
142 {
143  uint32_t snmpInPkts;
149  uint32_t snmpSilentDrops;
150  uint32_t snmpProxyDrops;
152 
153 
154 /**
155  * @brief Set group
156  **/
157 
158 typedef struct
159 {
162 
163 
164 /**
165  * @brief SNMP MIB base
166  **/
167 
168 typedef struct
169 {
174 } SnmpMibBase;
175 
176 
177 //SNMP MIB related constants
178 extern SnmpMibBase snmpMibBase;
179 extern const MibObject snmpMibObjects[];
180 extern const MibModule snmpMibModule;
181 
182 //C++ guard
183 #ifdef __cplusplus
184  }
185 #endif
186 
187 #endif
char char_t
Definition: compiler_port.h:41
SnmpMibSnmpGroup snmpGroup
#define MibObject
Definition: mib_common.h:44
SnmpMibSysService
System services.
SnmpMibSetGroup setGroup
SnmpMibBase snmpMibBase
SNMP MIB base.
int32_t snmpEnableAuthenTraps
#define SNMP_MIB_SYS_NAME_SIZE
uint32_t snmpInASNParseErrs
SNMP agent (Simple Network Management Protocol)
SNMP MIB base.
#define SNMP_MIB_SYS_LOCATION_SIZE
uint32_t snmpSilentDrops
#define SNMP_MIB_SYS_OBJECT_ID_SIZE
#define SNMP_MIB_SYS_CONTACT_SIZE
uint32_t sysORLastChange
uint32_t snmpInBadVersions
uint32_t snmpInBadCommunityUses
const MibModule snmpMibModule
SNMP MIB module.
SnmpAgentContext * context
SnmpMibSysGroup sysGroup
#define SNMP_MIB_SYS_DESCR_SIZE
Common definitions for MIB modules.
uint32_t snmpInBadCommunityNames
const MibObject snmpMibObjects[]
SNMP MIB objects.
#define SnmpAgentContext
Definition: snmp_agent.h:34
MIB module.
Definition: mib_common.h:285
System group.