home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.2 (Developer) / NS_dev_3.2.iso / NextDeveloper / Headers / bsd / net / etherdefs.h < prev    next >
C/C++ Source or Header  |  1993-10-19  |  2KB  |  80 lines

  1. /* 
  2.  * Mach Operating System
  3.  * Copyright (c) 1987 Carnegie-Mellon University
  4.  * All rights reserved.  The CMU software License Agreement specifies
  5.  * the terms and conditions for use and redistribution.
  6.  */
  7.  
  8. /*
  9.  * Copyright (c) 1982, 1986 Regents of the University of California.
  10.  * All rights reserved.
  11.  *
  12.  * Redistribution and use in source and binary forms are permitted
  13.  * provided that this notice is preserved and that due credit is given
  14.  * to the University of California at Berkeley. The name of the University
  15.  * may not be used to endorse or promote products derived from this
  16.  * software without specific prior written permission. This software
  17.  * is provided ``as is'' without express or implied warranty.
  18.  *
  19.  * HISTORY
  20.  * 09-Apr-90  Bradley Taylor (btaylor) at NeXT, Inc.
  21.  *    Created. Originally part of <netinet/if_ether.h>.
  22.  */
  23. #ifndef _ETHERDEFS_
  24. #define _ETHERDEFS_
  25.  
  26. /*
  27.  * Ethernet address - 6 octets
  28.  */
  29. #define NUM_EN_ADDR_BYTES    6
  30.  
  31. struct ether_addr {
  32.     u_char    ether_addr_octet[NUM_EN_ADDR_BYTES];
  33. };
  34.  
  35. #define ea_byte    ether_addr_octet
  36.  
  37. typedef struct ether_addr enet_addr_t;
  38.  
  39. /*
  40.  * Structure of a 10Mb/s Ethernet header.
  41.  */
  42. struct    ether_header {
  43.     u_char    ether_dhost[6];
  44.     u_char    ether_shost[6];
  45.     u_short    ether_type;
  46. };
  47.  
  48. typedef struct ether_header ether_header_t;
  49.  
  50. #define IFTYPE_ETHERNET "10MB Ethernet"
  51.  
  52. #define    ETHERTYPE_PUP    0x0200        /* PUP protocol */
  53. #define    ETHERTYPE_IP    0x0800        /* IP protocol */
  54. #define ETHERTYPE_ARP    0x0806        /* Addr. resolution protocol */
  55. #define ETHERTYPE_REVARP 0x8035        /* Reverse ARP (SUN_RPC) */
  56.  
  57. /*
  58.  * The ETHERTYPE_NTRAILER packet types starting at ETHERTYPE_TRAIL have
  59.  * (type-ETHERTYPE_TRAIL)*512 bytes of data followed
  60.  * by an ETHER type (as given above) and then the (variable-length) header.
  61.  */
  62. #define    ETHERTYPE_TRAIL        0x1000        /* Trailer packet */
  63. #define    ETHERTYPE_NTRAILER    16
  64.  
  65.  
  66. #define ETHERHDRSIZE    14
  67. #define    ETHERMTU    1500
  68. #define ETHERMAXPACKET    (ETHERHDRSIZE + ETHERMTU)
  69. #define ETHERMINPACKET    64
  70. #define ETHERCRC    4
  71. #define    ETHERMIN    (ETHERMINPACKET-ETHERCRC-ETHERHDRSIZE)
  72.  
  73. /*
  74.  * Byte and bit in an enet_addr_t defining individual/group destination.
  75.  */
  76. #define EA_GROUP_BYTE    0
  77. #define EA_GROUP_BIT    0x01
  78.  
  79. #endif /* _ETHERDEFS_ */
  80.