This is a discussion on Re: Regarding Table data Create and Fill within the SNMP Users forums, part of the Networking and Network Related category; --===============0880907627== Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit <!DOCTYPE html PUBLIC "-//W3C//DTD ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
--===============0880907627==
Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type"> </head> <body bgcolor="#ffffff" text="#000000"> Hi, <br> <br> As Dave says, you have to use the cache helper : <br> mib2c -c mib2c.table_data.conf -S cache=1 myDataTable<br> The code produced don't compile, it's a little buggy. See my code below.<br> the cache->flags is set to call each time the load function.<br> <a class="moz-txt-link-freetext" href="http://www.net-snmp.org/dev/agent/group__cache__handler.html">http://www.net-snmp.org/dev/agent/group__cache__handler.html</a><br> The last problem is if the table is empty the load function is never call !<br> <br> ----------<br> in .h:<br> NetsnmpCacheLoad myDataTable_load;<br> //NetsnmpCacheFree myDataTable_free;<br> <br> in.c :<br> initialize_table_mydataTable(void) {<br> .....<br> netsnmp_tdata_register(reg, table_data, table_info);<br> <br> cache = netsnmp_cache_create(-1, myDataTable_load, (NetsnmpCacheFree *)myDataTable_free,<br> myDataTable_oid, myDataTable_oid_len);<br> cache->magic = (void *) table_data;<br> cache->flags = NETSNMP_CACHE_DONT_INVALIDATE_ON_SET | NETSNMP_CACHE_DONT_FREE_BEFORE_LOAD | NETSNMP_CACHE_DONT_FREE_EXPIRED | NETSNMP_CACHE_DONT_AUTO_RELEASE;<br> <br> netsnmp_inject_handler_before(reg, netsnmp_cache_handler_get(cache),"mydataTable");<b r> // Init table<br> mydataTable_load(cache, table_data);<br> <br> }<br> <br> <br> int myDataTable_load(netsnmp_cache * cache, void *vmagic)<br> {<br> netsnmp_tdata * table_data = (netsnmp_tdata *) vmagic;<br> netsnmp_tdata_row *row;<br> struct myDataTable_entry *row_entry; <br> <br> row = NULL;<br> row = netsnmp_tdata_row_next(table_data, row);<br> row_entry = (struct myDataTable_entry *)row->data;<br> row_entry->myDataVal1++;<br> ....<br> }<br> -------<br> <br> Stephane.<br> <br> kumar undurthi a écrit : <blockquote cite="mid:ae35fd890803141232r2bee2f8bi9254f90f2527 8e92@mail.gmail.com" type="cite">Hi All,<br> <br> I have requirement in which i have to fill the table data when ever a request will come, For example check the below example.... it was generated by using mib2c.table_data.conf.<br> &n bsp; : in which "ocStbHostAVInterfaceTable_handler" is taking care of the requests, So my requirement is <br> when the a request come at " i.e "(check in code ) case MODE_GET:" then i want to update the table instated of initialize the table first (filling the table) at (check in code " initialize_table_ocStbHostAVInterfaceTable(void) " )<br> <br> Please give the Solution as early as possible..... (adv Thank's)<br> </blockquote> .... <br> <blockquote cite="mid:ae35fd890803141232r2bee2f8bi9254f90f2527 8e92@mail.gmail.com" type="cite"><br> <div class="gmail_quote">On Wed, Mar 12, 2008 at 6:39 AM, Dave Shield <<a moz-do-not-send="true" href="mailto:D.T.Shield@liverpool.ac.uk">D.T.Shiel d@liverpool.ac.uk</a>> wrote:<br> <blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> <div class="Ih2E3d">On 11/03/2008, kumar undurthi <<a moz-do-not-send="true" href="mailto:manu1394@gmail.com">manu1394@gmail.co m</a>> wrote:<br> > I have a problem in creating a table and Fill the table. i.e<br> > Normally table can create in initialization() part and can be fill with the<br> > static data.<br> > But in My case.... I want to Create and Fill the table with the dynamic<br> > data(values) when ever a request comes to the Agent.<br> <br> </div> Probably the best approach would be to use the cache helper.<br> <br> You haven't said how you are generating the code,<br> or which table helper you are using. But if you run<br> something like<br> mib2c -c mib2c.table_data.conf -S cache=1 myTable<br> <br> this should generate a suitable framework for your MIB module,<br> including the code to load the table data when a request<br> comes in. This cached data will then be used for the next<br> few requests, until it's judged "too old". Whereupon the<br> next request will trigger a fresh reload.<br> <br> The same approach can be used with the iterator helper<br> (same command, but specifying 'mib2c.iterator.conf'),<br> and probably also with the MfD framework.<br> (though I don't know much about that one).<br> <font color="#888888"><br> Dave<br> </font></blockquote> </div> <br> <pre wrap=""> <hr size="4" width="90%"> ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. <a class="moz-txt-link-freetext" href="http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/">http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/</a></pre> <pre wrap=""> <hr size="4" width="90%"> _______________________________________________ Net-snmp-users mailing list <a class="moz-txt-link-abbreviated" href="mailto:Net-snmp-users@lists.sourceforge.net">Net-snmp-users@lists.sourceforge.net</a> Please see the following page to unsubscribe or change other options: <a class="moz-txt-link-freetext" href="https://lists.sourceforge.net/lists/listinfo/net-snmp-users">https://lists.sourceforge.net/lists/listinfo/net-snmp-users</a> </pre> </blockquote> <br> </body> </html> --===============0880907627== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ --===============0880907627== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Net-snmp-users mailing list Net-snmp-users@lists.sourceforge.net Please see the following page to unsubscribe or change other options: https://lists.sourceforge.net/lists/...net-snmp-users --===============0880907627==-- |