Hello Phillip, Picture worth more than thousand of words, so I will direct you to one of my posts:
'Problems with registering handlers with extended range (range_subid, range_ubound)' posted on 2004-12-09 07:00. There is example code, which registers *one handler* for *one column* for indexes 101÷108. So, for other columns, you should register appropriate handlers. Unfortunately, this didn't work, because of the bug in my current version of the NetSnmp. (and this example would do the best for my problem :(( ) Other example, that was worked is down below: EXAMPLE code: ============================================================================ == static oid dsx1IntervalTable_oid2[] = { 1, 3, 6, 1, 2, 1, 10, 18, 8, 1, 1, 102 }; static oid dsx1IntervalTable_oid3[] = { 1, 3, 6, 1, 2, 1, 10, 18, 8, 1, 1, 103 }; static oid dsx1IntervalTable_oid4[] = { 1, 3, 6, 1, 2, 1, 10, 18, 8, 1, 1, 110 }; netsnmp_handler_registration *my_handler; my_handler = netsnmp_create_handler_registration("dsx1IntervalTable2", dsx1IntervalTable_handler2, dsx1IntervalTable_oid2, OID_LENGTH (dsx1IntervalTable_oid2), HANDLER_CAN_RWRITE); my_handler->range_subid = OID_LENGTH(dsx1IntervalTable_oid2) - 3; my_handler->range_ubound = 13; netsnmp_register_handler(my_handler); my_handler = netsnmp_create_handler_registration("dsx1IntervalTable3", dsx1IntervalTable_handler3, dsx1IntervalTable_oid3, OID_LENGTH (dsx1IntervalTable_oid3), HANDLER_CAN_RWRITE); my_handler->range_subid = OID_LENGTH(dsx1IntervalTable_oid3) - 3; my_handler->range_ubound = 13; netsnmp_register_handler(my_handler); my_handler = netsnmp_create_handler_registration("dsx1IntervalTable4", dsx1IntervalTable_handler4, dsx1IntervalTable_oid4, OID_LENGTH (dsx1IntervalTable_oid4), HANDLER_CAN_RWRITE); my_handler->range_subid = OID_LENGTH(dsx1IntervalTable_oid4) - 3; my_handler->range_ubound = 13; netsnmp_register_handler(my_handler); ============================================================================ = As you can see, there is *one handler* for all columns, but *separate handlers* for different *rows* - dsx1LineIndexes (look at the DS1-MIB mib). That was the easy part. Registering handlers. :(( Because, this is not 'normal' way of using tables, there is no written helper handler for managing oids, values etc. for GET/GETNEXT requests. From this point further, you're on your own. So, after registering handler, you have to manage requests in your handler for *all* modes, that you'd had made registration for it. (Robert, Wess, Dave,...: I would be very glad, if I'm wrong.) Everytime someone (manager) makes request, handler, registered for this subtree range is called. Variable (request->requestvb->name) is passed to it (with the original oid). In that point, there is no more control on the length of the oid, etc. Handler must take care of it. If I'm more exact in your questions: >same table. It sounds like you have done this, but I have not been able to. >From what I understand you to say, you call netsnmp_create_handler_registration(), >with oid set to the entire oid of a column object (the first one, I assume), including >the index, then set range_subid to the OID_LEN of the entire oid, including the index. Yes, this would have to do. >Then set range_ubound to the upper bound of the set of rows you want to handle. >In my case, it's the same as the index, since I want one row each. Then the handler >will be called for ALL columns with that index. No, handler will be called only for the column, you have registered it for. 'range_subid' is meant to set up the *position* of floating part of the registration oid. >I don't really understand this. How does netsnmp_create_handler_registration() >know that you want all the columns for that row, and not just the single column at >that row? Hmhmm. Registration of handler is what makes handler alive, not 'netsnmp_create_handler_registration()'. You *can't* have simultaneously registration for some range of columns and some range of indexes. (Robert, Wess, Dave,...: I would be very glad, if I'm wrong) Of course, If you have multiple indexes in table, you can generate the last one on the fly by the handler. >Also, how do I tie the handler to netsnmp_register_table_data_set()? You need to >pass that the oid of the table. Have you tried this? I think that this wouldn't go, because 'netsnmp_*_table_*' helpers uses table_helper_handler(), which asume, that you've registered oid of the *table*. >Have you seen any other mail or docs about this? Do you have any more detailed code examples? -----Original Message----- From: Gillis, Philip W (Philip) [mailto:[EMAIL PROTECTED] Sent: 13. december 2004 16:56 To: 'Grasic Igor'; '[EMAIL PROTECTED]' Subject: RE: Adding interfaces to the IFMIB via AgentX Dear Igor (or anyone else interested in this problem), I am trying to have one master agent, and multiple AgentX subagents, each implementing a row of the same table. It sounds like you have done this, but I have not been able to. From what I understand you to say, you call netsnmp_create_handler_registration(), with oid set to the entire oid of a column object (the first one, I assume), including the index, then set range_subid to the OID_LEN of the entire oid, including the index. Then set range_ubound to the upper bound of the set of rows you want to handle. In my case, it's the same as the index, since I want one row each. Then the handler will be called for ALL columns with that index. Do I have this right? I don't really understand this. How does netsnmp_create_handler_registration() know that you want all the columns for that row, and not just the single column at that row? Also, how do I tie the handler to netsnmp_register_table_data_set()? You need to pass that the oid of the table. Have you tried this? Have you seen any other mail or docs about this? Do you have any more detailed code examples? Thanks, Phil Gillis -----Original Message----- From: Grasic Igor [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 01, 2004 3:18 AM To: [EMAIL PROTECTED] Subject: Re: Adding interfaces to the IFMIB via AgentX Hello codders, John, The third way to register some rows in table via AgentX is to use 'netsnmp_register_handler' with set 'range_subid' and 'range_ubound' to the point in the oid, where is defined column number for the object and with the oid for the whole (!) row, included with the ifIndex at the end. In that way registered handler will always get only the request for the registered ifIndex, but for all column objects. Of course, in the handler you shouldn't forget to implement serving multiple request and MODE_GET_NEXT requests (depends on the flags)... Anyway, if you gonna look at mailing list, I already made some questions concerning the same problem you have. I tried with registering intances, but... if you have big number of objects, memory consumption of the running agent drasticaly increase. I hope, that this will help you some way. Enjoy, Igor G. Igor Grasic, Ms. D. Development Engineer Iskra Transmission, d. d., Ljubljana Stegne 11, SI-1000 Ljubljana, Slovenia www.iskratr.si, www.iskratr.com SNMP Coders, I have searched online for a couple of days now, and have read rstory"s faq quite throughly, but I can"t seem to find a good way to register additional rows to an existing (standard) table such as the ifmib through AgentX. The only way I have found to do this is to register each OID in the table for each inteface using netsnmp_watcher and netsnmp_instance... which means alot of registering, and alot of function handlers. This is very inefficient and non-extensible. AgentX will be running on another machine and I want that sub agent to add in (register) its ethernet interfaces to an exisiting agent. That way, when the network manager walks the IFMIB of the exisiting agent, it will be able to see the interfaces on the exisiting agent AND the interfaces on the machine that is running the subagent. I hope this makes sense. If you need me to draw up some pictures to explain more clearly, let me know. Thank you for any support you can provide, John ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/ _______________________________________________ Net-snmp-coders mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/net-snmp-coders ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/ _______________________________________________ Net-snmp-coders mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/net-snmp-coders