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

📄 ospf_configuration.c

📁 vxworks下ospf协议栈
💻 C
📖 第 1 页 / 共 2 页
字号:
/* ospf_configuration.c - OSPF configuration utilities *//* Copyright 1998 - 2003 Wind River Systems, Inc. *//*modification history--------------------02d,29may03,agi change add_entry_to_list() to ospf_add_entry_to_list()02c,27may03,ram SPR#83418 Removed code that was obsoleted as part of the fix but                not submitted20,20feb03,kc              Fixed SPR#86319 - modified ospf_set_default_values_for_areas()                            to rename inject_default_route_if_stub_area variable to                            inject_summary_lsa_into_stub_area. 02b,17feb03,ram			SPR 85432 Added supplemental changes to handle larger number of external routes 02a,09dec02,ram			SPR 83418 Added support for OSPF metric type and value configuration 19,3may01,jkw				Added printf messages for NULL pointers 18,26september00,reshma	Added WindRiver CopyRight 17,25september00,reshma	RFC-1587 implementation for OSPF NSSA Option, also tested against ANVL. 16,07july00,reshma			Unix compatibility related changes. 15,04april00,reshma		Added some MIB support (Read only).Passed all important ANVL OSPF tests. 14,23december99,reshma		Compatibility with VxWorks-IP and VxWorks RTM-interface 13,28december98,jack		Compiled and added some comments 12,02december98,jack		Changes to remove Vx warnings 11,13november98,jack		Changes related to introducing queuing in OSPF to RTM interface and bug							fix on the external route additions path (to RTM) 10,11november98,jack		Config changes, linted and big endian changes 09,30october98,jack		Incorporate changes for compilation on Vxworks 08,23august98,jack			ANVL tested OSPF with PATRICIA tree route table and no recursion 07,10august98,jack			PATRICIA Route Table Based OSPF Code Base 06,04june98,jack			Integration with RTM and BGP 05,24april98,jack			RTM changes 04,10july97,cindy			Pre-release v1.52b 03,02october97,cindy		Release Version 1.52 02,22october96,cindy		Release Version 1.50 01,05june96,cindy			First Beta Release*//*DESCRIPTIONospf_configuration.c is used for setting the values for the static configuration of OSPF.This file is used only at the startup of OSPF.*/#include "ospf.h"#include <netinet/in_var.h>/********************************************************************************************************************************/static enum BOOLEAN ospf_is_parameter_enabled (char *cptr_parameter_string);static enum BOOLEAN ospf_is_parameter_default (char *cptr_parameter_string);static void ospf_set_default_values_for_areas (void);static void ospf_set_default_values_for_ports (void);static ULONG ospf_convert_4bytes_to_ulong (BYTE byte_4, BYTE byte_3, BYTE byte_2, BYTE byte_1);static void ospf_configure_subnets_to_redistribute (char *cptr_value_string, LINK *sptr_head_link);/******************************************************************************* ospf_set_default_values - sets the default values for OSPF configuration** This routine will set the default values for the OSPF protocol.** <cptr_value_string> Configuration string from ospf_cfg.c** RETURNS: PASS or FAIL** ERRNO: N/A** NOMANUAL*/enum TEST ospf_set_default_values (char *cptr_value_string){	OSPF_PRINTF_PROLOGUE (OSPF_PROLOGUE_PRINTF, "OSPF: Entering ospf_set_default_values\r\n");	if (ospf_is_parameter_enabled (cptr_value_string) == TRUE)		{		ospf.ospf_export_route_queue_process_interval = 5; /* ten seconds */		/* SPR 85432 Supplemental -- Begin */		ospf.ospf_routes_dequeued_per_run = 150;		/* SPR 85432 Supplemental -- End */		ospf.ospf_maxaged_lsas_removed_per_tick = 50;		ospf.ospf_maxaged_lsas_removed_this_tick = 0;		ospf_set_default_values_for_areas ();		ospf_set_default_values_for_ports ();#if defined (__OSPF_DB_OVERFLOW_SUPPORT__)		ospf.ospf_external_lsdb_limit = OSPF_DEFAULT_EXTERNAL_LSDB_LIMIT;		ospf.ospf_exit_overflow_interval =  OSPF_DEFAULT_EXIT_OVERFLOW_TIMER;#endif /*__OSPF_DB_OVERFLOW_SUPPORT__*/		ospf.default_values_have_been_set = TRUE;		}	return (PASS);}/******************************************************************************* ospf_set_port_passive - sets the value for all ports to passive or non-passive** This routine will set the value for all the ports to passive or non-passive.** <cptr_value_string> Configuration string from ospf_cfg.c** RETURNS: PASS or FAIL** ERRNO: N/A** NOMANUAL*/enum TEST ospf_set_port_passive (char *cptr_value_string){	ULONG number_of_ports =0;	OSPF_PRINTF_PROLOGUE (OSPF_PROLOGUE_PRINTF, "OSPF: Entering ospf_set_port_passive\r\n");	if (ospf_is_parameter_default (cptr_value_string) == TRUE)		{		for (number_of_ports = 0x00000000L; number_of_ports < ospf.number_of_ports; ++number_of_ports)			{			if (ospf.port[number_of_ports].config.port_enabled == FALSE)				{				continue;				}			ospf.port[number_of_ports].config.passive = TRUE;			}		}	return (PASS);}/**************************************************************************************** ospf_set_bgp_subnets_to_redistribute - sets whether or not to redistibute bgp subnets** This routine sets whether or not to redistribute bgp subnets to OSPF.** <cptr_value_string>	Configuration string from ospf_cfg.c** RETURNS: PASS or FAIL** ERRNO: N/A** NOMANUAL*/enum TEST ospf_set_bgp_subnets_to_redistribute (char *cptr_value_string){	OSPF_PRINTF_PROLOGUE (OSPF_PROLOGUE_PRINTF, "OSPF: Entering ospf_set_bgp_subnets_to_redistribute\r\n");	ospf_configure_subnets_to_redistribute (cptr_value_string, (LINK *) &ospf.ospf_redistribution_configuration.ospf_imported_bgp_subnets);	return (PASS);}/**************************************************************************************** ospf_set_static_subnets_to_redistribute - sets whether or not to redistibute static subnets** This routine sets whether or not to redistribute static subnets to OSPF.** <cptr_value_string> Configuration string from ospf_cfg.c** RETURNS: PASS or FAIL** ERRNO: N/A** NOMANUAL*/enum TEST ospf_set_static_subnets_to_redistribute (char *cptr_value_string){	OSPF_PRINTF_PROLOGUE (OSPF_PROLOGUE_PRINTF, "OSPF: Entering ospf_set_static_subnets_to_redistribute\r\n");	ospf_configure_subnets_to_redistribute (cptr_value_string, (LINK *) &ospf.ospf_redistribution_configuration.ospf_imported_static_subnets);	return (PASS);}/**************************************************************************************** ospf_set_rip_subnets_to_redistribute - sets whether or not to redistibute rip subnets** This routine sets whether or not to redistribute rip subnets to OSPF.** <cptr_value_string> Configuration string from ospf_cfg.c** RETURNS: PASS or FAIL** ERRNO: N/A** NOMANUAL*/enum TEST ospf_set_rip_subnets_to_redistribute (char *cptr_value_string){	OSPF_PRINTF_PROLOGUE (OSPF_PROLOGUE_PRINTF, "OSPF: Entering ospf_set_rip_subnets_to_redistribute\r\n");	ospf_configure_subnets_to_redistribute (cptr_value_string, (LINK *) &ospf.ospf_redistribution_configuration.ospf_imported_rip_subnets);	return (PASS);}/**************************************************************************************** ospf_set_neighbor_as_not_allowed - sets the neighbor AS not be allowed** This routine sets the neighbor AS that is not allowed** <cptr_value_string> Configuration string from ospf_cfg.c** RETURNS: PASS or FAIL** ERRNO: N/A** NOMANUAL*/enum TEST ospf_set_neighbor_as_not_allowed (char *cptr_value_string){	ULONG temp1 =0;	ULONG index =0;	char *cptr_current_token;	OSPF_PRINTF_PROLOGUE (OSPF_PROLOGUE_PRINTF, "OSPF: Entering ospf_set_neighbor_as_not_allowed\r\n");	for ( cptr_current_token = strtok (cptr_value_string, "\t,;\n"); cptr_current_token != NULL;		cptr_current_token = strtok ((char *) '\0', ",\t\n;") )		{		temp1 = 0x0000;		sscanf (cptr_current_token,"%u", (int*) &temp1);		index = ospf.ospf_redistribution_configuration.number_of_do_not_allow_neighbors;		ospf.ospf_redistribution_configuration.do_not_allow_neighbor_as[index] = (USHORT) temp1;		++ospf.ospf_redistribution_configuration.number_of_do_not_allow_neighbors;		}	return (PASS);}/**************************************************************************************** ospf_set_origin_as_not_allowed - sets the origin AS not be allowed** This routine sets the origin AS that is not allowed** <cptr_value_string> Configuration string from ospf_cfg.c** RETURNS: PASS or FAIL** ERRNO: N/A** NOMANUAL*/enum TEST ospf_set_origin_as_not_allowed (char *cptr_value_string){	ULONG temp1 =0;	USHORT index =0;	char *cptr_current_token;	OSPF_PRINTF_PROLOGUE (OSPF_PROLOGUE_PRINTF, "OSPF: Entering ospf_set_origin_as_not_allowed\r\n");	for ( cptr_current_token = strtok (cptr_value_string, "\t,;\n"); cptr_current_token != NULL;		cptr_current_token = strtok ((char *) '\0', ",\t\n;") )		{		temp1 = 0x0000;		sscanf (cptr_current_token,"%u", (int*) &temp1);		index = ospf.ospf_redistribution_configuration.number_of_do_not_allow_origins;		ospf.ospf_redistribution_configuration.do_not_allow_origin_as[index] = (USHORT) temp1;		++ospf.ospf_redistribution_configuration.number_of_do_not_allow_origins;		}	return (PASS);}/**************************************************************************************** ospf_is_parameter_enabled - checks to see if paramter is enabled** This routine checks the string to see if the parameter is enabled** <cptr_value_string> Configuration string from ospf_cfg.c** RETURNS: TRUE or FALSE** ERRNO: N/A** NOMANUAL*/static enum BOOLEAN ospf_is_parameter_enabled (char *cptr_parameter_string){	OSPF_PRINTF_PROLOGUE (OSPF_PROLOGUE_PRINTF, "OSPF: Entering ospf_is_parameter_enabled\r\n");	if (strstr (ospf_strlwr (cptr_parameter_string), "enable") != NULL)		{		return (TRUE);		}	else		{		return (FALSE);		}}

⌨️ 快捷键说明

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