A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
flow-id-tag.cc
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2008 INRIA
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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
18
*/
19
#include "
flow-id-tag.h
"
20
21
#include "ns3/log.h"
22
23
namespace
ns3
24
{
25
26
NS_LOG_COMPONENT_DEFINE
(
"FlowIdTag"
);
27
28
NS_OBJECT_ENSURE_REGISTERED
(FlowIdTag);
29
30
TypeId
31
FlowIdTag::GetTypeId
()
32
{
33
static
TypeId
tid =
TypeId
(
"ns3::FlowIdTag"
)
34
.
SetParent
<
Tag
>()
35
.SetGroupName(
"Network"
)
36
.AddConstructor<
FlowIdTag
>();
37
return
tid;
38
}
39
40
TypeId
41
FlowIdTag::GetInstanceTypeId
()
const
42
{
43
return
GetTypeId
();
44
}
45
46
uint32_t
47
FlowIdTag::GetSerializedSize
()
const
48
{
49
NS_LOG_FUNCTION
(
this
);
50
return
4;
51
}
52
53
void
54
FlowIdTag::Serialize
(
TagBuffer
buf)
const
55
{
56
NS_LOG_FUNCTION
(
this
<< &buf);
57
buf.
WriteU32
(
m_flowId
);
58
}
59
60
void
61
FlowIdTag::Deserialize
(
TagBuffer
buf)
62
{
63
NS_LOG_FUNCTION
(
this
<< &buf);
64
m_flowId
= buf.
ReadU32
();
65
}
66
67
void
68
FlowIdTag::Print
(std::ostream& os)
const
69
{
70
NS_LOG_FUNCTION
(
this
<< &os);
71
os <<
"FlowId="
<<
m_flowId
;
72
}
73
74
FlowIdTag::FlowIdTag
()
75
:
Tag
()
76
{
77
NS_LOG_FUNCTION
(
this
);
78
}
79
80
FlowIdTag::FlowIdTag
(uint32_t
id
)
81
:
Tag
(),
82
m_flowId(id)
83
{
84
NS_LOG_FUNCTION
(
this
<<
id
);
85
}
86
87
void
88
FlowIdTag::SetFlowId
(uint32_t
id
)
89
{
90
NS_LOG_FUNCTION
(
this
<<
id
);
91
m_flowId
= id;
92
}
93
94
uint32_t
95
FlowIdTag::GetFlowId
()
const
96
{
97
NS_LOG_FUNCTION
(
this
);
98
return
m_flowId
;
99
}
100
101
uint32_t
102
FlowIdTag::AllocateFlowId
()
103
{
104
NS_LOG_FUNCTION_NOARGS
();
105
static
uint32_t nextFlowId = 1;
106
uint32_t flowId = nextFlowId;
107
nextFlowId++;
108
return
flowId;
109
}
110
111
}
// namespace ns3
ns3::FlowIdTag
Definition:
flow-id-tag.h:28
ns3::FlowIdTag::Deserialize
void Deserialize(TagBuffer buf) override
Definition:
flow-id-tag.cc:61
ns3::FlowIdTag::GetFlowId
uint32_t GetFlowId() const
Gets the flow id for the tag.
Definition:
flow-id-tag.cc:95
ns3::FlowIdTag::Serialize
void Serialize(TagBuffer buf) const override
Definition:
flow-id-tag.cc:54
ns3::FlowIdTag::FlowIdTag
FlowIdTag()
Definition:
flow-id-tag.cc:74
ns3::FlowIdTag::SetFlowId
void SetFlowId(uint32_t flowId)
Sets the flow id for the tag.
Definition:
flow-id-tag.cc:88
ns3::FlowIdTag::GetInstanceTypeId
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
Definition:
flow-id-tag.cc:41
ns3::FlowIdTag::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition:
flow-id-tag.cc:31
ns3::FlowIdTag::Print
void Print(std::ostream &os) const override
Definition:
flow-id-tag.cc:68
ns3::FlowIdTag::m_flowId
uint32_t m_flowId
Flow ID.
Definition:
flow-id-tag.h:65
ns3::FlowIdTag::AllocateFlowId
static uint32_t AllocateFlowId()
Uses a static variable to generate sequential flow id.
Definition:
flow-id-tag.cc:102
ns3::FlowIdTag::GetSerializedSize
uint32_t GetSerializedSize() const override
Definition:
flow-id-tag.cc:47
ns3::TagBuffer
read and write tag data
Definition:
tag-buffer.h:52
ns3::TagBuffer::ReadU32
TAG_BUFFER_INLINE uint32_t ReadU32()
Definition:
tag-buffer.h:217
ns3::TagBuffer::WriteU32
TAG_BUFFER_INLINE void WriteU32(uint32_t v)
Definition:
tag-buffer.h:187
ns3::Tag
tag a set of bytes in a packet
Definition:
tag.h:39
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:59
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition:
type-id.cc:931
flow-id-tag.h
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition:
log.h:202
NS_LOG_FUNCTION_NOARGS
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
Definition:
log-macros-enabled.h:206
NS_LOG_FUNCTION
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Definition:
log-macros-enabled.h:240
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition:
object-base.h:46
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
network
utils
flow-id-tag.cc
Generated on Sun Mar 3 2024 17:11:06 for ns-3 by
1.9.1