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 Net-snmp-users@lists.sourceforge.net Please see the following page to unsubscribe or change other options: https://lists.sourceforge.net/lists/listinfo/net-snmp-users