ethernet.h.html 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. <?xml version='1.0' encoding='iso-8859-1'?>
  2. <!doctype html public '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
  3. <html xmlns='http://www.w3c.org/1999/xhtml' lang='en-us'>
  4. <head>
  5. <title>
  6. ethernet.h
  7. </title>
  8. <meta http-equiv='content-type' content='text/html;iso-8859-1'/>
  9. <meta name='generator' content='motley-tools 1.9.4 13:40:33 Feb 18 2015'/>
  10. <meta name='author' content='cmaier@cmassoc.net'/>
  11. <meta name='robots' content='noindex,nofollow'/>
  12. <link href='toolkit.css' rel='stylesheet' type='text/css'/>
  13. </head>
  14. <body>
  15. <div class='headerlink'>
  16. [<a href='ether.h.html' title=' ether.h '>PREV</a>]
  17. [<a href='toolkit.html' title=' Index '>HOME</a>]
  18. [<a href='files.h.html' title=' files.h '>NEXT</a>]
  19. </div>
  20. <pre>
  21. /*====================================================================*
  22. *
  23. * Copyright (c) 2011 by Qualcomm Atheros.
  24. *
  25. * Permission to use, copy, modify, and/or distribute this software
  26. * for any purpose with or without fee is hereby granted, provided
  27. * that the above copyright notice and this permission notice appear
  28. * in all copies.
  29. *
  30. * THE SOFTWARE IS PROVIDED &quot;AS IS&quot; AND THE AUTHOR DISCLAIMS ALL
  31. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  32. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
  33. * THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
  34. * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  35. * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
  36. * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
  37. * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  38. *
  39. *--------------------------------------------------------------------*/
  40. /*====================================================================*
  41. *
  42. * ethernet.h - substitute net/ethernet.h for systems without one;
  43. *
  44. *. Intellon INT6000 Linux Toolkit for HomePlug AV;
  45. *: Published 2006-2009 by Intellon Corp. ALL RIGHTS RESERVED;
  46. *; For demonstration; Not for production use;
  47. *
  48. *--------------------------------------------------------------------*/
  49. #ifndef ETHERNET_HEADER
  50. #define ETHERNET_HEADER
  51. /*====================================================================*
  52. * system header files;
  53. *--------------------------------------------------------------------*/
  54. #include &lt;stdint.h&gt;
  55. /*====================================================================*
  56. * Ethernet frame lengths;
  57. *--------------------------------------------------------------------*/
  58. #define ETHER_ADDR_LEN 6
  59. #define ETHER_TYPE_LEN 2
  60. #define ETHER_CRC_LEN 4
  61. #define ETHER_HDR_LEN (ETHER_ADDR_LEN + ETHER_ADDR_LEN + ETHER_TYPE_LEN)
  62. #define ETHER_MIN_LEN 64
  63. #define ETHER_MAX_LEN 1518
  64. #define ETHERMTU 1500
  65. #define ETHERMIN (ETHER_MIN_LEN - ETHER_HDR_LEN - ETHER_CRC_LEN)
  66. /*====================================================================*
  67. * Ethernet type/length field values;
  68. *--------------------------------------------------------------------*/
  69. #define ETHERTYPE_PUP 0x0200
  70. #define ETHERTYPE_IP 0x0800
  71. #define ETHERTYPE_ARP 0x0806
  72. #define ETHERTYPE_REVARP 0x8035
  73. #define ETHERTYPE_VLAN 0x8100
  74. #define ETHERTYPE_IPV6 0x86dd
  75. #define ETHERTYPE_LOOPBACK 0x9000
  76. #define ETHERTYPE_HP10 0x887B
  77. #define ETHERTYPE_HPAV 0x88E1
  78. /*====================================================================*
  79. * Ethernet frame structure;
  80. *--------------------------------------------------------------------*/
  81. #pragma pack (push, 1)
  82. struct ether_header
  83. {
  84. uint8_t ether_dhost [ETHER_ADDR_LEN];
  85. uint8_t ether_shost [ETHER_ADDR_LEN];
  86. uint16_t ether_type;
  87. };
  88. #pragma pack (pop)
  89. /*====================================================================*
  90. *
  91. *--------------------------------------------------------------------*/
  92. #endif
  93. </pre>
  94. <div class='footerlink'>
  95. [<a href='ether.h.html' title=' ether.h '>PREV</a>]
  96. [<a href='toolkit.html' title=' Index '>HOME</a>]
  97. [<a href='files.h.html' title=' files.h '>NEXT</a>]
  98. </div>
  99. </body>
  100. </html>