Class ointellon
Introduction
This class implements a HomePlug AV vendor specific message header encoder/decoder. When instantiated, it provides access the Ethernet header plus the vendor specific version, message type and OUI. Class methods may be used to encode/decode or import/export a complete header or individual header fields stored in external memory in proper byte order.
The MessageType property and SetMessageType method perform implicit integer host-to-little-endian and little-endian-to-host conversion.
This class is declared in ointellon.hpp and defined in ointellon.cpp.
Inheritance
This class inherits the oethernet class to implement the Ethernet portion of the message header.
Dependence
This class references static class omemory to manipulate memory.
Properties
Class properties include all oethernet properties plus those described below.
ointellon::HeaderLength
unsigned HeaderLengthvoid
Return the HomePlug AV vendor specific header length in bytes. The header length includes the Ethernet HeaderLength plus the Atheros MessageVersion, MessageType and VendorOUI lengths. Use this property to allocate buffer space in application programs.
ointellon::LocalcastAddress
const uint8_t * LocalcastAddress
Return the Atheros localcast address as a constant 48-bit integer in network byte order. The value is 00:B0:52:00:00:01 and the length is ETHER_ADDR_LEN bytes. Although shown here as a property, this is implemented as a constant. Parentheses are omitted when referencing it.
ointellon::MessageType
uint16_t MessageTypevoid
Return the vendor specific message type as a 16-bit integer in host byte order. This property is the same as the MMTYPE field described in the Firmware Technical Reference Manual. On instantiation, this property constains oINTELLON_MMTYPE, as defined in ointellon.hpp.
ointellon::MessageTypeString
uint16_t MessageTypeStringvoid
Return the HomePlug AV message type as a string. The length is 6 characters including the NUL terminator. The string is formatted as colon-seperated, hexadecimal octets in little-endian order, as in 00:A0.
ointellon::MessageVersion
uint8_t MessageVersionvoid
Return the message version as an 8-bit integer. The message version indicates the revision of the HomePlug AV Specification that describes the message format. On instantiation, this property contains oINTELLON_MMV, as defined in header file ointellon.hpp. No methods are provided for changing the value.
ointellon::MessageVersionString
char const * MessageVersionStringvoid
Return the message version as a string. The length is 3 characters including the NUL terminator. The string is formatted as one hexadecimal octet.
ointellon::VendorOUI
uint8_t VendorOUIvoid
Return the vendor OUI as a byte array in network byte order. The length is ETHER_ADDR_LEN/2 bytes. On instantiation, this property contains 00:B0:52. No methods are provided for changing the value.
ointellon::VendorOUIString
char const * VendorOUIStringvoid
Return the vendor OUI as a string. The length is ETHER_ADDR_LEN*3/2 characters including the NUL terminator. The string is formatted as colon-seperated, hexadecimal octets, as in 00:B0:52.
Methods
Class methods include all oethernet methods plus those described below.
ointellon::ExportHeader
void * ExportHeadervoid * memory
Encode external memory with a HomePlug AV vendor specific message header. Return the address of the next unencoded memory byte. The number of bytes encoded will equal the HeaderLength property. The memory address is incremented by that amount and returned as the method value for subsequent export operations. The encoded header will include the Ethernet header plus the Atheros specific MessageVersion and MessageType. Instance properties are not modified by the operation.
ointellon::ImportHeader
void const * ImportHeadervoid const * memory
Decode external memory containing a HomePlug AV specific header. Return the address of the next undecoded memory byte. No length argument is required. The number of bytes decoded will be HeaderLength. The memory address is incremented by that amount and returned as the method value for subsequent import operations. External memory is unpacked and stored in Ethernet header properties and the Atheros MessageVersion and MessageType properties. External memory is not modified by this operation.
ointellon::IsMessageType
bool IsMessageTypeuint16_t type
Return true if this instance contains the expected Atheros vendor specific message header having the specified message type. This method may be called after importing an unknown message header to verify that the instance now contains the expected MessageType of type and the default MessageVersion and VendorOUI, all in one operation. It is typically used to detect, and possibly ignore, unexpected confirmation and indiction messages.
ointellon::SetMessageVersion
ointellon & SetMessageVersionuint8_t version
Assign a new value to the message version.
ointellon::SetMessageType
ointellon & SetMessageTypeuint16_t type
Specify the HomePlug AV vendor specific message type as an integer in host byte order. The type is stored internally in little-endian order. Valid HomePlug AV vendor specific message types are 0xA000 through 0xBFFC but this method does not validate the argument so any 16-bit value is permitted.
ointellon::Print
ointellon & Printvoid
Print the HomePlug AV header on stdout in human-friendly format.