A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
dsr-fs-header.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2011 Yufei Cheng
3
*
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License version 2 as
6
* published by the Free Software Foundation;
7
*
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
12
*
13
* You should have received a copy of the GNU General Public License
14
* along with this program; if not, write to the Free Software
15
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
*
17
* Author: Yufei Cheng <yfcheng@ittc.ku.edu>
18
*
19
* James P.G. Sterbenz <jpgs@ittc.ku.edu>, director
20
* ResiliNets Research Group https://resilinets.org/
21
* Information and Telecommunication Technology Center (ITTC)
22
* and Department of Electrical Engineering and Computer Science
23
* The University of Kansas Lawrence, KS USA.
24
*
25
* Work supported in part by NSF FIND (Future Internet Design) Program
26
* under grant CNS-0626918 (Postmodern Internet Architecture),
27
* NSF grant CNS-1050226 (Multilayer Network Resilience Analysis and Experimentation on GENI),
28
* US Department of Defense (DoD), and ITTC at The University of Kansas.
29
*/
30
31
#ifndef DSR_FS_HEADER_H
32
#define DSR_FS_HEADER_H
33
34
#include "
dsr-option-header.h
"
35
36
#include "ns3/header.h"
37
#include "ns3/ipv4-address.h"
38
39
#include <list>
40
#include <ostream>
41
#include <vector>
42
43
namespace
ns3
44
{
45
namespace
dsr
46
{
81
class
DsrFsHeader
:
public
Header
82
{
83
public
:
88
static
TypeId
GetTypeId
();
93
TypeId
GetInstanceTypeId
()
const override
;
97
DsrFsHeader
();
101
~DsrFsHeader
()
override
;
106
void
SetNextHeader
(uint8_t protocol);
111
uint8_t
GetNextHeader
()
const
;
116
void
SetMessageType
(uint8_t messageType);
121
uint8_t
GetMessageType
()
const
;
126
void
SetSourceId
(uint16_t sourceId);
131
uint16_t
GetSourceId
()
const
;
136
void
SetDestId
(uint16_t destId);
141
uint16_t
GetDestId
()
const
;
146
void
SetPayloadLength
(uint16_t length);
151
uint16_t
GetPayloadLength
()
const
;
156
void
Print
(std::ostream& os)
const override
;
161
uint32_t
GetSerializedSize
()
const override
;
166
void
Serialize
(
Buffer::Iterator
start
)
const override
;
172
uint32_t
Deserialize
(
Buffer::Iterator
start
)
override
;
173
174
private
:
178
uint8_t
m_nextHeader
;
182
uint8_t
m_messageType
;
186
uint16_t
m_payloadLen
;
190
uint16_t
m_sourceId
;
194
uint16_t
m_destId
;
198
Buffer
m_data
;
199
};
200
211
class
DsrOptionField
212
{
213
public
:
218
DsrOptionField
(uint32_t optionsOffset);
222
~DsrOptionField
();
227
uint32_t
GetSerializedSize
()
const
;
232
void
Serialize
(
Buffer::Iterator
start
)
const
;
239
uint32_t
Deserialize
(
Buffer::Iterator
start
, uint32_t length);
244
void
AddDsrOption
(
const
DsrOptionHeader
& option);
250
uint32_t
GetDsrOptionsOffset
()
const
;
255
Buffer
GetDsrOptionBuffer
();
256
257
private
:
263
uint32_t
CalculatePad
(
DsrOptionHeader::Alignment
alignment)
const
;
267
Buffer
m_optionData
;
271
uint32_t
m_optionsOffset
;
272
};
273
278
class
DsrRoutingHeader
:
public
DsrFsHeader
,
public
DsrOptionField
279
{
280
public
:
285
static
TypeId
GetTypeId
();
290
TypeId
GetInstanceTypeId
()
const override
;
294
DsrRoutingHeader
();
298
~DsrRoutingHeader
()
override
;
303
void
Print
(std::ostream& os)
const override
;
308
uint32_t
GetSerializedSize
()
const override
;
313
void
Serialize
(
Buffer::Iterator
start
)
const override
;
319
uint32_t
Deserialize
(
Buffer::Iterator
start
)
override
;
320
};
321
322
static
inline
std::ostream&
323
operator<<
(std::ostream& os,
const
DsrRoutingHeader
& dsr)
324
{
325
dsr.
Print
(os);
326
return
os;
327
}
328
329
}
// namespace dsr
330
}
// namespace ns3
331
332
#endif
/* DSR_FS_HEADER_H */
ns3::Buffer::Iterator
iterator in a Buffer instance
Definition:
buffer.h:100
ns3::Buffer
automatically resized byte buffer
Definition:
buffer.h:94
ns3::Header
Protocol header serialization and deserialization.
Definition:
header.h:44
ns3::Header::Deserialize
virtual uint32_t Deserialize(Buffer::Iterator start)=0
Deserialize the object from a buffer iterator.
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:59
ns3::dsr::DsrFsHeader
Dsr fixed size header Format.
Definition:
dsr-fs-header.h:82
ns3::dsr::DsrFsHeader::SetSourceId
void SetSourceId(uint16_t sourceId)
brief Set the source ID of the header.
Definition:
dsr-fs-header.cc:114
ns3::dsr::DsrFsHeader::DsrFsHeader
DsrFsHeader()
Constructor.
Definition:
dsr-fs-header.cc:63
ns3::dsr::DsrFsHeader::SetNextHeader
void SetNextHeader(uint8_t protocol)
Set the "Next header" field.
Definition:
dsr-fs-header.cc:78
ns3::dsr::DsrFsHeader::SetDestId
void SetDestId(uint16_t destId)
brief Set the dest ID of the header.
Definition:
dsr-fs-header.cc:126
ns3::dsr::DsrFsHeader::GetMessageType
uint8_t GetMessageType() const
brief Get the message type of the header.
Definition:
dsr-fs-header.cc:96
ns3::dsr::DsrFsHeader::GetTypeId
static TypeId GetTypeId()
Get the type identificator.
Definition:
dsr-fs-header.cc:48
ns3::dsr::DsrFsHeader::GetNextHeader
uint8_t GetNextHeader() const
Get the next header.
Definition:
dsr-fs-header.cc:84
ns3::dsr::DsrFsHeader::m_destId
uint16_t m_destId
The destination node id.
Definition:
dsr-fs-header.h:194
ns3::dsr::DsrFsHeader::m_sourceId
uint16_t m_sourceId
The source node id.
Definition:
dsr-fs-header.h:190
ns3::dsr::DsrFsHeader::GetSourceId
uint16_t GetSourceId() const
brief Get the source ID of the header.
Definition:
dsr-fs-header.cc:120
ns3::dsr::DsrFsHeader::GetInstanceTypeId
TypeId GetInstanceTypeId() const override
Get the instance type ID.
Definition:
dsr-fs-header.cc:58
ns3::dsr::DsrFsHeader::Serialize
void Serialize(Buffer::Iterator start) const override
Serialize the packet.
Definition:
dsr-fs-header.cc:153
ns3::dsr::DsrFsHeader::GetDestId
uint16_t GetDestId() const
brief Get the dest ID of the header.
Definition:
dsr-fs-header.cc:132
ns3::dsr::DsrFsHeader::m_messageType
uint8_t m_messageType
The type of the message.
Definition:
dsr-fs-header.h:182
ns3::dsr::DsrFsHeader::m_payloadLen
uint16_t m_payloadLen
The "payload length" field.
Definition:
dsr-fs-header.h:186
ns3::dsr::DsrFsHeader::SetMessageType
void SetMessageType(uint8_t messageType)
brief Set the message type of the header.
Definition:
dsr-fs-header.cc:90
ns3::dsr::DsrFsHeader::GetPayloadLength
uint16_t GetPayloadLength() const
Get the payload length of the header.
Definition:
dsr-fs-header.cc:108
ns3::dsr::DsrFsHeader::SetPayloadLength
void SetPayloadLength(uint16_t length)
brief Set the payload length of the header.
Definition:
dsr-fs-header.cc:102
ns3::dsr::DsrFsHeader::m_nextHeader
uint8_t m_nextHeader
The "next header" field.
Definition:
dsr-fs-header.h:178
ns3::dsr::DsrFsHeader::m_data
Buffer m_data
The data of the extension.
Definition:
dsr-fs-header.h:198
ns3::dsr::DsrFsHeader::Print
void Print(std::ostream &os) const override
Print some information about the packet.
Definition:
dsr-fs-header.cc:138
ns3::dsr::DsrFsHeader::~DsrFsHeader
~DsrFsHeader() override
Destructor.
Definition:
dsr-fs-header.cc:73
ns3::dsr::DsrFsHeader::GetSerializedSize
uint32_t GetSerializedSize() const override
Get the serialized size of the packet.
Definition:
dsr-fs-header.cc:147
ns3::dsr::DsrOptionField
Option field for an DsrFsHeader Enables adding options to an DsrFsHeader.
Definition:
dsr-fs-header.h:212
ns3::dsr::DsrOptionField::Serialize
void Serialize(Buffer::Iterator start) const
Serialize all added options.
Definition:
dsr-fs-header.cc:214
ns3::dsr::DsrOptionField::AddDsrOption
void AddDsrOption(const DsrOptionHeader &option)
Serialize the option, prepending pad1 or padn option as necessary.
Definition:
dsr-fs-header.cc:245
ns3::dsr::DsrOptionField::Deserialize
uint32_t Deserialize(Buffer::Iterator start, uint32_t length)
Deserialize the packet.
Definition:
dsr-fs-header.cc:234
ns3::dsr::DsrOptionField::m_optionData
Buffer m_optionData
Data payload.
Definition:
dsr-fs-header.h:267
ns3::dsr::DsrOptionField::GetDsrOptionBuffer
Buffer GetDsrOptionBuffer()
Get the buffer.
Definition:
dsr-fs-header.cc:282
ns3::dsr::DsrOptionField::m_optionsOffset
uint32_t m_optionsOffset
Offset.
Definition:
dsr-fs-header.h:271
ns3::dsr::DsrOptionField::GetDsrOptionsOffset
uint32_t GetDsrOptionsOffset() const
Get the offset where the options begin, measured from the start of the extension header.
Definition:
dsr-fs-header.cc:276
ns3::dsr::DsrOptionField::GetSerializedSize
uint32_t GetSerializedSize() const
Get the serialized size of the packet.
Definition:
dsr-fs-header.cc:207
ns3::dsr::DsrOptionField::CalculatePad
uint32_t CalculatePad(DsrOptionHeader::Alignment alignment) const
Calculate padding.
Definition:
dsr-fs-header.cc:270
ns3::dsr::DsrOptionField::DsrOptionField
DsrOptionField(uint32_t optionsOffset)
Constructor.
Definition:
dsr-fs-header.cc:196
ns3::dsr::DsrOptionField::~DsrOptionField
~DsrOptionField()
Destructor.
Definition:
dsr-fs-header.cc:202
ns3::dsr::DsrOptionHeader
Header for Dsr Options.
Definition:
dsr-option-header.h:53
ns3::dsr::DsrRoutingHeader
Header of Dsr Routing.
Definition:
dsr-fs-header.h:279
ns3::dsr::DsrRoutingHeader::DsrRoutingHeader
DsrRoutingHeader()
Constructor.
Definition:
dsr-fs-header.cc:303
ns3::dsr::DsrRoutingHeader::GetSerializedSize
uint32_t GetSerializedSize() const override
Get the serialized size of the packet.
Definition:
dsr-fs-header.cc:322
ns3::dsr::DsrRoutingHeader::~DsrRoutingHeader
~DsrRoutingHeader() override
Destructor.
Definition:
dsr-fs-header.cc:308
ns3::dsr::DsrRoutingHeader::Print
void Print(std::ostream &os) const override
Print some information about the packet.
Definition:
dsr-fs-header.cc:313
ns3::dsr::DsrRoutingHeader::GetTypeId
static TypeId GetTypeId()
Get the type identificator.
Definition:
dsr-fs-header.cc:290
ns3::dsr::DsrRoutingHeader::GetInstanceTypeId
TypeId GetInstanceTypeId() const override
Get the instance type ID.
Definition:
dsr-fs-header.cc:298
ns3::dsr::DsrRoutingHeader::Serialize
void Serialize(Buffer::Iterator start) const override
Serialize the packet.
Definition:
dsr-fs-header.cc:329
dsr-option-header.h
ns3::dsr::operator<<
static std::ostream & operator<<(std::ostream &os, const DsrRoutingHeader &dsr)
Definition:
dsr-fs-header.h:323
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
two-ray-to-three-gpp-ch-calibration.start
start
Definition:
two-ray-to-three-gpp-ch-calibration.py:520
ns3::dsr::DsrOptionHeader::Alignment
represents the alignment requirements of an option header
Definition:
dsr-option-header.h:60
src
dsr
model
dsr-fs-header.h
Generated on Sun Mar 3 2024 17:10:56 for ns-3 by
1.9.1