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

📄 netdev.h

📁 用于嵌入式系统的TCP/IP协议栈及若干服务
💻 H
📖 第 1 页 / 共 2 页
字号:
#endif } st_blk;/* macros to handle multiple IPA addresses on one interface */#define VLAN_SHIFT	0	/* up to 3 */#define MAX_VLAN	(1<<VLAN_SHIFT)/* macros to map ndp to Rip or OSPF circuits */#define ndp_2_cid(ndp)		(((int)ndp->nd_ix+1)<<VLAN_SHIFT)#define cid_2_ndix(cid)		(((int)cid>>VLAN_SHIFT)-1)/* net device switch */typedef struct netdev {	char    nd_name[MAX_DEV_NAME];  /* device name */	u16     nd_devid;       /* Minor device id, ie a board # */	u16     nd_xflags;  /* Filler field */	u32     nd_p0;      /* device specific init values */	u32     nd_p1;	u32     nd_p2;	u32     nd_p3;	so_addr	nd_lladdr;  /* link layer address of board - user fills in address family                           in device table.  Fusion queries device driver for link                           layer address.                        */	int (* nd_init)(struct netdev * ndp);	int (* nd_updown)(struct netdev * ndp, u16 flags, char * options);	st  (* nd_send)(struct m * mp);	int (* nd_start)(struct m * mp);	int (* nd_ioctl)(struct netdev * ndp, int cmnd, char * addr);	/*********************************************************************	 * NOTE: Everything below this line must stay there.  Any new fields	 * which require OEM initialization must be added above this line and	 * macros for devtable.h must be created for them (see below).  Fields which	 * which can be initialized to 0 and wouldn't require OEM initialization	 * go below this line.  See example devtable.h for device table	 * declaration.  CAUTION: Care MUST be taken to keep the order of entries     * in devtable.h and the netdev structure the same.	 */	u16     nd_flags;       /* Flags */	u16     nd_ix;          /* 'ndp_tbl' index (back ptr) - initialized by Fusion */	st_blk	nd_stat;        /* statistics */	u32	    nd_ipas[MAX_VLAN]; /* ipa addresses for this physical link */	u32	    nd_ipmasks[MAX_VLAN]; /* parallel subnet mask */	int	    nd_ipmtu;	    /* IP MTU */	u32	    nd_ifspeed;		/* Interface Speed */	u32	    nd_ospfarea;    /* maningful for OSPF area only */	q       nd_xmitq;       /* Transmit message queue for messages that have been	                           submitted to the driver and for which transmit 	                           completion notifications are being awaited. Used	                           only if F_N_PRESERVE_MSG flag is set. */    /* The following three fields are used only if the driver has a limited capacity	   to inernally queue outgoing messages (i.e., the F_N_IMMEDIATE flag is not set */	q		nd_holdq;       /* Queue to hold messages which cannot be submitted to							   the driver because we've maxed out on the capacity of 							   the driver to internally queue messages (nd_txpendlimit) */	int     nd_txpendlimit; /* Maximum number of outstanding "packets" that can be 							   submitted to the driver. */	int     nd_txnumpending; /* The number of outgoing packets presently pending 							    transmission by the driver. This field is touched								only by Fusion, driver should not touch it. */	struct so_t * nd_sop;   /* Socket backptr. for RAW stuff */	struct netdev   * nd_next;  /* Link to next similar device */#ifdef LWQ	struct  m   ** nd_mlist;/* preallocated receive buffers */	int	    nd_lpkts;       /* # of large preallocated buffers */	int	    nd_spkts;       /* # of small preallocated buffers */	q	    nd_recvq;       /* receive queue */#endif	dsu	    nd_dsu;     /* Device board specific union */#ifdef IGMP_PROTOCOL	addr_list	nd_multiaddr;  /* pointer to multicast addr. list */    u16     nd_mcast_addr_count;  /* Number of addresses in the list.  May be used                                  by the driver to know when to enable/disable                                   reception of multicast packets.                                */   	u8	    v1_router_present; /* Set to true (1) if a v1 router is present */	tcb		*v1_router_tcb;	   /* TCB for v1 router present timeout */#endif} netdev;/* Macros for devtable.h used to enter OEM specific required values into * the device table for each device. */#define NIL_DEV_NAME   " "#define  DEV_ADDRESS_FAMILY 0 /* Just a place holder for clarity */int loopback_driver_init (struct netdev * ndp);int loopback_driver_updown(struct netdev * ndp, u16 flags, char * options);int loopback_driver_ioctl(struct netdev * ndp, int cmnd, char * addr);st  loopback_driver_send (struct m * mp);int loopback_driver_start (struct m * mp);#ifndef MAX_RUNTIME_DEVICES#ifdef PPPOE_PROTOCOL#define MAX_RUNTIME_DEVICES     16  /* PPPoE default = 16 extra devices */#else#define MAX_RUNTIME_DEVICES     0   /* non PPPoE default = 0 */#endif#endif/* Just to keep example in table from compiling */#define  FNS_DEVICE_TABLE_TEMPLATE_ENTRY( a )        #define  FNS_STR_DEV_NAME(a)                    a, #define  FNS_U16_DEV_MINOR_ID(a)                (u16)a,#define  FNS_U16_DEV_XFLAGS(a)                  (u16)a, #define  FNS_U32_DEV_OEM_FIELD1(a)              (u32)a, #define  FNS_U32_DEV_OEM_FIELD2(a)              (u32)a, #define  FNS_U32_DEV_OEM_FIELD3(a)              (u32)a, #define  FNS_U32_DEV_OEM_FIELD4(a)              (u32)a,#define  FNS_U16_DEV_ADDRESS_FAMILY(a)          {a, 0},#define  FNS_FPTR_DEV_INIT(a)                   a,#define  FNS_FPTR_DEV_UPDOWN(a)                 a,#define  FNS_FPTR_DEV_SEND(a)                   a,#define  FNS_FPTR_DEV_TX_START(a)               a,#define  FNS_FPTR_DEV_IOCTL(a)                  a,#ifdef __FUSION_NCDEV_C__/* The device table only compiles into ncdev.c *//* See note above regarding BEGIN_FUSION_DEVICE_TABLE and END_FUSION_DEVICE_TABLE macros.*/#define  FUSION_DEVICE_TABLE(a) export netdev ndevsw[] = { \{"im", 0, 0, 0, 0, 0, 0, {AF_INTRA,0}, noent_init, noent_updown, im_send, noent_start, noent_ioctl }, \{"lo", 0, 0, 0, 0, 0, 0, {AF_LOOPBACK}, loopback_driver_init, loopback_driver_updown, \  loopback_driver_send, loopback_driver_start, loopback_driver_ioctl}, \  a \};#define  BEGIN_FUSION_DEVICE_TABLE export netdev ndevsw[] = { \    {"im", 0, 0, 0, 0, 0, 0, {AF_INTRA,0}, noent_init, noent_updown, im_send, noent_start, noent_ioctl }, \	{"lo", 0, 0, 0, 0, 0, 0, {AF_LOOPBACK}, loopback_driver_init, loopback_driver_updown, \		loopback_driver_send, loopback_driver_start, loopback_driver_ioctl}, \/* END_FUSION_DEVICE_TABLE */#define END_FUSION_DEVICE_TABLE	};/* NOTE:  As discussed above, the following macros are considered deprecated.          See the new devtable.hhh.*/#ifdef SLIP_PROTOCOL #define FUSION_GENERIC_SLIP_DEVICE_ENTRY(a) {a},#else#define FUSION_GENERIC_SLIP_DEVICE_ENTRY(a) #endif#ifdef PPP_PROTOCOL #define FUSION_GENERIC_PPP_DEVICE_ENTRY(a) {a},#else#define FUSION_GENERIC_PPP_DEVICE_ENTRY(a) #endif#ifdef ETHER_PROTOCOL #define FUSION_GENERIC_ETHER_DEVICE_ENTRY(a) {a},#else#define FUSION_GENERIC_ETHER_DEVICE_ENTRY(a) #endif/* Generic entry for devices other than Ethernet, SLIP, and PPP    NOTE:  As discussed above, the following macros are considered deprecated.          See the new devtable.hhh.*/#define  FUSION_DEVICE_TABLE_ENTRY(a) {a}, #define  BEGIN_FUSION_DEVICE_TABLE_ENTRY {#define  END_FUSION_DEVICE_TABLE_ENTRY },#endif /* __FUSION_NCDEV_C__ */#endif /* _NETDEV_ */

⌨️ 快捷键说明

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