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

📄 natcfg.c

📁 vxworks下ppp的实现源码
💻 C
字号:
/* natcfg.c - Network Address Translation configuration parameters *//* Copyright 2000-2003 Wind River Systems, Inc. *//* @format.tab-size 4, @format.use-tabs true, @format.new-line lf *//*modification history--------------------01a,23apr03,zhu  updated copyright*//********************************************************************	Please see the WindNet NAT User's Guide under the section	"Configuration Parameters" for the descriptions of the	configuration parameters.********************************************************************/#include <stdio.h>#include <string.h>extern char nat_configuration_text[];void natcfg(){	printf("natcfg: writing to 0x%lx\n",(ULONG)nat_configuration_text);	strcpy(nat_configuration_text, 		"[[ NAT Application = Section Start ]]\n"		/* Global parameters:		   When Single Global Address is enabled, NAT operates in		   NAPT mode.  If disabled, it operates in Basic NAT mode		*/		"NAT = enabled\n"		"NAT Single Global Address = enabled\n"		/* Port 0 (Local Interface) parameters */		"NAT IP Port Enable = 0, enabled\n"		"NAT IP Port Interface = 0, fei0\n"		"NAT IP Port Type = 0, local\n"		/* Port 1 (Global Interface) parameters */		"NAT IP Port Enable = 1, enabled\n"		"NAT IP Port Interface = 1, fei1\n"		"NAT IP Port Type = 1, global\n"		/* Setting NAT global address and mask.  Since it defaults 		   to that of the configured global interface address, the 		   option is not normally used, but provided here for example.		"NAT IP Global Address = 20.10.1.1\n"		"NAT IP Global Address Mask = 255.255.255.0\n"		*/		/* Please see the User's Guide section for the explanation		   of the following parameters.		*/		"NAT Dynamic Global Address = disabled\n"		"NAT Filter Non Corporate Addresses = enabled\n"		"NAT Unknown Protocol Filter = disabled\n"		/* Setting the ICMP Default Address applies to NAPT only.		   If this parameter is set, external echo request to the		   NAT global interface address will be replied by the 		   local host whose address is the ICMP Default Address.		   Otherwise, the reply will come from the NAT router itself.		   NOTE:  If your global address is different from the		   global interface address, then you must set the ICMP		   Default Address to get a reply.		*/		"NAT ICMP Default Address = 192.168.134.1\n"		/* The following line of configuration is provided for example.		   It applies to Basic NAT only and will have no effect		   in NAPT mode.		   This option tells NAT to dynamically assign a global 		   address from its global address pool starting from the 		   configured Starting Address. Without this parameter,		   NAT will default to the starting address of 1 in its pool		   (in this example, it will start from 20.10.1.1).		   Note that the Starting Global Address must have the same		   subnet with the NAT Global Address; otherwise, NAT will		   use the default starting address (i.e. 20.10.1.1).			    		"NAT Starting Basic NAT Global Address = 20.10.1.100\n"		*/		/* Debug traces:		   These traces can be used for troubleshooting purpose.		   When the NAT Printf is enabled, expect NAT to run		   much slower.		 */		"NAT Printf = disabled\n"		"NAT Printf Initialization = disabled\n"		"NAT Printf Debug = disabled\n"		"NAT Printf Trace = disabled\n"		"NAT Printf Data = disabled\n"		"NAT Printf Error = disabled\n"		"NAT Logging = disabled\n"		"NAT Logging Initialization = disabled\n"		"NAT Logging Trace = disabled\n"		"NAT Logging Data = disabled\n"		/*******************************************************		   Below are examples of static entries.  The static		   entry is required for a global client to start a		   session with a local server.  In this way, an internet		   user can initiate an inbound session with a private		   server without exposing the identity of the server.		   		********************************************************/				/* This is the master static entries enabler.  When		   disabled, none of the static entries will work.		*/		"NAT Static Entries Enabled = enabled\n"		/* Examples of static port-based translations		   (apply to NAPT only).		   NOTE:		   1. The static entry number must be unique for each		   entry in each transport protocol (TCP or UDP).  If 		   the same entry number is used for multiple entries		   in the same transport protocol, only the last one 		   will apply.		   2. The Global Port doesn't have to be the same as		   the Server Port although it is better to make them		   the same especially for standard well-known protocol		   ports.  If the Global Port is configured differently		   from the local Server Port, the global client must		   be configured to send its messages to the Global		   Port rather than using the standard protocol port		   which is normally the default port on the client		   application.		*/		/* Static mapping for FTP */		"NAT Static TCP Global Port = 0, 21\n"		"NAT Static TCP Server Port = 0, 21\n"		"NAT Static TCP Server Address = 0, 192.168.134.3\n"				/* Static mapping for HTTP */		"NAT Static TCP Global Port = 1, 80\n"		"NAT Static TCP Server Port = 1, 80\n"		"NAT Static TCP Server Address = 1, 192.168.134.3\n"		/* Static mapping for Telnet */		"NAT Static TCP Global Port = 2, 23\n"		"NAT Static TCP Server Port = 2, 23\n"		"NAT Static TCP Server Address = 2, 192.168.134.3\n"		/* Static mapping for H.323 (e.g. MicroSoft Netmeeting). */		"NAT Static TCP Global Port = 3, 1720\n"		"NAT Static TCP Server Port = 3, 1720\n"		"NAT Static TCP Server Address = 3, 192.168.134.4\n"		/* Static mapping for TFTP.  Note the following		   configuration provided for example:		   1. Global Port is configured differently from the 		      Server Port.		   2. Since this is a UDP entry, you can use the same		      entry number already used for TCP static entry.		*/ 		"NAT Static UDP Global Port = 0, 69\n"		"NAT Static UDP Server Port = 0, 69\n"		"NAT Static UDP Server Address = 0, 192.168.134.10\n"		/* Example of static address-based translation.  This		   translation is also called IP translation, and is		   used mainly in Basic NAT.  However, NAPT can be		   combined with Basic NAT for customers who want NAT		   to translate network traffic to/from certain local		   hosts in Basic NAT mode even though NAT has been		   configured in NAPT mode.		   Each entry number must be unique.  If there are		   duplicate entry number, only the last one applies.		   If the starting global address (in Basic NAT) is		   configured as above (at 20.10.1.100), it is still		   okay to use a global address with a lower index		   for static entry as shown in entry 1 below.		   When configuring NAT in NAPT, it is best to comment		   out all static address-based translations (see the		   WARNING below) and enable them only if you have the		   need to.		*/		/*		"NAT Static Entry Local Address = 0, 192.168.134.1\n"		"NAT Static Entry Global Address = 0, 20.10.1.50\n"		"NAT Static Entry Local Address = 1, 192.168.134.2\n"		"NAT Static Entry Global Address = 1, 20.10.1.101\n"		*/		/* WARNING:		   The following warnings apply only to user who wants to use		   address-based static entries in NAPT.		   The local address in static address-based translation		   must not be the same as any of the server address in   		   the static port-based translations configured above.		   See the explanation in the User's Guide.		   The following entry won't work in NAPT because 192.168.134.3		   is also used as a server address in static port-based		   translations.  It is shown here for example.  However,		   if you configure NAT as Basic NAT, the entry is fine.		"NAT Static Entry Local Address = 2, 192.168.134.3\n"		"NAT Static Entry Global Address = 2, 20.10.1.101\n"		*/		);}

⌨️ 快捷键说明

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