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

📄 usrnatstartup.c

📁 nat PNE 3.3 source code, running at more than vxworks6.x version.
💻 C
字号:
/* usrNatStartup.c - initialize and configure NAT *//* Copyright 2005 Wind River Systems, Inc. *//*modification history--------------------01a,25mar05,zhu  written*//*DESCRIPTIONThis file supplies sample code to configure and initialize NAT.NOMANUAL*//* includes */#include "vxWorks.h"#include "stdio.h"#include "wrn/coreip/ipProto.h"#include "wrn/coreip/ifLib.h"#include "wrn/nat/nat_api.h"#include "wrn/nat/natExtCalls.h"#include "wrn/nat/natMgmt.h"extern void usrNetNatInit(char*, char*);/******************************************************************************** usrNatStartup - NAT initialization routine.** This routine initializes NAT. ** This assumes:* 1. There are two interfaces fei0, fei1 on the target.* 2. fei0 is attached to the IP stack, its address is set, and it is the *    global interface.* 3. fei1 is not attached to the IP stack, and it is the local interface.* 4. NAT Configuration specified in*    $WIND_BASE/target/config/comps/src/net/usrNetNatCfg.c*    is the desired configuration** NOTE: This is provided only as an example** RETURNS: N/A** NOMANUAL*/void usrNatStartup(void)    {    /* Attach the local interface fei1 and set its address */    ipAttach(1, "fei");    ifMaskSet("fei1", 0xffffff00);    ifAddrSet("fei1", "10.0.1.1");    /*      * Initialize NAT      *     * This assumes:      * (a) fei0 is the global interface     * (b) fei1 is the local interface     */    usrNetNatInit("fei,0", "fei,1");    /*      * (Optional) Initialize the NAT ALGs     */    /* FTP ALG: */    /*    if (natFtpInit(21) != OK)        printf("NAT FTP ALG initialization failed!\n");     */    /* H323 ALG: */    /*    if (natH323Init(1720) != OK)         printf("NAT H323 ALG initialization failed!\n");      */    /* IPSec passthrough ALG: */    /*    if (natIPSecPTInit(500) != OK)         printf("NAT IPSec passthrough ALG initialization failed!\n");      */    /* PPTP passthrough ALG: */    /*    if (natPPTPPTInit() != OK)        printf("NAT PPTP passthrough ALG initialization failed!\n");     */    /* SIP ALG: */    /*    if (natSipInit() != OK)        printf("NAT SIP passthrough ALG initialization failed!\n");     */    /*      * (Optional) Set Port Triggers     *      * This assumes: An outbound TCP packet destined to ports 23 thru 24     * triggers the global ports 19 thru 21 open for inbound UDP connections.     * The triggered inbound UDP connections should be terminated if the      * trigger times out.      */    /*    if (natPortTriggerEntryAction(NAT_PORT_TRIGGER_ADD,                                  PORT_TRIGGER_STRICT,                                  IPPROTO_TCP, 23, 24,                                  IPPROTO_UDP, 19, 21) != OK)        printf("NAT Port Trigger Add failed!\n");     */    /*      * (Optional) Set the DMZ Host     *      * This assumes: The local host 10.0.1.2 serves as the DMZ Host      */    /*    if (natDMZHostSet("10.0.1.2") != OK)        printf("NAT DMZ Host Set failed!\n");     */     /* (Optional) NAT MIB: */    /*    natMgmtInit();    if (m2NatTreeAdd () == ERROR)         printf("Unable to add MIB fragment for NAT to tree!\n");     */    /* (Optional) NAT show routine */    /*    natShow();     */    printf("NAT configuration and initialization complete!\n");    }

⌨️ 快捷键说明

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