netif.h

来自「实现在ARM上的ICP/IP功能的源代码。」· C头文件 代码 · 共 38 行

H
38
字号

/* Network interface Head file */

/* the max number of netif */
#define NET_IF_MAX_NUM	1	
#define NETIF_HEAD_MAX_LEN	14	/* the max  phsical layer head len. eg ethernet head len */


/* netif is associated with each netwok device */
struct SNetIf
{
	struct SNetIf   *pNext;	/* point to the next netif */
	IP_ADDR IPAddr;			/* Ip address for this device */
	IP_ADDR NetMask;			/* Net mask for this device */
	IP_ADDR GateWay;			/* Gate way IP address fort this device */

	/* call input to get a packet from device to IP layer. This 
	function maybe 'EtherInput()', and called periodically */
	void (  * input)(struct SNetIf   * NetIf)  ;

	/* call output to put a packet from IP layer to device. After
	Ip layer selected a device, it use output to send this packet.
	MemHead contain a packet and Netif tell dirver which netif it 
	is. NOTE:MemHead->pStart point to pIPHead*/
	BOOL (  * output)(struct SMemHead   *MemHead,struct SNetIf  * NetIf,DWORD DestIP)  ;	

	void   *Info;	/* information of this device. eg. MAC address. */
};
void NetIfInit()  ;
struct SNetIf   * NetIfAdd(DWORD IPAddr, DWORD NetMask,DWORD GateWay,
						 void (  * input)(struct SNetIf   * NetIf)  ,
						 BOOL (  * output)(struct SMemHead   *MemHead,struct SNetIf  * NetIf,DWORD DestIP)  ,
						 void   * Info)  ;
struct SNetIf   * NetIfFindRout(IP_ADDR IPAddr)  ;
struct SNetIf   * NetIfFindIP(IP_ADDR IPAddr)  ;
void NetIfTimer()  ;

⌨️ 快捷键说明

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