net-snmp
5.4.1
|
00001 /* 00002 * table_container.h 00003 * $Id: table_container.h 13071 2005-10-17 11:36:06Z dts12 $ 00004 */ 00005 #ifndef _TABLE_CONTAINER_HANDLER_H_ 00006 #define _TABLE_CONTAINER_HANDLER_H_ 00007 00008 #ifdef __cplusplus 00009 extern "C" { 00010 #endif 00011 00012 /* 00013 * The table container helper is designed to simplify the task of 00014 * writing a table handler for the net-snmp agent when the data being 00015 * accessed is accessible via a netsnmp_container. 00016 * 00017 * Functionally, it is a specialized version of the more 00018 * generic table helper but easies the burden of GETNEXT processing by 00019 * retrieving the appropriate row for each index through 00020 * function calls which should be supplied by the module that wishes 00021 * help. The module the table_container helps should, afterwards, 00022 * never be called for the case of "MODE_GETNEXT" and only for the GET 00023 * and SET related modes instead. 00024 */ 00025 00026 #include <net-snmp/library/container.h> 00027 #include <net-snmp/agent/table.h> 00028 00029 #define TABLE_CONTAINER_ROW "table_container:row" 00030 #define TABLE_CONTAINER_CONTAINER "table_container:container" 00031 00032 #define TABLE_CONTAINER_KEY_NETSNMP_INDEX 1 /* default */ 00033 #define TABLE_CONTAINER_KEY_VARBIND_INDEX 2 00034 #define TABLE_CONTAINER_KEY_VARBIND_RAW 3 00035 00036 /* ==================================== 00037 * Container Table API: MIB maintenance 00038 * ==================================== */ 00039 00040 /* 00041 * get an injectable container table handler 00042 */ 00043 netsnmp_mib_handler * 00044 netsnmp_container_table_handler_get(netsnmp_table_registration_info *tabreq, 00045 netsnmp_container *container, 00046 char key_type); 00047 /* 00048 * register a container table 00049 */ 00050 int 00051 netsnmp_container_table_register(netsnmp_handler_registration *reginfo, 00052 netsnmp_table_registration_info *tabreq, 00053 netsnmp_container *container, 00054 char key_type); 00055 00057 netsnmp_container* 00058 netsnmp_container_table_container_extract(netsnmp_request_info *request); 00059 00061 #ifdef NETSNMP_USE_INLINE 00062 NETSNMP_STATIC_INLINE void * 00063 netsnmp_container_table_row_extract(netsnmp_request_info *request) 00064 { 00065 /* 00066 * NOTE: this function must match in table_container.c and table_container.h. 00067 * if you change one, change them both! 00068 */ 00069 return netsnmp_request_get_list_data(request, TABLE_CONTAINER_ROW); 00070 } 00071 00072 NETSNMP_STATIC_INLINE void * 00073 netsnmp_container_table_extract_context(netsnmp_request_info *request) 00074 { 00075 /* 00076 * NOTE: this function must match in table_container.c and table_container.h. 00077 * if you change one, change them both! 00078 */ 00079 return netsnmp_request_get_list_data(request, TABLE_CONTAINER_ROW); 00080 } 00081 #else 00082 void * 00083 netsnmp_container_table_row_extract(netsnmp_request_info *request); 00084 void * 00085 netsnmp_container_table_extract_context(netsnmp_request_info *request); 00086 #endif /* inline */ 00087 00088 void netsnmp_container_table_row_insert(netsnmp_request_info *request, 00089 netsnmp_index *row); 00090 00091 /* =================================== 00092 * Container Table API: Row operations 00093 * =================================== */ 00094 00095 void * 00096 netsnmp_container_table_find_next_row(netsnmp_request_info *request, 00097 netsnmp_table_request_info *tblreq, 00098 netsnmp_container *container, 00099 char key_type ); 00100 #ifdef __cplusplus 00101 } 00102 #endif 00103 00104 #endif /* _TABLE_CONTAINER_HANDLER_H_ */