A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
dsdv-packet.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2010 Hemanth Narra
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Author: Hemanth Narra <hemanth@ittc.ku.com>
7
*
8
* James P.G. Sterbenz <jpgs@ittc.ku.edu>, director
9
* ResiliNets Research Group https://resilinets.org/
10
* Information and Telecommunication Technology Center (ITTC)
11
* and Department of Electrical Engineering and Computer Science
12
* The University of Kansas Lawrence, KS USA.
13
*
14
* Work supported in part by NSF FIND (Future Internet Design) Program
15
* under grant CNS-0626918 (Postmodern Internet Architecture),
16
* NSF grant CNS-1050226 (Multilayer Network Resilience Analysis and Experimentation on GENI),
17
* US Department of Defense (DoD), and ITTC at The University of Kansas.
18
*/
19
20
#ifndef DSDV_PACKET_H
21
#define DSDV_PACKET_H
22
23
#include "ns3/header.h"
24
#include "ns3/ipv4-address.h"
25
#include "ns3/nstime.h"
26
27
#include <iostream>
28
29
namespace
ns3
30
{
31
namespace
dsdv
32
{
33
/**
34
* \ingroup dsdv
35
* \brief DSDV Update Packet Format
36
* \verbatim
37
| 0 | 1 | 2 | 3 |
38
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
39
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
40
| Destination Address |
41
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
42
| HopCount |
43
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
44
| Sequence Number |
45
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
46
* \endverbatim
47
*/
48
49
class
DsdvHeader
:
public
Header
50
{
51
public
:
52
/**
53
* Constructor
54
*
55
* \param dst destination IP address
56
* \param hopcount hop count
57
* \param dstSeqNo destination sequence number
58
*/
59
DsdvHeader
(
Ipv4Address
dst =
Ipv4Address
(),
uint32_t
hopcount = 0,
uint32_t
dstSeqNo = 0);
60
~DsdvHeader
()
override
;
61
/**
62
* \brief Get the type ID.
63
* \return the object TypeId
64
*/
65
static
TypeId
GetTypeId
();
66
TypeId
GetInstanceTypeId
()
const override
;
67
uint32_t
GetSerializedSize
()
const override
;
68
void
Serialize
(
Buffer::Iterator
start)
const override
;
69
uint32_t
Deserialize
(
Buffer::Iterator
start)
override
;
70
void
Print
(std::ostream& os)
const override
;
71
72
/**
73
* Set destination address
74
* \param destination the destination IPv4 address
75
*/
76
void
SetDst
(
Ipv4Address
destination)
77
{
78
m_dst
= destination;
79
}
80
81
/**
82
* Get destination address
83
* \returns the destination IPv4 address
84
*/
85
Ipv4Address
GetDst
()
const
86
{
87
return
m_dst
;
88
}
89
90
/**
91
* Set hop count
92
* \param hopCount the hop count
93
*/
94
void
SetHopCount
(
uint32_t
hopCount)
95
{
96
m_hopCount
= hopCount;
97
}
98
99
/**
100
* Get hop count
101
* \returns the hop count
102
*/
103
uint32_t
GetHopCount
()
const
104
{
105
return
m_hopCount
;
106
}
107
108
/**
109
* Set destination sequence number
110
* \param sequenceNumber The sequence number
111
*/
112
void
SetDstSeqno
(
uint32_t
sequenceNumber)
113
{
114
m_dstSeqNo
= sequenceNumber;
115
}
116
117
/**
118
* Get destination sequence number
119
* \returns the destination sequence number
120
*/
121
uint32_t
GetDstSeqno
()
const
122
{
123
return
m_dstSeqNo
;
124
}
125
126
private
:
127
Ipv4Address
m_dst
;
///< Destination IP Address
128
uint32_t
m_hopCount
;
///< Number of Hops
129
uint32_t
m_dstSeqNo
;
///< Destination Sequence Number
130
};
131
132
static
inline
std::ostream&
133
operator<<
(std::ostream& os,
const
DsdvHeader
& packet)
134
{
135
packet.
Print
(os);
136
return
os;
137
}
138
}
// namespace dsdv
139
}
// namespace ns3
140
141
#endif
/* DSDV_PACKET_H */
ns3::Buffer::Iterator
iterator in a Buffer instance
Definition
buffer.h:89
ns3::Header
Protocol header serialization and deserialization.
Definition
header.h:33
ns3::Ipv4Address
Ipv4 addresses are stored in host order in this class.
Definition
ipv4-address.h:31
ns3::TypeId
a unique identifier for an interface.
Definition
type-id.h:48
ns3::dsdv::DsdvHeader
DSDV Update Packet Format.
Definition
dsdv-packet.h:50
ns3::dsdv::DsdvHeader::m_hopCount
uint32_t m_hopCount
Number of Hops.
Definition
dsdv-packet.h:128
ns3::dsdv::DsdvHeader::DsdvHeader
DsdvHeader(Ipv4Address dst=Ipv4Address(), uint32_t hopcount=0, uint32_t dstSeqNo=0)
Constructor.
Definition
dsdv-packet.cc:31
ns3::dsdv::DsdvHeader::GetDst
Ipv4Address GetDst() const
Get destination address.
Definition
dsdv-packet.h:85
ns3::dsdv::DsdvHeader::SetDstSeqno
void SetDstSeqno(uint32_t sequenceNumber)
Set destination sequence number.
Definition
dsdv-packet.h:112
ns3::dsdv::DsdvHeader::GetHopCount
uint32_t GetHopCount() const
Get hop count.
Definition
dsdv-packet.h:103
ns3::dsdv::DsdvHeader::m_dst
Ipv4Address m_dst
Destination IP Address.
Definition
dsdv-packet.h:127
ns3::dsdv::DsdvHeader::GetDstSeqno
uint32_t GetDstSeqno() const
Get destination sequence number.
Definition
dsdv-packet.h:121
ns3::dsdv::DsdvHeader::~DsdvHeader
~DsdvHeader() override
Definition
dsdv-packet.cc:38
ns3::dsdv::DsdvHeader::Serialize
void Serialize(Buffer::Iterator start) const override
Definition
dsdv-packet.cc:65
ns3::dsdv::DsdvHeader::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition
dsdv-packet.cc:43
ns3::dsdv::DsdvHeader::SetDst
void SetDst(Ipv4Address destination)
Set destination address.
Definition
dsdv-packet.h:76
ns3::dsdv::DsdvHeader::m_dstSeqNo
uint32_t m_dstSeqNo
Destination Sequence Number.
Definition
dsdv-packet.h:129
ns3::dsdv::DsdvHeader::Print
void Print(std::ostream &os) const override
Definition
dsdv-packet.cc:87
ns3::dsdv::DsdvHeader::GetSerializedSize
uint32_t GetSerializedSize() const override
Definition
dsdv-packet.cc:59
ns3::dsdv::DsdvHeader::SetHopCount
void SetHopCount(uint32_t hopCount)
Set hop count.
Definition
dsdv-packet.h:94
ns3::dsdv::DsdvHeader::Deserialize
uint32_t Deserialize(Buffer::Iterator start) override
Definition
dsdv-packet.cc:73
ns3::dsdv::DsdvHeader::GetInstanceTypeId
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
Definition
dsdv-packet.cc:53
uint32_t
ns3::dsdv::operator<<
static std::ostream & operator<<(std::ostream &os, const DsdvHeader &packet)
Definition
dsdv-packet.h:133
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
dsdv
model
dsdv-packet.h
Generated on Fri Nov 8 2024 13:59:00 for ns-3 by
1.11.0