Editing SNMP MIB Implementation
Jump to navigation
Jump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 24: | Line 24: | ||
==Convert MIB to Binary File== | ==Convert MIB to Binary File== | ||
− | * mib2bin tool is modified from [http://net-snmp.sourceforge.net/ net-snmp] to convert ASN.1 format file to | + | * mib2bin tool is modified from [http://net-snmp.sourceforge.net/ net-snmp] to convert ASN.1 format file to three files, because the microchip '''mib2bib''' converter only supports upto 255 OIDs. |
MIB compiler tools: '''mib2bin''' | MIB compiler tools: '''mib2bin''' | ||
[http://www.modtronix.com/products/sbc44ec/00870a.pdf foo.mib] (ANS.1 format) -----------------------------------> foo.bin + foo_trap.bin + foo.h + foo_data.h | [http://www.modtronix.com/products/sbc44ec/00870a.pdf foo.mib] (ANS.1 format) -----------------------------------> foo.bin + foo_trap.bin + foo.h + foo_data.h | ||
Line 31: | Line 31: | ||
'''mib2bin <MIBfile>... | '''mib2bin <MIBfile>... | ||
* where MIBfile file is ASN.1 format file. MIBfile = <name>.<type> | * where MIBfile file is ASN.1 format file. MIBfile = <name>.<type> | ||
− | ** '''<name>.bin''' is the binary file storing information of OID tree. This file can be placed on an SD media card to be read by the | + | ** '''<name>.bin''' is the binary file storing information of OID tree. This file can be placed on an SD media card to be read by the FAT16 file system. |
− | ** '''<name>_trap.bin''' is the binary file storing information of TRAP of MIB. This file can be placed on an SD media card to be read by the | + | ** '''<name>_trap.bin''' is the binary file storing information of TRAP of MIB. This file can be placed on an SD media card to be read by the FAT16 file system. |
− | ** '''<name>_data.h''' is C header file storing information of OID tree. This file is generated by converting mchip.bin file to the C header file. It's only used when a system don't have system file and place on program memory. | + | ** '''<name>_data.h''' is C header file storing information of OID tree. This file is generated by converting mchip.bin file to the C header file. |
+ | It's only used when a system don't have system file and place on program memory. | ||
** '''<name>.h''' is C header file storing ID that's reference to function service of OID. | ** '''<name>.h''' is C header file storing ID that's reference to function service of OID. | ||
* Note: | * Note: | ||
** Subfolder '''mibs''' containing the basics MIB files (e.g.: RFC1155-SMI, RFC1213-MIB, RFC-1215, SNMPv2-MIB ... for us MIB file), must be present under the directory of execution. | ** Subfolder '''mibs''' containing the basics MIB files (e.g.: RFC1155-SMI, RFC1213-MIB, RFC-1215, SNMPv2-MIB ... for us MIB file), must be present under the directory of execution. | ||
− | ** If the | + | ** If the three files exist, mib2bin tool will overwrite the files. |
===Binary File Format <name>.bin=== | ===Binary File Format <name>.bin=== | ||
Line 54: | Line 55: | ||
* The microchip format only supports OIDs upto 255. The following is an workaround to store OID greater than 255. | * The microchip format only supports OIDs upto 255. The following is an workaround to store OID greater than 255. | ||
* Format of OID: | * Format of OID: | ||
− | + | An OID is a series of (one or more) octets. Bit 8 of each octet indicates whether it is the last in the series: bit 8 of the last octet is zero; | |
− | + | bit 8 of each preceding octet is one. Bits 7 to 1 of the octets in the series collectively encode the OID. Conceptually, these groups of bits are | |
+ | concatenated to form an unsigned binary number whose most significant bit is bit 7 of the first octet and whose least significant bit is bit 1 of | ||
+ | the last octet. The OID shall be encoded in the fewest possible octets, that is, the leading octet of the OID shall not have the value 0x80. | ||
− | |||
− | |||
− | |||
* Example: | * Example: | ||
The OID encode of OID in binary file (hex) | The OID encode of OID in binary file (hex) | ||
− | 4 | + | 4 BYTE(0x04) |
− | 1 | + | 1 BYTE(0x01) |
− | 36061 BYTE(0x80 + 0x02) BYTE(0x80 + 0x19) BYTE(0x5D) | + | 36061 BYTE(0x80+ 0x02) BYTE(0x80 + 0x19) BYTE(0x5D) |
The OID = 36061 is decoded by 0x02*0x80*0x80 + 0x19*0x80 + 0x5D | The OID = 36061 is decoded by 0x02*0x80*0x80 + 0x19*0x80 + 0x5D | ||
Line 152: | Line 152: | ||
===Binary File Format <name>_trap.bin=== | ===Binary File Format <name>_trap.bin=== | ||
* The binary file store TRAP information. It is generated by mib2bin tool. Agents will read binary file to get information of TRAP when something bad occurs. | * The binary file store TRAP information. It is generated by mib2bin tool. Agents will read binary file to get information of TRAP when something bad occurs. | ||
− | * In the binary file, | + | * In the binary file, A enterprise OID is stored first, followed by its first specific trap number and ID (this ID is match with ID of leaf in <name>.bin) data bindings to be included in this trap to last specific trap number and ID data bindings to be included it. Next, the structure of next this enterprise is stored. This structure is repeated until all enterprise in MIB file is stored. |
* The format of enterprise in <name>_trap.bin | * The format of enterprise in <name>_trap.bin | ||
<enterprise_oid><sibling_enterprise><enterprise_index>[specific_trap_number][sibling_specific_trap][number_varbinds][id_varbind]... | <enterprise_oid><sibling_enterprise><enterprise_index>[specific_trap_number][sibling_specific_trap][number_varbinds][id_varbind]... | ||
Line 377: | Line 377: | ||
* Varbind List is a Sequence of Varbinds. | * Varbind List is a Sequence of Varbinds. | ||
** Varbind is a Sequence of two fields, an OID and the value of OID. | ** Varbind is a Sequence of two fields, an OID and the value of OID. | ||
− | *** OID is an Object Identifier that points to a particular parameter in the SNMP agent | + | *** OID is an Object Identifier that points to a particular parameter in the SNMP agent. |
*** Value is the value of OID. | *** Value is the value of OID. | ||
+--------------------+-----------------------------------------------------------------+ | +--------------------+-----------------------------------------------------------------+ | ||
Line 442: | Line 442: | ||
* Time stamp is the time elapsed between the last initialization of the network entity and the generation of the trap. | * Time stamp is the time elapsed between the last initialization of the network entity and the generation of the trap. | ||
* Varbind List is a Sequence of Varbinds to be included in the trap. | * Varbind List is a Sequence of Varbinds to be included in the trap. | ||
− | ** Varbind is a Sequence of two fields, an OID and the value of OID | + | ** Varbind is a Sequence of two fields, an OID and the value of OID. |
*** OID is an Object Identifier that points to a particular parameter in the SNMP agent. | *** OID is an Object Identifier that points to a particular parameter in the SNMP agent. | ||
*** Value is the value of OID | *** Value is the value of OID | ||
− | |||
===Example SNMP Message=== | ===Example SNMP Message=== | ||
====GetRequest PDU==== | ====GetRequest PDU==== | ||
Line 553: | Line 552: | ||
| | | | | | | 0x01 |Length: 1 | | | | | | | | | 0x01 |Length: 1 | | ||
+---------+-----------+--------+------------+-----------+-------+-------------------------------------------------------------+-------------------+ | +---------+-----------+--------+------------+-----------+-------+-------------------------------------------------------------+-------------------+ | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− |