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

📄 usrnetwork.c

📁 ppc 8245 可编译bsp 包括 uart
💻 C
📖 第 1 页 / 共 5 页
字号:
/* usrNetwork.c - network initialization */

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

/*
modification history
--------------------
05y,16jun01,kc   Consider rfa boot device also to determine whether dc0 needs to be attached.
05x,25may01,kc   Added TMS OSPFv2 protocol registration and includes.
05w,16nov00,spm  enabled new DHCP lease for runtime device setup (SPR #20438)
05v,14nov00,rae  removed unused argument from sockLibAdd()
05u,27oct00,spm  fixed DHCP startup update and mod history entry
05t,27oct00,spm  code cleanup; removed incorrect proxy server requirement
05s,23oct00,niq  updated DHCP startup for latest version (from tor3_x branch)
05r,06oct00,spm  fixed device search with non-zero unit numbers (SPR #26154)
05q,03may99,pul  max_linkhdr to be set in usrNetInit 
05p,29apr99,pul  Upgraded NPT phase3 code to tor2.0.0
05o,02apr99,pul  "To make max_linkhdr user configurable"
05n,26mar99,pul  remove muxMCastMapAdd
05m,19mar99,dat  SPR 25877 removed old driver support
05l,18mar99,sj   removed INCLUDE_NPT check
05k,16mar99,dat  SPR 25790, boot from END or netif device
05j,09mar99,ham  rejected the 05e modification.
05i,08mar99,ham  added boot device "pcmcia" entry, SPR#24714.
05h,05mar99,sj   eliminated call to muxTkLibInit. Must set muxMaxBinds
05g,26feb99,dat  changed netIf to usrNetIfTbl and made it global. Added FEI
		 support (23818)
05f,02feb99,sgv  added bitflag parameter to sockLibAdd
05e,20jan99,scb  usrBpInit() modified to use "sm=" before SM_ANCHOR_ADRS (23035)
05d,03Nov98,pul  moved muxBindBase to muxTkLib.c 
05c,30nov98,c_s  20x -> 200 merge
05b,30nov98,gnn  corrected mod history and merged TFFS support
05a,07oct98,sj   added Network Protocol Toolkit(NPT) support 
04z,11sep98,spm  corrected default value of RIP_GARBAGE_TIME (SPR #21908)
04y,25aug98,n_s  fixed interface config when using bootline other field and END.
                 spr #22217.
04x,04may98,cym  added Windows ULIP code.
04w,29apr98,dbt  removed RDB references (no longer supported).
04v,25sep97,jmb  Add a default route for HPSIM SLIP connection.
04u,10jul97,jmb  Make NFS client work on HPSIM by setting nfsMaxMsgLen
		 to a number less than the MTU - 127.
04t,27jan97,jmb  Add SLIP patches for HPSIM (from Mark Mason).
04s,18jul98,spm  merged support for TFFS boot device into release view
04r,05dec97,spm  added DHCP code review modifications
04q,30nov97,vin  added network stack system pool
04p,29oct97,spm  delayed DHCP client startup to prevent failure for fast 
                 processors (SPR #9641)
04o,06oct97,spm  moved DHCP server default parameters to dhcpsLib.h; added
                 stub routine to support delayed startup of DHCP relay agent
04n,06oct97,spm  removed unused constant INCLUDE_BSD; added optional binary 
                 compatibility for BSD 4.3 applications
04m,03oct97,gnn  removed references to endDriver global
04l,25sep97,gnn  SENS beta feedback fixes
04k,19sep97,vin  added cluster blk configuration to network configuration.
		 changed MBLK_CONFIG to M_CL_CONFIG.
04j,26aug97,spm  major overhaul of DHCP: reorganized code and changed user 
                 interface to support multple leases at runtime; improved
                 handling of address information by client; altered all DHCP 
                 components to allow selection of UDP ports
04i,14aug97,vin  changed MBUF_CONFIG to MBLK_CONFIG
04h,12aug97,gnn  changes necessitated by MUX/END update.
04g,11aug97,vin  changed mbufConfig and clDescTbl.
04d,06aug97,cdp  fixed signed/unsigned comparison in checkInetAddrField.
04f,15jul97,spm  added support for SNTP client and server
04e,03jul97,vin  made routing sockets scalable.
04d,03jul97,sgv  fix for spr #8602 changed ftpdInit to check for 
		 authentication when INCLUDE_FTPD_SECURITY is defined
04c,02jun97,spm  allowed DHCP server to start without lease storage hook
04b,20may97,gnn  fixed SPR 8627 so that multiple gn devices are supported.
04a,09may97,spm  increased stack size for DHCP server task
03z,30apr97,spm  made hop limit for relay agent configurable; fixed DHCP bugs
03y,25apr97,gnn  changed INCLUDE_GN to INCLUDE_END
03x,18apr97,spm  eliminated DHCP-related compiler warnings when building BSP
03w,17apr97,gnn  changed network booting to work with END configNet files.
                 fixed two bugs that ANVL found in RIP timers.
03v,17apr97,vin  added ipFilterLibInit() in usrNetProtoInit().
03u,14apr97,vin  added mCastRouteLibInit(), igmpShowInit, icmpShowInit,
		 tcpShowInit, udpShowInit for scalability.
03t,10apr97,jag  added DNS resolver support
03s,07apr97,gnn  fixed a merge bug with Stephen's changes.
03r,07apr97,gnn  added new booting system for END network device.
03q,07apr97,spm  added DHCP server and relay agent support, fixed unit number 
                 support, removed redundant code for DHCP client
03p,12mar97,gnn  added new timer variables for ripLibInit
03o,24feb97,gnn  added RIP_MULTICAST for use by RIP
                 changed routedLibInit to ripLibInit
03n,14feb97,rjc  OSPF_INCLUDE changed to INCLUDE_OSPF
03m,14feb97,rjc  added ospf init calls
03l,07feb97,rjc  deleted routePref, now in routeLib.c
03k,31jan97,vin  added macros for config parameters.
03j,31jan97,spm  added dhcpShowInit() to link DHCP client show routines.
03i,29jan97,gnn  moved the muxDevLoad call to later in the sequence.
03h,21jan97,vin  added scalability of network stack, 
		 moved _func_remCurId[SG]et from netLib.c for scalability.
03g,21jan97,gnn  Added another argument to muxDevLoad().
03d,13jan97,jpd  Added if_lnEbsa driver entry.
03c,07jan97,jpd  Added if_oli driver entry.
03f,20dec96,vin	 removed warnings muxDevLoad().
03e,18dec96,spm  fixed small bug in DHCP client code
03d,03dec96,spm  removed bootLeaseExtract test when DHCP client not included
                 to reduce code size
03c,27nov96,spm  added support for DHCP client.
03b,26nov96,gnn  added INCLUDE_RIP directive for routed/rip.
03a,25nov96,vin	 added new cluster configuration.
02z,15nov96,vin  fixed problems with passive and silent options for PPP.
02y,23oct96,gnn  added END_DEV_NAME define for gnattach routine.
02x,22oct96,gnn  added END_BUFF_LOAN define so upper layer can request buffer
                 loaning.
03d,10dec97,spm  added configurable password authentication for FTP server
                 from SENS branch (SPR #8602)
03c,11apr97,dvs  added routes for SIMSPARCSOLARIS when using ppp instead of ULIP
03b,11dec96,vin  SPR7604 for PPP silent mode and passive mode.
03a,10dec96,yp   added route for ULIP driver so we send packets for our selves
		 to localhost since not all hosts return whats ours
02z,18nov96,dbt  ANSIfied function headers (SPR #7427.)
02y,11nov96,spm  added bzero() call to checkInetAddrField(). (SPR #6326).
02x,01nov96,hdn  added support for PCMCIA.  moved NETIF to sysLib.h.
02w,13aug96,dat  added NETIF_USR_DECL and NETIF_USR_ENTRIES, SPR 6970
02v,23jul96,hdn  added support for ATA driver.
02u,21jun96,jmb  long modhist -- deleted entries prior to 1994. (SPR #6528)
02t,13jun96,hdn  added INCLUDE_ESMC for SMC91c9x Ethernet driver.
02v,12aug96,rjc  snmp init funcs modified to reflect removal of memory partition                 options. 
02u,07aug96,rjc  added resolver changes.
02t,29may96,dat	 fixed SPR 4392 re: network services after scsi (disk) boot
02s,04apr96,rjc  Merged in changes for snmp agent for vxWorks53
02r,07mar96,gnn	 added SLIP_MTU so that we could configure the MTU. 
		 (SPR #4652)
02q,06mar96,sgv  Added error checks in usrStrmInit for tliInit(), dlpiInit()
		 autopushInit() and strmDebugInit.
02p,11nov95,vin  baudrate in bootstring, added pppHookLib.
02n,06sep95,jag  deleted call to fattachInit (), and changed iosStrmInit to
		 strmInit ().
02n,01aug95,dzb  changed STREAMS options to go through iosStrmInit ().
                 added protocol initialization hook routine.
 		 PPP initialization failure message (SPR #4505).
02m,28jul95,jag  changed INCLUDE_STREAMS_LOG to INCLUDE_STREAMS_STRACE and
		 INCLUDE_STREAMS_STRERR. Added the routines to support these
		 options.
02l,25jul95,dzb  tweaked socket library initialization.
02k,25jul95,dzb  added socket library init for BSD vs. STREAMS.
02j,25jul95,jag  Added check for the return value of iosStrmInit.
02i,18jul95,dzb  wait for PPP interface to come up in usrPPPInit().
02h,17jul95,dzb  fixed ordering of boot params search.
02g,26jun95,dzb  removed PPP_S_USEHOSTNAME option.
02f,22jun95,sgv  Added streamsInit() to Initialise STREAMS
02e,21jun95,dzb  Added INCLUDE_PPP_CRYPT for unbundled crypt() support.
02d,20jun95,dzb  changed PPP options structure to set values from macros.
02c,09jan95,dzb  Added PPP support.
02c,29jun95,caf  added nicEvb driver entry.
02b,28mar95,kkk  changed smNetInit() parameters to use macros from 
		 configAll.h (SPR #4130)
02z,27mar95,jag  removed dependency of INCLUDE_NFS_SERVER from INCLUDE_NFS
01z,19mar95,dvs  removed tron references - no longer supported.
01y,30jan95,hdn  included nfsdLib.h if INCLUDE_NFS_SERVER is defined.
		 added 6th argument to nfsdInit ().
02b,31mar95,caf  added dc driver entry.
02a,02jan95,kat  added ilac driver entry.
01x,09dec94,jag  Added INCLUDE_MIB2_AT
01w,13nov94,dzb  fixed placement of INCLUDE_PING.
01v,17aug94,dzb  fixed setting the gateway for a slip connection (SPR #2353).
		 added qu netif device.  added zbuf socket interface init.
		 added ping init.  added CSLIP support.  added tcpTrace init.
01u,11nov94,jag  divided SNMP and MIB-II support.
01t,09feb94,hdn  added support for if_elt 3COM Etherlink III driver.
		 added support for if_ene Eagle NE2000 driver.
*/

/*
DESCRIPTION
This file is used to configure and initialize the VxWorks networking support.
This file is included by usrConfig.c.

SEE ALSO: usrExtra.c

NOMANUAL
*/

#ifndef  __INCusrNetworkc
#define  __INCusrNetworkc

#include "zbufSockLib.h"
#include "pingLib.h"
#include "ipProto.h"

#ifdef INCLUDE_SNTPS
#include "sntpsLib.h"

/* Include this declaration if hook is defined. */

/* IMPORT STATUS SNTPS_TIME_HOOK (int, void *); */

#endif

#define DEF_MAX_LINK_HDR 16 

#ifndef USR_MAX_LINK_HDR
#define USR_MAX_LINK_HDR DEF_MAX_LINK_HDR
#endif

IMPORT int max_linkhdr;

#ifdef INCLUDE_SNTPC
#include "sntpcLib.h"
#endif

#ifdef INCLUDE_SNMPD
#include "snmp/snmpdInit.h"
#endif

#include "m2Lib.h"
#include "private/funcBindP.h"

#ifdef INCLUDE_OSPF
#include "ospf/ospfLib.h"
#endif /* INCLUDE_OSPF */

#ifdef INCLUDE_TMS_OSPFv2
#undef INCLUDE_OSPF       /* make sure the older version of OSPF is not defined */
#include "tms/ospfv2glue/ospfv2Lib.h"
#endif /* INCLUDE_TMS_OSPFv2 */

#ifdef INCLUDE_PIM                /* added by cxj for PIM module */
#include "netinet/pim_var.h"
#endif /* INCLUDE_PIM */

#ifdef INCLUDE_NFS_SERVER
#include "nfsdLib.h"
#endif

#ifdef INCLUDE_DNS_RESOLVER
#include "resolvLib.h"
#endif

#if (CPU==SIMHPPA)
extern int nfsMaxMsgLen;
#endif
#ifdef INCLUDE_FTPD_SECURITY
#include "loginLib.h"
#endif

#ifdef INCLUDE_DHCPS
#include "dhcp/dhcp.h"
#include "dhcp/common.h"
#include "dhcpsLib.h"
IMPORT long dhcps_dflt_lease;
IMPORT long dhcps_max_lease;
IMPORT STATUS dhcpsLeaseHookAdd (FUNCPTR);
IMPORT STATUS dhcpsAddressHookAdd (FUNCPTR);

/* Include these declarations if hooks are defined. */

/* IMPORT STATUS DHCPS_LEASE_HOOK (int, char *, int); */

/* IMPORT STATUS DHCPS_ADDRESS_HOOK (int, char *, int); */

#endif

#ifdef INCLUDE_DHCPC
#include "dhcp/dhcpcInit.h"
#include "dhcp/dhcpcCommonLib.h"
#else
LOCAL STATUS dhcpcBootLineClean (char *);
#endif /* INCLUDE_DHCPC */

#ifdef INCLUDE_DHCPR
#ifndef INCLUDE_DHCPS        /* Server is superset of relay agent. */
#include "dhcprLib.h"
#endif
#endif


#ifdef INCLUDE_END
#include "end.h"
#include "muxLib.h"
#include "muxTkLib.h"
#include "configNet.h"
#include "m2Lib.h"
#endif /* INCLUDE_END */

#if (defined (INCLUDE_DHCPC) || defined (INCLUDE_DHCPS) || \
     defined (INCLUDE_RIP) || defined (INCLUDE_OSPF)) || \
     defined (INCLUDE_TMS_OSPFv2) && !defined (INCLUDE_ROUTE_SOCK)
#define INCLUDE_ROUTE_SOCK
#endif /* INCLUDE_DHCPC || INCLUDE_DHCPS */

#ifdef INCLUDE_SLIP
#if (CPU==SIMHPPA)
extern void sysSlipSetup ();
#endif /* (CPU=SIMHPPA) */
#endif /* INCLUDE_SLIP */

#ifdef INCLUDE_END
#ifdef INCLUDE_NT_ULIP
extern int ntResolv ();
#endif /* INCLUDE_NT_ULIP */
#endif /* INCLUDE_END */

/* global variables */

/* network protocol configuration parameters */

#ifdef INCLUDE_TCP
TCP_CFG_PARAMS tcpCfgParams =	/* tcp configuration parameters */
    {
    TCP_FLAGS_DFLT,		/* include rfc1323 support */
    TCP_SND_SIZE_DFLT,		/* default send buffer size */
    TCP_RCV_SIZE_DFLT,		/* default recv buffer size */
    TCP_CON_TIMEO_DFLT,		/* initial connection time out */
    TCP_REXMT_THLD_DFLT,	/* retransmit threshold */
    TCP_MSS_DFLT,		/* default maximum segment size */
    TCP_RND_TRIP_DFLT,		/* default round trip time */
    TCP_IDLE_TIMEO_DFLT,	/* idle timeouts before first probe */
    TCP_MAX_PROBE_DFLT		/* max no. probes before dropping */
    }; 
#endif /* INCLUDE_TCP */

#ifdef INCLUDE_UDP
UDP_CFG_PARAMS udpCfgParams =	/* udp configuration parameters */
    {
    UDP_FLAGS_DFLT,
    UDP_SND_SIZE_DFLT,		/* send buffer size */
    UDP_RCV_SIZE_DFLT		/* recv buffer size */
    }; 
#endif /* INCLUDE_UDP */

#ifdef INCLUDE_ICMP
ICMP_CFG_PARAMS icmpCfgParams = /* icmp configuration parameters */
    {
    ICMP_FLAGS_DFLT		/* no icmp mask replies by default */
    }; 
#endif	/* INCLUDE_ICMP */

IP_CFG_PARAMS ipCfgParams =	/* ip configuration parameters */
    {
    IP_FLAGS_DFLT,		/* default ip flags */
    IP_TTL_DFLT,		/* ip default time to live */
    IP_QLEN_DFLT,		/* default ip intr queue len */
    IP_FRAG_TTL_DFLT		/* default ip fragment time to live */
    }; 

/* network buffers configuration */

/*
 * mBlk, clBlk configuration table for network stack data pool.
 * Only used for data transfer in the network stack.
 */
M_CL_CONFIG mClBlkConfig = 
    {
    /* 
    no. mBlks		no. clBlks	memArea		memSize
    -----------		----------	-------		-------
    */
    NUM_NET_MBLKS, 	NUM_CL_BLKS,	NULL, 		0
    };

/*
 * network stack data cluster pool configuration table
 * Only used for data transfer in the network stack.
 */
CL_DESC clDescTbl [] = 		
    {
    /* 
    clusterSize		num		memArea		memSize
    -----------		----		-------		-------
    */
    {64,		NUM_64,		NULL,		0},
    {128,		NUM_128,	NULL,		0},
    {256,		NUM_256,	NULL,		0},
    {512,		NUM_512,	NULL,		0},
    {1024,		NUM_1024,	NULL,		0},
    {2048,		NUM_2048,	NULL,		0}
    }; 
int clDescTblNumEnt = (NELEMENTS(clDescTbl));

/*
 * mBlk, clBlk configuration table for network stack system pool.
 * Used for network stack system structures such as routes, sockets,
 * protocol control blocks, interface addresses, mulitcast addresses,
 * and multicast routing entries.
 */
M_CL_CONFIG sysMclBlkConfig = 
    {
    /* 
    no. mBlks		no. clBlks		memArea		memSize
    -----------		----------		-------		-------
    */
    NUM_SYS_MBLKS, 	NUM_SYS_CL_BLKS,	NULL, 		0
    };

/*
 * network stack system cluster pool configuration table
 * Used for network stack system structures such as routes, sockets,
 * protocol control blocks, interface addresses, mulitcast addresses,
 * and multicast routing entries.
 */
CL_DESC sysClDescTbl [] = 		
    {
    /* 
    clusterSize		num		memArea		memSize
    -----------		----		-------		-------
    */
    {64,		NUM_SYS_64,	NULL,		0},
    {128,		NUM_SYS_128,	NULL,		0},
    {256,		NUM_SYS_256,	NULL,		0},
    {512,		NUM_SYS_512,	NULL,		0},
    }; 
int sysClDescTblNumEnt = (NELEMENTS(sysClDescTbl));

#if defined(INCLUDE_STREAMS) || defined(INCLUDE_STREAMS_ALL)

⌨️ 快捷键说明

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