1 /* 2 * SNMPStats Module 3 * Copyright (C) 2006 SOMA Networks, INC. 4 * Written by: Jeffrey Magder (jmagder@somanetworks.com) 5 * 6 * This file is part of Kamailio, a free SIP server. 7 * 8 * Kamailio is free software; you can redistribute it and/or modify it 9 * under the terms of the GNU General Public License as published by 10 * the Free Software Foundation; either version 2 of the License, or 11 * (at your option) any later version 12 * 13 * Kamailio is distributed in the hope that it will be useful, but 14 * WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 * General Public License for more details. 17 * 18 * You should have received a copy of the GNU General Public License 19 * along with this program; if not, write to the Free Software 20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 21 * USA 22 * 23 * This file implements the kamailioSIPRegUserLookupTable. For a full 24 * description of the table, please see the KAMAILIO-SIP-SERVER-MIB. 25 * 26 * This file consists of many more functions than the other header files. 27 * This is because this table is writable, bringing a lot of SNMP overhead. 28 * 29 * Most of the contents are auto-generated (aside from white space and comment 30 * changes), and can be ignored. The functions that have been modified are: 31 * 32 * 1) kamailioSIPRegUserLookupTable_extract_index() 33 * 34 * 2) kamailioSIPRegUserLookupTable_can_[activate|deactivate|delete]() 35 * 36 * 3) kamailioSIPRegUserLookupTable_set_reserve1() 37 * 38 * 4) kamailioSIPRegUserLookupTable_set_action() 39 * 40 * Full details can be found in kamailioSIPRegUserLookupTable.c. You can safely 41 * ignore the other functions. 42 */ 43 44 #ifndef KAMAILIOSIPREGUSERLOOKUPTABLE_H 45 #define KAMAILIOSIPREGUSERLOOKUPTABLE_H 46 47 #ifdef __cplusplus 48 extern "C" { 49 #endif 50 51 52 #include <net-snmp/net-snmp-config.h> 53 #include <net-snmp/library/container.h> 54 #include <net-snmp/agent/table_array.h> 55 56 #include "../../core/config.h" 57 58 59 /* This structure represnts a row in the table */ 60 typedef struct kamailioSIPRegUserLookupTable_context_s 61 { 62 netsnmp_index index; 63 64 /** UNSIGNED32 = ASN_UNSIGNED */ 65 unsigned long kamailioSIPRegUserLookupIndex; 66 67 /** SnmpAdminString = ASN_OCTET_STR */ 68 unsigned char *kamailioSIPRegUserLookupURI; 69 long kamailioSIPRegUserLookupURI_len; 70 71 /** UNSIGNED32 = ASN_UNSIGNED */ 72 unsigned long kamailioSIPRegUserIndex; 73 74 /** RowStatus = ASN_INTEGER */ 75 long kamailioSIPRegUserLookupRowStatus; 76 77 void *data; 78 79 } kamailioSIPRegUserLookupTable_context; 80 81 /* 82 * Initializes the kamailioSIPRegUserLookupTable table. This step is easier 83 * than in the other tables because there is no table population. All table 84 * population takes place during run time. 85 */ 86 void init_kamailioSIPRegUserLookupTable(void); 87 88 89 /* 90 * Initialize the kamailioSIPRegUserLookupTable table by defining how it is 91 * structured. 92 * 93 * This function is mostly auto-generated. 94 */ 95 void initialize_table_kamailioSIPRegUserLookupTable(void); 96 97 /* 98 * This function was auto-generated and didn't need modifications from its 99 * auto-generation. It is called to handle an SNMP GET request. 100 */ 101 int kamailioSIPRegUserLookupTable_get_value( 102 netsnmp_request_info *, netsnmp_index *, netsnmp_table_request_info *); 103 104 const kamailioSIPRegUserLookupTable_context * 105 kamailioSIPRegUserLookupTable_get_by_idx(netsnmp_index *); 106 107 const kamailioSIPRegUserLookupTable_context * 108 kamailioSIPRegUserLookupTable_get_by_idx_rs(netsnmp_index *, int row_status); 109 110 /* oid declarations */ 111 extern oid kamailioSIPRegUserLookupTable_oid[]; 112 extern size_t kamailioSIPRegUserLookupTable_oid_len; 113 114 115 #define kamailioSIPRegUserLookupTable_TABLE_OID KAMAILIO_OID, 3, 1, 2, 1, 5, 9 116 117 118 /* column number definitions for table kamailioSIPRegUserLookupTable */ 119 #define COLUMN_KAMAILIOSIPREGUSERLOOKUPINDEX 1 120 #define COLUMN_KAMAILIOSIPREGUSERLOOKUPURI 2 121 #define COLUMN_KAMAILIOSIPREGUSERINDEX 3 122 #define COLUMN_KAMAILIOSIPREGUSERLOOKUPROWSTATUS 4 123 124 #define kamailioSIPRegUserLookupTable_COL_MIN 2 125 #define kamailioSIPRegUserLookupTable_COL_MAX 4 126 127 128 /* Handles index extraction for row creation */ 129 int kamailioSIPRegUserLookupTable_extract_index( 130 kamailioSIPRegUserLookupTable_context *ctx, netsnmp_index *hdr); 131 132 /* Handle RESERVE1 and RESERVE2 phases of an SNMP SET */ 133 void kamailioSIPRegUserLookupTable_set_reserve1(netsnmp_request_group *); 134 void kamailioSIPRegUserLookupTable_set_reserve2(netsnmp_request_group *); 135 136 /* Handle the SET and ACTION phases of an SNMP SET */ 137 void kamailioSIPRegUserLookupTable_set_action(netsnmp_request_group *); 138 void kamailioSIPRegUserLookupTable_set_commit(netsnmp_request_group *); 139 140 /* Handle Resource cleanup if the ACTION or RESERVE1/RESERVE2 phases of an 141 * SNMPSET fail */ 142 void kamailioSIPRegUserLookupTable_set_free(netsnmp_request_group *); 143 void kamailioSIPRegUserLookupTable_set_undo(netsnmp_request_group *); 144 145 kamailioSIPRegUserLookupTable_context * 146 kamailioSIPRegUserLookupTable_duplicate_row( 147 kamailioSIPRegUserLookupTable_context *); 148 149 netsnmp_index *kamailioSIPRegUserLookupTable_delete_row( 150 kamailioSIPRegUserLookupTable_context *); 151 152 /* Used to check if there is a reason why a row can't be activated 153 * (There is no reason in our implementation) 154 */ 155 int kamailioSIPRegUserLookupTable_can_activate( 156 kamailioSIPRegUserLookupTable_context *undo_ctx, 157 kamailioSIPRegUserLookupTable_context *row_ctx, 158 netsnmp_request_group *rg); 159 160 /* Used to check if there is a reason why a row can't be deactivated 161 * (There is no reason in our implementation) 162 */ 163 int kamailioSIPRegUserLookupTable_can_deactivate( 164 kamailioSIPRegUserLookupTable_context *undo_ctx, 165 kamailioSIPRegUserLookupTable_context *row_ctx, 166 netsnmp_request_group *rg); 167 168 /* Used to check if there is a reason why a row can't be deleted 169 * (There is no reason in our implementation) 170 */ 171 int kamailioSIPRegUserLookupTable_can_delete( 172 kamailioSIPRegUserLookupTable_context *undo_ctx, 173 kamailioSIPRegUserLookupTable_context *row_ctx, 174 netsnmp_request_group *rg); 175 176 /* Basic structural setups of the new row */ 177 kamailioSIPRegUserLookupTable_context *kamailioSIPRegUserLookupTable_create_row( 178 netsnmp_index *); 179 180 181 #ifdef __cplusplus 182 } 183 #endif 184 185 #endif /** KAMAILIOSIPREGUSERLOOKUPTABLE_H */