title: SNMP AgentX: Howto register for OIDs?
body: <p>I'm writing an AgentX sub-agent for Net-SNMP in C++.</p>
  
  <p>I try to register for the OID  1.3.6.1.4.1.4711.1.1 like this</p>
  
  <pre><code>oid myOID[] = { 1, 3, 6, 1, 4, 1, 4711, 1, 1 };
  handler = netsnmp_create_handler_registration("foo", handler, myOID, OID_LENGTH(myOID), HANDLER_CAN_RONLY);
  if (handler)
      netsnmp_register_scalar(handler);
  </code></pre>
  
  <p>Strangely snmpget fails for 1.3.6.1.4.1.4711.1.1 and my handler only gets called when I do snmpget for 1.3.6.1.4.1.4711.1.1.0 (added zero).</p>
  
  <p>How can I register for 1.3.6.1.4.1.4711.1.1 ?</p>
  
  <p>The examples on net-snmp.org all register an instance variable, but I have to run some code to collect the value.</p>
  
  <p>Do I have to declare my callback as extern "C" from a C++ application ?</p>
  
  <p>Does anybbody have an example how to register for all OIDs below 1.3.6.1.4.1.4711.1 so I don't have to define so many handlers ?</p>