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

📄 usrnetwork.c

📁 ppc 8245 可编译bsp 包括 uart
💻 C
📖 第 1 页 / 共 5 页
字号:

#ifdef	STREAMS_PROTO_INIT_RTN
FUNCPTR	strmProtoInitRtn = (FUNCPTR) STREAMS_PROTO_INIT_RTN;
#endif	/* STREAMS_PROTO_INIT_RTN */
#endif /* INCLUDE_STREAMS || INCLUDE_STREAMS_ALL */


#ifdef INCLUDE_END	
#ifndef IP_MAX_UNITS 
#define IP_MAX_UNITS 1
#endif

#ifndef MUX_MAX_BINDS
#define MUX_MAX_BINDS 16
#endif /* MUX_MAX_BINDS */

IP_DRV_CTRL ipDrvCtrl [IP_MAX_UNITS]; 
int ipMaxUnits = IP_MAX_UNITS;

#else	/* INCLUDE_END not defined */
IP_DRV_CTRL  	ipDrvCtrl[1]; 
#endif 	/* INCLUDE_END */


#ifdef	INCLUDE_PPP

#ifndef PPP_OPTIONS_FLAGS
#define PPP_OPTIONS_FLAGS ((PPP_OPT_NO_ALL << PPP_S_NO_ALL)  | \
    (PPP_OPT_PASSIVE_MODE << PPP_S_PASSIVE_MODE)             | \
    (PPP_OPT_SILENT_MODE << PPP_S_SILENT_MODE)               | \
    (PPP_OPT_DEFAULTROUTE << PPP_S_DEFAULTROUTE)             | \
    (PPP_OPT_PROXYARP << PPP_S_PROXYARP)                     | \
    (PPP_OPT_IPCP_ACCEPT_LOCAL << PPP_S_IPCP_ACCEPT_LOCAL)   | \
    (PPP_OPT_IPCP_ACCEPT_REMOTE << PPP_S_IPCP_ACCEPT_REMOTE) | \
    (PPP_OPT_NO_IP << PPP_S_NO_IP)                           | \
    (PPP_OPT_NO_ACC << PPP_S_NO_ACC)                         | \
    (PPP_OPT_NO_PC << PPP_S_NO_PC)                           | \
    (PPP_OPT_NO_VJ << PPP_S_NO_VJ)                           | \
    (PPP_OPT_NO_VJCCOMP << PPP_S_NO_VJCCOMP)                 | \
    (PPP_OPT_NO_ASYNCMAP << PPP_S_NO_ASYNCMAP)               | \
    (PPP_OPT_NO_MN << PPP_S_NO_MN)                           | \
    (PPP_OPT_NO_MRU << PPP_S_NO_MRU)                         | \
    (PPP_OPT_NO_PAP << PPP_S_NO_PAP)                         | \
    (PPP_OPT_NO_CHAP << PPP_S_NO_CHAP)                       | \
    (PPP_OPT_REQUIRE_PAP << PPP_S_REQUIRE_PAP)               | \
    (PPP_OPT_REQUIRE_CHAP << PPP_S_REQUIRE_CHAP)             | \
    (PPP_OPT_LOGIN << PPP_S_LOGIN)                           | \
    (PPP_OPT_DEBUG << PPP_S_DEBUG)                           | \
    (PPP_OPT_DRIVER_DEBUG << PPP_S_DRIVER_DEBUG))
#endif  /* PPP_OPTIONS_FLAGS */
 
PPP_OPTIONS pppOptions = 
    {
    PPP_OPTIONS_FLAGS,              /* flags field */
    PPP_STR_ASYNCMAP,               /* Set the desired async map */
    PPP_STR_ESCAPE_CHARS,           /* Set chars to escape on transmission */
    PPP_STR_VJ_MAX_SLOTS,           /* Set max VJ compression header slots */
    PPP_STR_NETMASK,                /* Set netmask value for negotiation */
    PPP_STR_MRU,                    /* Set MRU value for negotiation */
    PPP_STR_MTU,                    /* Set MTU value for negotiation */
    PPP_STR_LCP_ECHO_FAILURE,       /* Set max consecutive LCP echo failures */
    PPP_STR_LCP_ECHO_INTERVAL,      /* Set time for LCP echo requests */
    PPP_STR_LCP_RESTART,            /* Set timeout for LCP */
    PPP_STR_LCP_MAX_TERMINATE,      /* Set max # xmits for LCP term-reqs */
    PPP_STR_LCP_MAX_CONFIGURE,      /* Set max # xmits for LCP conf-reqs */
    PPP_STR_LCP_MAX_FAILURE,        /* Set max # conf-naks for LCP */
    PPP_STR_IPCP_RESTART,           /* Set timeout for IPCP */
    PPP_STR_IPCP_MAX_TERMINATE,     /* Set max # xmits for IPCP term-reqs */
    PPP_STR_IPCP_MAX_CONFIGURE,     /* Set max # xmits for IPCP conf-reqs */
    PPP_STR_IPCP_MAX_FAILURE,       /* Set max # conf-naks for IPCP */
    PPP_STR_LOCAL_AUTH_NAME,        /* Set local name for authentication */
    PPP_STR_REMOTE_AUTH_NAME,       /* Set remote name for authentication */
    PPP_STR_PAP_FILE,               /* Set the PAP secrets file */
    PPP_STR_PAP_USER_NAME,          /* Set username for PAP auth with peer */
    PPP_STR_PAP_PASSWD,             /* Set password for PAP auth with peer */
    PPP_STR_PAP_RESTART,            /* Set timeout for PAP */
    PPP_STR_PAP_MAX_AUTHREQ,        /* Set max # xmits for PAP auth-reqs */
    PPP_STR_CHAP_FILE,              /* Set the CHAP secrets file */
    PPP_STR_CHAP_RESTART,           /* Set timeout for CHAP */
    PPP_STR_CHAP_INTERVAL,          /* Set interval for CHAP rechallenge */
    PPP_STR_CHAP_MAX_CHALLENGE      /* Set max # xmits for CHAP challenge */
    };
#endif  /* INCLUDE_PPP */

/* extern declarations, IMPORTS */

/* Network interface table. */
IMPORT int lnEbsaattach ();
IMPORT int oliattach();
IMPORT int dcattach ();
IMPORT int eglattach ();
IMPORT int eiattach ();
IMPORT int feiattach ();
IMPORT int exattach ();
IMPORT int enpattach ();
IMPORT int ieattach ();
IMPORT int ilacattach ();
IMPORT int lnattach ();
IMPORT int lnsgiattach ();
IMPORT int nicattach ();
IMPORT int nicEvbattach ();
IMPORT int medattach ();
IMPORT int loattach ();
IMPORT int snattach ();
IMPORT int fnattach ();
IMPORT int elcattach ();
IMPORT int ultraattach ();
IMPORT int eexattach ();
IMPORT int eltattach ();
IMPORT int eneattach ();
IMPORT int esmcattach ();
IMPORT int quattach ();
IMPORT int slattach ();
IMPORT int pppattach ();

#ifdef NETIF_USR_DECL	/* Additional declarations, from BSP */
    NETIF_USR_DECL
#endif

/* generic driver */
#ifdef INCLUDE_END
IMPORT int 	ipAttach ();
IMPORT END_TBL_ENTRY endDevTbl[];
#endif /* INCLUDE_END */

#ifdef  INCLUDE_TCP_DEBUG
IMPORT void tcpTraceInit ();
#endif  /* INCLUDE_TCP_DEBUG */

#ifdef	INCLUDE_IF_USR
IMPORT int IF_USR_ATTACH ();
#endif	/* INCLUDE_IF_USR */


/* local typedefs */


/* variables */

NETIF usrNetIfTbl [] =	/* network interfaces */
    {
#ifdef NETIF_USR_ENTRIES	/* Additional entries, from BSP */
    NETIF_USR_ENTRIES
#endif

#ifdef	INCLUDE_LNEBSA
        { "lnEbsa", lnEbsaattach, (char*)IO_ADRS_LNEBSA, INT_VEC_LNEBSA,
          INT_LVL_LNEBSA, LNEBSA_POOL_ADRS, LNEBSA_POOL_SIZE, LNEBSA_DATA_WIDTH,
          LNEBSA_MODE, LNEBSA_DMA_CHAN },
#endif	/* INCLUDE_LNEBSA */
#ifdef	INCLUDE_OLI
	{ "oli", oliattach, (char*)IO_ADRS_NISA_BASE,
	  IO_ADRS_NISA_PCMCIA, IO_ADRS_NISA_PCMEM,
	  INT_VEC_PCMCIA_A, INT_LVL_PCMCIA_A,
	  INT_VEC_PCMCIA_B, INT_LVL_PCMCIA_B },
#endif	/* INCLUDE_OLI */
#ifdef	INCLUDE_DC
	{ "dc", dcattach, (char*)IO_ADRS_DC, INT_VEC_DC, INT_LVL_DC,
	  DC_POOL_ADRS, DC_POOL_SIZE, DC_DATA_WIDTH, DC_RAM_PCI_ADRS,
	  DC_MODE },
#endif	/* INCLUDE_DC */
#ifdef  INCLUDE_EGL
        { "egl", eglattach, (char*)IO_ADRS_EGL, INT_VEC_EGL, INT_LVL_EGL },
#endif	/* INCLUDE_EGL */
#ifdef	INCLUDE_EI
	{ "ei", eiattach, (char*)INT_VEC_EI, EI_SYSBUS, EI_POOL_ADRS, 0, 0},
#endif	/* INCLUDE_EI */
#ifdef	INCLUDE_FEI
        { "fei", feiattach, (char*)FEI_POOL_ADRS, 0, 0, 0, 0},
#endif	/* INCLUDE_FEI */
#ifdef	INCLUDE_EX
	{ "ex", exattach, (char*)IO_ADRS_EX, INT_VEC_EX, INT_LVL_EX,
	  IO_AM_EX_MASTER, IO_AM_EX },
#endif	/* INCLUDE_EX */
#ifdef	INCLUDE_ENP
	{ "enp", enpattach, (char*)IO_ADRS_ENP, INT_VEC_ENP, INT_LVL_ENP,
	  IO_AM_ENP },
#endif	/* INCLUDE_ENP */
#ifdef	INCLUDE_IE
	{ "ie", ieattach, (char*)IO_ADRS_IE, INT_VEC_IE, INT_LVL_IE },
#endif	/* INCLUDE_IE */
#ifdef	INCLUDE_ILAC
	{ "ilac", ilacattach, (char*)IO_ADRS_ILAC, INT_VEC_ILAC},
#endif	/* INCLUDE_ILAC */
#ifdef	INCLUDE_IF_USR
	{ IF_USR_NAME, IF_USR_ATTACH, IF_USR_ARG1, IF_USR_ARG2, IF_USR_ARG3,
	  IF_USR_ARG4, IF_USR_ARG5, IF_USR_ARG6, IF_USR_ARG7, IF_USR_ARG8 },
#endif	/* INCLUDE_IF_USR */
#ifdef	INCLUDE_LN
	{ "ln", lnattach, (char*)IO_ADRS_LN, INT_VEC_LN, INT_LVL_LN,
	  LN_POOL_ADRS, LN_POOL_SIZE, LN_DATA_WIDTH, LN_PADDING,
	  LN_RING_BUF_SIZE },
#endif	/* INCLUDE_LN */
#ifdef  INCLUDE_LNSGI
        { "lnsgi", lnsgiattach, (char*)IO_ADRS_LNSGI, INT_VEC_LNSGI,
          INT_LVL_LNSGI, LNSGI_POOL_ADRS, LNSGI_POOL_SIZE, LNSGI_DATA_WIDTH,
          LNSGI_PADDING, LNSGI_RING_BUF_SIZE },
#endif  /* INCLUDE_LNSGI */
#ifdef  INCLUDE_NIC
        { "nic", nicattach, (char*)IO_ADRS_NIC, INT_VEC_NIC, INT_LVL_NIC },
#endif	/* INCLUDE_NIC */
#ifdef  INCLUDE_NIC_EVB
        { "nicEvb", nicEvbattach, (char*)IO_ADRS_NIC,INT_VEC_NIC,INT_LVL_NIC },
#endif  /* INCLUDE_NIC_EVB */
#ifdef  INCLUDE_MED
        { "med", medattach, (char*)IO_ADRS_DBETH, INT_VEC_DBETH, INT_LVL_DBETH},
#endif	/* INCLUDE_MED */
#ifdef  INCLUDE_ELC
	{ "elc", elcattach, (char*)IO_ADRS_ELC, INT_VEC_ELC, INT_LVL_ELC,
	  MEM_ADRS_ELC, MEM_SIZE_ELC, CONFIG_ELC},
#endif  /* INCLUDE_ELC */
#ifdef  INCLUDE_ULTRA
	{ "ultra", ultraattach, (char*)IO_ADRS_ULTRA, INT_VEC_ULTRA,
	  INT_LVL_ULTRA, MEM_ADRS_ULTRA, MEM_SIZE_ULTRA, CONFIG_ULTRA},
#endif  /* INCLUDE_ULTRA */
#ifdef  INCLUDE_EEX
	{ "eex", eexattach, (char*)IO_ADRS_EEX, INT_VEC_EEX, INT_LVL_EEX,
	  NTFDS_EEX, CONFIG_EEX},
#endif  /* INCLUDE_EEX */
#ifdef  INCLUDE_ELT
	{ "elt", eltattach, (char*)IO_ADRS_ELT, INT_VEC_ELT, INT_LVL_ELT,
	  NRF_ELT, CONFIG_ELT},
#endif  /* INCLUDE_ELT */
#ifdef  INCLUDE_QU
	{ "qu", quattach, (char*)IO_ADRS_QU_EN, INT_VEC_QU_EN, QU_EN_SCC,
	  QU_EN_TX_BD, QU_EN_RX_BD, QU_EN_TX_OFF, QU_EN_RX_OFF, QU_EN_MEM},
#endif  /* INCLUDE_QU */
#ifdef  INCLUDE_ENE
	{ "ene", eneattach, (char*)IO_ADRS_ENE, INT_VEC_ENE, INT_LVL_ENE},
#endif  /* INCLUDE_ENE */
#ifdef  INCLUDE_ESMC
	{ "esmc", esmcattach, (char*)IO_ADRS_ESMC, INT_VEC_ESMC, INT_LVL_ESMC,
	  CONFIG_ESMC, RX_MODE_ESMC},
#endif  /* INCLUDE_ESMC */
#ifdef  INCLUDE_SN
        { "sn", snattach, (char*)IO_ADRS_SN, INT_VEC_SN },
#endif	/* INCLUDE_SN */
#ifdef  INCLUDE_FN
        { "fn", fnattach },
#endif	/* INCLUDE_FN */

#ifdef  INCLUDE_SM_NET
        { "sm", smNetAttach, 0, 0, 0, 0, 0, 0 },
#endif  /* INCLUDE_SM_NET */

#ifdef	INCLUDE_PCMCIA
	{ "pcmcia", pcmciaattach, 0, 0, 0, 0, 0, 0 },
#endif	/* INCLUDE_PCMCIA */

#ifdef	INCLUDE_PPP
	{"ppp", 0, 0, 0, 0, 0},
#endif	/* INCLUDE_PPP */
#ifdef	INCLUDE_SLIP
	{"sl", 0, 0, 0, 0, 0},
#endif	/* INCLUDE_SLIP */
	{ "lo", loattach  },
	{ 0, 0, 0, 0, 0, 0 },
    };

/* forward declarations */

STATUS usrNetProtoInit (void); 

#ifdef INCLUDE_DNS_RESOLVER
LOCAL STATUS usrResolvInit (void);
#endif /* INCLUDE_DNS_RESOLVER */

#if defined (INCLUDE_DHCPS) || defined (INCLUDE_DHCPR)
/*
 * The following table lists the IP addresses which will receive DHCP
 * messages forwarded across network boundaries by a DHCP server or
 * relay agent.
 */
DHCP_TARGET_DESC dhcpTargetTbl [] =
    {
    /*
     IP address of DHCP target servers
     ---------------------------------
     */
     /* {"90.11.42.2"}, */
     };
LOCAL int dhcpTargetTblSize = (NELEMENTS(dhcpTargetTbl));

struct ifnet *devlist[1];

int dhcpMaxHops = DHCP_MAX_HOPS;
int dhcpSPort = DHCPS_SPORT;
int dhcpCPort = DHCPS_CPORT;
#endif

/* 
 * Example cache routine - should store records of active leases 
 *                         across reboots. 
 */

/*
#ifdef INCLUDE_DHCPS

STATUS dhcpsDummyCache (int, char *, int);

STATUS dhcpsDummyCache (int op, char *name, int length)
    {
    printf("Cache called with op %d on %d bytes.\n", op, length);
    if (op == DHCPS_STORAGE_READ)
        return (ERROR);          /@ Simulated end-of-file. @/
    return (OK);
    }
#endif
*/

#ifdef INCLUDE_DHCPS

DHCPS_LEASE_DESC dhcpsLeaseTbl [] =
    {
    /*
    Name        Start IP      End IP          Parameters
    ----        ----------    ------          -----------
                                     see man pages
                                (timers, bootfile, etc.)
    */

    /*
     * Host requirements defaults needed for RFC compliance - DO NOT REMOVE!!
     */

   {"dflt",    NULL, NULL, DHCPS_DEFAULT_ENTRY},

    /* Sample database entries. */

/* {"ent1", "90.11.42.24", "90.11.42.24", "clid=\"1:0x08003D21FE90\":maxl=90:dfll=60"},   */
/* {"ent2", "90.11.42.25", "90.11.42.26", "snmk=255.255.255.0:maxl=90:dfll=70:file=/vxWorks"}, */
/* {"ent3", "90.11.42.27", "90.11.42.27", "maxl=0xffffffff:file=/vxWorks"}, */
/* {"entry4", "90.11.42.28", "90.11.42.29", "albp=true:file=/vxWorks"}      */
    };
LOCAL int dhcpsLeaseTblSize = (NELEMENTS(dhcpsLeaseTbl));

/*
 * If the DHCP server will receive messages from relay agents,
 * the following table must be filled in by the user.
 */

DHCPS_RELAY_DESC dhcpsRelayTbl [] =
    {
    /*
     IP address of agent              Subnet Number
     --------------------             -------------
     */
    /* {"90.11.42.254",               "90.11.42.0"}, */
    };
LOCAL int dhcpsRelayTblSize = (NELEMENTS(dhcpsRelayTbl));

LOCAL int dhcpsTaskPriority  = 56;      /* Priority level of DHCP server */
LOCAL int dhcpsTaskOptions   = 0;       /* Option settings for DHCP server */
LOCAL int dhcpsTaskStackSize = 5000;    /* Stack size for DHCP server task */
IMPORT void dhcpsStart (void);
#endif

#ifdef INCLUDE_DHCPR                   /* Relay agent settings. */
#ifndef INCLUDE_DHCPS                  /* Server is superset of relay agent. */

LOCAL int dhcprTaskPriority  = 56;    /* Priority level of DHCP relay agent */
LOCAL int dhcprTaskOptions   = 0;     /* Option settings for DHCP relay agent */
LOCAL int dhcprTaskStackSize = 2500;  /* Stack size for DHCP relay agent */
IMPORT STATUS dhcprLibInit (int maxSize);
IMPORT STATUS dhcprInit (struct ifnet **, int, DHCP_TARGET_DESC *, int);
IMPORT void dhcprStart (void);
#endif
#endif

/*******************************************************************************
*
* usrNetInit - system-dependent network initialization
*
* This routine initializes the network.  The ethernet and backplane drivers
* and the TCP/IP software are configured.  It also adds hosts (analogous to
* the /etc/hosts file in UNIX), gateways (analogous to /etc/gateways), sets
* up our access rights on the host system (with iam()), optionally
* initializes telnet, rlogin, RPC, and NFS support.
*
* The boot string parameter is normally left behind by the boot ROMs,
* at address BOOT_LINE_ADRS.
*
* Unless the STANDALONE option is selected in usrConfig.c, this routine
* will automatically be called by the root task usrRoot().
*
* RETURNS:
* OK, or
* ERROR if there is a problem in the boot string, or initializing network.
*
* SEE ALSO:  "Network" chapter of the VxWorks Programmer's Guide
*
* NOMANUAL
*/

STATUS usrNetInit 
    (
    char *bootString		/* boot parameter string */
    )
    {
    BOOT_PARAMS	params;
    char	numString [30]; 	/* buffer for numeric strings */
    char * 	pNetDev = NULL; 	/* Name of network device to setup */
    char *	pBootString;       /* IP address settings from boot string */
    int		netmask;
    char	devName [MAX_FILENAME_LENGTH];	/* device name */
#ifdef INCLUDE_NET_REM_IO
    int		protocol;
#endif /* INCLUDE_NET_REM_IO */

⌨️ 快捷键说明

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