Thanks Dave... The issue is solved.
The change implemented is as below.
case snmp_Type_ObjectId :
{
vp->type = snmp_Type_ObjectId;
std::vector<long> varrowid;
varrowid.clear();
varrowid = BuildOid( strRetValue ); //BuildOid will return a vector
with only OIDs, removing the dot (.).
vector<long>::iterator it;
int i=0;
for ( it=varrowid.begin(); it < varrowid.end(); it++, i++ )
{
var_oid [i] =(oid) *it; // var_oid is a global array of
oid datatype.
}
*var_len = (int) (varrowid.size()*sizeof(netsnmp_oid));
return (u_char *)var_oid;
}
Thanks again.
-Ragesh
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf
Of Dave Shield
Sent: Friday, February 27, 2009 3:51 PM
To: Ragesh V
Cc: [email protected]
Subject: Re: SNMP Agent response time
2009/2/27 Ragesh V <[email protected]>:
>
> The code which handles getNext is as below......
> case snmp_Type_ObjectId :
> {
> vp->type = snmp_Type_ObjectId;
> if (!strRetValue.empty ())
> {
> *var_len = (int) 14;
> return (u_char *)strRetValue.c_str();
> }
> }
The value returned for a MIB object of syntax ASN_OBJECT_ID
should be of type "oid[]" (not a string), and the 'var_len' field
should be the size of this (in bytes, not subidentifiers).
I strongly suspect that you probably need to do something with
'strRetValue.c_str() to ensure it is an array of 'oid' values.
And if this always contains 14 subidentifiers, then you also need
*var_len = 14 * sizeof(oid);
Dave
DISCLAIMER:
-----------------------------------------------------------------------------------------------------------------------
The contents of this e-mail and any attachment(s) are confidential and intended
for the named recipient(s) only.
It shall not attach any liability on the originator or HCL or its affiliates.
Any views or opinions presented in
this email are solely those of the author and may not necessarily reflect the
opinions of HCL or its affiliates.
Any form of reproduction, dissemination, copying, disclosure, modification,
distribution and / or publication of
this message without the prior written consent of the author of this e-mail is
strictly prohibited. If you have
received this email in error please delete it and notify the sender
immediately. Before opening any mail and
attachments please check them for viruses and defect.
-----------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
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