Re: netsnmp_tdata * table_data structure
"Dave Shield" <[email protected]>
| Newsgroups | gmane.network.net-snmp.user |
|---|---|
| Message-ID | <[email protected]> |
[ First - *please* don't mail me privately, without copying
any responses to the mailing list. I don't have the time
or inclination to offer private, unpaid, SNMP consultancy.
Particularly at the moment, as I'm cutting down on the
time I spend on Net-SNMP support. Keep discussions
to the list, where others can both learn and offer advice.
Thanks. ]
2008/7/17 Richard Horton <[email protected]>:
> Still having an issue though, my test code is as follows (well the
> init bit for rows)
> for(i =0; i<ROWS_ON_STARTUP; i++) {
> row = gdukHornetRadioTable_createEntry(table_data,i);
> entry = row->data;
> DEBUGMSGTL(("GDUK-HORNET-MIB","\tModifying row
> %d/%d\n",entry->gdukHornetRadioIndex,i));
> entry->gdukHornetRadioState = 1;
> strcpy(entry->gdukHornetRadioName,"test");
> }
>
> After running the code the state field correctly is returning 1 in
> response to a get on any given row (typically 32 of them), where as
> the name is returning a null string...
Do you set the length of the string values anywhere?
(i.e. entry->gdukHornetRadioName_len)
Remember that by default, the code for returning values looks
like:
snmp_set_var_typed_value( request->requestvb, TYPE,
entry->string_field, entry->string_field_len);
so that it can handle binary string values.
If you know that all strings will definitely be printable
(and no embedded null characters), then you can tweak
this to use 'strlen(entry->string_field)' instead,
and drop the 'string_field_len' completely.
But if you're using the default code, then you need to
set the length as well as the string value. Otherwise
this length will remain at 0, any extra characters
(i.e. all of them!) will be ignored
Dave
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
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