📄 ospf_entry_initialize.c
字号:
/* ospf_entry_initialize.c - Entry point for OSPF *//* Copyright 2001-2003 Wind River Systems, Inc. */#include "copyright_wrs.h"/*modification history--------------------02d,29may03,agi changed CONFIGURATION_TABLE to OSPF_CONFIGURATION_TABLE as part of RWOS removal02d,22may03,asr Changes to make OSPF virtual stack compatible02c,14may03,agi Changed RWOS semaphores to vxWorks semaphores02b,22apr03,ram SPR#76812 Modifications for OSPF performance enhancements02a,28jan03,ram SPR 85050 Added new ospf mutex for extenal route queue access01e,19nov02,mwv Merge TMS code SPR 8428401d,21mar02,kc Fixed ospf_task_initialize() to use rw_memory_free() for freeing allocated memory if error occurs.01c,13oct01,kc Dynamic configuration changes.01b,26jun01,jkw Move global variables to ospf_globals.h for cleanup01a,03may01,jkw Added checks for NULL pointers and alarm messages*//*DESCRIPTIONospf_entry_initialize.c is used for creating a new task for OSPF. This filereads in the static configuration file and calls the next function to initialize the router.This file is used only at the startup of OSPF.*/#include "ospf.h"#if defined (__OSPF_VIRTUAL_STACK__)#include "ospf_vs_lib.h"#endif /* __OSPF_VIRTUAL_STACK__ */IMPORT enum TEST ospf_initialize_nvram( char *cptr_file_name, ULONG location_of_ini_file, char *cptr_section_name, void *vptr_location_of_configuration_table);#if !defined (__OSPF_VIRTUAL_STACK__)/*extern OSPF_CONFIGURATION_TABLE ospf_configuration_table;*/#include "ospf_configuration.h" #endif /* __OSPF_VIRTUAL_STACK__ *//**************************************************************************************** ospf_task_initialize - dynamically export external routes from ospf** This routine initializes the ospf task by initializing the configuration* parameters, initializing the mib, and initializing the router.** <p_configuration_file> Configuration file string** RETURNS: OK or ERROR** ERRNO: N/A** NOMANUAL*/STATUS ospf_task_initialize ( const char * p_configuration_file ) { char * p_ospf_data; /* pointer to OSPF data */ OSPF_PRINTF_PROLOGUE (OSPF_PROLOGUE_PRINTF, "OSPF: Entering ospf_task_initialize\r\n"); /* asr: set virtual stack context before initializing OSPF */ #if defined (VIRTUAL_STACK) virtualStackNumTaskIdSet (ospf.ospf_vsid); #endif /* VIRTUAL_STACK */ p_ospf_data = (char *) table_malloc (1, OSPF_MAXIMUM_FILE_SIZE); if (p_ospf_data == NULL) { ospf_print_memory_error_message_and_free_buffer_if_necessary ( (void *) NULL, "OSPF_MAXIMUM_FILE_SIZE"); return( ERROR ); } /* explicitly zero out the buffer ( TMS # 1569)*/ memset (p_ospf_data, 0, OSPF_MAXIMUM_FILE_SIZE); memcpy (p_ospf_data, p_configuration_file, OSPF_MAXIMUM_FILE_SIZE);#if defined (__OSPF_VIRTUAL_STACK__) ospfConfigurationTableInit(&ospf_configuration_table);#endif /* __OSPF_VIRTUAL_STACK__ */ if (ospf_initialize_nvram (NULL, (ULONG) p_ospf_data,"OSPF Routing" , (void*) &ospf_configuration_table) == FAIL) { /* free the allocated buffer */ table_free ((void *) p_ospf_data); return ERROR; } if (ospf_initialize_router (1) == FAIL) { /* free the allocated buffer */ table_free ((void *) p_ospf_data); return ERROR; } /* free the allocated buffer */ table_free ((void *) p_ospf_data); return OK; }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -