mikroSDK Reference Manual
snmp_mib_module.h
Go to the documentation of this file.
1
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
89extern "C" {
90#endif
91
92
97typedef enum
98{
99 SNMP_MIB_SYS_SERVICE_PHYSICAL = 0x01,
100 SNMP_MIB_SYS_SERVICE_DATALINK = 0x02,
101 SNMP_MIB_SYS_SERVICE_INTERNET = 0x04,
102 SNMP_MIB_SYS_SERVICE_END_TO_END = 0x08,
103 SNMP_MIB_SYS_SERVICE_APPLICATIONS = 0x40
105
106
111typedef enum
112{
113 SNMP_MIB_AUTHEN_TRAPS_ENABLED = 1,
114 SNMP_MIB_AUTHEN_TRAPS_DISABLED = 2
116
117
122typedef struct
123{
124#if (SNMP_MIB_SYS_DESCR_SIZE > 0)
125 char_t sysDescr[SNMP_MIB_SYS_DESCR_SIZE];
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];
130 size_t sysObjectIDLen;
131#endif
132 uint32_t sysUpTime;
133#if (SNMP_MIB_SYS_CONTACT_SIZE > 0)
134 char_t sysContact[SNMP_MIB_SYS_CONTACT_SIZE];
135 size_t sysContactLen;
136#endif
137#if (SNMP_MIB_SYS_NAME_SIZE > 0)
138 char_t sysName[SNMP_MIB_SYS_NAME_SIZE];
139 size_t sysNameLen;
140#endif
141#if (SNMP_MIB_SYS_LOCATION_SIZE > 0)
142 char_t sysLocation[SNMP_MIB_SYS_LOCATION_SIZE];
143 size_t sysLocationLen;
144#endif
145 int32_t sysServices;
146 uint32_t sysORLastChange;
148
149
154typedef struct
155{
156 uint32_t snmpInPkts;
157 uint32_t snmpInBadVersions;
158 uint32_t snmpInBadCommunityNames;
159 uint32_t snmpInBadCommunityUses;
160 uint32_t snmpInASNParseErrs;
161 int32_t snmpEnableAuthenTraps;
162 uint32_t snmpSilentDrops;
163 uint32_t snmpProxyDrops;
165
166
171typedef struct
172{
173 int32_t snmpSetSerialNo;
175
176
181typedef struct
182{
183 SnmpAgentContext *context;
184 SnmpMibSysGroup sysGroup;
185 SnmpMibSnmpGroup snmpGroup;
186 SnmpMibSetGroup setGroup;
188
189
190//SNMP MIB related constants
191extern SnmpMibBase snmpMibBase;
192extern const MibObject snmpMibObjects[];
193extern const MibModule snmpMibModule;
194
195//C++ guard
196#ifdef __cplusplus
197}
198#endif
199
200#endif
Common definitions for MIB modules.
SNMP agent (Simple Network Management Protocol)
SnmpMibEnableAuthenTraps
Enabled/disabled state of authentication failure traps.
Definition snmp_mib_module.h:112
SnmpMibSysService
System services.
Definition snmp_mib_module.h:98
MIB module.
Definition mib_common.h:288
SNMP MIB base.
Definition snmp_mib_module.h:182
Set group.
Definition snmp_mib_module.h:172
SNMP group.
Definition snmp_mib_module.h:155
System group.
Definition snmp_mib_module.h:123