⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 radius_auth_mib.c

📁 vxworks下radius协议栈 的源代码
💻 C
📖 第 1 页 / 共 2 页
字号:
      					for (i = 0; i < inst_len; i++)       			 			best_inst[i] = tmp_inst[i];						best_inst_len = inst_len;    					}					}				}			rw_container_next (server_iterator);			}	rw_container_free_iterator (server_iterator);	if (best)	{		found = true;		p_server = best;	}	else	{		found = false;	}	if (found == true)		{		p_server_stat = &(p_server->statistics);		pradiusAuthServerInfo->radiusAuthServerIndex = (UINT)p_server;		pradiusAuthServerInfo->radiusAuthServerAddress = htonl (p_server->ip_address);		pradiusAuthServerInfo->radiusAuthClientServerPortNumber = p_server->port;		auth_server_mib_stat_sync (pradiusAuthServerInfo, p_server_stat);		radiusAuthServerEntry_build_instance (pradiusAuthServerInfo, best_inst);	    /* we found a next so get the values and set the instance for all	     * the varbinds for this row of this table.	     * NOTE: if you allow holes in the table then this code will have to	     * change significantly to accomodate that.  */	    for ( ; vbp ; vbp = vbp->vb_link)	    	{			if ((error = radiusAuthServerEntryGetValue				(vbp->vb_ml.ml_last_match, pktp, vbp, pradiusAuthServerInfo)) == NO_ERROR)				{  				nextproc_next_instance(pktp, vbp, RADIUS_TBL_INDEX_LEN, best_inst);				}			else				{				nextproc_error(pktp, vbp, error);				}			}		}	else  /* there's no more in this table */		{	    for ( ; vbp ; vbp = vbp->vb_link )			{			nextproc_no_next(pktp, vbp);			}		}	semGive (g_sem_radius_mib);}/******************************************************************************** Method routines for the radiusAuthClient variables:********************************************************************************//******************************************************************************** radiusAuthServerEntryGetValue** An internal routine to retrieve the values of the variables, used* by the method routines radiusAuthClientGet and radiusAuthClientNext.* 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.* <pradiusAuthClientInfo>*			  	- the structure holding the info of RADIUS Client.*******************************************************************************/static int  radiusAuthClientGetValue (OIDC_T      lastmatch,                             SNMP_PKT_T *pktp,                             VB_T       *vbp,                             M2_RADIUS_AUTH_CLIENT_INFO *pradiusAuthClientInfo){	switch(lastmatch)		{		case LEAF_radiusAuthClientInvalidServerAddresses:			{			getproc_got_uint32(pktp, vbp,				radiusAuthClientInfo.radiusAuthClientInvalidServerAddresses, VT_COUNTER);			}	    break;	  	case LEAF_radiusAuthClientIdentifier:			{	    /* if the data being returned is in dynamic storage and needs	     * to be free'd, change the 0 argument to a 1. */		    getproc_got_string(pktp, vbp,		    	strlen (radiusAuthClientInfo.radiusAuthClientIdentifier),		    	radiusAuthClientInfo.radiusAuthClientIdentifier, 0, VT_STRING);			}	    break;		default:	    	return GEN_ERR;		}	return NO_ERROR;}/*******************************************************************************  radiusAuthClientGet**  Get method routine for for RADIUS Authentication client 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  radiusAuthClientGet(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);	/* check that the instance is exactly .0 */	if (!((compc == 1) && (*compl == 0)))		{		for ( ; vbp; vbp = vbp->vb_link)			{			getproc_nosuchins(pktp, vbp);			}		}	  /* grab the actual data for this variable.  this lookup routine will	   * probably have to be changed for your system.  for scalar variables	   * there might not even be any lookup routine. */	else		{/* retrieve all the values from the same data structure */	    for ( ; vbp; vbp = vbp->vb_link)	    	{	    	if ((error = radiusAuthClientGetValue	    		(vbp->vb_ml.ml_last_match, pktp, vbp, &radiusAuthClientInfo)) != NO_ERROR)				{				getproc_error(pktp, vbp, error);				}			}	    }}/*******************************************************************************  radiusAuthClientNext**  Next method routine for RADIUS Authentication Client 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  radiusAuthClientNext(OIDC_T      lastmatch,                        int         compc,                        OIDC_T     *compl,                        SNMP_PKT_T *pktp,                        VB_T       *vbp){	OIDC_T instance = 0;	/* the only time there's a next for a scalar is if we're given	 * no instance at all. */	if (compc != 0)		{	    nextproc_no_next(pktp, vbp);		}	  /* grab the data for these variables.  you'll probably have to change	   * this lookup routine for your system.  for scalar variables there	   * might not even be any lookup routine. */	else 		{	    /* find all the varbinds in this group and retrieve their	     * values from the same data structure */	    for (snmpdGroupByGetprocAndInstance (pktp, vbp, compc, compl);	        vbp; vbp = vbp->vb_link)	        {	        nextproc_next_instance(pktp, vbp, 1, &instance);			radiusAuthClientGetValue(vbp->vb_ml.ml_last_match, pktp, vbp,				&radiusAuthClientInfo);			}	    }}/********************************************************************************* Private functions.********************************************************************************/static int radiusAuthServerEntry_lookup(int compc, OIDC_T *compl, M2_RADIUS_AUTH_SERVER_INFO* pradiusAuthServerInfo){	RW_CONTAINER_ITERATOR server_iterator;	RADIUS_SERVER* p_server;	RADIUS_SERVER_STATISTICS *p_server_stat;	bool item_found = false;	if ((compc != RADIUS_TBL_INDEX_LEN) || (compl == NULL))		{		return (-1);		}	semTake (g_sem_radius_mib, WAIT_FOREVER);	server_iterator = rw_container_create_copy_of_iterator 		(radius.server_controller.iterator);	if (server_iterator != 0)		{		item_found = rw_container_find_by_content ((RW_CONTAINER_ITEM*)*compl, server_iterator);		if (item_found == true)			{			p_server = (RADIUS_SERVER*) rw_container_at (server_iterator); 	        if (p_server->type == RADIUS_AUTHENTICATION_SERVER_TYPE)				{				p_server_stat = &(p_server->statistics);								pradiusAuthServerInfo->radiusAuthServerIndex = (UINT)p_server;				pradiusAuthServerInfo->radiusAuthServerAddress = htonl (p_server->ip_address);				pradiusAuthServerInfo->radiusAuthClientServerPortNumber = p_server->port;				auth_server_mib_stat_sync (pradiusAuthServerInfo, p_server_stat);				}			else				{				item_found = false;				}			}		rw_container_free_iterator (server_iterator);		}	semGive (g_sem_radius_mib);	if (item_found == true)		{		return (0);		}	else		{		return (-1);		}}/*******************************************************************************/static unsigned radiusAuthServerEntry_build_instance (M2_RADIUS_AUTH_SERVER_INFO* data, OIDC_T* tmp_inst){	*tmp_inst = data->radiusAuthServerIndex;	return (0);} /*******************************************************************************/void auth_server_mib_stat_sync 	(M2_RADIUS_AUTH_SERVER_INFO* pradiusAuthServerInfo, RADIUS_SERVER_STATISTICS *pServerStat){	pradiusAuthServerInfo->radiusAuthClientRoundTripTime = pServerStat->authentication_round_trip_time;	pradiusAuthServerInfo->radiusAuthClientAccessRequests = pServerStat->authentication_access_requests_tx;	pradiusAuthServerInfo->radiusAuthClientAccessRetransmissions = pServerStat->authentication_access_requests_retransmit;	pradiusAuthServerInfo->radiusAuthClientAccessAccepts = pServerStat->authentication_access_accepts_rx;	pradiusAuthServerInfo->radiusAuthClientAccessRejects = pServerStat->authentication_access_rejects_rx;	pradiusAuthServerInfo->radiusAuthClientAccessChallenges = pServerStat->authentication_access_challenges_rx;	pradiusAuthServerInfo->radiusAuthClientMalformedAccessResponses = pServerStat->authentication_malformed_access_responses_rx;	pradiusAuthServerInfo->radiusAuthClientBadAuthenticators = pServerStat->authentication_bad_authenticators_rx;	pradiusAuthServerInfo->radiusAuthClientPendingRequests = pServerStat->authentication_pending_access_requests;	pradiusAuthServerInfo->radiusAuthClientTimeouts = pServerStat->authentication_timeouts;	pradiusAuthServerInfo->radiusAuthClientUnknownTypes = pServerStat->authentication_unknown_type_packets_rx;	pradiusAuthServerInfo->radiusAuthClientPacketsDropped = pServerStat->authentication_dropped_packets_rx;}/*******************************************************************************/#endif	/* __RADIUS_MIB__ */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -