-
Notifications
You must be signed in to change notification settings - Fork 2
MFD:ifXTable:Get_Data
Once the correct table context has been found, the individual node get routines will be called. These are generated in the file ifXTable_data_get.c. The code generated for each node defaults to returning MFD_SKIP, which will cause Net-SNMP to skip the column for the given table context. If you compile and run the code before implementing any code in the get routines, and try to walk the ifXTable, each node's get routine will be called once for each interface. Since every function will return MFD_SKIP, snmpwalk will eventually return END OF MIB.
We are using the same data structures that the ifTable implementation uses for the Linux kernel. I won't cover every node, as they are all very similar.
The ifName node is a string. First we check that the string is large enough to hold the name in our data context, allocating memory if it is not. Then the name is copied and the length variable is set.
Generated code |
Modified code |
||
|
|
The ifInMulticastPkts node is a integer. However, we don't always have the data for this node. At compile time we test a macro that will be set during configure to determine if the data is available. variable is set.
Generated code |
Modified code |
||
|
|
The ifHCInOctets node is a 64 bit counter. Net-SNMP uses a structure containing the high and low 32 bits for 64 bit counters. We use if_ibytes if it is available, or if_ipackets otherwise. This logic is straight from the current ifTable implementation.
Generated code |
Modified code |
||
|
|