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

📄 ospf_timer.c

📁 vxworks下ospf协议栈
💻 C
📖 第 1 页 / 共 4 页
字号:
                        {                        ospf_originate_new_instance_of_the_link_state_advertisement (sptr_database_entry, sptr_area, first_pass_external);                        }                    }                }            }        }    }/***************************************************************************************************//* section 14, (page 145) */#if defined (__OPAQUE_LSA__)static void ospf_age_the_type_11_link_state_database (OSPF_AREA_ENTRY *sptr_area, enum BOOLEAN first_pass_external){	OSPF_LS_DATABASE_HEAD *sptr_ls_database_head;	OSPF_LS_DATABASE_ENTRY *sptr_database_entry;	OSPF_LS_DATABASE_ENTRY *sptr_next_database_entry = NULL;	div_t div_result;	USHORT age;	enum TEST test_return_type;	ULONG index;	ULONG advertising_router;	/* Check for type 11 lsdb */	for (index = 0x00000000L, sptr_ls_database_head = &(ospf.type_11_database_hash_table[LS_TYPE_11_LSA][index]);	/* for each hash list */        index < OSPF_HASH_TABLE_SIZE; ++index, sptr_ls_database_head = &(ospf.type_11_database_hash_table[LS_TYPE_11_LSA][index]))		{		if (sptr_ls_database_head == NULL)			{			continue;			}		/* SPR#76812 */       	for (sptr_database_entry = sptr_ls_database_head->sptr_linear_database_entry;       		sptr_database_entry != NULL;       	    sptr_database_entry = sptr_next_database_entry)			{			sptr_next_database_entry = sptr_database_entry->sptr_forward_link;			age = sptr_database_entry->advertisement.sptr_router->ls_header.age;			age = net_to_host_short (age);			if (first_pass_external == TRUE)				{				if (age < OSPF_MAXIMUM_AGE)					{					++age;					sptr_database_entry->advertisement.sptr_router->ls_header.age = age;					sptr_database_entry->advertisement.sptr_router->ls_header.age =						host_to_net_short (sptr_database_entry->advertisement.sptr_router->ls_header.age);#if defined (__OSPF_MIB__)		            ospf2Mapi_request((void *)sptr_database_entry,						wrnOspfExtLsdbUpdateReqType);#endif /* __OSPF_MIB__ */					}				div_result = div ((int) age, (int) OSPF_CheckAge);				if (div_result.rem == (int) NULL)	/* advertisement's LS age is a multiple of OSPF_CheckAge, so verify the LS checksum */					{					age = sptr_database_entry->advertisement.sptr_router->ls_header.age;					sptr_database_entry->advertisement.sptr_router->ls_header.age = 0x0000;					test_return_type = ospf_verify_LS_checksum ((void *) sptr_database_entry->advertisement.sptr_router,					sptr_database_entry->advertisement.sptr_router->ls_header.length /* in network order */,						sptr_database_entry->advertisement.sptr_router->ls_header.checksum);					sptr_database_entry->advertisement.sptr_router->ls_header.age = age;					}				age = sptr_database_entry->advertisement.sptr_router->ls_header.age;				age = net_to_host_short (age);				test_return_type = ospf_check_if_advertisements_link_state_id_is_equal_to_one_of_the_routers_own_IP_interface_addresses (					sptr_database_entry->advertisement.sptr_router);				advertising_router = sptr_database_entry->advertisement.sptr_router->ls_header.advertising_router;				advertising_router = net_to_host_long (advertising_router);				if ((age == OSPF_MAXIMUM_AGE)  && (ospf.ospf_maxaged_lsas_removed_this_tick < ospf.ospf_maxaged_lsas_removed_per_tick ))					{					ospf.ospf_maxaged_lsas_removed_this_tick++;					if ( (sptr_database_entry->ls_database_freeme == FALSE) && ( (advertising_router == ospf.router_id) ||						((sptr_database_entry->advertisement.sptr_router->ls_header.type == OSPF_LS_NETWORK) && (test_return_type == PASS)) ) )						{						(void) ospf_flood_advertisement_out_some_subset_of_the_routers_interfaces (sptr_database_entry->advertisement.sptr_router,							sptr_area, NULL, NULL, TRUE);						sptr_database_entry->ls_database_freeme = TRUE;						ospf_clean_up_retransmit_lists_affiliated_with_this_advertisement (sptr_database_entry);						(void) ospf_free_database_entry (sptr_database_entry);						}		            else if ((sptr_database_entry->sptr_ls_database_retrans == NULL) &&						(ospf.number_of_neighbors_in_exchange_state == ospf.number_of_neighbors_in_full_state))						{						ospf_clean_up_retransmit_lists_affiliated_with_this_advertisement (sptr_database_entry);						(void) ospf_free_database_entry (sptr_database_entry);						}					}				else					{					/* section 12.4, item (1) - (page 114-115) */					/* Section of code from here moved up */					if (((advertising_router == ospf.router_id) ||						((sptr_database_entry->advertisement.sptr_router->ls_header.type == OSPF_LS_NETWORK) &&						(test_return_type == PASS))) && (age == OSPF_LSRefreshTime))  /* Refresh self originated advertisements */						{						ospf_originate_new_instance_of_the_link_state_advertisement (sptr_database_entry, sptr_area, first_pass_external);						}					}				}			}		}	return;}#endif /* __OPAQUE_LSA__ *//******************************************************************************** ospf_send_periodic_hello_packets - send periodic hello packet** This function sends the periodic hello packets.  See RFC 2328, section 9.5,* (page 71-73) for details.** RETURNS: N/A** NOMANUAL*/static void ospf_send_periodic_hello_packets    (    OSPF_INTERFACE *    sptr_interface  /* ospf interface to send packet */    )    {	OSPF_NEIGHBOR * sptr_neighbor = NULL;   /* next neighbor to examine */    OSPF_PRINTF_PROLOGUE (        OSPF_PROLOGUE_PRINTF,        "OSPF: Entering ospf_send_periodic_hello_packets\n");	/* section 9, (page 60-61) */    ++sptr_interface->periodic_hello_time_counter;	/* section 9.5.1, (page 73) */    if (sptr_interface->type == OSPF_NBMA)        {        for (sptr_neighbor = sptr_interface->sptr_neighbor;             sptr_neighbor != NULL;             sptr_neighbor = sptr_neighbor->sptr_forward_link)            {            if ((sptr_neighbor->state == OSPF_NEIGHBOR_DOWN) && (sptr_interface->periodic_hello_time_counter > sptr_interface->poll_interval))                {                ospf_send_hello (sptr_interface, sptr_neighbor, FALSE);                sptr_interface->periodic_hello_time_counter = 0x00000000L;                }            else if ((sptr_neighbor->state > OSPF_NEIGHBOR_DOWN) && (sptr_interface->periodic_hello_time_counter > sptr_interface->hello_interval))                {                ospf_send_hello (sptr_interface, sptr_neighbor, FALSE);                sptr_interface->periodic_hello_time_counter = 0x00000000L;                }            }        }    else	  /* section 9.5, (page 72) */        {        if ((sptr_interface->periodic_hello_time_counter >= sptr_interface->hello_interval) &&            (sptr_interface->state > OSPF_INTERFACE_IS_DOWN))            {            if (sptr_interface->sptr_neighbor == NULL)                {                ospf_send_hello (sptr_interface, NULL, FALSE);                sptr_interface->periodic_hello_time_counter = 0x00000001L;                /* SPR 85432 -- Begin */                sptr_interface->last_hello_time = ospf_get_system_elapsed_time_second ();                /* SPR 85432 -- End */                }            else                {                sptr_neighbor = sptr_interface->sptr_neighbor;                ospf_send_hello (sptr_interface, sptr_neighbor, FALSE);                sptr_interface->periodic_hello_time_counter = 0x00000001L;                /* SPR 85432 -- Begin */                sptr_interface->last_hello_time = ospf_get_system_elapsed_time_second ();                /* SPR 85432 -- End */                }            }        }    }/******************************************************************************** ospf_retransmit_database_and_ls_request_packets -***/static void ospf_retransmit_database_and_ls_request_packets    (    OSPF_INTERFACE *    sptr_interface    )    {	OSPF_NEIGHBOR *sptr_neighbor = NULL;	OSPF_NEIGHBOR *sptr_next_neighbor = NULL;	for (sptr_neighbor = sptr_interface->sptr_neighbor; sptr_neighbor != NULL; sptr_neighbor = sptr_next_neighbor)		{		sptr_next_neighbor = sptr_neighbor->sptr_forward_link;		if (sptr_neighbor->state < OSPF_NEIGHBOR_EXCHANGE_START)			{			continue;			}		if (sptr_neighbor->state == OSPF_NEIGHBOR_EXCHANGE_START)			{			ospf_send_an_empty_database_description_packet (sptr_interface, sptr_neighbor);			continue;			}		if ((sptr_neighbor->state == OSPF_NEIGHBOR_EXCHANGE) && (sptr_neighbor->mode == OSPF_MASTER) && (sptr_neighbor->sptr_database_summary != NULL))			{			ospf_send_database_summary (sptr_interface, sptr_neighbor);			}		if ((sptr_neighbor->state >= OSPF_NEIGHBOR_EXCHANGE) && (sptr_neighbor->ls_request_queue_count != 0x0000))			{			ospf_send_ls_request_packet (sptr_interface, sptr_neighbor);			}		}    }/******************************************************************************** ospf_retransmit_link_state_advertisements -**/static void ospf_retransmit_link_state_advertisements    (    OSPF_INTERFACE *    sptr_interface    )    {	OSPF_NEIGHBOR *sptr_neighbor = NULL;	OSPF_NEIGHBOR *sptr_next_neighbor = NULL;	for (sptr_neighbor = sptr_interface->sptr_neighbor; sptr_neighbor != NULL; sptr_neighbor = sptr_next_neighbor)		{		sptr_next_neighbor = sptr_neighbor->sptr_forward_link;		if ((sptr_neighbor->state >= OSPF_NEIGHBOR_EXCHANGE) && (sptr_neighbor->retransmit_queue_count != 0x0000))			{			ospf_send_ls_update (sptr_neighbor->sptr_retransmit, sptr_neighbor, sptr_interface, TRUE, TRUE);			}		}	return;}/****************************************************************************/static void ospf_send_link_state_advertisements_that_were_queued_up_during_MinLSInterval (OSPF_AREA_ENTRY *sptr_area){	OSPF_INTERFACE *sptr_interface = NULL;	OSPF_INTERFACE *sptr_next_interface = NULL;	ULONG current_time;	/* SPR 84312 -- Begin */	current_time = ospf_get_system_elapsed_time_second ();	/* SPR 84312 -- End */	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)			{			if ((sptr_interface->lock_time != 0x00000000L) && (current_time - sptr_interface->lock_time >= OSPF_MinLSInterval))				{				sptr_interface->lock_time = 0x00000000L;				if (sptr_interface->flags._bit.network_scheduled == TRUE)					{					sptr_interface->flags._bit.network_scheduled = FALSE;					sptr_interface->flags._bit.build_network = FALSE;					if (sptr_interface->state == OSPF_INTERFACE_DESIGNATED_ROUTER)						{						ospf_originate_network_links_advertisement (sptr_interface);						}					}				}			}		}	if ((sptr_area->lock_time != 0x00000000L) && (current_time - sptr_area->lock_time >= OSPF_MinLSInterval))		{		sptr_area->lock_time = 0x00000000L;		ospf_originate_router_links_advertisement (sptr_area);		}    }

⌨️ 快捷键说明

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