EtherRaw
Public Member Functions
MACAddress Class Reference

Support for IPv4 addresses. More...

#include <EtherRaw.h>

List of all members.

Public Member Functions

 MACAddress ()
 MACAddress (uint8_t octet1, uint8_t octet2, uint8_t octet3, uint8_t octet4, uint8_t octet5, uint8_t octet6)
 MACAddress (const uint8_t *address)
bool operator== (const MACAddress &addr)
bool operator== (const uint8_t *addr)
uint8_t operator[] (int index) const
uint8_t & operator[] (int index)
MACAddressoperator= (const uint8_t *addr)
uint8_t * address ()
size_t printTo (Print &p) const

Detailed Description

Support for IPv4 addresses.

This class allows easy access to the contents of a MAC address in on-the-wire format.


Constructor & Destructor Documentation

MACAddress::MACAddress ( )

Constructor. Clears the address to all zeros

MACAddress::MACAddress ( uint8_t  octet1,
uint8_t  octet2,
uint8_t  octet3,
uint8_t  octet4,
uint8_t  octet5,
uint8_t  octet6 
)

Constructor Initialise the address from separate octets.

Parameters:
[in]octet1Value for octet 1
[in]octet2Value for octet 2
[in]octet3Value for octet 3
[in]octet4Value for octet 4
[in]octet5Value for octet 5
[in]octet6Value for octet 6
MACAddress::MACAddress ( const uint8_t *  address)

Constructor. Initialise the address from some other array or structure.

Parameters:
[in]addressPointer to 6 octets of MAC address

Member Function Documentation

uint8_t * MACAddress::address ( )

Access the raw address as an array of octets.

Returns:
The raw address
MACAddress & MACAddress::operator= ( const uint8_t *  addr)

Assignment operator. Copies the raw address pointed to by addr to this address.

Parameters:
[in]addrThe raw address to be used to initialise this address
Returns:
This address
bool MACAddress::operator== ( const MACAddress addr)

Equality operator. Tests whether 2 addresses are identical.

Parameters:
[in]addrThe other address
Returns:
true if address is identical to this address
bool MACAddress::operator== ( const uint8_t *  addr)

Equality operator. Tests whether 2 addresses are identical.

Parameters:
[in]addrThe other address as some raw array or structure
Returns:
true if address is identical to this address
uint8_t MACAddress::operator[] ( int  index) const

Overloaded index operator. Allow getting and setting individual octets of the address

Parameters:
[in]indexThe index of the octet to access
Returns:
The value of the indexed octet
uint8_t & MACAddress::operator[] ( int  index)

Overloaded index operator. Allow getting and setting individual octets of the address

Parameters:
[in]indexThe index of the octet to access
Returns:
Reference to the value of the indexed octet
size_t MACAddress::printTo ( Print &  p) const

Print. Prints an ASCII formatted version of the address to a Printable such as Serial.

Returns:
The number of characters printed

Referenced by EthernetHeader::printTo().


The documentation for this class was generated from the following files: