Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/net Define several constants related to the Ethernet pro...
details: https://anonhg.NetBSD.org/src/rev/eb855ed3a867
branches: trunk
changeset: 467556:eb855ed3a867
user: thorpej <thorpej%NetBSD.org@localhost>
date: Thu Mar 25 23:08:28 1999 +0000
description:
Define several constants related to the Ethernet protocol:
- ETHER_ADDR_LEN: length of Ethernet address (actually, we already defined
this).
- ETHER_TYPE_LEN: length of the Ethernet header `type' field.
- ETHER_CRC_LEN: length of the Ethernet CRC (explorer got this already, mostly
because I forgot to commit these changes earlier).
- ETHER_HDR_LEN: total length of the Ethernet header
- ETHER_MAX_LEN: maximum length of an Ethernet frame, including header and CRC
- ETHER_MIN_LEN: minimum length of an Ethernet frame, including header and CRC
Define ETHERMTU and ETHERMIN (payload sizes) in terms of the above constants.
diffstat:
sys/net/if_ether.h | 21 ++++++++++++++-------
1 files changed, 14 insertions(+), 7 deletions(-)
diffs (51 lines):
diff -r 1d4e0dadb6be -r eb855ed3a867 sys/net/if_ether.h
--- a/sys/net/if_ether.h Thu Mar 25 22:38:28 1999 +0000
+++ b/sys/net/if_ether.h Thu Mar 25 23:08:28 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_ether.h,v 1.6 1999/03/25 04:45:37 explorer Exp $ */
+/* $NetBSD: if_ether.h,v 1.7 1999/03/25 23:08:28 thorpej Exp $ */
/*
* Copyright (c) 1982, 1986, 1993
@@ -39,18 +39,26 @@
#define _NET_IF_ETHER_H_
/*
+ * Some basic Ethernet constants.
+ */
+#define ETHER_ADDR_LEN 6 /* length of an Ethernet address */
+#define ETHER_TYPE_LEN 2 /* length of the Ethernet type field */
+#define ETHER_CRC_LEN 4 /* length of the Ethernet CRC */
+#define ETHER_HDR_LEN ((ETHER_ADDR_LEN * 2) + ETHER_TYPE_LEN)
+#define ETHER_MIN_LEN 64 /* minimum frame length, including CRC */
+#define ETHER_MAX_LEN 1518 /* maximum frame length, including CRC */
+
+/*
* Ethernet address - 6 octets
* this is only used by the ethers(3) functions.
*/
struct ether_addr {
- u_int8_t ether_addr_octet[6];
+ u_int8_t ether_addr_octet[ETHER_ADDR_LEN];
};
/*
* Structure of a 10Mb/s Ethernet header.
*/
-#define ETHER_ADDR_LEN 6
-
struct ether_header {
u_int8_t ether_dhost[ETHER_ADDR_LEN];
u_int8_t ether_shost[ETHER_ADDR_LEN];
@@ -61,9 +69,8 @@
#define ETHER_IS_MULTICAST(addr) (*(addr) & 0x01) /* is address mcast/bcast? */
-#define ETHERMTU 1500
-#define ETHERMIN (60-14)
-#define ETHER_CRC_LEN 4
+#define ETHERMTU (ETHER_MAX_LEN - ETHER_HDR_LEN - ETHER_CRC_LEN)
+#define ETHERMIN (ETHER_MIN_LEN - ETHER_HDR_LEN - ETHER_CRC_LEN)
#ifdef _KERNEL
/*
Home |
Main Index |
Thread Index |
Old Index