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

📄 ospf_initialization.c

📁 vxworks下ospf协议栈
💻 C
📖 第 1 页 / 共 5 页
字号:
                    break;                        }                }            }        if (sptr_interface->type == OSPF_VIRTUAL_LINK)            {            for (sptr_area = ospf.sptr_area_list; sptr_area != NULL; sptr_area = sptr_next_area)                                {                sptr_next_area = sptr_area->sptr_forward_link;                if (ospf.port[number_of_ports].config.transit_area_id == sptr_area->area_id)                                        {                    sptr_interface->sptr_transit_area = sptr_area;                    break;                    }                }            }        else            {            sptr_interface->sptr_transit_area = NULL;            }                return;}/*************************************************************************** ospf_configure_neighbor_for_interface - creates neighbors for interfaces** This routine creates neighbors for interfaces.** <sptr_interface> OSPF interface** <number_of_ports> Number of OSPF interfaces** RETURNS: N/A** ERRNO: N/A** NOMANUAL*/static void ospf_configure_neighbor_for_interface (OSPF_INTERFACE *sptr_interface, ULONG number_of_ports){        OSPF_NEIGHBOR *sptr_new_neighbor;        UNION_OSPF_OPTIONS new_neighbor_options;        BOOL dynamic_created = FALSE;        OSPF_PRINTF_PROLOGUE (OSPF_PROLOGUE_PRINTF, "OSPF: Entering ospf_configure_neighbor_for_interface\r\n");        sptr_interface->virtual_neighbor_rid = ospf.port[number_of_ports].config.virtual_neighbor_rid;        ospf_add_entry_to_virtual_link_list (sptr_interface, dynamic_created);        sptr_new_neighbor = (OSPF_NEIGHBOR *) table_malloc (1, sizeof (OSPF_NEIGHBOR));        if (sptr_new_neighbor == NULL)                {                ospf_print_memory_error_message_and_free_buffer_if_necessary ((void *) NULL, "OSPF_NEIGHBOR");                }        else                {                memset (sptr_new_neighbor, 0x00, sizeof (OSPF_NEIGHBOR));                new_neighbor_options._byte = 0x00;                ospf_set_neighbor_fields (sptr_new_neighbor, sptr_interface->virtual_neighbor_rid, sptr_interface->virtual_neighbor_rid, 0x00000000L,                        sptr_interface, 0x0000, new_neighbor_options._byte, OSPF_NEIGHBOR_DOWN);                ospf_add_neighbor (sptr_interface, sptr_new_neighbor);                }        return;}/*************************************************************************** ospf_initialize_global_parameters - initializes global parameters** This routine creates initializes all the global members in the OSPF class.** <clock_ticks_per_second> Clock ticks per second** RETURNS: N/A** ERRNO: N/A** NOMANUAL*/static void ospf_initialize_global_parameters     (    ULONG   clock_ticks_per_second    )    {    OSPF_LS_DATABASE_HEAD * sptr_ls_database_head;    enum OSPF_ROUTE_TABLE_TYPE table_type;    ULONG index;#if defined (__OSPF_MIB__)    bool  mutexAcquired;#endif /* __OSPF_MIB__ */        OSPF_PRINTF_PROLOGUE (        OSPF_PROLOGUE_PRINTF,         "OSPF: Entering ospf_initialize_global_parameters\r\n");    ospf.number_of_neighbors = 0x00000000L;    ospf.number_of_neighbors_in_init_state = 0x00000000L;    ospf.number_of_neighbors_in_exchange_state = 0x00000000L;    ospf.number_of_neighbors_in_full_state = 0x00000000L;    ospf.sptr_ospf_export_route_queue = NULL;    ospf.ospf_queue_interval_counter = 0x00000000L;    ospf.sptr_external_route_queue = ospf_list_create (NULL);    /* SPR#76812 -- Begin */    for (table_type = OSPF_ROUTE_TABLE_NETWORK;          table_type < OSPF_ROUTE_TABLE_MAX;          table_type++)        {        for (index = 0x00000000L; index < OSPF_RT_HASH_TABLE_SIZE; index++)            {            ospf.sptr_routing_table_head[table_type][index] = NULL;            ospf.sptr_old_routing_table[table_type][index] = NULL;            }        }    /* SPR#76812 -- End */        ospf.build_routing_table = FALSE;    ospf.routing_table_build_time_counter = 0x00000000L;    ospf.clock_ticks_per_second = clock_ticks_per_second;    ospf.ospfGeneralGroupEntry.ospfVersionNumber = OSPF_VERSION;    ospf.ospfGeneralGroupEntry.ospfAreaBdrRtrStatus = (BYTE) ospf_check_if_area_border_router ();    ospf.ospfGeneralGroupEntry.ospfExternLsaCount = 0x00000000L;    ospf.ospfGeneralGroupEntry.ospfExternLsaCksumSum = 0x00000000L;    ospf.ospfGeneralGroupEntry.ospfOriginateNewLsas = 0x00000000L;    ospf.ospfGeneralGroupEntry.ospfRxNewLsas = 0x00000000L;    ospf.ospf_multicast_extensions = 0x00000000L;    ospf.ospf_demand_extensions = FALSE;    /* SPR 85432 -- Begin */    ospf.sptr_external_lsdb_print_queue = ospf_list_create (NULL);    ospf.sptr_table_route_print_queue = ospf_list_create (NULL);    ospf.sptr_lsdb_print_queue = ospf_list_create (NULL);    /* SPR 85432 -- End */    ten_seconds_counter = 0;    /* SPR#76812 -- Begin */    for (index = 0x00000000L, sptr_ls_database_head = &(ospf.external_database_hash_table[LS_EXTERNAL_LSA][index]); /* for each hash list */         index < OSPF_HASH_TABLE_SIZE;          ++index, sptr_ls_database_head = &(ospf.external_database_hash_table[LS_EXTERNAL_LSA][index]))        {        sptr_ls_database_head->sptr_linear_database_entry = NULL;        sptr_ls_database_head->sptr_avl_database_entry = NULL;        }#if defined (__OPAQUE_LSA__)    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]))        {        sptr_ls_database_head->sptr_linear_database_entry = NULL;        sptr_ls_database_head->sptr_avl_database_entry = NULL;        }#endif /* #if defined (__OPAQUE_LSA__) */    /* SPR#76812 -- End */#if defined (__OSPF_DB_OVERFLOW_SUPPORT__)    ospf_db_overflow_timer = ospf.ospf_exit_overflow_interval;    ospf.in_overflow_state = FALSE;    ospf.force_out_of_overflow_state = FALSE;    ospf.reset_ospf_exit_overflow_interval = FALSE;    ospf.ospf_external_lsa_count =0;    if (ospf.ospf_external_lsdb_limit != -1)        {        OSPF_PRINTF_DB_OVERFLOW (OSPF_DB_OVERFLOW_PRINTF, "OSPF: The External LSDB limit is set to %ld\n",ospf.ospf_external_lsdb_limit);        }    else        {        OSPF_PRINTF_DB_OVERFLOW (OSPF_DB_OVERFLOW_PRINTF, "OSPF: The External LSDB limit is set to %ld and hence there is no LSDB limit\n",ospf.ospf_external_lsdb_limit);        }    if (ospf.ospf_exit_overflow_interval != 0)        {        OSPF_PRINTF_DB_OVERFLOW (OSPF_DB_OVERFLOW_PRINTF, "OSPF: The Exit Overflow Interval is set to %ld\n",ospf.ospf_exit_overflow_interval);        }    else        {        OSPF_PRINTF_DB_OVERFLOW (OSPF_DB_OVERFLOW_PRINTF, "OSPF: The Exit Overflow Interval is set to %ld and hence we do not exit Overflow State\n",ospf.ospf_exit_overflow_interval);        }#endif/*__OSPF_DB_OVERFLOW_SUPPORT__*/#if defined (__OSPF_MIB__)    if ( readStaticConfig == TRUE )        {        /* update the general group read-write variables */        mutexAcquired = semTake (ospf_global_mutex , WAIT_FOREVER);        ospf2Mapi_request( (void *)&ospf, ospfGenGroupCreateReqType );        semGive (ospf_global_mutex );        }#endif /* __OSPF_MIB__ */    }/*************************************************************************** ospf_initialize_interfaces - initializes all configured interfaces** This routine calls the function to initialize all the interfaces** RETURNS: N/A** ERRNO: N/A** NOMANUAL*/static void ospf_initialize_interfaces (void){        OSPF_INTERFACE *sptr_interface = NULL;        OSPF_INTERFACE *sptr_next_interface = NULL;                BOOL dynamic = FALSE;        OSPF_PRINTF_PROLOGUE (OSPF_PROLOGUE_PRINTF, "OSPF: Entering ospf_initialize_interfaces\r\n");                for (sptr_interface = ospf.sptr_interface_list; sptr_interface != NULL; sptr_interface = sptr_next_interface)                        {            sptr_next_interface = sptr_interface->sptr_forward_link;            ospf_initialize_interface (sptr_interface, dynamic);                        }        return;}/*************************************************************************** ospf_create_pseudo_area_for_virtual_link - creates area for virtual link** This routine creates an area for the virtual link since there is not an* associated area with the configured virtual link.** <sptr_interface> OSPF interface** RETURNS: OSPF_AREA_ENTRY * or NULL** ERRNO: N/A** NOMANUAL*/OSPF_AREA_ENTRY* ospf_create_pseudo_area_for_virtual_link (OSPF_INTERFACE *sptr_interface)    {    OSPF_AREA_ENTRY *sptr_area = NULL;    OSPF_AREA_ENTRY *sptr_area_already_configured = NULL;    OSPF_AREA_ENTRY *sptr_next_area_already_configured = NULL;    ULONG area_id;    ULONG index;    enum OSPF_LS_TYPE ls_type;    OSPF_LS_DATABASE_HEAD *sptr_ls_database_head;    ULONG number_of_address_ranges = 0;    OSPF_PRINTF_PROLOGUE (OSPF_PROLOGUE_PRINTF, "OSPF: Entering ospf_create_pseudo_area_for_virtual_link\r\n");    area_id = OSPF_STARTING_AREA_ID_FOR_VIRTUAL_INTERFACE;    sptr_area = (OSPF_AREA_ENTRY *) table_malloc (1, sizeof (OSPF_AREA_ENTRY));    if (sptr_area != NULL)        {        memset (sptr_area, 0x00, sizeof (OSPF_AREA_ENTRY));        for (sptr_area_already_configured = ospf.sptr_area_list;              sptr_area_already_configured != NULL;             sptr_area_already_configured = sptr_next_area_already_configured)            {            sptr_next_area_already_configured = sptr_area_already_configured->sptr_forward_link;                            if ((area_id == sptr_area_already_configured->area_id) || (area_id == ospf.sptr_area_list->area_id) )                {                --area_id;                sptr_area_already_configured = ospf.sptr_area_list;                continue;                }            } /* comeup with a unique area ID */            sptr_area->area_id = area_id;        ospf_set_address_ranges_for_the_area (sptr_area, number_of_address_ranges);        sptr_area->shortest_path_first_tree.vertex = ospf.router_id;        sptr_area->shortest_path_first_tree.vertex_type = OSPF_LS_ROUTER;            sptr_area->shortest_path_first_tree.intervening_router = 0x00000000L;        sptr_area->run_shortest_path_calculation = FALSE;        sptr_area->shortest_path_calculation_time_counter = 0x00000000L;        sptr_area->bring_up_virtual_links = FALSE;#if !defined (__NSSA__)        for (ls_type = OSPF_LS_ROUTER; ls_type <= OSPF_LS_AS_EXTERNAL; ++ls_type)                                                       /* for each type of advertisement */#else        for (ls_type = OSPF_LS_ROUTER; ls_type <= OSPF_LS_TYPE_7; ++ls_type)                                                    /* for each type of advertisement */    #endif /*__NSSA__*/                {    #if defined (__NSSA__)            if (ls_type == OSPF_LS_MULTICAST )                {                continue;                }    #endif /*__NSSA__*/                for (index = 0x00000000L, sptr_ls_database_head = &(sptr_area->ls_database_hash_table[ls_type][index]); /* for each hash list */                 index < OSPF_HASH_TABLE_SIZE;                  ++index, sptr_ls_database_head = &(sptr_area->ls_database_hash_table[ls_type][index]))                 {

⌨️ 快捷键说明

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