?? radius_acct_mib.c
字號(hào):
/* radius_acct_mib.c */#ifdef __RADIUS_MIB__/**************************************************************************************************************************************************************** This file was automatically generated by Wind River Systems**** Emissary SNMP MIB Compiler, version 7.0.**** This file was generated using the -stub switch.**** **** This file contains stub function declarations to aid in building**** the agent MIB interface. It creates all the MIB get, set, test, and**** next method routines that you will need to supply. However,**** since it doesn't know your system, several things are left to you.**** Look for comments with `!!!' in them for places you're likely to want**** to change for your system. Also, while the layout of the method**** routines is a commonly useful one, it will not fit all data structures**** and systems. Look at this output as a guide to how to write your**** method routines; a guide that will, in most cases, significantly reduce**** the amount of typing you need to do.**** **** The code here assumes you've created a file called `mibleaf.h' with**** the -leaf option to the mibcompiler.**** **** YOU WILL PROBABLY MODIFY THIS FILE BUT BEWARE ACCIDENTALLY**** OVERWRITING IT BY REGENERATING IT WITH THE MIB COMPILER.**** **** Last build date: Thu Feb 17 17:32:59 2000**** from files:**** rfc2571.mib, rfc2620.mib*************************************************************************************************************************************************************//* Copyright 1984 - 2000 Wind River Systems, Inc. */#include "copyright_wrs.h"/*modification history____________________01e,26jan01,tk ifdef out entire file if __RADIUS_MIB__ is not defined 01d,22dec00,md changed radiusAccServerEntryGet() to return only acct server type01c,22dec00,md changed radiusAccServerEntryNext() to return only acct server type01b,19dec00,md Fixed bug - radiusAccServerEntryNext() to search entire server list instead of just basing on the compl01a,19dec00,md merged from visual source safe*/#include "radius.h"#include "radius_mib_include.h"/********************************************************************************* Global Varialbles.********************************************************************************/M2_RADIUS_ACC_SERVER_INFO radiusAccServerInfo;M2_RADIUS_ACC_CLIENT_INFO radiusAccClientInfo;/********************************************************************************* Private function prototypes.********************************************************************************/void acc_server_mib_stat_sync (M2_RADIUS_ACC_SERVER_INFO* pRadiusAccServerInfo, RADIUS_SERVER_STATISTICS *pServerStat);static int radiusAccServerEntry_lookup (int compc, OIDC_T *compl, M2_RADIUS_ACC_SERVER_INFO* data);static unsigned radiusAccServerEntry_build_instance (M2_RADIUS_ACC_SERVER_INFO* data, OIDC_T* tmp_inst);/********************************************************************************* Method routines for the radiusAuthServerTable:********************************************************************************//******************************************************************************** radiusAcctServerEntryGetValue** An internal routine to retrieve the values of the variables, used by the * method routines radiusAcctServerEntryGet and radiusAcctServerEntryNext.* Parameters to this routine are** <lastmatch> - the last oid component that was matched to get to this leaf.* <pktp> - ptr to internal representation of the snmp pkt.* <vbp> - ptr to var bind being processed.* <pRadiusServerInfo>* - the structure holding the info of RADIUS server.*******************************************************************************/static int radiusAccServerEntryGetValue(OIDC_T lastmatch, SNMP_PKT_T *pktp, VB_T *vbp, M2_RADIUS_ACC_SERVER_INFO *pRadiusAcctServerInfo) { switch(lastmatch) { case LEAF_radiusAccServerAddress: getproc_got_ip_address(pktp, vbp, pRadiusAcctServerInfo->radiusAccServerAddress); break; case LEAF_radiusAccClientServerPortNumber: getproc_got_int32(pktp, vbp, pRadiusAcctServerInfo->radiusAccClientServerPortNumber); break; case LEAF_radiusAccClientRoundTripTime: getproc_got_uint32(pktp, vbp, pRadiusAcctServerInfo->radiusAccClientRoundTripTime, VT_TIMETICKS); break; case LEAF_radiusAccClientRequests: getproc_got_uint32(pktp, vbp, pRadiusAcctServerInfo->radiusAccClientRequests, VT_COUNTER); break; case LEAF_radiusAccClientRetransmissions: getproc_got_uint32(pktp, vbp, pRadiusAcctServerInfo->radiusAccClientRetransmissions, VT_COUNTER); break; case LEAF_radiusAccClientResponses: getproc_got_uint32(pktp, vbp, pRadiusAcctServerInfo->radiusAccClientResponses, VT_COUNTER); break; case LEAF_radiusAccClientMalformedResponses: getproc_got_uint32(pktp, vbp, pRadiusAcctServerInfo->radiusAccClientMalformedResponses, VT_COUNTER); break; case LEAF_radiusAccClientBadAuthenticators: getproc_got_uint32(pktp, vbp, pRadiusAcctServerInfo->radiusAccClientBadAuthenticators, VT_COUNTER); break; case LEAF_radiusAccClientPendingRequests: getproc_got_uint32(pktp, vbp, pRadiusAcctServerInfo->radiusAccClientPendingRequests, VT_GAUGE); break; case LEAF_radiusAccClientTimeouts: getproc_got_uint32(pktp, vbp, pRadiusAcctServerInfo->radiusAccClientTimeouts, VT_COUNTER); break; case LEAF_radiusAccClientUnknownTypes: getproc_got_uint32(pktp, vbp, pRadiusAcctServerInfo->radiusAccClientUnknownTypes, VT_COUNTER); break; case LEAF_radiusAccClientPacketsDropped: getproc_got_uint32(pktp, vbp, pRadiusAcctServerInfo->radiusAccClientPacketsDropped, VT_COUNTER); break; default: return GEN_ERR; } return NO_ERROR;}/******************************************************************************* radiusAccServerEntryGet** Get method routine for for RADIUS Authentication server table*** Parameters to this routine are** <lastmatch> - the last oid component that was matched to get to this leaf.* <compc> - count of components remaining in the unmatched portion i.e.* the length of the instance portion.* <compl> - ptr to the oid sequence remaining, i.e. the instance portion.* <pktp> - ptr to internal representation of the snmp pkt.* <vbp> - ptr to var bind being processed.** RETURNS : N/A*******************************************************************************/void radiusAccServerEntryGet (OIDC_T lastmatch, int compc, OIDC_T *compl, SNMP_PKT_T *pktp, VB_T *vbp){ int error; /* find all the varbinds that share the same getproc and instance */ snmpdGroupByGetprocAndInstance(pktp, vbp, compc, compl); /* use the instance (compc and compl) to look up the entry in the * table. This lookup routine will probably have to be changed to * suit your system. */ if (radiusAccServerEntry_lookup(compc, compl, &radiusAccServerInfo) != 0) { for ( ; vbp != NULL; vbp = vbp->vb_link) { getproc_nosuchins(pktp, vbp); } } else { /* retrieve all the values from the same data structure */ for ( ; vbp != NULL; vbp = vbp->vb_link) { if ((error = radiusAccServerEntryGetValue (vbp->vb_ml.ml_last_match, pktp, vbp, &radiusAccServerInfo)) != NO_ERROR) { getproc_error(pktp, vbp, error); } } }}/******************************************************************************* radiusAccServerEntryNext** Next method routine for RADIUS Authentication server table*** Parameters to this routine are** <lastmatch> - the last oid component that was matched to get to this leaf.* <compc> - count of components remaining in the unmatched portion i.e.* the length of the instance portion.* <compl> - ptr to the oid sequence remaining, i.e. the instance portion.* <pktp> - ptr to internal representation of the snmp pkt.* <vbp> - ptr to var bind being processed.** RETURNS : N/A*******************************************************************************/void radiusAccServerEntryNext(OIDC_T lastmatch, int compc, OIDC_T *compl, SNMP_PKT_T *pktp, VB_T *vbp){ M2_RADIUS_ACC_SERVER_INFO *pRadiusAccServerInfo = &radiusAccServerInfo; RW_CONTAINER_ITERATOR server_iterator; RADIUS_SERVER* p_server = NULL; RADIUS_SERVER_STATISTICS *p_server_stat; RADIUS_SERVER *data; RADIUS_SERVER *best; OIDC_T tmp_inst [RADIUS_TBL_INDEX_LEN]; OIDC_T best_inst[RADIUS_TBL_INDEX_LEN]; unsigned inst_len; unsigned best_inst_len; int error; int i; bool found = false; /* find all the varbinds that share the same getproc and instance */ snmpdGroupByGetprocAndInstance (pktp, vbp, compc, compl); /* generate the instance of each table entry and find the * smallest instance that's larger than compc/compl */ best = 0; semTake (g_sem_radius_mib, WAIT_FOREVER); server_iterator = rw_container_create_copy_of_iterator (radius.server_controller.iterator); rw_container_goto_front (server_iterator); while (rw_container_is_at_end (server_iterator) == false) { data = rw_container_at (server_iterator); if (data != NULL) { if (data->type == RADIUS_ACCOUNTING_SERVER_TYPE) { inst_len = RADIUS_TBL_INDEX_LEN; *tmp_inst = (UINT) data; if ((oidcmp2(inst_len, tmp_inst, compc, compl) > 0) && ((!best || (oidcmp2(inst_len, tmp_inst, inst_len, best_inst) < 0)))) { best = data; for (i = 0; i < inst_len; i++) best_inst[i] = tmp_inst[i]; best_inst_len = inst_len; } } }
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -