ether.h.html 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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. ether.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='error.h.html' title=' error.h '>PREV</a>]
  17. [<a href='toolkit.html' title=' Index '>HOME</a>]
  18. [<a href='ethernet.h.html' title=' ethernet.h '>NEXT</a>]
  19. </div>
  20. <pre>
  21. /*====================================================================*
  22. *
  23. * ether.h - Ethernet definitions and declarations;
  24. *
  25. * include or exclude various ethernet related definitions based
  26. * platform and environment;
  27. *
  28. *. Qualcomm Atheros HomePlug AV Powerline Toolkit
  29. *: Copyright (c) 2009-2013 by Qualcomm Atheros Inc. ALL RIGHTS RESERVED;
  30. *; For demonstration and evaluation only; Not for production use.
  31. *
  32. *--------------------------------------------------------------------*/
  33. #ifndef ETHER_HEADER
  34. #define ETHER_HEADER
  35. /*====================================================================*
  36. * system header files;
  37. *--------------------------------------------------------------------*/
  38. #include &lt;stdint.h&gt;
  39. #if defined (__linux__)
  40. # include &lt;net/if.h&gt;
  41. # include &lt;net/ethernet.h&gt;
  42. # include &lt;arpa/inet.h&gt;
  43. #elif defined (__APPLE__)
  44. # include &lt;sys/types.h&gt;
  45. # include &lt;sys/socket.h&gt;
  46. # include &lt;net/if.h&gt;
  47. # include &lt;net/ethernet.h&gt;
  48. # include &lt;arpa/inet.h&gt;
  49. # include &lt;net/bpf.h&gt;
  50. #elif defined (__OpenBSD__)
  51. # include &lt;sys/ioctl.h&gt;
  52. # include &lt;sys/types.h&gt;
  53. # include &lt;sys/socket.h&gt;
  54. # include &lt;net/if.h&gt;
  55. # include &lt;netinet/in.h&gt;
  56. # include &lt;netinet/if_ether.h&gt;
  57. # include &lt;net/bpf.h&gt;
  58. # include &lt;fcntl.h&gt;
  59. #elif defined (WIN32)
  60. # if defined (WINPCAP)
  61. # include &lt;pcap.h&gt;
  62. # include &lt;Packet32.h&gt;
  63. # endif
  64. # include &lt;net/ethernet.h&gt;
  65. # include &lt;net/if.h&gt;
  66. #elif defined (__CYGWIN__)
  67. # error &quot;Cygwin in unsupported!&quot;
  68. #else
  69. # error &quot;Unknown environment!&quot;
  70. #endif
  71. /*====================================================================*
  72. * custom header files;
  73. *--------------------------------------------------------------------*/
  74. #include &quot;../tools/types.h&quot;
  75. /*====================================================================*
  76. * variables;
  77. *--------------------------------------------------------------------*/
  78. typedef struct nic
  79. {
  80. unsigned ifindex;
  81. byte ethernet [ETHER_ADDR_LEN];
  82. byte internet [4];
  83. char ifname [IF_NAMESIZE];
  84. char ifdesc [255];
  85. }
  86. NIC;
  87. /*====================================================================*
  88. * ethertypes;
  89. *--------------------------------------------------------------------*/
  90. #define ETH_P_HP10 0x887B
  91. #define ETH_P_HCP 0x88B7
  92. #define ETH_P_LLDP 0x88CC
  93. #define ETH_P_HPAV 0x88E1
  94. #define ETH_P_1905 0x893A
  95. /*====================================================================*
  96. * basic 802.2 Ethernet frame structure;
  97. *--------------------------------------------------------------------*/
  98. #ifndef __GNUC__
  99. #pragma pack (push, 1)
  100. #endif
  101. typedef struct ethernet_frame
  102. {
  103. byte frame_dhost [ETHER_ADDR_LEN];
  104. byte frame_shost [ETHER_ADDR_LEN];
  105. uint16_t frame_type;
  106. byte frame_data [ETHERMTU];
  107. }
  108. FRAME;
  109. #ifndef __GNUC__
  110. #pragma pack (pop)
  111. #endif
  112. /*====================================================================*
  113. * functions;
  114. *--------------------------------------------------------------------*/
  115. char * getifname (signed number);
  116. signed gethwaddr (void * memory, char const * device);
  117. signed anynic (char buffer [], unsigned length);
  118. unsigned hostnics (struct nic list [], unsigned size);
  119. /*====================================================================*
  120. *
  121. *--------------------------------------------------------------------*/
  122. #endif
  123. </pre>
  124. <div class='footerlink'>
  125. [<a href='error.h.html' title=' error.h '>PREV</a>]
  126. [<a href='toolkit.html' title=' Index '>HOME</a>]
  127. [<a href='ethernet.h.html' title=' ethernet.h '>NEXT</a>]
  128. </div>
  129. </body>
  130. </html>