|
|
1.1 ! root 1: /* eth.h */ ! 2: /* ! 3: Copyright (C) 1992 Ross Biro ! 4: ! 5: This program is free software; you can redistribute it and/or modify ! 6: it under the terms of the GNU General Public License as published by ! 7: the Free Software Foundation; either version 2, or (at your option) ! 8: any later version. ! 9: ! 10: This program is distributed in the hope that it will be useful, ! 11: but WITHOUT ANY WARRANTY; without even the implied warranty of ! 12: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! 13: GNU General Public License for more details. ! 14: ! 15: You should have received a copy of the GNU General Public License ! 16: along with this program; if not, write to the Free Software ! 17: Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ! 18: ! 19: The Author may be reached as [email protected] or ! 20: C/O Department of Mathematics; Stanford University; Stanford, CA 94305 ! 21: */ ! 22: ! 23: ! 24: #ifndef _TCP_ETH_H ! 25: #define _TCP_ETH_H ! 26: ! 27: #define ETHER_MIN_LEN 64 ! 28: #define ETHER_ADDR_LEN 6 ! 29: ! 30: #define ETHERTYPE_ARP 0x806 ! 31: #define ETHERTYPE_IP 0x800 ! 32: #define ETHER_TYPE 1 ! 33: ! 34: /* Reciever modes */ ! 35: #define ETH_MODE_MONITOR 1 /* Monitor mode - no receive */ ! 36: #define ETH_MODE_PHYSICAL 2 /* Physical address receive only */ ! 37: #define ETH_MODE_BROADCAST 3 /* Broadcast receive + mode 2 */ ! 38: #define ETH_MODE_MULTICAST 4 /* Multicast receive + mode 3 */ ! 39: #define ETH_MODE_PROMISCUOUS 5 /* Promiscuous mode - receive all */ ! 40: ! 41: #define WD_RX_SAVE_ERRORS 1 /* save error packets */ ! 42: #define WD_RX_RUNT 2 /* accept runt packets */ ! 43: #define WD_RX_BROAD 4 /* accept broadcast packets */ ! 44: #define WD_RX_MULTI 8 /* accept multicast packets */ ! 45: #define WD_RX_PROM 0x10 /* accept all packets */ ! 46: #define WD_RX_MON 0x20 /* monitor mode (just count packets) */ ! 47: ! 48: #define NET16(x) (((x&0xff)<<8)|((x>>8)&0xff)) ! 49: ! 50: struct enet_header ! 51: { ! 52: unsigned char daddr[ETHER_ADDR_LEN]; ! 53: unsigned char saddr[ETHER_ADDR_LEN]; ! 54: unsigned short type; ! 55: }; ! 56: ! 57: #define ETHER_HEADER sizeof(struct enet_header) ! 58: ! 59: struct enet_statistics{ ! 60: int rx_packets; /* total packets received */ ! 61: int tx_packets; /* total packets transmitted */ ! 62: int rx_errors; /* bad packets received */ ! 63: int tx_errors; /* packet transmit problems */ ! 64: int rx_dropped; /* no space in linux buffers */ ! 65: int tx_dropped; /* no space available in linux */ ! 66: int collisions; /* total number of collisions */ ! 67: int multicast; /* multicast packets received */ ! 68: /* detailed rx_errors: */ ! 69: int rx_length_errors; ! 70: int rx_over_errors; /* receiver overwrote ring buffer in card */ ! 71: int rx_crc_errors; /* received packet with crc error */ ! 72: int rx_frame_errors; /* received frame alignment error */ ! 73: int rx_fifo_errors; /* receiver fifo overrun */ ! 74: int rx_missed_errors; /* receiver missed packet */ ! 75: /* detailed tx_errors */ ! 76: int tx_aborted_errors; ! 77: int tx_carrier_errors; ! 78: int tx_fifo_errors; ! 79: int tx_heartbeat_errors; ! 80: int tx_window_errors; ! 81: }; ! 82: ! 83: void print_eth(struct enet_header *eth); ! 84: int eth_hard_header (unsigned char *buff, struct device *dev, ! 85: unsigned short type, unsigned long daddr, ! 86: unsigned long saddr, unsigned len); ! 87: ! 88: int eth_rebuild_header(void *eth, struct device *dev); ! 89: void eth_add_arp (unsigned long addr, struct sk_buff *skb, ! 90: struct device *dev); ! 91: unsigned short eth_type_trans (struct sk_buff *skb, struct device *dev); ! 92: ! 93: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.