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 | |
parent | e493662216791794146087a0923839e6105241bf (diff) | |
download | accel-ppp-863694e6547b94488a077e500028aabaadc48086.tar.gz accel-ppp-863694e6547b94488a077e500028aabaadc48086.zip |
net-snmp: export interface counters in the sessionTable
Diffstat (limited to 'accel-pppd/extra')
-rw-r--r-- | accel-pppd/extra/net-snmp/ACCEL-PPP-MIB.txt | 38 | ||||
-rw-r--r-- | accel-pppd/extra/net-snmp/sessionTable.c | 16 | ||||
-rw-r--r-- | accel-pppd/extra/net-snmp/sessionTable.h | 6 | ||||
-rw-r--r-- | accel-pppd/extra/net-snmp/sessionTable_data_access.c | 12 | ||||
-rw-r--r-- | accel-pppd/extra/net-snmp/sessionTable_data_get.c | 190 | ||||
-rw-r--r-- | accel-pppd/extra/net-snmp/sessionTable_data_get.h | 4 | ||||
-rw-r--r-- | accel-pppd/extra/net-snmp/sessionTable_data_set.c | 2 | ||||
-rw-r--r-- | accel-pppd/extra/net-snmp/sessionTable_data_set.h | 2 | ||||
-rw-r--r-- | accel-pppd/extra/net-snmp/sessionTable_enums.h | 32 | ||||
-rw-r--r-- | accel-pppd/extra/net-snmp/sessionTable_interface.c | 74 | ||||
-rw-r--r-- | accel-pppd/extra/net-snmp/sessionTable_interface.h | 2 | ||||
-rw-r--r-- | accel-pppd/extra/net-snmp/sessionTable_oids.h | 33 |
12 files changed, 343 insertions, 68 deletions
diff --git a/accel-pppd/extra/net-snmp/ACCEL-PPP-MIB.txt b/accel-pppd/extra/net-snmp/ACCEL-PPP-MIB.txt index 847a270d..b536a9b7 100644 --- a/accel-pppd/extra/net-snmp/ACCEL-PPP-MIB.txt +++ b/accel-pppd/extra/net-snmp/ACCEL-PPP-MIB.txt @@ -209,7 +209,11 @@ sessionEntry ::= SEQUENCE { sesState INTEGER, sesUptime TimeTicks, sesCallingSID OCTET STRING, - sesCalledSID OCTET STRING + sesCalledSID OCTET STRING, + sesRxBytes Counter64, + sesRxPkts Counter32, + sesTxBytes Counter64, + sesTxPkts Counter32 } sesSID OBJECT-TYPE @@ -294,6 +298,38 @@ sesCalledSID OBJECT-TYPE "Called-Station-ID" ::= { sessionEntry 9 } +sesRxBytes OBJECT-TYPE + SYNTAX Counter64 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Received bytes" + ::= { sessionEntry 10 } + +sesRxPkts OBJECT-TYPE + SYNTAX Counter32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Received packets" + ::= { sessionEntry 11 } + +sesTxBytes OBJECT-TYPE + SYNTAX Counter64 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Transmitted bytes" + ::= { sessionEntry 12 } + +sesTxPkts OBJECT-TYPE + SYNTAX Counter32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Transmitted packets" + ::= { sessionEntry 13 } + -- -- Administration -- diff --git a/accel-pppd/extra/net-snmp/sessionTable.c b/accel-pppd/extra/net-snmp/sessionTable.c index 954ca1e3..dc7d62bd 100644 --- a/accel-pppd/extra/net-snmp/sessionTable.c +++ b/accel-pppd/extra/net-snmp/sessionTable.c @@ -1,6 +1,6 @@ /* * Note: this file originally auto-generated by mib2c using - * version : 14170 $ of $ + * version : 14170 $ of $ * * $Id:$ */ @@ -42,7 +42,7 @@ init_sessionTable(void) /* * TODO:300:o: Perform sessionTable one-time module initialization. */ - + /* * here we initialize all the tables we're planning on supporting */ @@ -63,7 +63,7 @@ shutdown_sessionTable(void) } /** - * Initialize the table sessionTable + * Initialize the table sessionTable * (Define its contents and how it's structured) */ void @@ -88,13 +88,13 @@ initialize_table_sessionTable(void) * string token is used to add, find or remove pointers. */ user_context = netsnmp_create_data_list("sessionTable", NULL, NULL); - + /* * No support for any flags yet, but in the future you would * set any flags here. */ flags = 0; - + /* * call interface initialization code */ @@ -102,7 +102,7 @@ initialize_table_sessionTable(void) } /* initialize_table_sessionTable */ /** - * Shutdown the table sessionTable + * Shutdown the table sessionTable */ void shutdown_table_sessionTable(void) @@ -129,7 +129,7 @@ sessionTable_rowreq_ctx_init(sessionTable_rowreq_ctx *rowreq_ctx, DEBUGMSGTL(("verbose:sessionTable:sessionTable_rowreq_ctx_init","called\n")); netsnmp_assert(NULL != rowreq_ctx); - + /* * TODO:210:o: |-> Perform extra sessionTable rowreq initialization. (eg DEFVALS) */ @@ -146,7 +146,7 @@ void sessionTable_rowreq_ctx_cleanup(sessionTable_rowreq_ctx *rowreq_ctx) DEBUGMSGTL(("verbose:sessionTable:sessionTable_rowreq_ctx_cleanup","called\n")); netsnmp_assert(NULL != rowreq_ctx); - + /* * TODO:211:o: |-> Perform extra sessionTable rowreq cleanup. */ diff --git a/accel-pppd/extra/net-snmp/sessionTable.h b/accel-pppd/extra/net-snmp/sessionTable.h index 2635f21c..31735c39 100644 --- a/accel-pppd/extra/net-snmp/sessionTable.h +++ b/accel-pppd/extra/net-snmp/sessionTable.h @@ -83,6 +83,12 @@ struct sessionTable_data_s unsigned long uptime; char *calling_sid; char *called_sid; + unsigned int rx_bytes; + unsigned int rx_gw; + unsigned int rx_pkts; + unsigned int tx_bytes; + unsigned int tx_gw; + unsigned int tx_pkts; }; typedef struct sessionTable_data_s sessionTable_data; diff --git a/accel-pppd/extra/net-snmp/sessionTable_data_access.c b/accel-pppd/extra/net-snmp/sessionTable_data_access.c index edc5e6b2..13ddfc5d 100644 --- a/accel-pppd/extra/net-snmp/sessionTable_data_access.c +++ b/accel-pppd/extra/net-snmp/sessionTable_data_access.c @@ -9,6 +9,8 @@ #include <net-snmp/net-snmp-includes.h> #include <net-snmp/agent/net-snmp-agent-includes.h> +#include <linux/if_link.h> + /* include our parent header */ #include "sessionTable.h" @@ -199,6 +201,7 @@ sessionTable_container_load(netsnmp_container *container) sessionTable_rowreq_ctx *rowreq_ctx; size_t count = 0; struct ap_session *ses; + struct rtnl_link_stats stats; DEBUGMSGTL(("verbose:sessionTable:sessionTable_container_load","called\n")); @@ -233,6 +236,15 @@ sessionTable_container_load(netsnmp_container *container) rowreq_ctx->data->calling_sid = _strdup(ses->ctrl->calling_station_id); rowreq_ctx->data->called_sid = _strdup(ses->ctrl->called_station_id); + ap_session_read_stats(ses, &stats); + rowreq_ctx->data->rx_pkts = stats.rx_packets; + rowreq_ctx->data->rx_bytes = stats.rx_bytes; + rowreq_ctx->data->rx_gw = ses->acct_input_gigawords; + rowreq_ctx->data->tx_pkts = stats.tx_packets; + rowreq_ctx->data->tx_bytes = stats.tx_bytes; + rowreq_ctx->data->tx_gw = ses->acct_output_gigawords; + + CONTAINER_INSERT(container, rowreq_ctx); ++count; } diff --git a/accel-pppd/extra/net-snmp/sessionTable_data_get.c b/accel-pppd/extra/net-snmp/sessionTable_data_get.c index e2b1cbc6..f936e125 100644 --- a/accel-pppd/extra/net-snmp/sessionTable_data_get.c +++ b/accel-pppd/extra/net-snmp/sessionTable_data_get.c @@ -694,4 +694,194 @@ sesCalledSID_get( sessionTable_rowreq_ctx *rowreq_ctx, char **sesCalledSID_val_p return MFD_SUCCESS; } /* sesCalledSID_get */ +/*--------------------------------------------------------------------- + * ACCEL-PPP-MIB::sessionEntry.sesRxBytes + * sesRxBytes is subid 10 of sessionEntry. + * Its status is Current, and its access level is ReadOnly. + * OID: .1.3.6.1.4.1.8072.100.2.1.1.10 + * Description: +Received bytes + * + * Attributes: + * accessible 1 isscalar 0 enums 0 hasdefval 0 + * readable 1 iscolumn 1 ranges 0 hashint 0 + * settable 0 + * + * + * Its syntax is INTEGER (based on perltype INTEGER) + * The net-snmp type is ASN_INTEGER. The C type decl is long (long) + */ +/** + * Extract the current value of the sesRxBytes data. + * + * Set a value using the data context for the row. + * + * @param rowreq_ctx + * Pointer to the row request context. + * @param sesRxBytes_val_ptr + * Pointer to storage for a long variable + * + * @retval MFD_SUCCESS : success + * @retval MFD_SKIP : skip this node (no value for now) + * @retval MFD_ERROR : Any other error + */ +int +sesRxBytes_get( sessionTable_rowreq_ctx *rowreq_ctx, U64 * sesRxBytes_val_ptr ) +{ + /** we should have a non-NULL pointer */ + netsnmp_assert( NULL != sesRxBytes_val_ptr ); + + + DEBUGMSGTL(("verbose:sessionTable:sesRxBytes_get","called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + + sesRxBytes_val_ptr->high = rowreq_ctx->data->rx_gw; + sesRxBytes_val_ptr->low = rowreq_ctx->data->rx_bytes; + + return MFD_SUCCESS; +} /* sesRxBytes_get */ + +/*--------------------------------------------------------------------- + * ACCEL-PPP-MIB::sessionEntry.sesRxPkts + * sesRxPkts is subid 11 of sessionEntry. + * Its status is Current, and its access level is ReadOnly. + * OID: .1.3.6.1.4.1.8072.100.2.1.1.11 + * Description: +Received packets + * + * Attributes: + * accessible 1 isscalar 0 enums 0 hasdefval 0 + * readable 1 iscolumn 1 ranges 0 hashint 0 + * settable 0 + * + * + * Its syntax is INTEGER (based on perltype INTEGER) + * The net-snmp type is ASN_INTEGER. The C type decl is long (long) + */ +/** + * Extract the current value of the sesRxPkts data. + * + * Set a value using the data context for the row. + * + * @param rowreq_ctx + * Pointer to the row request context. + * @param sesRxPkts_val_ptr + * Pointer to storage for a long variable + * + * @retval MFD_SUCCESS : success + * @retval MFD_SKIP : skip this node (no value for now) + * @retval MFD_ERROR : Any other error + */ +int +sesRxPkts_get( sessionTable_rowreq_ctx *rowreq_ctx, u_long * sesRxPkts_val_ptr ) +{ + /** we should have a non-NULL pointer */ + netsnmp_assert( NULL != sesRxPkts_val_ptr ); + + + DEBUGMSGTL(("verbose:sessionTable:sesRxPkts_get","called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + + *sesRxPkts_val_ptr = rowreq_ctx->data->rx_pkts; + + return MFD_SUCCESS; +} /* sesRxPkts_get */ + +/*--------------------------------------------------------------------- + * ACCEL-PPP-MIB::sessionEntry.sesTxBytes + * sesTxBytes is subid 12 of sessionEntry. + * Its status is Current, and its access level is ReadOnly. + * OID: .1.3.6.1.4.1.8072.100.2.1.1.12 + * Description: +Transmitted bytes + * + * Attributes: + * accessible 1 isscalar 0 enums 0 hasdefval 0 + * readable 1 iscolumn 1 ranges 0 hashint 0 + * settable 0 + * + * + * Its syntax is INTEGER (based on perltype INTEGER) + * The net-snmp type is ASN_INTEGER. The C type decl is long (long) + */ +/** + * Extract the current value of the sesTxBytes data. + * + * Set a value using the data context for the row. + * + * @param rowreq_ctx + * Pointer to the row request context. + * @param sesTxBytes_val_ptr + * Pointer to storage for a long variable + * + * @retval MFD_SUCCESS : success + * @retval MFD_SKIP : skip this node (no value for now) + * @retval MFD_ERROR : Any other error + */ +int +sesTxBytes_get( sessionTable_rowreq_ctx *rowreq_ctx, U64* sesTxBytes_val_ptr ) +{ + /** we should have a non-NULL pointer */ + netsnmp_assert( NULL != sesTxBytes_val_ptr ); + + + DEBUGMSGTL(("verbose:sessionTable:sesTxBytes_get","called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + + sesTxBytes_val_ptr->high = rowreq_ctx->data->tx_gw; + sesTxBytes_val_ptr->low = rowreq_ctx->data->tx_bytes; + + return MFD_SUCCESS; +} /* sesTxBytes_get */ + +/*--------------------------------------------------------------------- + * ACCEL-PPP-MIB::sessionEntry.sesTxPkts + * sesTxPkts is subid 13 of sessionEntry. + * Its status is Current, and its access level is ReadOnly. + * OID: .1.3.6.1.4.1.8072.100.2.1.1.13 + * Description: +Transmitted packets + * + * Attributes: + * accessible 1 isscalar 0 enums 0 hasdefval 0 + * readable 1 iscolumn 1 ranges 0 hashint 0 + * settable 0 + * + * + * Its syntax is INTEGER (based on perltype INTEGER) + * The net-snmp type is ASN_INTEGER. The C type decl is long (long) + */ +/** + * Extract the current value of the sesTxPkts data. + * + * Set a value using the data context for the row. + * + * @param rowreq_ctx + * Pointer to the row request context. + * @param sesTxPkts_val_ptr + * Pointer to storage for a long variable + * + * @retval MFD_SUCCESS : success + * @retval MFD_SKIP : skip this node (no value for now) + * @retval MFD_ERROR : Any other error + */ +int +sesTxPkts_get( sessionTable_rowreq_ctx *rowreq_ctx, u_long * sesTxPkts_val_ptr ) +{ + /** we should have a non-NULL pointer */ + netsnmp_assert( NULL != sesTxPkts_val_ptr ); + + + DEBUGMSGTL(("verbose:sessionTable:sesTxPkts_get","called\n")); + + netsnmp_assert(NULL != rowreq_ctx); + + *sesTxPkts_val_ptr = rowreq_ctx->data->tx_pkts; + + return MFD_SUCCESS; +} /* sesTxPkts_get */ + /** @} */ diff --git a/accel-pppd/extra/net-snmp/sessionTable_data_get.h b/accel-pppd/extra/net-snmp/sessionTable_data_get.h index e5a3ae62..82107200 100644 --- a/accel-pppd/extra/net-snmp/sessionTable_data_get.h +++ b/accel-pppd/extra/net-snmp/sessionTable_data_get.h @@ -50,6 +50,10 @@ extern "C" { int sesUptime_get( sessionTable_rowreq_ctx *rowreq_ctx, u_long * sesUptime_val_ptr ); int sesCallingSID_get( sessionTable_rowreq_ctx *rowreq_ctx, char **sesCallingSID_val_ptr_ptr, size_t *sesCallingSID_val_ptr_len_ptr ); int sesCalledSID_get( sessionTable_rowreq_ctx *rowreq_ctx, char **sesCalledSID_val_ptr_ptr, size_t *sesCalledSID_val_ptr_len_ptr ); + int sesRxBytes_get( sessionTable_rowreq_ctx *rowreq_ctx, U64 * sesRxBytes_val_ptr ); + int sesRxPkts_get( sessionTable_rowreq_ctx *rowreq_ctx, u_long * sesRxPkts_val_ptr ); + int sesTxBytes_get( sessionTable_rowreq_ctx *rowreq_ctx, U64 * sesTxBytes_val_ptr ); + int sesTxPkts_get( sessionTable_rowreq_ctx *rowreq_ctx, u_long * sesTxPkts_val_ptr ); int sessionTable_indexes_set_tbl_idx(sessionTable_mib_index *tbl_idx, char *sesSID_val_ptr, size_t sesSID_val_ptr_len); diff --git a/accel-pppd/extra/net-snmp/sessionTable_data_set.c b/accel-pppd/extra/net-snmp/sessionTable_data_set.c index 2f3bfa02..ebfeeeaa 100644 --- a/accel-pppd/extra/net-snmp/sessionTable_data_set.c +++ b/accel-pppd/extra/net-snmp/sessionTable_data_set.c @@ -18,7 +18,7 @@ * * These routines are used to set the value for individual objects. The * row context is passed, along with the new value. - * + * * @{ */ /** @} */ diff --git a/accel-pppd/extra/net-snmp/sessionTable_data_set.h b/accel-pppd/extra/net-snmp/sessionTable_data_set.h index c77b466c..70534baa 100644 --- a/accel-pppd/extra/net-snmp/sessionTable_data_set.h +++ b/accel-pppd/extra/net-snmp/sessionTable_data_set.h @@ -1,6 +1,6 @@ /* * Note: this file originally auto-generated by mib2c using - * version : 12077 $ of $ + * version : 12077 $ of $ * * $Id:$ */ diff --git a/accel-pppd/extra/net-snmp/sessionTable_enums.h b/accel-pppd/extra/net-snmp/sessionTable_enums.h index 7897ff02..74268eef 100644 --- a/accel-pppd/extra/net-snmp/sessionTable_enums.h +++ b/accel-pppd/extra/net-snmp/sessionTable_enums.h @@ -33,30 +33,20 @@ extern "C" { /************************************************************* * constants for enums for the MIB node - * sesType (IANAtunnelType / ASN_INTEGER) + * sesType (INTEGER / ASN_INTEGER) * * since a Textual Convention may be referenced more than once in a * MIB, protect againt redefinitions of the enum values. */ -#ifndef IANATUNNELTYPE_ENUMS -#define IANATUNNELTYPE_ENUMS +#ifndef SESTYPE_ENUMS +#define SESTYPE_ENUMS -#define IANATUNNELTYPE_OTHER 1 -#define IANATUNNELTYPE_DIRECT 2 -#define IANATUNNELTYPE_GRE 3 -#define IANATUNNELTYPE_MINIMAL 4 -#define IANATUNNELTYPE_L2TP 5 -#define IANATUNNELTYPE_PPTP 6 -#define IANATUNNELTYPE_L2F 7 -#define IANATUNNELTYPE_UDP 8 -#define IANATUNNELTYPE_ATMP 9 -#define IANATUNNELTYPE_MSDP 10 -#define IANATUNNELTYPE_SIXTOFOUR 11 -#define IANATUNNELTYPE_SIXOVERFOUR 12 -#define IANATUNNELTYPE_ISATAP 13 -#define IANATUNNELTYPE_TEREDO 14 +#define SESTYPE_PPTP 1 +#define SESTYPE_L2TP 2 +#define SESTYPE_PPPOE 3 +#define SESTYPE_IPOE 4 -#endif /* IANATUNNELTYPE_ENUMS */ +#endif /* SESTYPE_ENUMS */ /************************************************************* @@ -69,9 +59,9 @@ extern "C" { #ifndef SESSTATE_ENUMS #define SESSTATE_ENUMS -#define SESSTATE_STARTING 1 -#define SESSTATE_ACTIVE 2 -#define SESSTATE_FINISHING 3 +#define SESSTATE_STARTING 1 +#define SESSTATE_ACTIVE 2 +#define SESSTATE_FINISHING 3 #endif /* SESSTATE_ENUMS */ diff --git a/accel-pppd/extra/net-snmp/sessionTable_interface.c b/accel-pppd/extra/net-snmp/sessionTable_interface.c index 420336da..cabf9ca0 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. */ diff --git a/accel-pppd/extra/net-snmp/sessionTable_interface.h b/accel-pppd/extra/net-snmp/sessionTable_interface.h index 2b99dde6..ebd1143d 100644 --- a/accel-pppd/extra/net-snmp/sessionTable_interface.h +++ b/accel-pppd/extra/net-snmp/sessionTable_interface.h @@ -9,7 +9,7 @@ * \warning This code should not be modified, called directly, * or used to interpret functionality. It is subject to * change at any time. - * + * * @{ */ /* diff --git a/accel-pppd/extra/net-snmp/sessionTable_oids.h b/accel-pppd/extra/net-snmp/sessionTable_oids.h index 0fc5c284..01d84b60 100644 --- a/accel-pppd/extra/net-snmp/sessionTable_oids.h +++ b/accel-pppd/extra/net-snmp/sessionTable_oids.h @@ -1,6 +1,6 @@ /* * Note: this file originally auto-generated by mib2c using - * : generic-table-oids.m2c 12855 2005-09-27 15:56:08Z rstory $ + * : generic-table-oids.m2c 17548 2009-04-23 16:35:18Z hardaker $ * * $Id:$ */ @@ -15,28 +15,37 @@ extern "C" { /* column number definitions for table sessionTable */ #define SESSIONTABLE_OID 1,3,6,1,4,1,8072,100,2,1 -#define COLUMN_SESSID 1 +#define COLUMN_SESSID 1 + #define COLUMN_SESIFNAME 2 - + #define COLUMN_SESUSERNAME 3 - + #define COLUMN_SESIP 4 - + #define COLUMN_SESTYPE 5 - + #define COLUMN_SESSTATE 6 - + #define COLUMN_SESUPTIME 7 - + #define COLUMN_SESCALLINGSID 8 - + #define COLUMN_SESCALLEDSID 9 - + +#define COLUMN_SESRXBYTES 10 + +#define COLUMN_SESRXPKTS 11 + +#define COLUMN_SESTXBYTES 12 + +#define COLUMN_SESTXPKTS 13 + #define SESSIONTABLE_MIN_COL COLUMN_SESSID -#define SESSIONTABLE_MAX_COL COLUMN_SESCALLEDSID - +#define SESSIONTABLE_MAX_COL COLUMN_SESTXPKTS + #ifdef __cplusplus |