The SNMP OBJECT-TYPE MACRO is one of several MACROs used in Management Information Base (MIB) definitions. It is the only MACRO of interest to ASN1C because it is the one that specifies the object identifiers and data that are contained in the MIB.
The version of the MACRO currently supported by this version of ASN1C can be found in the SMI Version 2 RFC (RFC 2578). The compiler generates code for two of the items specified in this MACRO definition:
The ASN.1 type that is specified using the SYNTAX command, and
The assigned OBJECT IDENTIFIER value
For an example of the generated code, we can look at the following definition from the UDP MIB:
udpInDatagrams OBJECT-TYPE SYNTAX Counter32 MAX-ACCESS read-only STATUS current DESCRIPTION "The total number of UDP datagrams delivered to UDP users." ::= { udp 1 }
In this case, a type definition is generated for the SYNTAX element and an Object Identifier value is generated for the entire item. The name used for the type definition is “<name>_SYNTAX” where <name> would be replaced with the OBJECT-TYPE name (i.e., udpInDatagrams). The name used for the Object Identifier value constant is the OBJECTTYPE name. So for the above definitions, the following two C# items would be generated:
A “udpInDatagrams_SYNTAX.cs” file. This would contain the udpInDatagrams_SYNTAX class definition, and
A udpInDatagrams value definition in the _UDP_MIBValues class.