mikroSDK Reference Manual
mib2_module.h
Go to the documentation of this file.
1
31#ifndef _MIB2_MODULE_H
32#define _MIB2_MODULE_H
33
34//Dependencies
35#include "core/net.h"
36#include "core/udp.h"
37#include "core/tcp.h"
38#include "ipv4/ipv4.h"
39#include "mibs/mib_common.h"
40
41//MIB-II module support
42#ifndef MIB2_SUPPORT
43 #define MIB2_SUPPORT DISABLED
44#elif (MIB2_SUPPORT != ENABLED && MIB2_SUPPORT != DISABLED)
45 #error MIB2_SUPPORT parameter is not valid
46#endif
47
48//System group support
49#ifndef MIB2_SYS_GROUP_SUPPORT
50 #define MIB2_SYS_GROUP_SUPPORT ENABLED
51#elif (MIB2_SYS_GROUP_SUPPORT != ENABLED && MIB2_SYS_GROUP_SUPPORT != DISABLED)
52 #error MIB2_SYS_GROUP_SUPPORT parameter is not valid
53#endif
54
55//Interface group support
56#ifndef MIB2_IF_GROUP_SUPPORT
57 #define MIB2_IF_GROUP_SUPPORT ENABLED
58#elif (MIB2_IF_GROUP_SUPPORT != ENABLED && MIB2_IF_GROUP_SUPPORT != DISABLED)
59 #error MIB2_IF_GROUP_SUPPORT parameter is not valid
60#endif
61
62//IP group support
63#ifndef MIB2_IP_GROUP_SUPPORT
64 #define MIB2_IP_GROUP_SUPPORT ENABLED
65#elif (MIB2_IP_GROUP_SUPPORT != ENABLED && MIB2_IP_GROUP_SUPPORT != DISABLED)
66 #error MIB2_IP_GROUP_SUPPORT parameter is not valid
67#endif
68
69//ICMP group support
70#ifndef MIB2_ICMP_GROUP_SUPPORT
71 #define MIB2_ICMP_GROUP_SUPPORT ENABLED
72#elif (MIB2_ICMP_GROUP_SUPPORT != ENABLED && MIB2_ICMP_GROUP_SUPPORT != DISABLED)
73 #errorMIB2_ICMP_GROUP_SUPPORT parameter is not valid
74#endif
75
76//TCP group support
77#ifndef MIB2_TCP_GROUP_SUPPORT
78 #define MIB2_TCP_GROUP_SUPPORT ENABLED
79#elif (MIB2_TCP_GROUP_SUPPORT != ENABLED && MIB2_TCP_GROUP_SUPPORT != DISABLED)
80 #error MIB2_TCP_GROUP_SUPPORT parameter is not valid
81#endif
82
83//UDP group support
84#ifndef MIB2_UDP_GROUP_SUPPORT
85 #define MIB2_UDP_GROUP_SUPPORT ENABLED
86#elif (MIB2_UDP_GROUP_SUPPORT != ENABLED && MIB2_UDP_GROUP_SUPPORT != DISABLED)
87 #error MIB2_UDP_GROUP_SUPPORT parameter is not valid
88#endif
89
90//SNMP group support
91#ifndef MIB2_SNMP_GROUP_SUPPORT
92 #define MIB2_SNMP_GROUP_SUPPORT ENABLED
93#elif (MIB2_SNMP_GROUP_SUPPORT != ENABLED && MIB2_SNMP_GROUP_SUPPORT != DISABLED)
94 #error MIB2_SNMP_GROUP_SUPPORT parameter is not valid
95#endif
96
97//Size of sysDescr object
98#ifndef MIB2_SYS_DESCR_SIZE
99 #define MIB2_SYS_DESCR_SIZE 16
100#elif (MIB2_SYS_DESCR_SIZE < 0)
101 #error MIB2_SYS_DESCR_SIZE parameter is not valid
102#endif
103
104//Size of sysObjectID object
105#ifndef MIB2_SYS_OBJECT_ID_SIZE
106 #define MIB2_SYS_OBJECT_ID_SIZE 16
107#elif (MIB2_SYS_OBJECT_ID_SIZE < 0)
108 #error MIB2_SYS_OBJECT_ID_SIZE parameter is not valid
109#endif
110
111//Size of sysContact object
112#ifndef MIB2_SYS_CONTACT_SIZE
113 #define MIB2_SYS_CONTACT_SIZE 16
114#elif (MIB2_SYS_CONTACT_SIZE < 0)
115 #error MIB2_SYS_CONTACT_SIZE parameter is not valid
116#endif
117
118//Size of sysName object
119#ifndef MIB2_SYS_NAME_SIZE
120 #define MIB2_SYS_NAME_SIZE 16
121#elif (MIB2_SYS_NAME_SIZE < 0)
122 #error MIB2_SYS_NAME_SIZE parameter is not valid
123#endif
124
125//Size of sysLocation object
126#ifndef MIB2_SYS_LOCATION_SIZE
127 #define MIB2_SYS_LOCATION_SIZE 16
128#elif (MIB2_SYS_LOCATION_SIZE < 0)
129 #error MIB2_SYS_LOCATION_SIZE parameter is not valid
130#endif
131
132//Size of ifSpecific object
133#ifndef MIB2_IF_SPECIFIC_SIZE
134 #define MIB2_IF_SPECIFIC_SIZE 16
135#elif (MIB2_IF_SPECIFIC_SIZE < 1)
136 #error MIB2_IF_SPECIFIC_SIZE parameter is not valid
137#endif
138
139//Size of PhysAddress data type
140#ifndef MIB2_PHYS_ADDRESS_SIZE
141 #define MIB2_PHYS_ADDRESS_SIZE 6
142#elif (MIB2_PHYS_ADDRESS_SIZE < 6)
143 #error MIB2_PHYS_ADDRESS_SIZE parameter is not valid
144#endif
145
146//Size of IpAddress data type
147#ifndef MIB2_IP_ADDRESS_SIZE
148 #define MIB2_IP_ADDRESS_SIZE 4
149#elif (MIB2_IP_ADDRESS_SIZE != 4)
150 #error MIB2_IP_ADDRESS_SIZE parameter is not valid
151#endif
152
153//Macro definitions (Interface group)
154#if (MIB2_SUPPORT == ENABLED && MIB2_IF_GROUP_SUPPORT == ENABLED)
155 #define MIB2_IF_SET_TIME_TICKS(name, value) mib2Base.ifGroup.name = value
156 #define MIB2_IF_INC_COUNTER32(name, value) mib2Base.ifGroup.name += value
157#else
158 #define MIB2_IF_SET_TIME_TICKS(name, value)
159 #define MIB2_IF_INC_COUNTER32(name, value)
160#endif
161
162//Macro definitions (IP group)
163#if (MIB2_SUPPORT == ENABLED && MIB2_IP_GROUP_SUPPORT == ENABLED)
164 #define MIB2_IP_INC_COUNTER32(name, value) mib2Base.ipGroup.name += value
165#else
166 #define MIB2_IP_INC_COUNTER32(name, value)
167#endif
168
169//Macro definitions (ICMP group)
170#if (MIB2_SUPPORT == ENABLED && MIB2_ICMP_GROUP_SUPPORT == ENABLED)
171 #define MIB2_ICMP_INC_COUNTER32(name, value) mib2Base.icmpGroup.name += value
172#else
173 #define MIB2_ICMP_INC_COUNTER32(name, value)
174#endif
175
176//Macro definitions (TCP group)
177#if (MIB2_SUPPORT == ENABLED && MIB2_TCP_GROUP_SUPPORT == ENABLED)
178 #define MIB2_TCP_INC_COUNTER32(name, value) mib2Base.tcpGroup.name += value
179#else
180 #define MIB2_TCP_INC_COUNTER32(name, value)
181#endif
182
183//Macro definitions (UDP group)
184#if (MIB2_SUPPORT == ENABLED && MIB2_UDP_GROUP_SUPPORT == ENABLED)
185 #define MIB2_UDP_INC_COUNTER32(name, value) mib2Base.udpGroup.name += value
186#else
187 #define MIB2_UDP_INC_COUNTER32(name, value)
188#endif
189
190//Macro definitions (SNMP group)
191#if (MIB2_SUPPORT == ENABLED && MIB2_SNMP_GROUP_SUPPORT == ENABLED)
192 #define MIB2_SNMP_INC_COUNTER32(name, value) mib2Base.snmpGroup.name += value
193#else
194 #define MIB2_SNMP_INC_COUNTER32(name, value)
195#endif
196
197//C++ guard
198#ifdef __cplusplus
199extern "C" {
200#endif
201
202
207typedef enum
208{
209 MIB2_SYS_SERVICE_PHYSICAL = 0x01,
210 MIB2_SYS_SERVICE_DATALINK = 0x02,
211 MIB2_SYS_SERVICE_INTERNET = 0x04,
212 MIB2_SYS_SERVICE_END_TO_END = 0x08,
213 MIB2_SYS_SERVICE_APPLICATIONS = 0x40
215
216
221typedef enum
222{
223 MIB2_IF_TYPE_OTHER = 1,
224 MIB2_IF_TYPE_ETHERNET_CSMACD = 6,
225 MIB2_IF_TYPE_PROP_PTP_SERIAL = 22,
226 MIB2_IF_TYPE_PPP = 23,
227 MIB2_IF_TYPE_SOFT_LOOPBACK = 24,
228 MIB2_IF_TYPE_SLIP = 28,
229 MIB2_IF_TYPE_RS232 = 33,
230 MIB2_IF_TYPE_PARA = 34,
231 MIB2_IF_TYPE_IEEE_802_11 = 71,
232 MIB2_IF_TYPE_HDLC = 118,
233 MIB2_IF_TYPE_TUNNEL = 131,
234 MIB2_IF_TYPE_L2_VLAN = 135,
235 MIB2_IF_TYPE_USB = 160,
236 MIB2_IF_TYPE_PLC = 174,
237 MIB2_IF_TYPE_BRIDGE = 209,
238 MIB2_IF_TYPE_IEEE_802_15_4 = 259
239} Mib2IfType;
240
241
246typedef enum
247{
248 MIB2_IF_ADMIN_STATUS_UP = 1,
249 MIB2_IF_ADMIN_STATUS_DOWN = 2,
250 MIB2_IF_ADMIN_STATUS_TESTING = 3
252
253
258typedef enum
259{
260 MIB2_IF_OPER_STATUS_UP = 1,
261 MIB2_IF_OPER_STATUS_DOWN = 2,
262 MIB2_IF_OPER_STATUS_TESTING = 3
264
265
270typedef enum
271{
272 MIB2_IP_FORWARDING_ENABLED = 1,
273 MIB2_IP_FORWARDING_DISABLED = 2
275
276
281typedef enum
282{
283 MIB2_IP_NET_TO_MEDIA_TYPE_OTHER = 1,
284 MIB2_IP_NET_TO_MEDIA_TYPE_INVALID = 2,
285 MIB2_IP_NET_TO_MEDIA_TYPE_DYNAMIC = 3,
286 MIB2_IP_NET_TO_MEDIA_TYPE_STATIC = 4
288
289
294typedef enum
295{
296 MIB2_TCP_RTO_ALGORITHM_OTHER = 1,
297 MIB2_TCP_RTO_ALGORITHM_CONSTANT = 2,
298 MIB2_TCP_RTO_ALGORITHM_RSRE = 3,
299 MIB2_TCP_RTO_ALGORITHM_VANJ = 4
301
302
307typedef enum
308{
309 MIB2_TCP_CONN_STATE_CLOSED = 1,
310 MIB2_TCP_CONN_STATE_LISTEN = 2,
311 MIB2_TCP_CONN_STATE_SYN_SENT = 3,
312 MIB2_TCP_CONN_STATE_SYN_RECEIVED = 4,
313 MIB2_TCP_CONN_STATE_ESTABLISHED = 5,
314 MIB2_TCP_CONN_STATE_FIN_WAIT_1 = 6,
315 MIB2_TCP_CONN_STATE_FIN_WAIT_2 = 7,
316 MIB2_TCP_CONN_STATE_CLOSE_WAIT = 8,
317 MIB2_TCP_CONN_STATE_LAST_ACK = 9,
318 MIB2_TCP_CONN_STATE_CLOSING = 10,
319 MIB2_TCP_CONN_STATE_TIME_WAIT = 11,
320 MIB2_TCP_CONN_STATE_DELETE_TCB = 12
322
323
328typedef enum
329{
330 MIB2_AUTHEN_TRAPS_ENABLED = 1,
331 MIB2_AUTHEN_TRAPS_DISABLED = 2
333
334
339typedef struct
340{
341#if (MIB2_SYS_DESCR_SIZE > 0)
342 char_t sysDescr[MIB2_SYS_DESCR_SIZE];
343 size_t sysDescrLen;
344#endif
345#if (MIB2_SYS_OBJECT_ID_SIZE > 0)
346 uint8_t sysObjectID[MIB2_SYS_OBJECT_ID_SIZE];
347 size_t sysObjectIDLen;
348#endif
349 uint32_t sysUpTime;
350#if (MIB2_SYS_CONTACT_SIZE > 0)
351 char_t sysContact[MIB2_SYS_CONTACT_SIZE];
352 size_t sysContactLen;
353#endif
354#if (MIB2_SYS_NAME_SIZE > 0)
355 char_t sysName[MIB2_SYS_NAME_SIZE];
356 size_t sysNameLen;
357#endif
358#if (MIB2_SYS_LOCATION_SIZE > 0)
359 char_t sysLocation[MIB2_SYS_LOCATION_SIZE];
360 size_t sysLocationLen;
361#endif
362 int32_t sysServices;
364
365
370typedef struct
371{
372 uint32_t ifLastChange;
373 uint32_t ifInOctets;
374 uint32_t ifInUcastPkts;
375 uint32_t ifInNUcastPkts;
376 uint32_t ifInDiscards;
377 uint32_t ifInErrors;
378 uint32_t ifInUnknownProtos;
379 uint32_t ifOutOctets;
380 uint32_t ifOutUcastPkts;
381 uint32_t ifOutNUcastPkts;
382 uint32_t ifOutDiscards;
383 uint32_t ifOutErrors;
384 uint32_t ifOutQLen;
385 uint8_t ifSpecific[MIB2_IF_SPECIFIC_SIZE];
386 size_t ifSpecificLen;
388
389
394typedef struct
395{
396 int32_t ifNumber;
397 Mib2IfEntry ifTable[NET_INTERFACE_COUNT];
399
400
405typedef struct
406{
407 int32_t ipForwarding;
408 int32_t ipDefaultTTL;
409 uint32_t ipInReceives;
410 uint32_t ipInHdrErrors;
411 uint32_t ipInAddrErrors;
412 uint32_t ipForwDatagrams;
413 uint32_t ipInUnknownProtos;
414 uint32_t ipInDiscards;
415 uint32_t ipInDelivers;
416 uint32_t ipOutRequests;
417 uint32_t ipOutDiscards;
418 uint32_t ipOutNoRoutes;
419 int32_t ipReasmTimeout;
420 uint32_t ipReasmReqds;
421 uint32_t ipReasmOKs;
422 uint32_t ipReasmFails;
423 uint32_t ipFragOKs;
424 uint32_t ipFragFails;
425 uint32_t ipFragCreates;
426 uint32_t ipRoutingDiscards;
428
429
434typedef struct
435{
436 uint32_t icmpInMsgs;
437 uint32_t icmpInErrors;
438 uint32_t icmpInDestUnreachs;
439 uint32_t icmpInTimeExcds;
440 uint32_t icmpInParmProbs;
441 uint32_t icmpInSrcQuenchs;
442 uint32_t icmpInRedirects;
443 uint32_t icmpInEchos;
444 uint32_t icmpInEchoReps;
445 uint32_t icmpInTimestamps;
446 uint32_t icmpInTimestampReps;
447 uint32_t icmpInAddrMasks;
448 uint32_t icmpInAddrMaskReps;
449 uint32_t icmpOutMsgs;
450 uint32_t icmpOutErrors;
451 uint32_t icmpOutDestUnreachs;
452 uint32_t icmpOutTimeExcds;
453 uint32_t icmpOutParmProbs;
454 uint32_t icmpOutSrcQuenchs;
455 uint32_t icmpOutRedirects;
456 uint32_t icmpOutEchos;
457 uint32_t icmpOutEchoReps;
458 uint32_t icmpOutTimestamps;
459 uint32_t icmpOutTimestampReps;
460 uint32_t icmpOutAddrMasks;
461 uint32_t icmpOutAddrMaskReps;
463
464
469typedef struct
470{
471 int32_t tcpRtoAlgorithm;
472 int32_t tcpRtoMin;
473 int32_t tcpRtoMax;
474 int32_t tcpMaxConn;
475 uint32_t tcpActiveOpens;
476 uint32_t tcpPassiveOpens;
477 uint32_t tcpAttemptFails;
478 uint32_t tcpEstabResets;
479 uint32_t tcpInSegs;
480 uint32_t tcpOutSegs;
481 uint32_t tcpRetransSegs;
482 uint32_t tcpInErrs;
483 uint32_t tcpOutRsts;
485
486
491typedef struct
492{
493 uint32_t udpInDatagrams;
494 uint32_t udpNoPorts;
495 uint32_t udpInErrors;
496 uint32_t udpOutDatagrams;
498
499
504typedef struct
505{
506 uint32_t snmpInPkts;
507 uint32_t snmpOutPkts;
508 uint32_t snmpInBadVersions;
509 uint32_t snmpInBadCommunityNames;
510 uint32_t snmpInBadCommunityUses;
511 uint32_t snmpInASNParseErrs;
512 uint32_t snmpInTooBigs;
513 uint32_t snmpInNoSuchNames;
514 uint32_t snmpInBadValues;
515 uint32_t snmpInReadOnlys;
516 uint32_t snmpInGenErrs;
517 uint32_t snmpInTotalReqVars;
518 uint32_t snmpInTotalSetVars;
519 uint32_t snmpInGetRequests;
520 uint32_t snmpInGetNexts;
521 uint32_t snmpInSetRequests;
522 uint32_t snmpInGetResponses;
523 uint32_t snmpInTraps;
524 uint32_t snmpOutTooBigs;
525 uint32_t snmpOutNoSuchNames;
526 uint32_t snmpOutBadValues;
527 uint32_t snmpOutGenErrs;
528 uint32_t snmpOutGetRequests;
529 uint32_t snmpOutGetNexts;
530 uint32_t snmpOutSetRequests;
531 uint32_t snmpOutGetResponses;
532 uint32_t snmpOutTraps;
533 int32_t snmpEnableAuthenTraps;
535
536
541typedef struct
542{
543#if (MIB2_SYS_GROUP_SUPPORT == ENABLED)
544 Mib2SysGroup sysGroup;
545#endif
546#if (MIB2_IF_GROUP_SUPPORT == ENABLED)
547 Mib2IfGroup ifGroup;
548#endif
549#if (MIB2_IP_GROUP_SUPPORT == ENABLED)
550 Mib2IpGroup ipGroup;
551#endif
552#if (MIB2_ICMP_GROUP_SUPPORT == ENABLED)
553 Mib2IcmpGroup icmpGroup;
554#endif
555#if (MIB2_TCP_GROUP_SUPPORT == ENABLED)
556 Mib2TcpGroup tcpGroup;
557#endif
558#if (MIB2_UDP_GROUP_SUPPORT == ENABLED)
559 Mib2UdpGroup udpGroup;
560#endif
561#if (MIB2_SNMP_GROUP_SUPPORT == ENABLED)
562 Mib2SnmpGroup snmpGroup;
563#endif
564} Mib2Base;
565
566
567//MIB-II related constants
568extern Mib2Base mib2Base;
569extern const MibObject mib2Objects[];
570extern const MibModule mib2Module;
571
572//C++ guard
573#ifdef __cplusplus
574}
575#endif
576
577#endif
IPv4 (Internet Protocol Version 4)
Mib2TcpRtoAlgorithm
RTO calculation algorithm.
Definition mib2_module.h:295
Mib2IfType
Interface types.
Definition mib2_module.h:222
Mib2IpNetToMediaType
Type of mapping.
Definition mib2_module.h:282
Mib2SysService
System services.
Definition mib2_module.h:208
Mib2IfAdminStatus
The desired state of the interface.
Definition mib2_module.h:247
Mib2IpForwarding
IP forwarding state.
Definition mib2_module.h:271
Mib2EnableAuthenTraps
Enabled/disabled state of authentication failure traps.
Definition mib2_module.h:329
Mib2TcpConnState
TCP connection states.
Definition mib2_module.h:308
Mib2IfOperStatus
The operational state of the interface.
Definition mib2_module.h:259
Common definitions for MIB modules.
TCP/IP stack core.
MIB-II base.
Definition mib2_module.h:542
ICMP group.
Definition mib2_module.h:435
Interfaces table entry.
Definition mib2_module.h:371
Interfaces group.
Definition mib2_module.h:395
IP group.
Definition mib2_module.h:406
SNMP group.
Definition mib2_module.h:505
System group.
Definition mib2_module.h:340
TCP group.
Definition mib2_module.h:470
UDP group.
Definition mib2_module.h:492
MIB module.
Definition mib_common.h:288
TCP (Transmission Control Protocol)
UDP (User Datagram Protocol)