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
flow-id-tag.cc
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2008 INRIA
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
7
*/
8
#include "
flow-id-tag.h
"
9
10
#include "ns3/log.h"
11
12
namespace
ns3
13
{
14
15
NS_LOG_COMPONENT_DEFINE
(
"FlowIdTag"
);
16
17
NS_OBJECT_ENSURE_REGISTERED
(FlowIdTag);
18
19
TypeId
20
FlowIdTag::GetTypeId
()
21
{
22
static
TypeId
tid =
TypeId
(
"ns3::FlowIdTag"
)
23
.
SetParent
<
Tag
>()
24
.SetGroupName(
"Network"
)
25
.AddConstructor<
FlowIdTag
>();
26
return
tid;
27
}
28
29
TypeId
30
FlowIdTag::GetInstanceTypeId
()
const
31
{
32
return
GetTypeId
();
33
}
34
35
uint32_t
36
FlowIdTag::GetSerializedSize
()
const
37
{
38
NS_LOG_FUNCTION
(
this
);
39
return
4;
40
}
41
42
void
43
FlowIdTag::Serialize
(
TagBuffer
buf)
const
44
{
45
NS_LOG_FUNCTION
(
this
<< &buf);
46
buf.
WriteU32
(
m_flowId
);
47
}
48
49
void
50
FlowIdTag::Deserialize
(
TagBuffer
buf)
51
{
52
NS_LOG_FUNCTION
(
this
<< &buf);
53
m_flowId
= buf.
ReadU32
();
54
}
55
56
void
57
FlowIdTag::Print
(std::ostream& os)
const
58
{
59
NS_LOG_FUNCTION
(
this
<< &os);
60
os <<
"FlowId="
<<
m_flowId
;
61
}
62
63
FlowIdTag::FlowIdTag
()
64
:
Tag
()
65
{
66
NS_LOG_FUNCTION
(
this
);
67
}
68
69
FlowIdTag::FlowIdTag
(
uint32_t
id
)
70
:
Tag
(),
71
m_flowId(id)
72
{
73
NS_LOG_FUNCTION
(
this
<<
id
);
74
}
75
76
void
77
FlowIdTag::SetFlowId
(
uint32_t
id
)
78
{
79
NS_LOG_FUNCTION
(
this
<<
id
);
80
m_flowId
= id;
81
}
82
83
uint32_t
84
FlowIdTag::GetFlowId
()
const
85
{
86
NS_LOG_FUNCTION
(
this
);
87
return
m_flowId
;
88
}
89
90
uint32_t
91
FlowIdTag::AllocateFlowId
()
92
{
93
NS_LOG_FUNCTION_NOARGS
();
94
static
uint32_t
nextFlowId = 1;
95
uint32_t
flowId = nextFlowId;
96
nextFlowId++;
97
return
flowId;
98
}
99
100
}
// namespace ns3
ns3::FlowIdTag
Definition
flow-id-tag.h:17
ns3::FlowIdTag::Deserialize
void Deserialize(TagBuffer buf) override
Definition
flow-id-tag.cc:50
ns3::FlowIdTag::GetFlowId
uint32_t GetFlowId() const
Gets the flow id for the tag.
Definition
flow-id-tag.cc:84
ns3::FlowIdTag::Serialize
void Serialize(TagBuffer buf) const override
Definition
flow-id-tag.cc:43
ns3::FlowIdTag::FlowIdTag
FlowIdTag()
Definition
flow-id-tag.cc:63
ns3::FlowIdTag::SetFlowId
void SetFlowId(uint32_t flowId)
Sets the flow id for the tag.
Definition
flow-id-tag.cc:77
ns3::FlowIdTag::GetInstanceTypeId
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
Definition
flow-id-tag.cc:30
ns3::FlowIdTag::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition
flow-id-tag.cc:20
ns3::FlowIdTag::Print
void Print(std::ostream &os) const override
Definition
flow-id-tag.cc:57
ns3::FlowIdTag::m_flowId
uint32_t m_flowId
Flow ID.
Definition
flow-id-tag.h:54
ns3::FlowIdTag::AllocateFlowId
static uint32_t AllocateFlowId()
Uses a static variable to generate sequential flow id.
Definition
flow-id-tag.cc:91
ns3::FlowIdTag::GetSerializedSize
uint32_t GetSerializedSize() const override
Definition
flow-id-tag.cc:36
ns3::TagBuffer
read and write tag data
Definition
tag-buffer.h:41
ns3::TagBuffer::ReadU32
TAG_BUFFER_INLINE uint32_t ReadU32()
Definition
tag-buffer.h:206
ns3::TagBuffer::WriteU32
TAG_BUFFER_INLINE void WriteU32(uint32_t v)
Definition
tag-buffer.h:176
ns3::Tag
tag a set of bytes in a packet
Definition
tag.h:28
ns3::TypeId
a unique identifier for an interface.
Definition
type-id.h:48
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition
type-id.cc:1001
uint32_t
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:191
NS_LOG_FUNCTION_NOARGS
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
Definition
log-macros-enabled.h:195
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:229
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition
object-base.h:35
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
network
utils
flow-id-tag.cc
Generated on Fri Nov 8 2024 13:59:05 for ns-3 by
1.11.0