Packet header for Ethernet.
More...
#include <ethernet-header.h>
List of all members.
Detailed Description
Packet header for Ethernet.
This class can be used to add a header to an ethernet packet that will specify the source and destination addresses and the length of the packet. Eventually the class will be improved to also support VLAN tags in packet headers.
Constructor & Destructor Documentation
ns3::EthernetHeader::EthernetHeader |
( |
bool |
hasPreamble |
) |
|
Construct a null ethernet header.
- Parameters:
-
| hasPreamble | if true, insert and remove an ethernet preamble from the packet, if false, does not insert and remove it. |
Member Function Documentation
virtual uint32_t ns3::EthernetHeader::Deserialize |
( |
Buffer::Iterator |
start |
) |
[virtual] |
- Parameters:
-
| start | an iterator which points to where the header should written. |
- Returns:
- the number of bytes read.
This method is used by Packet::RemoveHeader to re-create a header from the byte buffer of a packet. The data read is expected to match bit-for-bit the representation of this header in real networks.
Implements ns3::Header.
Mac48Address ns3::EthernetHeader::GetDestination |
( |
void |
|
) |
const |
- Returns:
- The destination address of this packet
uint32_t ns3::EthernetHeader::GetHeaderSize |
( |
|
) |
const |
- Returns:
- The size of the header
virtual TypeId ns3::EthernetHeader::GetInstanceTypeId |
( |
void |
|
) |
const [virtual] |
uint16_t ns3::EthernetHeader::GetLengthType |
( |
void |
|
) |
const |
- Returns:
- The size of the payload in bytes
- Returns:
- The type of packet (only basic Ethernet is currently supported)
uint64_t ns3::EthernetHeader::GetPreambleSfd |
( |
|
) |
const |
- Returns:
- The value of the PreambleSfd field
virtual uint32_t ns3::EthernetHeader::GetSerializedSize |
( |
void |
|
) |
const [virtual] |
- Returns:
- the expected size of the header.
This method is used by Packet::AddHeader to store a header into the byte buffer of a packet. This method should return the number of bytes which are needed to store the full header data by Serialize.
Implements ns3::Header.
- Returns:
- The source address of this packet
static TypeId ns3::EthernetHeader::GetTypeId |
( |
void |
|
) |
[static] |
virtual void ns3::EthernetHeader::Print |
( |
std::ostream & |
os |
) |
const [virtual] |
This method is used by Packet::Print to print the content of a trailer as ascii data to a c++ output stream. Although the trailer is free to format its output as it wishes, it is recommended to follow a few rules to integrate with the packet pretty printer: start with flags, small field values located between a pair of parens. Values should be separated by whitespace. Follow the parens with the important fields, separated by whitespace. i.e.: (field1 val1 field2 val2 field3 val3) field4 val4 field5 val5
Implements ns3::Header.
virtual void ns3::EthernetHeader::Serialize |
( |
Buffer::Iterator |
start |
) |
const [virtual] |
- Parameters:
-
| start | an iterator which points to where the header should be written. |
This method is used by Packet::AddHeader to store a header into the byte buffer of a packet. The data written is expected to match bit-for-bit the representation of this header in a real network.
Implements ns3::Header.
void ns3::EthernetHeader::SetDestination |
( |
Mac48Address |
destination |
) |
|
- Parameters:
-
| destination | The destination address of this packet. |
void ns3::EthernetHeader::SetLengthType |
( |
uint16_t |
size |
) |
|
- Parameters:
-
| size | The size of the payload in bytes |
void ns3::EthernetHeader::SetPreambleSfd |
( |
uint64_t |
preambleSfd |
) |
|
- Parameters:
-
| preambleSfd | The value that the preambleSfd field should take |
- Parameters:
-
| source | The source address of this packet |
Member Data Documentation
size of src/dest addr header fields
If false, the preamble/sfd are not serialised/deserialised.
The documentation for this class was generated from the following files:
- src/node/ethernet-header.h
- doc/introspected-doxygen.h