On Sun, 2008-12-14 at 16:13 +0200, Eugene Yasman wrote:
> Hello net-snmp coders,
> 
> I would like to propose null terminated string "magic tie" helper
> function implementation: netsnmp_register_str_instance().
> 
> The C source code for null terminated strings can be then
> automagically generated from MIB by mib2c.tie.conf, see attachments. 
> 
> netsnmp_register_str_instance() behaves like
> netsnmp_register_int_instance() function, but should receive pointer
> to netsnmp_ntstr_t structure instead of int pointer, no API functions
> were modified.
> 
> //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

> //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
> 
> I have been looking for "magic tie" helper for null terminated strings
> in net-snmp API but haven't found one. Am I missing some point? Do you
> think it could be helpful for someone else?

I am not all that certain about what a magically tied string is but if
you just wish to be able to use nul-terminated strings then I would
recommend that you take a look on the watcher handler which, among other
things, already handles nul-terminated strings.

Like this:

netsnmp_watcher_info winfo;
winfo.data = YourBuffer;
winfo.max_size = sizeof(YourBuffer) - 1;
winfo.type = ASN_OCTET_STR;
winfo.flags = WATCHER_MAX_SIZE | WATCHER_SIZE_STRLEN;
netsnmp_register_watched_instance(YourRegInfo, &winfo);

With this said I think that a generalized mib2c.tie.conf would be a good
thing, but it is questionable if we need a new helper.

/MF

> Best regards,
> Eugene
> 
> ------------------------------------------------------------------------------
> SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
> The future of the web can't happen without you.  Join us at MIX09 to help
> pave the way to the Next Web now. Learn more and register at
> http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
> _______________________________________________ Net-snmp-coders mailing list 
> [email protected] 
> https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to