Ethernet.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2003 Andras Varga; CTIE, Monash University, Australia
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU Lesser General Public License
00006  * as published by the Free Software Foundation; either version 2
00007  * of the License, or (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU Lesser General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU Lesser General Public License
00015  * along with this program; if not, see <http://www.gnu.org/licenses/>.
00016 */
00017 
00018 #ifndef __INET_ETHERNET_H
00019 #define __INET_ETHERNET_H
00020 
00021 #include "INETDefs.h"
00022 
00023 // Constants from the 802.3 spec
00024 #define MAX_PACKETBURST              13
00025 #define GIGABIT_MAX_BURST_BYTES      8192  /* don't start new frame after 8192 or more bytes already transmitted */
00026 #define MAX_ETHERNET_DATA            1500  /* including LLC, SNAP etc headers */
00027 #define MAX_ETHERNET_FRAME           1518  /* excludes preamble and SFD */
00028 #define MIN_ETHERNET_FRAME           64    /* excludes preamble and SFD */
00029 #define GIGABIT_MIN_FRAME_WITH_EXT   512 /* excludes preamble and SFD, but includes 448 byte extension */
00030 #define INTERFRAME_GAP_BITS          96
00031 #define ETHERNET_TXRATE              10000000.0    /* 10 Mbit/sec (in bit/s) */
00032 #define FAST_ETHERNET_TXRATE         100000000.0   /* 100 Mbit/sec (in bit/s) */
00033 #define GIGABIT_ETHERNET_TXRATE      1000000000.0  /* 1 Gbit/sec (in bit/s) */
00034 #define FAST_GIGABIT_ETHERNET_TXRATE 10000000000.0 /* 10 Gbit/sec (in bit/s) */
00035 #define SLOT_TIME                    (512.0/ETHERNET_TXRATE)  /* for Ethernet & Fast Ethernet, in seconds */
00036 #define GIGABIT_SLOT_TIME            (4096.0/GIGABIT_ETHERNET_TXRATE) /* seconds */
00037 #define MAX_ATTEMPTS                 16
00038 #define BACKOFF_RANGE_LIMIT          10
00039 #define JAM_SIGNAL_BYTES             4
00040 #define PREAMBLE_BYTES               7
00041 #define SFD_BYTES                    1
00042 #define PAUSE_BITTIME                512 /* pause is in 512-bit-time units */
00043 
00044 #define ETHER_MAC_FRAME_BYTES        (6+6+2+4) /* src(6)+dest(6)+length/type(2)+FCS(4) */
00045 #define ETHER_LLC_HEADER_LENGTH      (3) /* ssap(1)+dsap(1)+control(1) */
00046 #define ETHER_SNAP_HEADER_LENGTH     (5) /* org(3)+local(2) */
00047 #define ETHER_PAUSE_COMMAND_BYTES    (6) /* FIXME verify */
00048 
00049 #endif
00050