Keil Logo

Technical Support

On-Line Manuals

RL-ARM User's Guide (MDK v4)

RL-RTX RL-FlashFS RL-TCPnet TCP Socket Opening TCP Connection TCP Active Open TCP Passive Open Sending TCP Data Example for Sending Data Multiple TCP Connections UDP Socket Opening UDP Connection Sending UDP Data When DHCP Enabled When ARP Cache Empty Example for Sending Data IP Multicasting Multiple UDP Connections Configuring RL-TCPnet Static Configuration System Definitions Ethernet Network Interface PPP Network Interface SLIP Network Interface UDP Socket TCP Socket BSD Socket HTTP Server Telnet Server TFTP Server TFTP Client FTP Server FTP Client DNS Client SMTP Client SNMP Agent SNTP Client Error Function Runtime Configuration Library Files Using RL-TCPnet Stand Alone With RTX Kernel Event Driven Operation IP Address Assignment Ethernet Interface PPP Interface SLIP Interface Localhost Applications HTTP Server Script Language CGI Functions Ajax Support Using XML XML Example How it works SOAP Support SOAP Interface Large POST Messages Web Pages Default Page Error Pages Web on SD Card Web Update File System Interface Http Caching How it works Internal Web External Web Multi-user Authentication Using RAM File System FCARM File Converter PRINT Directive NOPRINT Directive PAGEWIDTH Directive PAGELENGTH Directive ROOT Directive Telnet Server Command Line Interface Multi-user Authentication Sending Reply Message Short Reply Long Reply Continuous Screen Update TFTP Server File System Interface TFTP Client File System Interface FTP Server File System Interface Multi-user Authentication Supported Commands FTP Client File System Interface SMTP Client SNMP Agent MIB Database MIB Interface MIB Entry MIB Table DNS Resolver Starting DNS Device Drivers Ethernet Driver Interrupt Mode Modem Driver Serial Driver Using Serial Link Cable Connection Modem Connection Windows Dial-up Add Direct Serial Link New Dial-up Connection Configure PPP Dial-up Configure SLIP Dial-up Debugging Enabling Debug Debug Level Redirecting Output Function Overview BSD Routines CGI Routines Ethernet Routines FTP Routines HTTP Routines IGMP Routines Miscellaneous Routines Modem Routines PPP Routines Serial Routines SLIP Routines SMTP Routines SNMP Routines System Functions TCP Routines Telnet Routines TFTP Routines UDP Routines RL-CAN RL-USB Example Programs Library Reference Appendix

MIB Table

The snmp_mib table is defined as an array. The components of this array are of type MIB_ENTRY.

const MIB_ENTRY snmp_mib[] = {
  /* ---------- System MIB ----------- */
  /* SysDescr Entry */
    8, {OID0(1,3), 6, 1, 2, 1, 1, 1, 0},
    MIB_STR("Embedded System SNMP V1.0"),
    NULL },
  /* SysObjectID Entry */
    8, {OID0(1,3), 6, 1, 2, 1, 1, 2, 0},
    NULL },
  /* SysUpTime Entry */
    8, {OID0(1,3), 6, 1, 2, 1, 1, 3, 0},
    4, &snmp_SysUpTime,
    NULL },

In the following example, we will construct a MIB variable entry LedOut. It will allow SNMP Manager to control LED diodes on an evaluation board.

  • The MIB variable type is Integer. An U8 variable is sufficient, because the LED port is 8-bit:
      /* LedOut Entry */
      { MIB_INTEGER,
  • The OID reference is It is defined in the Experimental MIB branch of the MIB tree:
        6, {OID0(1,3), 6, 1, 3, 1, 0},
    - the first byte defines the length of the OID name,
    - macro OID0 calculates the first byte of OID value from 1st and 2nd address byte,
    - the value of an OID address byte must be less than 128, othervise an extended encoding must be used.
  • The variable size and location is described with the help of MIB_INT macro:

    The following macros are defined:

    Macro Variable Definition
    MIB_STR Octet String size and location.
    MIB_INT Signed or Unsigned Integer size and location.
    MIB_IP IP Address size and location.
  • The write_leds is specified as callback function. It gets called when the LedOut is written:
        write_leds },
  • Finally we need the actual variable definition:
    static U8 LedOut;

For the LedOut control we actually need the following parts of code to be defined in SNMP_MIB.c module:

static U8 LedOut;
static void write_leds (int mode);

const MIB_ENTRY snmp_mib[] = {
  /* LedOut Entry */
    6, {OID0(1,3), 6, 1, 3, 1, 0},
    write_leds },

static void write_leds (int mode) {
  /* No action on read access. */
  if (mode == MIB_WRITE) {
    LED_out (LedOut);

Extended OID encoding

The value of OID address byte must be less than 128. If it is not, an OID address must be encoded in extended format. This is because the high bit of an address byte is an address extension bit.

For example, the OID address is encoded as:

  8, {OID0(1,3), 6, 1, 4, 1, 130, 55, 0},

The address value for the highlighted numbers is calculated as:

  (130-128) * 128 + 55 = 311

The OID address is encoded as:

  12, {OID0(1,3), 6, 1, 4, 1, 129, 242, 60, 50, 1, 1, 0},

where the value 31036 is calculated as:

  (129-128) * 128 * 128 + (242-128) * 128 + 60 = 31036
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.