snmp API: read_objid should not return an error in the case

"Alexander Bubnov" <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>
I am learning snmp API by tutorials
(http://net-snmp.sourceforge.net/wiki/index.php/Tutorials). One of
them prints an error in place where is no one as I suppose,
http://net-snmp.sourceforge.net/wiki/index.php/TUT:Simple_Async_Application

here is the function from that tutorial:

void initialize (void)
{
  struct oid *op = oids;

  /* Win32: init winsock */
  SOCK_STARTUP;

  /* initialize library */
  init_snmp("asynchapp");

  /* parse the oids */
  while (op->Name) {
    op->OidLen = sizeof(op->Oid)/sizeof(op->Oid[0]);
    if (!read_objid(op->Name, op->Oid, &op->OidLen)) {
      snmp_perror("read_objid");
      exit(1);
    }
    op++;
  }
}


Below cut of the code reproduces an assumed fault:

#include <net-snmp/net-snmp-config.h>
#include <net-snmp/net-snmp-includes.h>
#include <string.h>

int main(int argc, char ** argv)
{
    oid anOID[MAX_OID_LEN];
    size_t anOID_len = MAX_OID_LEN;

    init_snmp("snmptest");

    if(!read_objid("system.sysDescr.0", anOID, &anOID_len))
        snmp_perror("read_objid");
    else
        puts("no errors");

}


the output:

No log handling enabled - turning on stderr logging
read_objid: Unknown Object Identifier (Sub-id not found: (top) -> system)


What is wrong there?

Thanks in advance.

-- 
/BR, Alexander

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.