SNMP Subagent Programmer's Guide
Writing Subagent Logic
SNMP Subagent Programmer’s Guide—119728 4-3
MIB Variable Declarations
For example, the sample Hello World program uses a MIB object named helloPrintCnt:
helloPrintCnt OBJECT-TYPE
 SYNTAX Counter
 ACCESS read-only
 STATUS mandatory
 DESCRIPTION
 "A running count of the number of times the
 helloOutputText message has been printed to
 the console."
 ::= { hello 3 }
...
The global variable that holds values for this MIB object is declared as follows in the 
Hello World source code:
static Counter helloPrintCnt = 0;
Table 4-1. Mapping SNMP Data Types to C Data Types
smitypeh Typedef Description C Data Type
INTEGER 32-bit signed number long
Counter 32-bit unsigned number that only 
increases except when wrapping to 0
unsigned long
Gauge 32-bit unsigned number that can go up or 
down
unsigned long
TimeTicks 32-bit unsigned number representing the 
time in 1/100ths of a second since some 
epoch
unsigned long
IpAddress 4-byte Internet address in network-byte 
order
unsigned long
OCTETSTRING Arbitrary-length array of bytes struct octet_string
DisplayString Arbitrary-length array of ASCII 
characters
struct octet_string
OBJECTIDENTIFIER Arbitrary-length OBJECT IDENTIFIER struct octet_string
Opaque Arbitrary-length block of bytes that have 
some internal meaning
struct octet_string
PhysAddress Arbitrary-length block of bytes that 
represent media- or physical-level 
addresses
struct octet_string










