diff options
author | Dmitry Kozlov <xeb@mail.ru> | 2015-12-02 17:31:23 +0300 |
---|---|---|
committer | Dmitry Kozlov <xeb@mail.ru> | 2015-12-02 17:31:23 +0300 |
commit | 863694e6547b94488a077e500028aabaadc48086 (patch) | |
tree | 33c224f3d7b45d5a853bf3185289e0fb876c771e /accel-pppd/extra/net-snmp/sessionTable_interface.c | |
parent | e493662216791794146087a0923839e6105241bf (diff) | |
download | accel-ppp-xebd-863694e6547b94488a077e500028aabaadc48086.tar.gz accel-ppp-xebd-863694e6547b94488a077e500028aabaadc48086.zip |
net-snmp: export interface counters in the sessionTable
Diffstat (limited to 'accel-pppd/extra/net-snmp/sessionTable_interface.c')
-rw-r--r-- | accel-pppd/extra/net-snmp/sessionTable_interface.c | 74 |
1 files changed, 51 insertions, 23 deletions
diff --git a/accel-pppd/extra/net-snmp/sessionTable_interface.c b/accel-pppd/extra/net-snmp/sessionTable_interface.c index 420336d..cabf9ca 100644 --- a/accel-pppd/extra/net-snmp/sessionTable_interface.c +++ b/accel-pppd/extra/net-snmp/sessionTable_interface.c @@ -1,6 +1,6 @@ /* * Note: this file originally auto-generated by mib2c using - * version : 15899 $ of $ + * version : 15899 $ of $ * * $Id:$ */ @@ -60,7 +60,7 @@ typedef struct sessionTable_interface_ctx_s { netsnmp_cache *cache; sessionTable_registration * user_ctx; - + netsnmp_table_registration_info tbl_info; netsnmp_baby_steps_access_methods access_multiplexer; @@ -110,7 +110,7 @@ static Netsnmp_Node_Handler _mfd_sessionTable_object_lookup; static Netsnmp_Node_Handler _mfd_sessionTable_get_values; /** * @internal - * Initialize the table sessionTable + * Initialize the table sessionTable * (Define its contents and how it's structured) */ void @@ -160,7 +160,7 @@ _sessionTable_initialize_interface(sessionTable_registration * reg_ptr, u_long snmp_log(LOG_ERR,"could not initialize container for sessionTable\n"); return; } - + /* * access_multiplexer: REQUIRED wrapper for get request handling */ @@ -179,7 +179,7 @@ _sessionTable_initialize_interface(sessionTable_registration * reg_ptr, u_long * Create a registration, save our reg data, register table. */ DEBUGMSGTL(("sessionTable:init_sessionTable", - "Registering sessionTable as a mibs-for-dummies table.\n")); + "Registering sessionTable as a mibs-for-dummies table.\n")); handler = netsnmp_baby_steps_access_multiplexer_get(access_multiplexer); reginfo = netsnmp_handler_registration_create("sessionTable", handler, sessionTable_oid, @@ -210,14 +210,14 @@ _sessionTable_initialize_interface(sessionTable_registration * reg_ptr, u_long mfd_modes |= BABY_STEP_PRE_REQUEST; if( access_multiplexer->post_request ) mfd_modes |= BABY_STEP_POST_REQUEST; - + if( access_multiplexer->undo_setup ) mfd_modes |= BABY_STEP_UNDO_SETUP; if( access_multiplexer->undo_cleanup ) mfd_modes |= BABY_STEP_UNDO_CLEANUP; if( access_multiplexer->undo_sets ) mfd_modes |= BABY_STEP_UNDO_SETS; - + if( access_multiplexer->row_creation ) mfd_modes |= BABY_STEP_ROW_CREATE; if( access_multiplexer->consistency_checks ) @@ -226,7 +226,7 @@ _sessionTable_initialize_interface(sessionTable_registration * reg_ptr, u_long mfd_modes |= BABY_STEP_COMMIT; if( access_multiplexer->undo_commit ) mfd_modes |= BABY_STEP_UNDO_COMMIT; - + handler = netsnmp_baby_steps_handler_get(mfd_modes); netsnmp_inject_handler(reginfo, handler); @@ -291,7 +291,7 @@ sessionTable_index_to_oid(netsnmp_index *oid_idx, sessionTable_mib_index *mib_idx) { int err = SNMP_ERR_NOERROR; - + /* * temp storage for parsing indexes */ @@ -343,7 +343,7 @@ sessionTable_index_from_oid(netsnmp_index *oid_idx, sessionTable_mib_index *mib_idx) { int err = SNMP_ERR_NOERROR; - + /* * temp storage for parsing indexes */ @@ -460,7 +460,7 @@ sessionTable_release_rowreq_ctx(sessionTable_rowreq_ctx *rowreq_ctx) DEBUGMSGTL(("internal:sessionTable:sessionTable_release_rowreq_ctx","called\n")); netsnmp_assert(NULL != rowreq_ctx); - + sessionTable_rowreq_ctx_cleanup(rowreq_ctx); /* @@ -469,7 +469,7 @@ sessionTable_release_rowreq_ctx(sessionTable_rowreq_ctx *rowreq_ctx) if ((rowreq_ctx->data) && !(rowreq_ctx->rowreq_flags & MFD_ROW_DATA_FROM_USER)) sessionTable_release_data(rowreq_ctx->data); - + /* * free index oid pointer */ @@ -493,13 +493,13 @@ _mfd_sessionTable_pre_request(netsnmp_mib_handler *handler, DEBUGMSGTL(("internal:sessionTable:_mfd_sessionTable_pre_request", "called\n")); - + if (1 != netsnmp_row_merge_status_first(reginfo, agtreq_info)) { DEBUGMSGTL(("internal:sessionTable", "skipping additional pre_request\n")); return SNMP_ERR_NOERROR; } - + rc = sessionTable_pre_request(sessionTable_if_ctx.user_ctx); if (MFD_SUCCESS != rc) { /* @@ -509,7 +509,7 @@ _mfd_sessionTable_pre_request(netsnmp_mib_handler *handler, "sessionTable_pre_request\n", rc)); netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc)); } - + return SNMP_ERR_NOERROR; } /* _mfd_sessionTable_pre_request */ @@ -544,7 +544,7 @@ _mfd_sessionTable_post_request(netsnmp_mib_handler *handler, "waiting for last post_request\n")); return SNMP_ERR_NOERROR; } - + packet_rc = netsnmp_check_all_requests_error(agtreq_info->asp, 0); rc = sessionTable_post_request(sessionTable_if_ctx.user_ctx,packet_rc); if (MFD_SUCCESS != rc) { @@ -554,7 +554,7 @@ _mfd_sessionTable_post_request(netsnmp_mib_handler *handler, DEBUGMSGTL(("sessionTable","error %d from " "sessionTable_post_request\n", rc)); } - + return SNMP_ERR_NOERROR; } /* _mfd_sessionTable_post_request */ @@ -571,7 +571,7 @@ _mfd_sessionTable_object_lookup(netsnmp_mib_handler *handler, int rc = SNMP_ERR_NOERROR; sessionTable_rowreq_ctx *rowreq_ctx = netsnmp_container_table_row_extract(requests); - + DEBUGMSGTL(("internal:sessionTable:_mfd_sessionTable_object_lookup","called\n")); /* @@ -606,7 +606,7 @@ _sessionTable_get_column( sessionTable_rowreq_ctx *rowreq_ctx, netsnmp_variable_list *var, int column ) { int rc = SNMPERR_SUCCESS; - + DEBUGMSGTL(("internal:sessionTable:_mfd_sessionTable_get_column", "called for %d\n", column)); @@ -681,6 +681,34 @@ rc = sesCallingSID_get(rowreq_ctx, (char **)&var->val.string, &var->val_len ); rc = sesCalledSID_get(rowreq_ctx, (char **)&var->val.string, &var->val_len ); break; + /* sesRxBytes(10)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h */ + case COLUMN_SESRXBYTES: + var->val_len = sizeof(U64); + var->type = ASN_COUNTER64; +rc = sesRxBytes_get(rowreq_ctx, (U64 *)var->val.string ); + break; + + /* sesRxPkts(11)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h */ + case COLUMN_SESRXPKTS: + var->val_len = sizeof(u_long); + var->type = ASN_COUNTER; +rc = sesRxPkts_get(rowreq_ctx, (u_long *)var->val.string ); + break; + + /* sesTxBytes(12)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h */ + case COLUMN_SESTXBYTES: + var->val_len = sizeof(U64); + var->type = ASN_COUNTER64; +rc = sesTxBytes_get(rowreq_ctx, (U64 *)var->val.string ); + break; + + /* sesTxPkts(13)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h */ + case COLUMN_SESTXPKTS: + var->val_len = sizeof(u_long); + var->type = ASN_COUNTER; +rc = sesTxPkts_get(rowreq_ctx, (u_long *)var->val.string ); + break; + default: if (SESSIONTABLE_MIN_COL <= column && column <= SESSIONTABLE_MAX_COL) { DEBUGMSGTL(("internal:sessionTable:_mfd_sessionTable_get_column", @@ -712,7 +740,7 @@ _mfd_sessionTable_get_values(netsnmp_mib_handler *handler, DEBUGMSGTL(("internal:sessionTable:_mfd_sessionTable_get_values","called\n")); netsnmp_assert(NULL != rowreq_ctx); - + for(;requests; requests = requests->next) { /* * save old pointer, so we can free it if replaced @@ -734,7 +762,7 @@ _mfd_sessionTable_get_values(netsnmp_mib_handler *handler, tri = netsnmp_extract_table_info(requests); if(NULL == tri) continue; - + rc = _sessionTable_get_column(rowreq_ctx, requests->requestvb, tri->colnum); if(rc) { if(MFD_SKIP == rc) { @@ -798,7 +826,7 @@ _cache_load(netsnmp_cache *cache, void *vmagic) /** should only be called for an invalid or expired cache */ netsnmp_assert((0 == cache->valid) || (1 == cache->expired)); - + /* * call user code */ @@ -856,7 +884,7 @@ _container_free(netsnmp_container *container) * call user code */ sessionTable_container_free(container); - + /* * free all items. inefficient, but easy. */ |