>> This is in excerpt of my code at the beginning (in C):
>
> [snip]
>
>OK - that looks like the code for the main body of the subagent.
>But you've got four routines that (presumably) initialise and register the MIB
>information that the subagent should report:
>
>> init_mib_physicalInterfacesTable();
>> init_mib_bChannelTable();
>> init_mib_sessionTable();
>
>> init_mib_scalar();
>
>What do these init routines look like?
Here the code of init_mib_physicalInterfacesTable():
------------------------------------------------
void initialize_table_physicalInterfacesTable(void)
{
int retval=999;
static oid physicalInterfacesTable_oid[] =
{ 1, 3, 6, 1, 4, 1, 17524, 2, 1, 2 };
size_t physicalInterfacesTable_oid_len =
OID_LENGTH(physicalInterfacesTable_oid);
//netsnmp_table_data_set *table_set;
/*
* create the table structure itself
*/
physicalInterfacesTable_table_set =
netsnmp_create_table_data_set("physicalInterfacesTable");
/*
* comment this out or delete if you don't support creation of new rows
*/
physicalInterfacesTable_table_set->allow_creation = 1;
/***************************************************
* Adding indexes
*/
DEBUGMSGTL(("initialize_table_physicalInterfacesTable",
"adding indexes to table physicalInterfacesTable\n"));
netsnmp_table_set_add_indexes(physicalInterfacesTable_table_set,
ASN_INTEGER, /* index: physicalInterfaceIndex */
0);
DEBUGMSGTL(("initialize_table_physicalInterfacesTable",
"adding column types to table physicalInterfacesTable\n"));
netsnmp_table_set_multi_add_default_row
(physicalInterfacesTable_table_set, COLUMN_PHYSICALINTERFACEINDEX,
ASN_INTEGER, 0, NULL, 0, COLUMN_PHYSICALINTERFACENAME,
ASN_OCTET_STR, 0, NULL, 0, COLUMN_PHYSICALINTERFACETYPE,
ASN_OCTET_STR, 0, NULL, 0, COLUMN_PHYSICALINTERFACESTATE,
ASN_OCTET_STR, 0, NULL, 0, 0);
/*
* registering the table with the master agent
*/
/*
* note: if you don't need a subhandler to deal with any aspects
* of the request, change physicalInterfacesTable_handler to "NULL"
*/
retval=netsnmp_register_table_data_set(netsnmp_create_handler_registration
("physicalInterfacesTable",
physicalInterfacesTable_handler,
physicalInterfacesTable_oid,
physicalInterfacesTable_oid_len,
HANDLER_CAN_RWRITE),
physicalInterfacesTable_table_set,
NULL);
printf("Return of
netsnmp_register_table_data_set(physicalInterfacesTable): %d\n",retval);
}
/** Initializes the mib_physicalInterfacesTable module */
void init_mib_physicalInterfacesTable(void)
{
printf("init_mib_physicalInterfacesTable()\n");
/*
* here we initialize all the tables we're planning on supporting
*/
initialize_table_physicalInterfacesTable();
}
/** handles requests for the physicalInterfacesTable table, if anything else
needs to be done */
int
physicalInterfacesTable_handler(netsnmp_mib_handler * handler,
netsnmp_handler_registration * reginfo,
netsnmp_agent_request_info * reqinfo,
netsnmp_request_info * requests)
{
printf("physicalInterfacesTable_handler()\n");
/*
* perform anything here that you need to do. The requests have
* already been processed by the master table_dataset handler, but
* this gives you chance to act on the request in some other way
* if need be.
*/
return SNMP_ERR_NOERROR;
}
------------------------------------------------------
The functions "init_mib_bChannelTable()" and "init_mib_sessionTable()" looking
similar to "init_mib_physicalInterfacesTable()".
They are made by mib2c.
>In particular, they'll presumably call some form of 'netsnmp_register_xxx'
>routine. As part of that registration, there should be some
>mention of an 'xxx_handler' routine.
The subagent never print out the debug text in the
physicalInterfacesTable_handler function! Same for sessionTable and
bChannelTable.
Return of 'netsnmp_register_xxx' is in every function zero.
In 'init_mib_scalar' the function 'netsnmp_register_scalar()' is called for
every scalar. Return of 'netsnmp_register_scalar()' is always zero.
Thanks
Julian
________________________________
Ferrari electronic AG
Ruhlsdorfer Str. 138
14513 Teltow (bei Berlin)
Handelregister Potsdam: HRB 12091
Vorstand: Johann Deutinger, Ulrich Dziergwa, Dr. Hartmut Fetzer
Aufsichtsrat: Peter Mark Droste (Vorsitzender)
------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm
_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users