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

📄 radius_configure.c

📁 vxworks下radius协议栈 的源代码
💻 C
字号:
/* radius_configure.c *//* Implementations of RADIUS server configuration, to read parameters from a 	*//* string and write them to a RADIUS server object inside of a RADIUS_CLASS 	*//* global structure.															*//* Copyright 1984 - 2000 Wind River Systems, Inc. */#include "copyright_wrs.h"/*modification history____________________01b,19dec00,md  removed "RADIUS_AUTHENTICATION_AND_ACCOUNTING_SERVER" string01a,19dec00,md  merged from visual source safe*//************************************************************************//*	Copyright (C) 1993 - 1999 RouterWare, Inc.   								*//*	Unpublished - rights reserved under the Copyright Laws of the			*//*	United States.  Use, duplication, or disclosure by the 					*//*	Government is subject to restrictions as set forth in 					*//*	subparagraph (c)(1)(ii) of the Rights in Technical Data and 			*//*	Computer Software clause at 252.227-7013.										*//*	RouterWare, Inc., 3961 MacArthur Suite 212 Newport Beach, CA 92660	*//************************************************************************/#include <stddef.h>#include <string.h>#include <stdio.h>#include "radius.h"#include <vnvrmstr.h>#include "radius_configuration.h"/****************************************************************************/ULONG radius_get_configuration_table_address (void){	return ((ULONG) &radius_configuration_table);}/****************************************************************************/void radius_parse_server_configuration_string (char *cptr_string){	char *cptr_current_token;	ULONG tmp0;	ULONG tmp1;	ULONG tmp2;	ULONG tmp3;	UINT secret_length;		/* Comma or space separated; Expected order: IP Address, port, server type, max_retransmit_count, retransmission_interval, secret 	   e.g. 209.31.183.55, 1812, RADIUS_AUTHENTICATION_AND_ACCOUNTING_SERVER_TYPE, 5, 10 (in seconds) */		cptr_current_token = strtok (cptr_string, ", ");		if (cptr_current_token != NULL)		{		sscanf (cptr_current_token,"%03lu.%03lu.%03lu.%03lu", &tmp0, &tmp1, &tmp2, &tmp3);				radius.server_info[radius.number_of_servers_configured].ip_address = convert_4_bytes_to_ulong ((BYTE) tmp3, (BYTE) tmp2, (BYTE) tmp1, (BYTE) tmp0);		}	cptr_current_token = strtok ((char *) '\0', ",; ");		if (cptr_current_token != NULL)		{		radius.server_info[radius.number_of_servers_configured].port = (UINT) get_decimal_value (cptr_current_token);		}			cptr_current_token = strtok ((char *) '\0', ",; ");		if (cptr_current_token != NULL)		{		if (strstr (cptr_current_token, "RADIUS_AUTHENTICATION_SERVER") != NULL)			{			radius.server_info[radius.number_of_servers_configured].type = RADIUS_AUTHENTICATION_SERVER_TYPE;			}		else if (strstr (cptr_current_token, "RADIUS_ACCOUNTING_SERVER") != NULL)			{			radius.server_info[radius.number_of_servers_configured].type = RADIUS_ACCOUNTING_SERVER_TYPE;			}		else			{			radius_printf (RADIUS_ALARM_PRINTF,"RADIUS: radius_parse_server_configuration_string: Illegal server type\r\n");						return;			}		}			cptr_current_token = strtok ((char *) '\0', ",; ");		if (cptr_current_token != NULL)		{		radius.server_info[radius.number_of_servers_configured].max_retransmit_count = (UINT) get_decimal_value (cptr_current_token);		}	cptr_current_token = strtok ((char *) '\0', ",; ");		if (cptr_current_token != NULL)		{		radius.server_info[radius.number_of_servers_configured].retransmission_interval = (UINT) get_decimal_value (cptr_current_token);		}	cptr_current_token = strtok ((char *) '\0', ",; ");		if (cptr_current_token != NULL)		{		secret_length = strlen (cptr_current_token);				if (secret_length > RADIUS_MAX_SECRET_LENGTH)			{			radius_printf (RADIUS_ALARM_PRINTF,"RADIUS: radius_parse_server_configuration_string: Secret length exceeds maximum allowed; return FAIL\r\n");						secret_length = 0; /* this will result in configuration failure in radius_copy_configured_server_information() */						return;			}					memcpy (&radius.server_info[radius.number_of_servers_configured].secret[0], cptr_current_token, secret_length);		}	else		{		radius_printf (RADIUS_ALARM_PRINTF,"RADIUS: radius_parse_server_configuration_string: Insufficient number of fields\r\n");		}		++radius.number_of_servers_configured;	}

⌨️ 快捷键说明

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