home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 4 / DATAFILE_PDCD4.iso / utilities / utilss / sockets / include / netinet / h / if_ether < prev    next >
Encoding:
Text File  |  1995-01-24  |  3.2 KB  |  119 lines

  1. /*
  2.  * $Header: /ax/networking:include/netinet/if_ether.h:networking  1.2  $
  3.  * $Source: /ax/networking:include/netinet/if_ether.h: $
  4.  *
  5.  * Copyright (c) 1988 Acorn Computers Ltd., Cambridge, England
  6.  *
  7.  * $Log:    if_ether.h,v $
  8.  * Revision 1.2  95/01/24  16:28:21  kwelton
  9.  * etherbroadcastaddr must be declared as an extern of unknown size - the
  10.  * original declaration was illegal in ANSI C, and "undefined behaviour"
  11.  * in pcc C - the new C compiler produced different (and unwanted)
  12.  * undefined behaviour.
  13.  * 
  14.  * Revision 1.1  95/01/11  10:16:49  kwelton
  15.  * Initial revision
  16.  * 
  17.  * Revision 1.3  88/06/17  20:26:02  beta
  18.  * Acorn Unix initial beta version
  19.  * 
  20.  */
  21. /* @(#)if_ether.h    1.2 87/07/09 3.2/4.3NFSSRC */
  22. /*
  23.  * Copyright (c) 1982, 1986 Regents of the University of California.
  24.  * All rights reserved.  The Berkeley software License Agreement
  25.  * specifies the terms and conditions for redistribution.
  26.  *
  27.  *    @(#)if_ether.h    7.1 (Berkeley) 6/5/86
  28.  */
  29.  
  30. #include "sys/types.h"
  31. #include "sys/socket.h"
  32.  
  33. #include "net/if.h"
  34. #include "net/if_arp.h"
  35.  
  36. #include "netinet/in.h"
  37.  
  38. /*
  39.  * Ethernet address - 6 octets
  40.  */
  41. struct ether_addr {
  42.     u_char    ether_addr_octet[6];
  43. };
  44.  
  45. /*
  46.  * Structure of a 10Mb/s Ethernet header.
  47.  */
  48. struct    ether_header {
  49.     u_char    ether_dhost[6];
  50.     u_char    ether_shost[6];
  51.     u_short    ether_type;
  52. };
  53.  
  54. #define    ETHERTYPE_PUP    0x0200        /* PUP protocol */
  55. #define    ETHERTYPE_IP    0x0800        /* IP protocol */
  56. #define ETHERTYPE_ARP    0x0806        /* Addr. resolution protocol */
  57. #define ETHERTYPE_REVARP 0x8035        /* Reverse ARP */
  58. /*
  59.  * The ETHERTYPE_NTRAILER packet types starting at ETHERTYPE_TRAIL have
  60.  * (type-ETHERTYPE_TRAIL)*512 bytes of data followed
  61.  * by an ETHER type (as given above) and then the (variable-length) header.
  62.  */
  63. #define    ETHERTYPE_TRAIL        0x1000        /* Trailer packet */
  64. #define    ETHERTYPE_NTRAILER    16
  65.  
  66. #define    ETHERMTU    1500
  67. #define    ETHERMIN    (60-14)
  68.  
  69. /*
  70.  * Ethernet Address Resolution Protocol.
  71.  *
  72.  * See RFC 826 for protocol description.  Structure below is adapted
  73.  * to resolving internet addresses.  Field names used correspond to 
  74.  * RFC 826.
  75.  */
  76. struct    ether_arp {
  77.     struct    arphdr ea_hdr;    /* fixed-size header */
  78.     u_char    arp_sha[6];    /* sender hardware address */
  79.     u_char    arp_spa[4];    /* sender protocol address */
  80.     u_char    arp_tha[6];    /* target hardware address */
  81.     u_char    arp_tpa[4];    /* target protocol address */
  82. };
  83. #define    arp_hrd    ea_hdr.ar_hrd
  84. #define    arp_pro    ea_hdr.ar_pro
  85. #define    arp_hln    ea_hdr.ar_hln
  86. #define    arp_pln    ea_hdr.ar_pln
  87. #define    arp_op    ea_hdr.ar_op
  88.  
  89.  
  90. /*
  91.  * Structure shared between the ethernet driver modules and
  92.  * the address resolution code.  For example, each ec_softc or il_softc
  93.  * begins with this structure.
  94.  */
  95. struct    arpcom {
  96.     struct     ifnet ac_if;        /* network-visible interface */
  97.     u_char    ac_enaddr[6];        /* ethernet hardware address */
  98.     struct in_addr ac_ipaddr;    /* copy of ip address- XXX */
  99. };
  100.  
  101. /*
  102.  * Internet to ethernet address resolution table.
  103.  */
  104. struct    arptab {
  105.     struct    in_addr at_iaddr;    /* internet address */
  106.     u_char    at_enaddr[6];        /* ethernet address */
  107.     u_char    at_timer;        /* minutes since last reference */
  108.     u_char    at_flags;        /* flags */
  109.     struct    mbuf *at_hold;        /* last packet until resolved/timeout */
  110. };
  111.  
  112. #ifdef    KERNEL
  113. extern u_char etherbroadcastaddr[];
  114. struct    arptab *arptnew();
  115. char *ether_sprintf();
  116. #endif
  117.  
  118. /* EOF if_ether.h */
  119.