📄 net.h
字号:
/***************************************** Copyright (c) 2002-2004 Sigma Designs, Inc. All Rights Reserved Proprietary and Confidential *****************************************//* This file is part of the boot loader *//* * net.h * * network layer * * first revision by Ho Lee 11/06/2002 */#ifndef __BOOT_LOADER_NET_H#define __BOOT_LOADER_NET_Hstruct ethhdr;struct arprequest;struct iphdr;struct icmphdr;struct udphdr;struct bootphdr;struct tftphdr;struct sk_buff { unsigned char *data; // pointer to packet data unsigned int len; // size of packet unsigned int buflen; // size of allocated buffer int valid; // data is available (set by skb_put()) int owned; // owned by a process (set by skb_get()) int timestamp; // sequence number (set by skb_put() and verified by skb_get()) struct sk_buff *next; // next socket buffer with data // after packet parsing struct ethhdr *eth; unsigned char *ethdata; int ethdata_len; struct arprequest *arp; struct iphdr *ip; unsigned char *ipdata; int ipdata_len; struct icmphdr *icmp; struct udphdr *udp; unsigned char *udpdata; int udpdata_len; struct bootphdr *bootp; struct tftphdr *tftp; // struct net_device *dev;};enum { ETHIRQ_RX = 0x01, ETHIRQ_TX = 0x02 };enum { NETDEV_NODEV, NETDEV_DOWN, NETDEV_UP };#define MACADDR_LEN 6#define IFNAMSIZ 16struct net_device { int state; void *priv; int (*init)(struct net_device *dev); int (*open)(struct net_device *dev); int (*close)(struct net_device *dev); int (*send_packet)(struct sk_buff *skbuff, struct net_device *dev, int async); int (*receive_packet)(struct net_device *dev); void (*print_status)(struct net_device *dev); unsigned char dev_addr[MACADDR_LEN]; // EEPROM int eeprom_size; unsigned short (*eeprom_readw)(struct net_device *dev, int reg); void (*eeprom_writew)(struct net_device *dev, int reg, int data); //for em86xx_eth.h char name[IFNAMSIZ]; /* I/O specific fields */ unsigned long rmem_end; /* shmem "recv" end */ unsigned long rmem_start; /* shmem "recv" start */ unsigned long mem_end; /* shared mem end */ unsigned long mem_start; /* shared mem start */// unsigned long base_addr; /* device I/O address */ unsigned int irq; /* device IRQ number */ unsigned char dma; /* DMA channel */ struct net_device_stats* (*get_stats)(struct net_device *dev); unsigned long trans_start; /* Time (in jiffies) of last Tx */ unsigned long last_rx; /* Time of last Rx */ unsigned mtu; /* interface MTU value, Maximum Transmission Unit*/ unsigned short hard_header_len; /* hardware hdr length */ /* Interface address info. */ unsigned char broadcast[MACADDR_LEN]; /* hw bcast add */ unsigned char addr_len; /* hardware address length */#define HAVE_NETDEV_POLL int (*poll) (struct net_device *dev, int *quota);};extern struct net_device g_netdev;//// function prototypes//int net_init(void);int net_found(void);int net_arp_setup(void);int net_dev_up(void);int net_dev_down(void);struct sk_buff *net_getpacket(int timeout);int net_sendpacket(struct sk_buff *skb, int async);int net_defaultaction(struct sk_buff *skb);void net_device_status(void);struct sk_buff *skb_alloc(int len);void skb_free(struct sk_buff *skb);struct sk_buff *skb_dup(struct sk_buff *skb);void skb_put(struct sk_buff *skb);struct sk_buff *skb_get(void);struct sk_buff *skb_alloc_tx(int len);#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -