📄 radius_auth_mib.c
字号:
/* radius_auth_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: Mon Jan 31 17:38:09 2000**** from files:**** rfc1155.smi, rfc2571.mib, rfc2618.mib*************************************************************************************************************************************************************//* Copyright 1984 - 2000 Wind River Systems, Inc. */#include "copyright_wrs.h"/*modification history____________________052301 tk Fix bug 17 from Siemens: mapping of radius internal and MIB counters is messed up in auth_server_mib_stat_sync.012601 tk ifdef out entire file if __RADIUS_MIB__ is not defined01d,22dec00,md changed radiusAuthServerEntryGet() to return only auth server type01c,22dec00,md changed radiusAuthServerEntryNext() to return only auth server type01b,19dec00,md Fixed bug - radiusAuthServerEntryNext() to search entire server list instead of just basing on the compl01a,19dec00,md merged from visual source safe*/#include <asn1conf.h>#include <asn1.h>#include <buffer.h>#include <mib.h>#include <snmpdefs.h>#include <snmp.h>#include <auxfuncs.h>#include "radius.h"#include "radius_mib_include.h"/********************************************************************************* Global Varialbles.********************************************************************************/M2_RADIUS_AUTH_SERVER_INFO radiusAuthServerInfo;M2_RADIUS_AUTH_CLIENT_INFO radiusAuthClientInfo;/********************************************************************************* Private function prototypes.********************************************************************************/void auth_server_mib_stat_sync (M2_RADIUS_AUTH_SERVER_INFO* pradiusAuthServerInfo, RADIUS_SERVER_STATISTICS *pServerStat);static int radiusAuthServerEntry_lookup (int compc, OIDC_T *compl, M2_RADIUS_AUTH_SERVER_INFO* data);static unsigned radiusAuthServerEntry_build_instance (M2_RADIUS_AUTH_SERVER_INFO* data, OIDC_T* tmp_inst);/********************************************************************************* Method routines for the radiusAuthServerTable:********************************************************************************//******************************************************************************** radiusAuthServerEntryGetValue** An internal routine to retrieve the values of the variables, used* by the method routines radiusAuthServerEntryGet and radiusAuthServerEntryNext.* 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.* <pradiusAuthServerInfo>* - the structure holding the info of RADIUS server.*******************************************************************************/static int radiusAuthServerEntryGetValue(OIDC_T lastmatch, SNMP_PKT_T *pktp, VB_T *vbp, M2_RADIUS_AUTH_SERVER_INFO *pradiusAuthServerInfo){ switch(lastmatch) { case LEAF_radiusAuthServerAddress: getproc_got_ip_address(pktp, vbp, pradiusAuthServerInfo->radiusAuthServerAddress); break; case LEAF_radiusAuthClientServerPortNumber: getproc_got_int32(pktp, vbp, pradiusAuthServerInfo->radiusAuthClientServerPortNumber); break; case LEAF_radiusAuthClientRoundTripTime: getproc_got_uint32(pktp, vbp, pradiusAuthServerInfo->radiusAuthClientRoundTripTime, VT_TIMETICKS); break; case LEAF_radiusAuthClientAccessRequests: getproc_got_uint32(pktp, vbp, pradiusAuthServerInfo->radiusAuthClientAccessRequests, VT_COUNTER); break; case LEAF_radiusAuthClientAccessRetransmissions: getproc_got_uint32(pktp, vbp, pradiusAuthServerInfo->radiusAuthClientAccessRetransmissions, VT_COUNTER); break; case LEAF_radiusAuthClientAccessAccepts: getproc_got_uint32(pktp, vbp, pradiusAuthServerInfo->radiusAuthClientAccessAccepts, VT_COUNTER); break; case LEAF_radiusAuthClientAccessRejects: getproc_got_uint32(pktp, vbp, pradiusAuthServerInfo->radiusAuthClientAccessRejects, VT_COUNTER); break; case LEAF_radiusAuthClientAccessChallenges: getproc_got_uint32(pktp, vbp, pradiusAuthServerInfo->radiusAuthClientAccessChallenges, VT_COUNTER); break; case LEAF_radiusAuthClientMalformedAccessResponses: getproc_got_uint32(pktp, vbp, pradiusAuthServerInfo->radiusAuthClientMalformedAccessResponses, VT_COUNTER); break; case LEAF_radiusAuthClientBadAuthenticators: getproc_got_uint32(pktp, vbp, pradiusAuthServerInfo->radiusAuthClientBadAuthenticators, VT_COUNTER); break; case LEAF_radiusAuthClientPendingRequests: getproc_got_uint32(pktp, vbp, pradiusAuthServerInfo->radiusAuthClientPendingRequests, VT_GAUGE); break; case LEAF_radiusAuthClientTimeouts: getproc_got_uint32(pktp, vbp, pradiusAuthServerInfo->radiusAuthClientTimeouts, VT_COUNTER); break; case LEAF_radiusAuthClientUnknownTypes: getproc_got_uint32(pktp, vbp, pradiusAuthServerInfo->radiusAuthClientUnknownTypes, VT_COUNTER); break; case LEAF_radiusAuthClientPacketsDropped: getproc_got_uint32(pktp, vbp, pradiusAuthServerInfo->radiusAuthClientPacketsDropped, VT_COUNTER); break; default: return GEN_ERR; } return NO_ERROR;}/******************************************************************************* radiusAuthServerEntryGet** 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 radiusAuthServerEntryGet(OIDC_T lastmatch, int compc, OIDC_T *compl, SNMP_PKT_T *pktp, VB_T *vbp){ M2_RADIUS_AUTH_SERVER_INFO *pradiusAuthServerInfo = &radiusAuthServerInfo; 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 (radiusAuthServerEntry_lookup(compc, compl, pradiusAuthServerInfo) != 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 = radiusAuthServerEntryGetValue (vbp->vb_ml.ml_last_match, pktp, vbp, pradiusAuthServerInfo)) != NO_ERROR) { getproc_error(pktp, vbp, error); } } }}/******************************************************************************* radiusAuthServerEntryNext** 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 radiusAuthServerEntryNext (OIDC_T lastmatch, int compc, OIDC_T *compl, SNMP_PKT_T *pktp, VB_T *vbp){ M2_RADIUS_AUTH_SERVER_INFO* pradiusAuthServerInfo = &radiusAuthServerInfo; 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_AUTHENTICATION_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;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -