table_maintenance(3)

NAME
table_maintenance - Routines for maintaining the contents of a table.

  Functions
void * netsnmp_generic_create_table (const char *name, int flags)
Create a structure to represent the table.
void netsnmp_generic_delete_table (void *table)
Release the structure representing a table.
void * netsnmp_generic_create_row (void)
Create a new row structure suitable for this style of table.
void * netsnmp_generic_clone_row (void *row)
Create a new copy of the specified row.
int netsnmp_generic_copy_row (void *dst_row, void *src_row)
Copy the contents of one row into another.
void netsnmp_generic_delete_row (void *row)
Delete a row data structure.
int netsnmp_generic_add_row (void *table, void *row)
Add a row to the table.
int netsnmp_generic_replace_row (void *table, void *old_row, void *new_row)
Replace one row with another in the table.
void * netsnmp_generic_remove_row (void *table, void *row)
Remove a row from the table.
void netsnmp_generic_remove_delete_row (void *table, void *row)
Remove and delete a row from the table.

Detailed Description

Routines for maintaining the contents of a table.

This would typically be part of implementing an SNMP MIB, but could potentially also be used for a standalone table.

This section of the generic API is primarily relevant to table helpers where the representation of the table is constructed and maintained within the helper itself. 'External' tables will typically look after such aspects directly, although this section of the abstract API framework could also help direct the design of such table-specific implementations.

Function Documentation

  int netsnmp_generic_add_row (void * table, void * row)

Add a row to the table.

Definition at line 104 of file table_generic.c.

  void* netsnmp_generic_clone_row (void * row)

Create a new copy of the specified row.

Definition at line 82 of file table_generic.c.

  int netsnmp_generic_copy_row (void * dst_row, void * src_row)

Copy the contents of one row into another.

The destination row structure should be created before this routine is called.

Definition at line 90 of file table_generic.c.

  void* netsnmp_generic_create_row (void)

Create a new row structure suitable for this style of table.

Note that this would typically be a 'standalone' row, and would not automatically be inserted into an actual table.

Definition at line 76 of file table_generic.c.

  void* netsnmp_generic_create_table (const char * name, int flags)

Create a structure to represent the table.

This could be as simple as the head of a linked list, or a more complex container structure. The 'name' field would typically be used to distinguish between several tables implemented using the same table helper. The 'flags' field would be used to control various (helper-specific) aspects of table behaviour.

The table structure returned should typically be regarded as an opaque, private structure. All operations on the content of the table should ideally use the appropriate routines from this API.

Definition at line 60 of file table_generic.c.

  void netsnmp_generic_delete_row (void * row)

Delete a row data structure.

The row should be removed from any relevant table(s) before this routine is called.

Definition at line 98 of file table_generic.c.

  void netsnmp_generic_delete_table (void * table)

Release the structure representing a table.

Any rows still contained within the table should also be removed and deleted.

Definition at line 68 of file table_generic.c.

  void netsnmp_generic_remove_delete_row (void * table, void * row)

Remove and delete a row from the table.

Definition at line 127 of file table_generic.c.

  void* netsnmp_generic_remove_row (void * table, void * row)

Remove a row from the table.

The data structure for the row should not be released, and would be the return value of this routine.

Definition at line 121 of file table_generic.c.

  int netsnmp_generic_replace_row (void * table, void * old_row, void * new_row)

Replace one row with another in the table.

This will typically (but not necessarily) involve two rows sharing the same index information (e.g. to implement update/restore-style SET behaviour).

Definition at line 113 of file table_generic.c.