3
* $Id: table_array.h,v 5.8 2002/07/30 06:56:23 rstory Exp $
5
#ifndef _TABLE_ARRAY_HANDLER_H_
6
#define _TABLE_ARRAY_HANDLER_H_
13
* The table array helper is designed to simplify the task of
14
* writing a table handler for the net-snmp agent when the data being
15
* accessed is in an oid sorted form and must be accessed externally.
17
* Functionally, it is a specialized version of the more
18
* generic table helper but easies the burden of GETNEXT processing by
19
* retrieving the appropriate row for ead index through
20
* function calls which should be supplied by the module that wishes
21
* help. The module the table_array helps should, afterwards,
22
* never be called for the case of "MODE_GETNEXT" and only for the GET
23
* and SET related modes instead.
26
#include <net-snmp/library/container.h>
27
#include <net-snmp/agent/table.h>
29
#define TABLE_ARRAY_NAME "table_array"
32
* group_item is to allow us to keep a list of requests without
33
* disrupting the actual netsnmp_request_info list.
35
typedef struct netsnmp_request_group_item_s {
36
netsnmp_request_info *ri;
37
netsnmp_table_request_info *tri;
38
struct netsnmp_request_group_item_s *next;
39
} netsnmp_request_group_item;
42
* structure to keep a list of requests for each unique index
44
typedef struct netsnmp_request_group_s {
46
* index for this row. points to someone else's memory, so
52
* container in which rows belong
54
netsnmp_container *table;
57
* actual old and new rows
59
netsnmp_index *existing_row;
60
netsnmp_index *undo_info;
71
* requests for this row
73
netsnmp_request_group_item *list;
79
} netsnmp_request_group;
81
typedef int (Netsnmp_User_Row_Operation_c) (const void *lhs,
83
typedef int (Netsnmp_User_Row_Operation) (void *lhs, void *rhs);
84
typedef int (Netsnmp_User_Get_Processor) (netsnmp_request_info *,
87
netsnmp_table_request_info
90
*(UserRowMethod) (netsnmp_index *);
91
typedef int (Netsnmp_User_Row_Action) (netsnmp_index *,
93
netsnmp_request_group *);
94
typedef void (Netsnmp_User_Group_Method) (netsnmp_request_group *);
97
* structure for array callbacks
99
typedef struct netsnmp_table_array_callbacks_s {
101
Netsnmp_User_Row_Operation *row_copy;
102
Netsnmp_User_Row_Operation_c *row_compare;
104
Netsnmp_User_Get_Processor *get_value;
107
Netsnmp_User_Row_Action *can_activate;
108
Netsnmp_User_Row_Action *activated;
109
Netsnmp_User_Row_Action *can_deactivate;
110
Netsnmp_User_Row_Action *deactivated;
111
Netsnmp_User_Row_Action *can_delete;
113
UserRowMethod *create_row;
114
UserRowMethod *duplicate_row;
115
UserRowMethod *delete_row;
117
Netsnmp_User_Group_Method *set_reserve1;
118
Netsnmp_User_Group_Method *set_reserve2;
119
Netsnmp_User_Group_Method *set_action;
120
Netsnmp_User_Group_Method *set_commit;
121
Netsnmp_User_Group_Method *set_free;
122
Netsnmp_User_Group_Method *set_undo;
124
/** not callbacks, but this is a useful place for them... */
125
netsnmp_container* container;
128
} netsnmp_table_array_callbacks;
132
netsnmp_table_container_register(netsnmp_handler_registration *reginfo,
133
netsnmp_table_registration_info
135
netsnmp_table_array_callbacks *cb,
136
netsnmp_container *container,
139
netsnmp_container * netsnmp_extract_array_context(netsnmp_request_info *);
141
Netsnmp_Node_Handler netsnmp_table_array_helper_handler;
144
netsnmp_table_array_check_row_status(netsnmp_table_array_callbacks *cb,
145
netsnmp_request_group *ag,
146
long *rs_new, long *rs_old);
152
#endif /* _TABLE_ARRAY_HANDLER_H_ */