[First - *please* don't mail me privately, without
      Cc:ing the mailing list. I don't have the time or
      inclination to offer private, unpaid, SNMP consultancy.
      In fact, you should send initial queries to the list
      *only*. I've currently stepped back from the lists,
      to try and concentrate on other work for a while.]


On Fri, 2005-03-18 at 09:16, V, Bharath (Bharath) wrote:
> Hi Dave,
> 
> I am trying to update a octet string variable using snmpset, but i
> am facing some problem.
> If the length of new string and old string is same then it will work fine.. 
> if the length is different it gives "Wrong length error"

Yes - that's because you've declared things as being "fixed size".


> ******************************************************
> winfo[i] = netsnmp_create_watcher_info((strScalars),
>                             strlen((strScalars)),
>                             ASN_OCTET_STR, WATCHER_FIXED_SIZE);
                                             ^^^^^^^^^^^^^^^^^^

> Is there any way to update the length of the string???

There should be a discussion of this on the mailing list,
though I don't have a reference to hand.  Very briefly,
the watcher structure contains two size fields - max_size
and data_size.  These are both initialised to the same value
by the netsnmp_create_watcher_info() call.
   If you've got a variable-length string, you'll have to set
one of these manually.

Either:
  winfo[i] = netsnmp_create_watcher_info((strScalars),
                                  strlen((strScalars)),
                                  ASN_OCTET_STR, WATCHER_MAX_SIZE);
  winfo[i]->max_size = sizeof(strScalars);

or:
  winfo[i] = netsnmp_create_watcher_info((strScalars),
                                  sizeof((strScalars)),
                                  ASN_OCTET_STR, WATCHER_MAX_SIZE);
  winfo[i]->data_size = strlen(strScalars);



Dave



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to