/*
 *------------------------------------------------------------------
 *
 * $Source: /mit/cgw/src/tftp.vax/RCS/ether.h,v $
 * $Revision: 1.3 $
 * $Date: 88/07/11 18:54:58 $
 * $State: Exp $
 * $Author: jon $
 * $Locker: jon $
 *
 * $Log:	ether.h,v $
 * Revision 1.3  88/07/11  18:54:58  jon
 * Sommerfeld's changes.
 * 
 * 
 *------------------------------------------------------------------
 */

#define	etadcpy(s,d)	{ int _i; for(_i=0; _i<6; _i++) (d)[_i] = (s)[_i]; }

extern unsigned char etmyaddr[6];
extern unsigned char etbroad[6];
extern long in_me;

struct et_hdr {
  char  et_unused[2];  /* see comment in vii.h  I aggree.  Alignment sucks */
  unsigned char  et_dst[6];
  unsigned char	et_src[6];
  short	et_type;
};

struct et_real_hdr {
  unsigned char  et_dst[6];
  unsigned char	et_src[6];
  short	et_type;
};

#define ln_hdr_type struct et_hdr


#define ETHER_HLEN  6             /* ether hardware address length */
#define ETHER_HTYPE_BYTE 1

#ifdef vax
#define	ETHER_HTYPE	0x0100	  /* ethernet hardware type (little endian) */
#define	ETHER_IP	0x0008	  /* internet protocol type (little endian) */
#define	ETHER_ARP	0x0608    /* arp protocol type (little endian) */
#endif

#if ibm032
#define	ETHER_HTYPE	0x0001	  /* ethernet hardware type (big endian) */
#define	ETHER_IP	0x8000    /* internet protocol type (big endian) */
#define ETHER_ARP       0x8060    /* arp protocol type (big endian) */
#endif

#ifdef vax
#define	ARP_REQ	0x100		/* byte swapped request opcode */
#define	ARP_REP	0x200		/* byte swapped reply opcode */
#endif

#ifdef ibm032
#define	ARP_REQ	0x1		/* byte swapped request opcode */
#define	ARP_REP	0x2		/* byte swapped reply opcode */
#endif

/* ARP structure */

struct adr {
	struct	et_hdr	ar_et;  /* ether header (including pad) */
	short	ar_hd;		/* hardware type */
	short	ar_pro;		/* protcol type */
	char	ar_hln;		/* hardware addr length */
	char	ar_pln;		/* protocol header length */
	short	ar_op;		/* opcode */
	char	ar_sha[6];	/* sender hardware address */
	char    ar_spa[4];	/* sender protocol address */
	char	ar_tha[6];	/* target hardware address */
	char	ar_tpa[4];	/* target protocol address */
	};

