A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
ethernet-header.h
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2007 Emmanuelle Laprise
4
*
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License version 2 as
7
* published by the Free Software Foundation;
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
*
18
* Author: Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
19
*/
20
21
#ifndef ETHERNET_HEADER_H
22
#define ETHERNET_HEADER_H
23
24
#include "ns3/header.h"
25
#include <string>
26
#include "ns3/mac48-address.h"
27
28
namespace
ns3 {
29
34
enum
ethernet_header_t
{
35
LENGTH
,
37
VLAN
,
38
QINQ
39
};
50
class
EthernetHeader
:
public
Header
51
{
52
public
:
53
59
EthernetHeader
(
bool
hasPreamble);
64
EthernetHeader
();
68
void
SetLengthType
(uint16_t size);
72
void
SetSource
(
Mac48Address
source);
76
void
SetDestination
(
Mac48Address
destination);
80
void
SetPreambleSfd
(uint64_t preambleSfd);
84
uint16_t
GetLengthType
(
void
)
const
;
88
ethernet_header_t
GetPacketType
(
void
)
const
;
92
Mac48Address
GetSource
(
void
)
const
;
96
Mac48Address
GetDestination
(
void
)
const
;
100
uint64_t
GetPreambleSfd
()
const
;
104
uint32_t
GetHeaderSize
()
const
;
105
106
static
TypeId
GetTypeId
(
void
);
107
virtual
TypeId
GetInstanceTypeId
(
void
)
const
;
108
virtual
void
Print
(std::ostream &os)
const
;
109
virtual
uint32_t
GetSerializedSize
(
void
)
const
;
110
virtual
void
Serialize
(
Buffer::Iterator
start
)
const
;
111
virtual
uint32_t
Deserialize
(
Buffer::Iterator
start);
112
private
:
113
static
const
int
PREAMBLE_SIZE
= 8;
114
static
const
int
LENGTH_SIZE
= 2;
115
static
const
int
MAC_ADDR_SIZE
= 6;
116
120
bool
m_enPreambleSfd
;
121
uint64_t
m_preambleSfd
;
122
uint16_t
m_lengthType
;
123
Mac48Address
m_source
;
124
Mac48Address
m_destination
;
125
};
126
127
}
// namespace ns3
128
129
130
#endif
/* ETHERNET_HEADER_H */
ns3::Header
Protocol header serialization and deserialization.
Definition:
header.h:42
ns3::EthernetHeader::GetTypeId
static TypeId GetTypeId(void)
Definition:
ethernet-header.cc:118
ns3::EthernetHeader::Print
virtual void Print(std::ostream &os) const
Definition:
ethernet-header.cc:132
ns3::EthernetHeader::PREAMBLE_SIZE
static const int PREAMBLE_SIZE
Definition:
ethernet-header.h:113
ns3::EthernetHeader::GetLengthType
uint16_t GetLengthType(void) const
Definition:
ethernet-header.cc:57
visualizer.core.start
def start
Definition:
core.py:1482
ns3::EthernetHeader::SetSource
void SetSource(Mac48Address source)
Definition:
ethernet-header.cc:77
ns3::Buffer::Iterator
iterator in a Buffer instance
Definition:
buffer.h:98
ns3::VLAN
Single tagged packet.
Definition:
ethernet-header.h:37
ns3::EthernetHeader::GetHeaderSize
uint32_t GetHeaderSize() const
Definition:
ethernet-header.cc:110
ns3::EthernetHeader::Serialize
virtual void Serialize(Buffer::Iterator start) const
Definition:
ethernet-header.cc:160
ns3::EthernetHeader::m_destination
Mac48Address m_destination
Source address.
Definition:
ethernet-header.h:124
ns3::EthernetHeader::m_preambleSfd
uint64_t m_preambleSfd
Definition:
ethernet-header.h:121
ns3::EthernetHeader::SetPreambleSfd
void SetPreambleSfd(uint64_t preambleSfd)
Definition:
ethernet-header.cc:64
ns3::EthernetHeader::EthernetHeader
EthernetHeader()
Construct a null ethernet header By default, does not add or remove an ethernet preamble.
Definition:
ethernet-header.cc:43
ns3::LENGTH
Basic ethernet packet, no tags, type/length field indicates packet length or IP/ARP packet...
Definition:
ethernet-header.h:35
ns3::Mac48Address
an EUI-48 address
Definition:
mac48-address.h:41
ns3::EthernetHeader
Packet header for Ethernet.
Definition:
ethernet-header.h:50
ns3::QINQ
Double tagged packet.
Definition:
ethernet-header.h:38
ns3::EthernetHeader::GetPreambleSfd
uint64_t GetPreambleSfd() const
Definition:
ethernet-header.cc:70
ns3::EthernetHeader::Deserialize
virtual uint32_t Deserialize(Buffer::Iterator start)
Definition:
ethernet-header.cc:174
ns3::EthernetHeader::GetSource
Mac48Address GetSource(void) const
Definition:
ethernet-header.cc:83
ns3::EthernetHeader::GetDestination
Mac48Address GetDestination(void) const
Definition:
ethernet-header.cc:96
ns3::ethernet_header_t
ethernet_header_t
Types of ethernet packets.
Definition:
ethernet-header.h:34
ns3::EthernetHeader::GetInstanceTypeId
virtual TypeId GetInstanceTypeId(void) const
Definition:
ethernet-header.cc:127
ns3::EthernetHeader::m_lengthType
uint16_t m_lengthType
Value of the Preamble/SFD fields.
Definition:
ethernet-header.h:122
ns3::EthernetHeader::GetSerializedSize
virtual uint32_t GetSerializedSize(void) const
Definition:
ethernet-header.cc:146
ns3::EthernetHeader::m_source
Mac48Address m_source
Length or type of the packet.
Definition:
ethernet-header.h:123
ns3::EthernetHeader::MAC_ADDR_SIZE
static const int MAC_ADDR_SIZE
size of the length_type header field
Definition:
ethernet-header.h:115
ns3::EthernetHeader::LENGTH_SIZE
static const int LENGTH_SIZE
size of the preamble_sfd header field
Definition:
ethernet-header.h:114
ns3::EthernetHeader::SetLengthType
void SetLengthType(uint16_t size)
Definition:
ethernet-header.cc:51
ns3::EthernetHeader::m_enPreambleSfd
bool m_enPreambleSfd
size of src/dest addr header fields
Definition:
ethernet-header.h:120
ns3::EthernetHeader::GetPacketType
ethernet_header_t GetPacketType(void) const
Definition:
ethernet-header.cc:103
ns3::EthernetHeader::SetDestination
void SetDestination(Mac48Address destination)
Definition:
ethernet-header.cc:90
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:49
src
network
utils
ethernet-header.h
Generated on Sat Apr 19 2014 14:07:06 for ns-3 by
1.8.6