ch03s14.html 6.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Packet Basics</title><meta name="generator" content="DocBook XSL Stylesheets V1.76.1"><meta name="keywords" content="Intellon, Atheros, Qualcomm, HomePlug, powerline, communications, INT6000, INT6300, INT6400, AR7400, AR7420"><link rel="home" href="index.html" title="Qualcomm Atheros Open Powerline Toolkit"><link rel="up" href="ch03.html" title="Chapter 3.  Software"><link rel="prev" href="ch03s13.html" title="Endian-ness"><link rel="next" href="ch03s15.html" title="Frame Encoding"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">
  2. Packet Basics
  3. </th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch03s13.html">Prev</a> </td><th width="60%" align="center">Chapter 3. 
  4. Software
  5. </th><td width="20%" align="right"> <a accesskey="n" href="ch03s15.html">Next</a></td></tr></table><hr></div><div class="section" title="Packet Basics"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="packet-basics"></a>
  6. Packet Basics
  7. </h2></div></div></div><p>
  8. Local and remote <span class="trademark">HomePlug</span>® AV powerline devices are managed by sending Ethernet frames that contain <span class="trademark">HomePlug AV</span>® formatted management messages. These frames have an 802.3 Ethernet header and a payload that contains the Management Message (MM).
  9. </p><p>
  10. The Ethernet header must be transmitted in newtwork byte order which is big-endian. The Ethernet payload must be sent in <span class="productname">ARM</span>™ host byte order which is little endian. You should use standard network functions <code class="varname">htons()</code> and <code class="varname">htonl()</code> to write Ethernet headers and <code class="varname">ntohs()</code> and <code class="varname">ntohl()</code> to read them. You should use function <code class="varname">HTOLE16()</code> and <code class="varname">HTOLE32()</code> to write integer payload values and <code class="varname">LE26TOH()</code> and <code class="varname">LE32TOH()</code> to read them.
  11. </p><pre class="programlisting">
  12. +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ ... +---+---+
  13. | Ethernet Header | Ethernet Payload |
  14. +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ ... +---+---+
  15. </pre><p>
  16. Ethernet headers consist of a destination address (<code class="constant">ODA</code>), a source address (<code class="constant">OSA</code>) and an ethertype (<code class="constant">MTYPE</code>). The ethertype is always 0x88E1 for Homeplug frames of any type. Programmers may use either function <a class="ulink" href="EthernetHeader.c.html" target="_top">EthernetHeader.c</a> or <a class="ulink" href="EncodeEthernetHeader.c.html" target="_top">EncodeEthernetHeader</a> to encode a buffer with the ODA and OSA and the HomePlug ethertype. An example appears later on. Structure <code class="constant">header_eth</code> is defined in <a class="ulink" href="ihp.h.html" target="_top">ihp.h</a> for this purpose.
  17. </p><pre class="programlisting">
  18. +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ ... +---+---+
  19. | ODA | OSA | MTYPE | Ethernet Payload |
  20. +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ ... +---+---+
  21. </pre><p>
  22. Management messages consist of a message header (MMHEADER) and a message entry (MMENTRY). The message header identifies the nature of the message entry that follows it. The acronyms MME and MMENTRY both mean Management Message Entry but they are often used to mean the entire management message or Ethernet frame. This imprecise usage can be confusing at times. Structure <code class="constant">header_mme</code> is defined in <a class="ulink" href="ihp.h.html" target="_top">ihp.h</a> for this purpose.
  23. </p><pre class="programlisting">
  24. +---+ ... +---+---+---+---+---+---+---+---+---+---+---+ ... +---+---+---+---+---+
  25. | | MMHEADER | MMENTRY |
  26. +---+ ... +---+---+---+---+---+---+---+---+---+---+---+ ... +---+---+---+---+---+
  27. </pre><p>
  28. The message header contains message protocol version (MMV), message type (MMTYPE) and vendor identifier (OUI). The management message entry (MMENTRY) that follows the header contains information unique to a the request (REQ), confirmation (CNF), response (RSP) or indication (IND). Programmers may use the Atheros EncodeAtherosHeader function to encode a buffer with a specific MMTYPE and the Atheros MMV and OUI. AN example appears later on.
  29. </p><pre class="programlisting">
  30. +---+ ... +---+---+---+---+---+---+---+---+---+---+---+ ... +---+---+---+---+---+
  31. | |MMV| MMTYPE| OUI | MMENTRY |
  32. +---+ ... +---+---+---+---+---+---+---+---+---+---+---+ ... +---+---+---+---+---+
  33. </pre><p>
  34. The MMV value, within MMHEADER, indicates the Homeplug AV Management Message protocol version which determines how the message should be interpreted. The protocol version is defined in the HomePlug AV Specification and may change from time to time. One notable change is the recent insertion of an FMI (Fragment Management Information ) field between MMTYPE and OUI , as shown below.
  35. </p><p>
  36. In most cases, protocol changes are hidden from the application by the Atheros API functions; however, software developers should set the <code class="constant">HOMEPLUG_MMV</code> constant, defined in <a class="ulink" href="ihp.h.html" target="_top">ihp.h</a>, to the version appropriate for their firmware or application. The value of this constant enables or disables conditional compilation statements throughout the HomePlug API code base.
  37. </p><p>
  38. To send an MME, you must encode an Ethernet frame buffer with information and transmit it. To read an MME, you must read an Ethernet frame buffer and decode it. The information necessary to encode or decode Atheros vendor-specific Ethernet frames is covered in the <span class="trademark">INT6000</span>™ Firmware Technical Reference Manual; however, the Atheros HomePlug API includes many buffer encode and decode functions that support basic operational requirements.
  39. </p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch03s13.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch03.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch03s15.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">
  40. Endian-ness
  41.  </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 
  42. Frame Encoding
  43. </td></tr></table></div></body></html>