|
Whisper Library
|
Represents an ethernet header. More...
Public Member Functions | |
| EthernetHeader () | |
| Constructor that initializes the header with 0. | |
| EthernetHeader (unsigned char *header) | |
| Constructor that initializees the header with the given char array. More... | |
| ~EthernetHeader () | |
| Destructor. | |
| string | sourceMAC () |
| Returns the source mac address in the format ff:ff:ff:ff:ff:ff (hexadecimal, bytes seperated by :) | |
| string | destinationMAC () |
| Returns the destination mac address in the format ff:ff:ff:ff:ff:ff (hexadecimal, bytes seperated by :) | |
| unsigned long | ethernetType () |
| Returns the ethernet type (2048<-> ipv4) | |
| void | setSourceMAC (string mac) |
| Sets the source mac address in the format ff:ff:ff:ff:ff:ff (hexadecimal, bytes seperated by :) | |
| void | setSourceMAC (unsigned char *char_array) |
| Sets the source mac address. More... | |
| void | setDestinationMAC (string mac) |
| Sets the destination mac address in the format ff:ff:ff:ff:ff:ff (hexadecimal, bytes seperated by :) | |
| void | setDestinationMAC (unsigned char *char_array) |
| Sets the destination mac address. More... | |
| void | setEthernetType (unsigned long type) |
| Sets the ethernet type (2048<-> ipv4) | |
| vector< bool > | toVector () |
| Returns the content of the header as binary in little endian. | |
| string | toString () |
| Creates a string which lists all fields and values in humanly readable form. More... | |
Static Public Member Functions | |
| static string | toMacString (unsigned char *buffer) |
| Converts a binary mac address to a string in the format ff:ff:ff:ff:ff:ff (hexadecimal, bytes seperated by :) More... | |
Private Member Functions | |
| unsigned char | hexToInt (string hex) |
| Converts hexadecimal to decimal. More... | |
Static Private Member Functions | |
| static string | intToHex (unsigned int i) |
| Converts an integer to hexadecimal. More... | |
Private Attributes | |
| unsigned char * | m_head |
| holds the 14 byte header | |
Represents an ethernet header.
This class provides getters and setters for all ethernet header fields (IEEE 802.3 without extensions) The content is exported as binary by using 'toVector'.
| whisper_library::EthernetHeader::EthernetHeader | ( | unsigned char * | header | ) |
Constructor that initializees the header with the given char array.
| header | pointer to char array of 14 byte (char <-> 1 byte) |
|
private |
Converts hexadecimal to decimal.
| hex | hexadecimal string, maximum 1 byte |
|
staticprivate |
Converts an integer to hexadecimal.
| i | Integer you want to convert |
| void whisper_library::EthernetHeader::setDestinationMAC | ( | unsigned char * | char_array | ) |
Sets the destination mac address.
| char_array | pointer to a char array of 6 bytes |
| void whisper_library::EthernetHeader::setSourceMAC | ( | unsigned char * | char_array | ) |
Sets the source mac address.
| char_array | pointer to a char array of 6 bytes |
|
static |
Converts a binary mac address to a string in the format ff:ff:ff:ff:ff:ff (hexadecimal, bytes seperated by :)
| buffer | pointer to a char array of 6 byte |
| string whisper_library::EthernetHeader::toString | ( | ) |
Creates a string which lists all fields and values in humanly readable form.