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 */
src
network
utils
ethernet-header.h
Generated on Tue Nov 13 2012 10:32:20 for ns-3 by
1.8.1.2