On Sun, Oct 31, 2004 at 08:58:10AM -0800, Wes Hardaker wrote:
> >>>>> On Thu, 14 Oct 2004 13:46:01 +0100, Patrick Welche <[EMAIL PROTECTED]> 
> >>>>> said:
> 
> Patrick> In writing a client using net-snmplib, is there an easy way
> Patrick> of using indices or does one need (for the text
> Patrick> representation of the oid, eg somemib::someoid.i.j) to use
> Patrick> sprintf/strcat and then send the resultant string to
> Patrick> snmp_parse_oid ?
> 
> Patrick> Are there more coding examples than those of the tutorial for
> Patrick> clients?
> 
> Did you want to parse OIDs returned by an agent, or construct them
> from data?  We have APIs for both, but they're not well documented at
> the moment.

Construct them from data.

  static const char varname[]="somemib::sometable.1.1";
  oid value[MAX_OID_LEN];
  size_t valuelen;

  valuelen=sizeof(value)/sizeof(oid);
  snmp_parse_oid(varname,value,&valuelen);
  value[valuelen-2]=index1;
  value[valuelen-1]=index2;
  snmp_add_null_var(pdu,value,valuelen);

seems to work, but is this The Right Way(tm) ?

Cheers,

Patrick


-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8
_______________________________________________
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

Reply via email to