Re: OID printing question

Shane Dawalt <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>
   Ah ... your explanation was highly illuminating.  I didn't realize 
that I was using a more specific function and that the *print_value() 
function would have sufficed. I thought it was up to me (my code) to 
intuit the type of data and to call the appropriate printing function. 
Thanks!!

  Shane


Dave Shield wrote:

> On 20/07/06, Shane D <[email protected]> wrote:
>
>>   But I was trying to print an OID (system.sysObjectID).  The expected
>> string would print, but then all kinds of numeric jibberish was appended
>> to it (using snprint_objid).
>>           .... did I miss some place where something talks about
>> this mysterious division by sizeof(oid)?
>
>
> It's probably not mentioned explicitly, no.
>
> The prototype for the 'print_objid' family is given as:
>       void {sn,f,}print_objid( ...., oid *objid, int objidlen);
> where 'objidlen' is the length of the objid array - i.e the number of
> sub-identifiers in the OID.
> That's the standard way of representing the name side of (name=value) 
> varbinds.
>
> Howevere, values are represented as a union of the various possible
> syntaxes, and are typically displayed using the 'print_value' family
> of routines.  This takes the absolute size of the value (since this
> could be a printable/binary string, or some form of integer, or an
> OID),
> checks the type and interprets the value accordingly.
>
> If you're handling this manually, you need to do much the same - check
> the type of the value returned, and interpret the results
> appropriately.  That's where this sizeof(oid) comes into play -
> converting from a general-purpose value (where you work with the size
> of the data) to an OID array (where you work with the number of
> elements).
>
>
> It's undoubtably true that the documentation could be significantly
> better - both here and elsewhere.  Unfortunately, those of us who've
> been working with this code for years (and so are probably the best
> placed to provide such descriptions), are too familiar with how things
> work to recognise where the most glaring deficiencies lie.
>
> Dave



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
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.