A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
src
network
utils
flow-id-tag.cc
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2008 INRIA
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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19
*/
20
#include "
flow-id-tag.h
"
21
#include "ns3/log.h"
22
23
namespace
ns3
{
24
25
NS_LOG_COMPONENT_DEFINE
(
"FlowIdTag"
);
26
27
NS_OBJECT_ENSURE_REGISTERED
(FlowIdTag);
28
29
TypeId
30
FlowIdTag::GetTypeId
(
void
)
31
{
32
static
TypeId
tid =
TypeId
(
"ns3::FlowIdTag"
)
33
.
SetParent
<
Tag
> ()
34
.SetGroupName(
"Network"
)
35
.AddConstructor<
FlowIdTag
> ()
36
;
37
return
tid;
38
}
39
TypeId
40
FlowIdTag::GetInstanceTypeId
(
void
)
const
41
{
42
return
GetTypeId
();
43
}
44
uint32_t
45
FlowIdTag::GetSerializedSize
(
void
)
const
46
{
47
NS_LOG_FUNCTION
(
this
);
48
return
4;
49
}
50
void
51
FlowIdTag::Serialize
(
TagBuffer
buf)
const
52
{
53
NS_LOG_FUNCTION
(
this
<< &buf);
54
buf.
WriteU32
(
m_flowId
);
55
}
56
void
57
FlowIdTag::Deserialize
(
TagBuffer
buf)
58
{
59
NS_LOG_FUNCTION
(
this
<< &buf);
60
m_flowId
= buf.
ReadU32
();
61
}
62
void
63
FlowIdTag::Print
(std::ostream &os)
const
64
{
65
NS_LOG_FUNCTION
(
this
<< &os);
66
os <<
"FlowId="
<<
m_flowId
;
67
}
68
FlowIdTag::FlowIdTag
()
69
:
Tag
()
70
{
71
NS_LOG_FUNCTION
(
this
);
72
}
73
74
FlowIdTag::FlowIdTag
(uint32_t
id
)
75
:
Tag
(),
76
m_flowId (id)
77
{
78
NS_LOG_FUNCTION
(
this
<<
id
);
79
}
80
81
void
82
FlowIdTag::SetFlowId
(uint32_t
id
)
83
{
84
NS_LOG_FUNCTION
(
this
<<
id
);
85
m_flowId
= id;
86
}
87
uint32_t
88
FlowIdTag::GetFlowId
(
void
)
const
89
{
90
NS_LOG_FUNCTION
(
this
);
91
return
m_flowId
;
92
}
93
94
uint32_t
95
FlowIdTag::AllocateFlowId
(
void
)
96
{
97
NS_LOG_FUNCTION_NOARGS
();
98
static
uint32_t nextFlowId = 1;
99
uint32_t flowId = nextFlowId;
100
nextFlowId++;
101
return
flowId;
102
}
103
104
}
// namespace ns3
105
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:213
ns3::FlowIdTag::GetSerializedSize
virtual uint32_t GetSerializedSize(void) const
Definition:
flow-id-tag.cc:45
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition:
object-base.h:45
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:176
ns3::TagBuffer::ReadU32
TAG_BUFFER_INLINE uint32_t ReadU32(void)
Definition:
tag-buffer.h:215
flow-id-tag.h
ns3::FlowIdTag::GetTypeId
static TypeId GetTypeId(void)
Get the type ID.
Definition:
flow-id-tag.cc:30
ns3::TagBuffer::WriteU32
TAG_BUFFER_INLINE void WriteU32(uint32_t v)
Definition:
tag-buffer.h:186
ns3::FlowIdTag::Print
virtual void Print(std::ostream &os) const
Definition:
flow-id-tag.cc:63
ns3::FlowIdTag::Deserialize
virtual void Deserialize(TagBuffer buf)
Definition:
flow-id-tag.cc:57
ns3::Tag
tag a set of bytes in a packet
Definition:
tag.h:36
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::FlowIdTag::Serialize
virtual void Serialize(TagBuffer buf) const
Definition:
flow-id-tag.cc:51
ns3::TagBuffer
read and write tag data
Definition:
tag-buffer.h:51
ns3::FlowIdTag
Introspection did not find any typical Config paths.
Definition:
flow-id-tag.h:27
ns3::FlowIdTag::AllocateFlowId
static uint32_t AllocateFlowId(void)
Uses a static variable to generate sequential flow id.
Definition:
flow-id-tag.cc:95
ns3::FlowIdTag::SetFlowId
void SetFlowId(uint32_t flowId)
Sets the flow id for the tag.
Definition:
flow-id-tag.cc:82
ns3::FlowIdTag::GetFlowId
uint32_t GetFlowId(void) const
Gets the flow id for the tag.
Definition:
flow-id-tag.cc:88
ns3::FlowIdTag::m_flowId
uint32_t m_flowId
Flow ID.
Definition:
flow-id-tag.h:64
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:58
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition:
type-id.cc:915
ns3::FlowIdTag::FlowIdTag
FlowIdTag()
Definition:
flow-id-tag.cc:68
ns3::FlowIdTag::GetInstanceTypeId
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
Definition:
flow-id-tag.cc:40
Generated on Wed Nov 7 2018 10:02:07 for ns-3 by
1.8.14