-
Notifications
You must be signed in to change notification settings - Fork 2
MFD:ifTable:Get_Data
Once the correct table context has been found, the individual node get routines will be called. These are generated in the file ifTable_data_get.c.
Because we used the data context that is generated by default, we populated the data in the data structure during the data access phase and our MIB only has simple data types, the code which was generated for the get routines does not need much modification.
There is, however, a case where the data format specified by the MIB does not match the data format we got from our datastore. The ifType enumerations need to be mapped from the Linux specific ARPHDR values. Here again, we haven't tried to provide a complete implementation, but enought to give you the an overview.
The PhysAddr ioctl call provides us with an ARPHRD type for an interface. This type must be mapped to one of the valid IANAifType enumerated values. The file ifTable_enums.h contains macro definitions for all the allow values. It also contains a list of the same macros prefixed with 'INTERNAL_'. For the case where there is a one to one mapping between a MIB type and the implementation's type, this provides a way to map without having to update the code.
Unfortunately, the ifType isn't one of those cases. Only a small subset of the possible values are available in our implementation, and often there are several ARPHDR types that map to a single IANAifType. The first step is to whittle down the internal list to the ones with a direct mapping that we are going to support.
|
Then we update the implementation to remove all the extras, and use a default of 'other' for any unknown types.
|
As mentioned before, we are leaving some colums unimplemented. There are several reasons a column might be left unimplemnted. The data may not be available, or a particular column might not make sense for an implementation.
We omitted some columns from the valid columns structure, because we don't want to provide data for those columns, ever. If you have columns that might have data, depending on the row, then those columns should be in the valid columns structure. When the column get routine is called for a row which had not data for the column, simply return MFD_SKIP from the object's get routine, and the agent will move on to the next object.
You should also consult your MIB to see if, for a particular column for which you don't have data, a special value is specified which should be returned when the data isn't available. For example, the ifPhysAddress object states: For interfaces which do not have such an address (e.g., a serial line), this object should contain an octet string of zero length.
Even though we've eliminated some columns from the valid columns, here is a simple example if skipping a column:
|