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

📄 ospf_timer.c

📁 vxworks下ospf协议栈
💻 C
📖 第 1 页 / 共 4 页
字号:
/* ospf_timer.c - OSPF timer *//* Copyright 2000-2003 Wind River Systems, Inc. */#include "copyright_wrs.h"/*modification history--------------------  03d,17jul03,agi     Fixed opaque lsa processing03c,04jul03,agi     Fixed compiler error03b,03jul03,ram     Backed out SPR#88600 workaround03a,24jun03,agi     Fixed ospfTimer crash02z,15may03,asr	    Changes to make OSPF virtual stack compatible02y,26may03,agi     Changed rwos_get_system_elapsed_time_second() to                    ospf_get_system_elapsed_time_second()                    Added code inspection changes02x,26may03,dsk     SPR 88600 fix for stuck in EXCHANGE_START (timer added                    to restart if stuck in exchange start state too long)02w,14may03,agi     Changed RWOS semaphores to vxWorks semaphores02v,15may03,ram     SPR#88410 Fix for external route refresh update02u,22apr03,ram	    SPR#76812 Modifications for OSPF performance enhancements02t,20mar03,mwv     SPR 87019 possible reference to NULL pointer02s,29jan03,mwv     SPR 85893 set the ls_database_pending_delete when max age02r,06jan03,ram	 	SPR 85432 Changes to allow more OSPF external route processing02q,03dec02,ram     SPR 84312 - Change elapsed time to return seconds02p,19nov02,mwv     Merge TMS code SPR 8428402o,08oct02,agi     Fixed compiler warnings02n,18sep02,agi     Removed ospf_flood_advertisement_out_some_subset_of_the_routers                    _ interfaces() calls from ospf_age_the_type_11_link_state_                    database()02m,10jul02,jkw		Fix UNH 5.3 test.02l,06jun02,kc      Remove the unneeded rw_container_create_iterator() and                    rw_container_free_iterator() from ospf_age_the_link_state_database()                    and ospf_age_the_type_11_link_state_database().02k,05jun02,kc      Do not reset ospf_external_lsa_count in ospf_router_timer()02j,22apr02,ark     Added in fixes for Virtual links02i,19apr02,jkw     Fix memory leak for external lsas.02h,16apr02,jkw     One copy of external and type 11 lsa02g,09apr09,jkw     Sequence number wrap.02f,11feb02,delia   Removed CSPF build from ospf_router_timer ISR. Added Release RWOS                    semaphore on forced exit from ISR02e,20dec01,jkw     Removed sptr_area->sptr_interfaces structure.02d,12nov,jkw       Virtual link hello fix.02c,18oct01,ak      Added support for database overflow API's.02b,13oct01,kc      Dynamic configuration changes.02a,13oct01,br      Hello timer fix. SPR 7092001z,14aug01,kc      ospf_router_timer(): release rwos_ospf_mutex semaphore if error.01y,26jun01,jkw     Move global variables to ospf_globals.h for cleanup01x,19jun01,aos     Calling to ospf_clean_up_retransmit_lists_affiliated_with_this_                    advertisement () function before freeing the LS database entry.01w,21may01,jkw     Add updates for point to point01v,26sep00,reshma  Added WindRiver CopyRight01u,25sep00,reshma  RFC-1587 implementation for OSPF NSSA Option, also tested against                    ANVL.01t,07jul00,reshma  Unix compatibility related changes.01s,04apr00,reshma  Added some MIB support (Read only). Passed all important ANVL OSPF                    tests.01r,23dec99,reshma  Compatibility with VxWorks-IP and VxWorks RTM-interface01q,13aug99,jack    ifdefed lsl control calls01p,28may99,jack    Fixes in PPP related stuff01o,28dec98,jack    Compiled and added some comments01n,13nov98,jack    Changes related to introducing queuing in OSPF to RTM interface and                    bug fix on the external route additions path (to RTM)01m,11nov98,jack    Config changes, linted and big endian changes01l,30oct98,jack    Incorporate changes for compilation on Vxworks01k,23aug98,jack    ANVL tested OSPF with PATRICIA tree route table and no recursion01j,10aug98,jack    PATRICIA Route Table Based OSPF Code Base01i,06aug98,jack    In function, ospf_age_the_link_state_database, added the condition                    (sptr_database_entry->ls_database_freeme == FALSE) to check before                    calling ospf_flood_advertisement_out_some_subset_of_the_routers_                    interfaces and set sptr_database_entry->ls_database_freeme = TRUE01h,16jun98,jack    Corrected syntax error01g,16jun98,jack    Changes related to external_routes queuing and the queue processing01f,04jun98,jack    Integration with RTM and BGP01e,24apr98,jack    RTM changes01d,10jul97,cindy   Pre-release v1.52b01c,02oct97,cindy   Release Version 1.5201b,22oct96,cindy   Release Version 1.5001a,05jun96,cindy   First Beta Release*//*DESCRIPTIONospf_timer.c is used for sending OSPF packets, calculating the routing table,exporting routes, and aging the link state database on a periodic basis.This file is used every second as a timer.*/#include "ospf.h"#if defined (__OSPF_VIRTUAL_STACK__)#include "ospf_vs_lib.h"#endif /* __OSPF_VIRTUAL_STACK__ *//****************************************************************************/static void ospf_age_the_link_state_database (OSPF_AREA_ENTRY *sptr_area);static void ospf_age_the_external_link_state_database (OSPF_AREA_ENTRY *sptr_area, enum BOOLEAN first_pass_external);#if defined (__OPAQUE_LSA__)static void ospf_age_the_type_11_link_state_database (OSPF_AREA_ENTRY *sptr_area, enum BOOLEAN first_pass_external);#endif /* __OPAQUE_LSA__ */static void ospf_send_periodic_hello_packets (OSPF_INTERFACE *sptr_interface);static void ospf_retransmit_database_and_ls_request_packets (OSPF_INTERFACE *sptr_interface);static void ospf_retransmit_link_state_advertisements (OSPF_INTERFACE *sptr_interface);static void ospf_send_link_state_advertisements_that_were_queued_up_during_MinLSInterval (OSPF_AREA_ENTRY *sptr_area);IMPORT bool ospf_mib_initialize( void );/******************************************************************************** ospf_hello_timer - OSPF hello timer** This function executes the OSPF hello timer.  It ets called every* <hello_interval> seconds.** RETURNS: N/A*//* SPR 85432 -- Begin */void ospf_hello_timer ()    {    OSPF_AREA_ENTRY *sptr_area = NULL;    OSPF_INTERFACE *sptr_interface = NULL;    OSPF_PRINTF_PROLOGUE (        OSPF_PROLOGUE_PRINTF, "OSPF: Entering ospf_hello_timer\r\n");    /* asr: set virtual stack context to ensure all calls from the hello     * timer task use the correct stack context     */#if defined (VIRTUAL_STACK)    virtualStackNumTaskIdSet (ospf.ospf_vsid);#endif /* VIRTUAL_STACK */    if (semTake (ospf_config_mutex, WAIT_FOREVER) == ERROR)        {        return;        }    for (sptr_area = ospf.sptr_area_list;         sptr_area != NULL;         sptr_area = sptr_area->sptr_forward_link)        {        for (sptr_interface = sptr_area->sptr_interfaces;             sptr_interface != NULL;             sptr_interface = sptr_interface->sptr_forward_link)            {            if ((sptr_interface->area_id == sptr_area->area_id) ||               ((sptr_interface->type == OSPF_VIRTUAL_LINK) &&               (sptr_interface->area_id == OSPF_BACKBONE) &&               (sptr_area->area_id == OSPF_STARTING_AREA_ID_FOR_VIRTUAL_INTERFACE)))                {                ospf_send_periodic_hello_packets (sptr_interface);                }            }        }    ospf.hello_1_second_counter = 0x00000000L;    semGive (ospf_config_mutex);    }/* SPR 85432 -- End *//********************************************************************************* ospf_router_timer - OSPF router timer** This function gets called every tick.*/void ospf_router_timer ()    {    OSPF_AREA_ENTRY *sptr_area = NULL;    OSPF_AREA_ENTRY *sptr_next_area = NULL;    OSPF_INTERFACE *sptr_interface = NULL;    OSPF_INTERFACE *sptr_next_interface = NULL;    OSPF_NEIGHBOR *sptr_neighbor;    OSPF_NEIGHBOR *sptr_next_neighbor;    enum OSPF_NEIGHBOR_STATE neighbors_old_state;    enum OSPF_ACKNOWLEDGEMENT_RETURN_TYPE return_type;    ULONG ip_address;    enum BOOLEAN first_pass_external = TRUE;    OSPF_PRINTF_PROLOGUE (        OSPF_PROLOGUE_PRINTF, "OSPF: Entering ospf_router_timer\r\n");    /* asr: set virtual stack context to ensure all calls from the     * timer task use the correct stack context     */#if defined (VIRTUAL_STACK)    virtualStackNumTaskIdSet (ospf.ospf_vsid);#endif /* VIRTUAL_STACK */    /* take the ospf global semaphore to access ospf datastructures */    if (semTake (ospf_global_mutex, WAIT_FOREVER) == ERROR)        {        return;        }    if (ospf.timer_enabled == FALSE)		{        semGive (ospf_global_mutex);		return;		}	ospf.ospf_maxaged_lsas_removed_this_tick = 0x0;	sptr_neighbor = NULL;#if defined (__OSPF_DB_OVERFLOW_SUPPORT__)	if ((ospf.in_overflow_state == TRUE) && (ospf.ospf_exit_overflow_interval !=0))	    {		if(ospf.force_out_of_overflow_state == TRUE)		    {			ospf.force_out_of_overflow_state = FALSE;			ospf_db_overflow_timer = ospf.ospf_exit_overflow_interval;			ospf.in_overflow_state = FALSE;			OSPF_PRINTF_DB_OVERFLOW (OSPF_DB_OVERFLOW_PRINTF, "OSPF: The Router has been forced out of Overflow State\n");            semGive (ospf_global_mutex); /* release semaphore taken by this ISR before leaving ISR */			return;		    }		if(ospf.reset_ospf_exit_overflow_interval == TRUE)		    {			--ospf_db_overflow_timer;			OSPF_PRINTF_DB_OVERFLOW (OSPF_DB_OVERFLOW_PRINTF, "OSPF: The Exit Overflow Timer will be reset in %ld seconds\n",ospf_db_overflow_timer);			if(ospf_db_overflow_timer == 0)			    {				ospf_db_overflow_timer = ospf.ospf_exit_overflow_interval;				ospf.in_overflow_state = FALSE;				ospf.reset_ospf_exit_overflow_interval = FALSE;				OSPF_PRINTF_DB_OVERFLOW (OSPF_DB_OVERFLOW_PRINTF, "OSPF: The Exit Overflow Timer has been reset and out of Overflow State\n");			    }		    }		else		    {			--ospf_db_overflow_timer;			OSPF_PRINTF_DB_OVERFLOW (OSPF_DB_OVERFLOW_PRINTF, "OSPF: The Exit Overflow Timer will be reset in %ld seconds\n",ospf_db_overflow_timer);			if(ospf_db_overflow_timer == 0)			    {				ospf_db_overflow_timer = ospf.ospf_exit_overflow_interval;				ospf.in_overflow_state = FALSE;				OSPF_PRINTF_DB_OVERFLOW (OSPF_DB_OVERFLOW_PRINTF, "OSPF: The Exit Overflow Timer has been reset and out of Overflow State\n");			    }		    }	    }	if ((ospf.in_overflow_state == TRUE) && (ospf.ospf_exit_overflow_interval == 0))        {		if (ospf.force_out_of_overflow_state == TRUE)		    {			ospf.force_out_of_overflow_state = FALSE;			ospf.in_overflow_state = FALSE;			OSPF_PRINTF_DB_OVERFLOW (OSPF_DB_OVERFLOW_PRINTF, "OSPF: The Router has been forced out of Overflow State\n");            }        }#endif /*__OSPF_DB_OVERFLOW_SUPPORT__*/    ospf.ospf_queue_interval_counter++;    for (sptr_area = ospf.sptr_area_list;         sptr_area != NULL;         sptr_area = sptr_next_area)        {        sptr_next_area = sptr_area->sptr_forward_link;        ++sptr_area->periodic_MinLSInterval_time_counter;#if !defined (__OSPF_VIRTUAL_LINK__)        if ((sptr_area->MinLSInterval_timer_enabled == TRUE) &&            (sptr_area->periodic_MinLSInterval_time_counter > OSPF_MinLSInterval))            {            ospf_send_link_state_advertisements_that_were_queued_up_during_MinLSInterval (sptr_area);            sptr_area->periodic_MinLSInterval_time_counter = 0x00000000L;            }#else /*__OSPF_VIRTUAL_LINK__*/        if ((sptr_area->periodic_MinLSInterval_time_counter > OSPF_MinLSInterval))            {            ospf_send_link_state_advertisements_that_were_queued_up_during_MinLSInterval (sptr_area);            sptr_area->periodic_MinLSInterval_time_counter = 0x00000000L;            }#endif  /* __OSPF_VIRTUAL_LINK__ */        ospf_age_the_link_state_database (sptr_area);								/* section 14, (page 145) */        ospf_age_the_external_link_state_database (sptr_area, first_pass_external);						/* section 14, (page 145) */#if defined (__OPAQUE_LSA__)        ospf_age_the_type_11_link_state_database (sptr_area, first_pass_external);								/* section 14, (page 145) */#endif /* __OPAQUE_LSA__ */        first_pass_external = FALSE;        for (sptr_interface = sptr_area->sptr_interfaces;             sptr_interface != NULL;             sptr_interface = sptr_next_interface)            {            sptr_next_interface = sptr_interface->sptr_forward_link;            if ((sptr_interface->area_id == sptr_area->area_id) ||

⌨️ 快捷键说明

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