I have been able to use MFD to implement a mib table without any problem.
I have prior SNMP knowledge but have only worked on enemate (on HP-UX
ofcource). I think I may not have understood one thing in the way mib2c is
generating the stubs so my first question:
1) Generated code:
In function
xxxTable_container_load()
The test used befor populating a column defined as:
wpiPath DisplayString
/* Code taht I have problem with */
if ((NULL == rowreq_ctx->data.wpiPath) ||
(rowreq_ctx->data.wpiPath_len <
(wpiPath_len * sizeof(wpiPath[0])))) {
snmp_log(LOG_ERR, "not enoughhhhh space for value %s %d\n",wpiPath,
wpiPath_len);
return MFD_ERROR;
}
rowreq_ctx->data.wpiPath_len = wpiPath_len * sizeof(wpiPath[0]);
memcpy(rowreq_ctx->data.wpiPath, wpiPath,
wpiPath_len * sizeof(wpiPath[0]));
"if" above will always fail because the generated data structor for
wpiPath by mib2c is:
/*
*
wpiPath(2)/DisplayString/ASN_OCTET_STR/char(char)//L/A/w/e/R/d/H
*/
char wpiPath[255];
size_t wpiPath_len; /* # of char elements, not bytes */
Would it not always fail? because rowreq_ctx->data.wpiPath_len has not
been populated, and also what does "of char elements, not bytes" means in
above aomments. wouldn't wpiPath_len * sizeof(wpiPath[0])) still be
strlen(wpiPath).
The MFD tutorial is using hardcoded values like 6 for ifPhysAddress_len,
how would I calculate the length (wpi_len)?.
Would I be doing semething wrong by using:
if((wpiPath_len * sizeof(wpiPath[0])) > 255){
Or in this case just
if(wpiPath_len > 255){
2) Is there any performance loss using MFD compared to older ways of
implementing the MIB.
Thanks for kind handholding
Regards
-------------------------------------------------------------------------
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-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders