I never added the COLUMN enum value into my "valid columns" array which I
placed in the init_data() function ...... ugh.
Anyway, this table now works perfectly ......
--- On Mon, 9/1/08, Need Help <[EMAIL PROTECTED]> wrote:
From: Need Help <[EMAIL PROTECTED]>
Subject: How to populate SnmpAdminString in MFD row context in container_load()?
To: "net-snmp Coders" <net-snmp-coders@lists.sourceforge.net>
Date: Monday, September 1, 2008, 7:37 AM
I generated code for my table using the MFD format. In the "data_acess.cpp"
file there is a container_load() function which is where I am populating the
complete table. When I snmpwalk through the table all fields get displayed
except for the last field which happens to be the only SnmpAdminString text
string defined in the table. All other fields are displayed fine with their
correct values when I perform the snmpwalk. The SnmpAdminString text string
field (which happens to be the last field defined in the table) is the only one
not displayed at all. I am assuming this is because I am not populating the
data correctly in the row context.
Here is the code snipet generated using the MFD config which provides a format
to use when populating the SnmpAdminString into the row context. Obviously, my
SnmpAdminString field
name is "diagInbandTunerChanParentalControlStatus".
/*
* make sure there is enough space for
* diagInbandTunerChanParentalControlStatus data
*/
if ((NULL == rowreq_ctx->data.diagInbandTunerChanParentalControlStatus) ||
(rowreq_ctx->data.diagInbandTunerChanParentalControlStatus_len <
(diagInbandTunerChanParentalControlStatus_len *
sizeof(diagInbandTunerChanParentalControlStatus[0]))) )
{
snmp_log(LOG_ERR, "not enough space for value\n");
return MFD_ERROR;
}
rowreq_ctx->data.diagInbandTunerChanParentalControlStatus_len =
diagInbandTunerChanParentalControlStatus_len *
sizeof(diagInbandTunerChanParentalControlStatus[0]);
memcpy(rowreq_ctx->data.diagInbandTunerChanParentalControlStatus,
diagInbandTunerChanParentalControlStatus,
diagInbandTunerChanParentalControlStatus_len *
sizeof(diagInbandTunerChanParentalControlStatus[0]));
The first part where it checks if there is enough space seems to be incorrect
since the variables it is checking against have not even been populated yet.
Anyway, I skipped that part for now since I am having trouble with the next
part, where it assigns the values of the text string into the row
context.
Due to me having trouble, I decided to perform a quick test locally within the
container_load() function itself to determine if I could populate the row
context fields correctly. I generated the following code in the
container_load() function:
PCT_Char parentalControlStatusText[255];
PCT_UInt8 parentalControlStatusText_len;
strcpy(parentalControlStatusText, "HELLO WORLD");
parentalControlStatusText_len = strlen(parentalControlStatusText);
..... and then populated the row context as recommended:
rowreq_ctx->data.diagInbandTunerChanParentalControlStatus_len =
(parentalControlStatusText_len *
sizeof(parentalControlStatusText[0]));
memcpy( rowreq_ctx->data.diagInbandTunerChanParentalControlStatus,
parentalControlStatusText,
(parentalControlStatusText_len * sizeof(parentalControlStatusText[0]))
);
however, when I walk through the table, the
"diagInbandTunerChanParentalControlStatus" field is not displayed at all, so
obviously I do not see the field value of "HELLO WORLD" either. Any ideas what
I am doing wrong which would be causing the field name not to even be displayed
when I perform a snmpwalk?
2) As a related question, should I be able to use the following code to
populate the row context in the same manner? Or is there a reason one must use
the "sizeof" calculations instead?
rowreq_ctx->data.diagInbandTunerChanParentalControlStatus_len =
strlen(parentalControlStatusText);
memcpy(rowreq_ctx->data.diagInbandTunerChanParentalControlStatus,
parentalControlStatusText,
strlen(parentalControlStatusText));
3) The "diagInbandTunerChanParentalControlStatus_len" field is defined in the
"Table.h" file as being of (size_t) and has the "# of char elements, not bytes"
next to it. What does this comment mean? Should I be able to populate this
length field using strlen() or not?
** I have been trying to solve this problem for 1 full day now and I am going a
bit bonkers, so any help provided would be well received.
-------------------------------------------------------------------------
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-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
-------------------------------------------------------------------------
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-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders