Yeah, thats a mistake. But the program doesn't come to that loop at all it returns with "There was an error in reading". Still I don't have any clue.
rithin.
--
On Thu, 28 Feb 2002 09:49:55
Raju Krishnappa wrote:
>Checkout your print loop.
>
> if (read_objid("system.sysName.0",anOID,&anOID_len)) {
> for(j=0;j<i;j++){
> printf("%d\n",anOID[j]);
> }
>
>I think it should j<anOID_len, not j<i
>
>Raj
>
>-----Original Message-----
>From: rithin shetty [mailto:ri...@ly...]
>Sent: Thursday, February 28, 2002 8:16 AM
>To: net...@li...
>Subject: Can't use read_objid........
>
>
>Hi,
> I'm new to using net-snmp and have this problem. I'm using net-snmp
>4.2.3 on mandrake 8.0. The following program doen't return me the
>sysName object's OID. The add_mibdir however returns the appropriate no.
>of files in the directory.Not only this print_objid also doen't work.
>What could be wrong?
>
>
>#include <sys/types.h>
>#include <ucd-snmp/ucd-snmp-config.h>
>#include <ucd-snmp/ucd-snmp-includes.h>
>#include <ucd-snmp/asn1.h>
>#include <ucd-snmp/mib.h>
>#include <ucd-snmp/parse.h>
>#include <string.h>
>
>
>int main(int argc, char ** argv)
>{
> struct tree *tr;
> int i=0,j=0,n;
>
> oid anOID[MAX_OID_LEN];
> size_t anOID_len = MAX_OID_LEN;
>
> /*
> * Initialize the SNMP library
> */
> init_snmp("filename");
>
> init_mib();
> if ((n=add_mibdir("/usr/local/share/snmp/mibs")) <0 )
> printf("\nThere was an error\n");
> else
> printf("\nThe no. of files in the directory is %d\n",n);
>
>
> printf("\n");
> if (read_objid("system.sysName.0",anOID,&anOID_len)) {
> for(j=0;j<i;j++){
> printf("%d\n",anOID[j]);
> }
> }
> else
> printf("There was an error in reading\n");
>
>} /* main() */
>
>Any help would be appreciated.
>
>thanks
>rithin
>
>
>
>
>
>2,000,000,000 Web Pages--you only need 1. Save time with My Lycos.
>http://my.lycos.com
>
>_______________________________________________
>Net-snmp-coders mailing list
>Net...@li...
>https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
>
2,000,000,000 Web Pages--you only need 1. Save time with My Lycos.
http://my.lycos.com
|