please see below code:
i am using a xml file that is in application config folder that contains
tag like :
<OID>.1.3.6.1.4.1.27.3.12.3.3.2.38.0</OID>
....
...
i am using this
vector<string> vData;
that holds these oids as a string.
for( int k = 0; k< vdata.size();k++)
{
char arr[MAX_OID_LEN];
oid kpioid[MAX_OID_LEN];
size_t oidlength = MAX_OID_LEN;
strcpy(arr,vdata[k].c_str());
snmp_parse_oid(arr,kpioid,&oidlength))
print_objid(kpioid,oidlength);
}
data prints like:
.0.0.0.0.21.0.12209668.0.0.13098996.0.13098996.13103392.160.179193048.12230487.179193048.0.164.101169.179193040.160.2678720.18.58478480.5.2640881.58478376.0.20.179193056.1679560.0.1.1679612.5.58478480.4284404.0.58478480.4284404.4225534.4223856.58476704.4001536.58478480.58478552.110586140.58478552.4.0.0.58476704.110586220.7.58351616.4096.4095.16.12238206.12224961.110586152.179192672.128000.128000.6.58478480.1048575.81.4284404.0.110591120.110586184.4230182.0.143890276.110586264.141339687.110586220.110586220.141341652.179192728.316.3.110586264.0.0.0.4096.0.128000.0.0.0.0.143890276.110586328.141341111.179192728.4232049.143015859.142660001.4236396.179192696.179192728.1.0.325.163385014.110588588.110586328.4237408.110586344.136164416.163353780.0.110586360.136888998.163353776.481.110586408.136890271.0.4.0.325.481.325
On Tue, Feb 16, 2010 at 7:37 PM, Dave Shield <[email protected]>wrote:
> On 16 February 2010 13:43, Ashish vashishtha
> <[email protected]> wrote:
> > i think snmp_parse_oid() function convert oids like ABCD to oid.
>
> Whereas I think that snmp_parse_oid() converts a string representation
> of an OID (in any of a variety of formats - including dotted-numeric)
> into a numeric array.
>
> May I humbly suggest that my beliefs are perhaps a shade more
> likely to bear a passing resemblance to the actuality.....
> (or in plain English - you're wrong!)
>
>
> > when i am trying this function with
> > string str that contains 1.3.6.1.1.133.5 i am getting garbage values.
>
> Then there must be something wrong with your code.
> If you show us what you've got, maybe we could suggest
> where the error is.
>
> Dave
>
--
Regards
Ashish Vashishtha
------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
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