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 bir7@leland.stanford.edu 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 #defineETHER_MIN_LEN 64
28 #defineETHER_ADDR_LEN 6
29
30 #defineETHERTYPE_ARP 0x806
31 #defineETHERTYPE_IP 0x800
32 #defineETHER_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 #defineNET16(x) (((x&0xff)<<8)|((x>>8)&0xff))
49
50 structenet_header 51 { 52 unsignedchardaddr[ETHER_ADDR_LEN];
53 unsignedcharsaddr[ETHER_ADDR_LEN];
54 unsignedshorttype;
55 };
56
57 #define ETHER_HEADER sizeof(structenet_header)
58
59 structenet_statistics{ 60 intrx_packets; /* total packets received */ 61 inttx_packets; /* total packets transmitted */ 62 intrx_errors; /* bad packets received */ 63 inttx_errors; /* packet transmit problems */ 64 int rx_dropped; /* no space in linux buffers */ 65 int tx_dropped; /* no space available in linux */ 66 intcollisions; /* total number of collisions */ 67 int multicast; /* multicast packets received */ 68 /* detailed rx_errors: */ 69 int rx_length_errors;
70 intrx_over_errors; /* receiver overwrote ring buffer in card */ 71 intrx_crc_errors; /* received packet with crc error */ 72 intrx_frame_errors; /* received frame alignment error */ 73 intrx_fifo_errors; /* receiver fifo overrun */ 74 intrx_missed_errors; /* receiver missed packet */ 75 /* detailed tx_errors */ 76 inttx_aborted_errors;
77 inttx_carrier_errors;
78 inttx_fifo_errors;
79 inttx_heartbeat_errors;
80 inttx_window_errors;
81 };
82
83 voidprint_eth(structenet_header *eth);
84 inteth_hard_header (unsignedchar *buff, structdevice *dev,
85 unsignedshorttype, unsignedlongdaddr,
86 unsignedlongsaddr, unsignedlen);
87
88 inteth_rebuild_header(void *eth, structdevice *dev);
89 voideth_add_arp (unsignedlongaddr, structsk_buff *skb,
90 structdevice *dev);
91 unsignedshorteth_type_trans (structsk_buff *skb, structdevice *dev);
92
93 #endif