📄 ospf_vs_lib.c
字号:
return (ERROR); } /* Free the structure. */ table_free(ospfVsTbl[ospfVsIndex]); /* Let's be extra paranoid. */ ospfVsTbl[ospfVsIndex] = NULL; semGive(ospfVsTblLock); return (OK); }/********************************************************************************* ospfVirtualStackIdGet - return the OSPF_VSID named in pName** This routine returns a OSPF_VSID in the pointer passed to it in pVSID if a stack* with pName is found in the Virtual Stack Table.** RETURNS: OK or ERROR if the stack named in pName was not found**/STATUS ospfVirtualStackIdGet ( char* pName, /* Name that was used in ospfVirtualStackCreate */ OSPF_VSID* pVSID ) { int ospfVsIndex; semTake(ospfVsTblLock, WAIT_FOREVER); for (ospfVsIndex = 0; ospfVsIndex < OSPF_VSID_MAX; ospfVsIndex++) if (!strncmp (ospfVsTbl[ospfVsIndex]->pName, pName, min (strlen (pName), OSPF_VS_NAME_MAX))) break; /* Hey, we found it! */ /* Check that we did find it. */ if (ospfVsIndex == OSPF_VSID_MAX) { semGive(ospfVsTblLock); return (ERROR); } *pVSID = ospfVsTbl[ospfVsIndex]; semGive(ospfVsTblLock); return (OK); }/********************************************************************************* ospfVirtualStackInfo - print out some information about an Ospf Virtual Stack** This routine takes the OSPF_VSID in ospf_vsid and prints some information on* the console about it.** RETURNS: OK or ERROR if the OSPF_VSID was somehow invalid**/void ospfVirtualStackInfo ( OSPF_VSID ospf_vsid ) { int ospfVsIndex; if (ospf_vsid == NULL) return; semTake(ospfVsTblLock, WAIT_FOREVER); for (ospfVsIndex = 0; ospfVsIndex < OSPF_VSID_MAX; ospfVsIndex++) if (ospfVsTbl[ospfVsIndex] == ospf_vsid) break; /* Hey, we found it! */ /* Check that we did find it. */ if (ospfVsIndex == OSPF_VSID_MAX) { semGive(ospfVsTblLock); return; } printf ("Index: %d \tName: %s\n", ospfVsIndex, ospfVsTbl[ospfVsIndex]->pName); semGive(ospfVsTblLock); }/******************************************************************************** ospfVirtualStackShow - print out the list of Ospf Virtual Stacks** This routine goes through the list of Ospf Virtual Stacks and calls* ospfVirtualStackInfo on each.** RETURNS N/A**/void ospfVirtualStackShow () { int ospfVsIndex; for (ospfVsIndex = 0; ospfVsIndex < OSPF_VSID_MAX; ospfVsIndex++) ospfVirtualStackInfo(ospfVsTbl[ospfVsIndex]); }/************************************************************************************ ospfConfigurationTableInit - init configuration table for virtual stack** This routine initialize the configuration table for virtual stack** RETURNS: N/A*/void ospfConfigurationTableInit(CONFIGURATION_TABLE *configuration_table){ configuration_table->valid = 1; configuration_table->function[0].fptr_parameter_function = (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) ospf_set_enum_enable; configuration_table->function[0].eptr_enable_string = NULL; configuration_table->function[0].cptr_parameter_string = "OSPF ="; configuration_table->function[0].parameter_1 = (ULONG) offsetof (OSPF_CLASS,protocol_enabled); configuration_table->function[0].ulptr_parameter_2 = (ULONG ) &ospf; configuration_table->function[0].parameter_3 = (ULONG) NULL; configuration_table->function[1].fptr_parameter_function = (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) ospf_set_default_values; configuration_table->function[1].eptr_enable_string = NULL; configuration_table->function[1].cptr_parameter_string = "OSPF Use Default Values ="; configuration_table->function[2].fptr_parameter_function = (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) ospf_set_ip_address; configuration_table->function[2].eptr_enable_string = NULL; configuration_table->function[2].cptr_parameter_string = "OSPF Router ID ="; configuration_table->function[2].parameter_1 = (ULONG) offsetof (OSPF_CLASS,router_id); configuration_table->function[2].ulptr_parameter_2 = (ULONG ) &ospf; configuration_table->function[2].parameter_3 = (ULONG) NULL; configuration_table->function[3].fptr_parameter_function = (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) ospf_set_enum_enable; configuration_table->function[3].eptr_enable_string = NULL; configuration_table->function[3].cptr_parameter_string = "OSPF Type of Service Capability ="; configuration_table->function[3].parameter_1 = (ULONG) offsetof (OSPF_CLASS,type_of_service_capability); configuration_table->function[3].ulptr_parameter_2 = (ULONG ) &ospf; configuration_table->function[3].parameter_3 = (ULONG) NULL; configuration_table->function[4].fptr_parameter_function = (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) ospf_set_enum_enable; configuration_table->function[4].eptr_enable_string = NULL; configuration_table->function[4].cptr_parameter_string = "OSPF Autonomous System Border Router ="; configuration_table->function[4].parameter_1 = (ULONG) offsetof (OSPF_CLASS,autonomous_system_border_router); configuration_table->function[4].ulptr_parameter_2 = (ULONG ) &ospf; configuration_table->function[4].parameter_3 = (ULONG) NULL; configuration_table->function[5].fptr_parameter_function = (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) ospf_set_enum_enable; configuration_table->function[5].eptr_enable_string = NULL; configuration_table->function[5].cptr_parameter_string = "OSPF IP Multicast ="; configuration_table->function[5].parameter_1 = (ULONG) offsetof (OSPF_CLASS,ip_multicast); configuration_table->function[5].ulptr_parameter_2 = (ULONG ) &ospf; configuration_table->function[5].parameter_3 = (ULONG) NULL; configuration_table->function[6].fptr_parameter_function = (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) ospf_set_ulong_decimal_value; configuration_table->function[6].eptr_enable_string = NULL; configuration_table->function[6].cptr_parameter_string = "OSPF Number of Areas ="; configuration_table->function[6].parameter_1 = (ULONG) offsetof (OSPF_CLASS, number_of_areas); configuration_table->function[6].ulptr_parameter_2 = (ULONG ) &ospf; configuration_table->function[6].parameter_3 = (ULONG) NULL; configuration_table->function[7].fptr_parameter_function = (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) ospf_set_variable_port_and_ip_address; configuration_table->function[7].eptr_enable_string = NULL; configuration_table->function[7].cptr_parameter_string = "OSPF Area ID ="; configuration_table->function[7].parameter_1 = (ULONG) offsetof (OSPF_CLASS, area[0].config.area_id); configuration_table->function[7].ulptr_parameter_2 = (ULONG ) &ospf; configuration_table->function[7].parameter_3 = sizeof (OSPF_AREA_CLASS);#if defined (__RFC_2328__) configuration_table->function[8].fptr_parameter_function = (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) ospf_set_variable_port_and_ip_address; configuration_table->function[8].eptr_enable_string = NULL; configuration_table->function[8].cptr_parameter_string = "OSPF Area Address Range Address ="; configuration_table->function[8].parameter_1 = (ULONG) offsetof (OSPF_CLASS, area_address_range[0].config.network); configuration_table->function[8].ulptr_parameter_2 = (ULONG ) &ospf; configuration_table->function[8].parameter_3 = sizeof (OSPF_AREA_ADDRESS_RANGE_CLASS); configuration_table->function[9].fptr_parameter_function = (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) ospf_set_variable_port_and_ip_address; configuration_table->function[9].eptr_enable_string = NULL; configuration_table->function[9].cptr_parameter_string = "OSPF Area Address Range Mask ="; configuration_table->function[9].parameter_1 = (ULONG) offsetof (OSPF_CLASS, area_address_range[0].config.mask); configuration_table->function[9].ulptr_parameter_2 = (ULONG ) &ospf; configuration_table->function[9].parameter_3 = sizeof (OSPF_AREA_ADDRESS_RANGE_CLASS); configuration_table->function[10].fptr_parameter_function = (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) ospf_set_variable_port_and_enable; configuration_table->function[10].eptr_enable_string = NULL; configuration_table->function[10].cptr_parameter_string = "OSPF Area Address Range Advertise ="; configuration_table->function[10].parameter_1 = (ULONG) offsetof (OSPF_CLASS, area_address_range[0].config.advertise); configuration_table->function[10].ulptr_parameter_2 = (ULONG ) &ospf; configuration_table->function[10].parameter_3 = sizeof (OSPF_AREA_ADDRESS_RANGE_CLASS); configuration_table->function[11].fptr_parameter_function = (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) ospf_set_variable_port_and_ulong_decimal_value; configuration_table->function[11].eptr_enable_string = NULL; configuration_table->function[11].cptr_parameter_string = "OSPF Area Address Range Cost ="; configuration_table->function[11].parameter_1 = (ULONG) offsetof (OSPF_CLASS, area_address_range[0].config.cost); configuration_table->function[11].ulptr_parameter_2 = (ULONG ) &ospf; configuration_table->function[11].parameter_3 = sizeof (OSPF_AREA_ADDRESS_RANGE_CLASS); configuration_table->function[12].fptr_parameter_function = (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) ospf_set_variable_port_and_enable; configuration_table->function[12].eptr_enable_string = NULL; configuration_table->function[12].cptr_parameter_string = "OSPF Area Address Range Area ID ="; configuration_table->function[12].parameter_1 = (ULONG) offsetof (OSPF_CLASS, area_address_range[0].config.area_id); configuration_table->function[12].ulptr_parameter_2 = (ULONG ) &ospf; configuration_table->function[12].parameter_3 = sizeof (OSPF_AREA_ADDRESS_RANGE_CLASS);#else /*__RFC_2328__*/ configuration_table->function[8].fptr_parameter_function = (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) ospf_set_variable_port_and_ip_address; configuration_table->function[8].eptr_enable_string = NULL; configuration_table->function[8].cptr_parameter_string = "OSPF Area Address ="; configuration_table->function[8].parameter_1 = (ULONG) offsetof (OSPF_CLASS, area[0].config.ip_address); configuration_table->function[8].ulptr_parameter_2 = (ULONG ) &ospf; configuration_table->function[8].parameter_3 = sizeof (OSPF_AREA_CLASS); configuration_table->function[9].fptr_parameter_function = (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) ospf_set_variable_port_and_ip_address; configuration_table->function[9].eptr_enable_string = NULL; configuration_table->function[9].cptr_parameter_string = "OSPF Area Address Mask ="; configuration_table->function[9].parameter_1 = (ULONG) offsetof (OSPF_CLASS, area[0].config.subnetmask); configuration_table->function[9].ulptr_parameter_2 = (ULONG ) &ospf; configuration_table->function[9].parameter_3 = sizeof (OSPF_AREA_CLASS); configuration_table->function[10].fptr_parameter_function = (void (*) (char *cptr_start_of_configuration_string,ULONG parameter_1,ULONG ulptr_parameter_2,ULONG parameter_3)) ospf_set_variable_port_and_enable;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -