ethernet_packet Class Reference

The ethernet_packet class contains function to change the ethernet information in bytes from the ethernet packet header to human readable data types (strings) More...

`#include <ethernet_packet.h>`

Inheritance diagram for ethernet_packet:

## Public Member Functions

| ethernet_packet ()
| Constructor, does nothing.
void | setEtherDHost (u_char[])
| Receives the array of 6 bytes of a destination host. More...
void | setEtherSHost (u_char[])
| Receives the array of 6 bytes of a source host. More...
void | setEtherType (u_short)
| Set the Ethernet type. More...
string | getEtherDHost ()
| Returns the destination HA in string format. More...
string | getEtherSHost ()
| Returns the source HA in string format. More...
u_short | getEtherType ()
| Returns the Ethernet type. More...

## Private Member Functions

string | mac2string (u_char[])
| Function to change the array of bytes representing a Hardware Address to its standard string representation. More...

## Private Attributes

sniff_ethernet | ethernet

## Detailed Description

The ethernet_packet class contains function to change the ethernet information in bytes from the ethernet packet header to human readable data types (strings)

## Member Function Documentation

string ethernet_packet::getEtherDHost | ( |  | ) |

Returns the destination HA in string format.

Returns
  the destination HA in string format

string ethernet_packet::getEtherSHost | ( |  | ) |

Returns the source HA in string format.

Returns
  the source HA in string format

u_short ethernet_packet::getEtherType | ( |  | ) |

Returns the Ethernet type.

Returns
  the Ethernet type.

string ethernet_packet::mac2string | ( | u_char | srcmac[] | ) |

private

Function to change the array of bytes representing a Hardware Address to its standard string representation.

Parameters

  srcmac | array with an Ethernet address

Returns
  Ethernet address in string format

void ethernet_packet::setEtherDHost | ( | u_char | dhost[] | ) |

Receives the array of 6 bytes of a destination host.

Parameters

  dhost | destination host Ethernet address

void ethernet_packet::setEtherSHost | ( | u_char | shost[] | ) |

Receives the array of 6 bytes of a source host.

Parameters

  shost | source host Ethernet address

void ethernet_packet::setEtherType | ( | u_short | type | ) |

Set the Ethernet type.

Parameters

  type | Ethernet type

## Member Data Documentation

sniff_ethernet ethernet_packet::ethernet

private

Ethernet header / encabezado Ethernet

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

- ethernet_packet.h
- ethernet_packet.cpp