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

📄 nat_task_init.c

📁 VXWORKS NAT 部分源代码3 有兴趣朋友可以参考下
💻 C
字号:
/* nat_task_init.c */

/* Copyright 2000-2003 Wind River Systems, Inc. */

/* @format.tab-size 4, @format.use-tabs true, @format.new-line lf */

/*
modification history
--------------------
01c,25apr03,myz  removed rwos_task_reference_counter variable.
01b,23apr03,zhu  updated copyright
01a,21apr03,myz  start WRS modification history.
missing initial modification history.
*/

#include "nat.h"
#include <stdio.h>					/* printf() prototype */
#include <string.h>					/* memcpy() prototype */
#include <taskLib.h>				/* taskSuspend() */


/* 
//	Defined in NVRAM.c
//	******************
//	extern NVRAM_CLASS nvram;
*/
extern enum TEST initialize_nvram (char *cptr_file_name, ULONG location_of_ini_file, char *cptr_section_name, void *vptr_location_of_configuration_table);
extern void natcfg();
char nat_configuration_text[RWOS_MAXIMUM_FILE_SIZE+1];/*={"<uninitialized>\n"};*/

/*
//	External interface.
*/



void nat_task_initialize(const char* p_configuration_data)
{
/*
	char* p_module_data;
*/
	
	
#if 0
	/* Allocate buffer to hold copy of config data */	
	p_module_data = malloc (RWOS_MAXIMUM_FILE_SIZE+1);

	if (p_module_data == NULL)
	{
		nat_printf (NAT_PRINTF_ERROR, "nat_task_initialize(): malloc failure\n");
		return;
	}

	/*
	//	Initialize NAT configuration table.
	*/
	strcpy(p_module_data, nat_configuration_text);

	if (initialize_nvram(NULL, (ULONG)p_module_data,"NAT Application"
		,(void*)nat_get_configuration_table_address()) == FAIL)
	{
		nat_printf (NAT_PRINTF_ERROR, "initialize_nvram failed\n");

		free ((void *)p_module_data);
		return;
	}

	free ((void *)p_module_data);
#endif
	/*
	//	Save the RwOS global mutex within the calling module.
	*/
	/*
	//	module_class.rwos_global_instance_mutex = rwos_get_global_mutex();
	*/

	/*
	//	Perform NAT initialization.
	*/
	if (nat_initialize() != OK)
	{
		nat_printf (NAT_PRINTF_ERROR, "nat_initialize failed\n");
		return;
	}

	nat_printf(NAT_PRINTF_INIT,"nat_task_initialize() successful.\n");
}


void nat_parameter_initialize(void)
{

	if(!nat.enabled)
	{
		memset(&nat,0,sizeof(nat));	

	/*
		natcfg();
	*/
		nat.enabled = false;
		nat.single_global_address_enabled = true;
		nat.global_address_mask = 0xffffff00;	/* 255.255.255.0 */
		nat.filter_non_corporate_addresses = true;
		nat.tcp_disconnected_timer = NAT_TCP_DISCONNECTED_TIMER;
		nat.tcp_connecting_timer = NAT_TCP_CONNECTING_TIMER;
		nat.tcp_connected_timer = NAT_TCP_CONNECTED_TIMER;
		nat.tcp_closing_timer = NAT_TCP_CLOSING_TIMER;
		nat.ip_translation_entry_timer = NAT_TRANSLATION_ENTRY_TIMER;
		nat.udp_translation_entry_timer = NAT_UDP_TRANSLATION_ENTRY_TIMER;
		nat.icmp_translation_entry_timer = NAT_ICMP_TRANSLATION_ENTRY_TIMER;
		nat.sequence_entry_timer = SEQUENCE_ENTRY_TIMER;
		nat.natg.global_address_pool_size = 8;	/* 8-bits, 256 values */
		nat.filter_unknown_protocols = false;
		nat.fastnat=false;
		nat.printing_enabled = false;
		nat.error_printing_enabled = false;
		nat.initialization_printing_enabled = false;
		nat.error_logging_enabled = false;
		nat.initialization_logging_enabled = false;
		nat.static_entries_enabled=true;
	}
	

}


⌨️ 快捷键说明

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