/* vim: set filetype=c:
 *
 * ethernet.h86  -  Ethernet definitions
 *
 * Copyright (C) 1998-2007 Gero Kuhlmann <gero@gkminix.han.de>
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 * $Id: ethernet.h86,v 1.6 2007/01/06 18:30:54 gkminix Exp $
 */

#ifndef NET_ETHERNET_H86
#define NET_ETHERNET_H86



/*
 * This file can only get included into target C or assembler source files.
 */
#define GCC_INCLUDE
#include <compiler.h>



/*
 * Magic constants for ethernet
 */
#define ETH_ALEN	6			 /* Bytes in ethernet addr  */
#define ETH_FLEN	4			 /* Bytes in FCS (CRC)      */
#define ETH_HLEN	14			 /* Total bytes in header   */
#define ETH_DATA_MIN	46			 /* Min. bytes in payload   */
#define ETH_DATA_MAX	1500			 /* Max. bytes in payload   */
#define ETH_FRAME_MIN	(ETH_DATA_MIN + ETH_HLEN)  /* Min. bytes w/o FCS    */
#define ETH_FRAME_MAX	(ETH_DATA_MAX + ETH_HLEN)  /* Max. bytes w/o FCS    */
#define ETH_BUF_SIZE	(ETH_FRAME_MAX + ETH_FLEN) /* Buffer size with FCS  */



/*
 * Ethernet frame header
 */
#ifndef _ASSEMBLY_

struct ether_header {
  __u8   dest[ETH_ALEN];			/* destination address */
  __u8   src[ETH_ALEN];				/* source address */
  __u16  type;					/* packet type ID field */
} PACKED;

#else

			.struct	0
ether_dest:		.struct	.+ETH_ALEN	/* destination address */
ether_src:		.struct	.+ETH_ALEN	/* source address */
ether_type:		.struct	.+2		/* packet type ID field */

#endif


/*
 * Ethernet protocol ID's
 */
#define	ETHERTYPE_IP	0x0800			/* IP */
#define	ETHERTYPE_ARP	0x0806			/* Address resolution */
#define	ETHERTYPE_RARP	0x8035			/* Reverse ARP */


#endif

