|
|
| Some (incomplete) ramblings about netsnmp_containers... | | Some (incomplete) ramblings about netsnmp_containers... |
| | | |
− | ==Inroduction== | + | ==Introduction== |
| Containers are a generic data interface, | | Containers are a generic data interface, |
| similar to a database. Like a database, you use an index (aka key) to access | | similar to a database. Like a database, you use an index (aka key) to access |
|
|
| determine the sort order. The function is called with a pointer to two data | | determine the sort order. The function is called with a pointer to two data |
| itmes, and must return a value indicating which of the two has the lesser index | | itmes, and must return a value indicating which of the two has the lesser index |
− | value. So, by providing a second compare function allows the user to access the | + | value. |
− | data in a different order.
| + | |
| | | |
| + | ==Types of Containers== |
| + | There are several base types of containers: |
| + | |
| + | *sorted_singly_linked_list |
| + | *unsorted_singly_linked_list |
| + | *lifo (a last in, first out stack) |
| + | *fifo (a first in, first out stack) |
| + | *binary_array |
| + | *null (for testing) |
| + | |
| + | Some of these have aliases: |
| + | |
| + | *table_container (binary_array) |
| + | *linked_list (sorted_singly_linked_list) |
| + | *ssll_container (sorted_singly_linked_list) |
| + | |
| + | Some types also come with a comparison routine other than the usual OID index: |
| + | *string or string:binary_array (binary_array with a string comparison function) |
| + | |
| + | Developer Tip: |
| + | New types are registered via netsnmp_container_register() and netsnmp_container_register_with_compare(). |
| + | |
| + | ==MIB indexes vs Conainer indexes== |
| SNMP tables have indexes. A table index may have multiple components which, | | SNMP tables have indexes. A table index may have multiple components which, |
| taken together, uniquely identify a row. | | taken together, uniquely identify a row. |
|
|
| The default compare routine for containers assumes that the data record's first | | The default compare routine for containers assumes that the data record's first |
| component is a netsnmp_index, so when using an OID as a key, you don't need to provide a comparison | | component is a netsnmp_index, so when using an OID as a key, you don't need to provide a comparison |
Exception encountered, of type "Error"