A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
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
NS_LOG_COMPONENT_DEFINE
(
"FlowIdTag"
);
24
25
namespace
ns3 {
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
.AddConstructor<FlowIdTag> ()
35
;
36
return
tid;
37
}
38
TypeId
39
FlowIdTag::GetInstanceTypeId
(
void
)
const
40
{
41
return
GetTypeId
();
42
}
43
uint32_t
44
FlowIdTag::GetSerializedSize
(
void
)
const
45
{
46
NS_LOG_FUNCTION
(
this
);
47
return
4;
48
}
49
void
50
FlowIdTag::Serialize
(
TagBuffer
buf)
const
51
{
52
NS_LOG_FUNCTION
(
this
<< &buf);
53
buf.
WriteU32
(
m_flowId
);
54
}
55
void
56
FlowIdTag::Deserialize
(
TagBuffer
buf)
57
{
58
NS_LOG_FUNCTION
(
this
<< &buf);
59
m_flowId
= buf.
ReadU32
();
60
}
61
void
62
FlowIdTag::Print
(std::ostream &os)
const
63
{
64
NS_LOG_FUNCTION
(
this
<< &os);
65
os <<
"FlowId="
<<
m_flowId
;
66
}
67
FlowIdTag::FlowIdTag
()
68
:
Tag
()
69
{
70
NS_LOG_FUNCTION
(
this
);
71
}
72
73
FlowIdTag::FlowIdTag
(uint32_t
id
)
74
:
Tag
(),
75
m_flowId (id)
76
{
77
NS_LOG_FUNCTION
(
this
<<
id
);
78
}
79
80
void
81
FlowIdTag::SetFlowId
(uint32_t
id
)
82
{
83
NS_LOG_FUNCTION
(
this
<<
id
);
84
m_flowId
= id;
85
}
86
uint32_t
87
FlowIdTag::GetFlowId
(
void
)
const
88
{
89
NS_LOG_FUNCTION
(
this
);
90
return
m_flowId
;
91
}
92
93
uint32_t
94
FlowIdTag::AllocateFlowId
(
void
)
95
{
96
NS_LOG_FUNCTION_NOARGS
();
97
static
uint32_t nextFlowId = 1;
98
uint32_t flowId = nextFlowId;
99
nextFlowId++;
100
return
flowId;
101
}
102
103
}
// namespace ns3
104
NS_LOG_FUNCTION
#define NS_LOG_FUNCTION(parameters)
Definition:
log.h:311
ns3::FlowIdTag::Serialize
virtual void Serialize(TagBuffer buf) const
Definition:
flow-id-tag.cc:50
ns3::FlowIdTag::GetInstanceTypeId
virtual TypeId GetInstanceTypeId(void) const
Definition:
flow-id-tag.cc:39
NS_LOG_FUNCTION_NOARGS
#define NS_LOG_FUNCTION_NOARGS()
Definition:
log.h:275
ns3::TagBuffer::ReadU32
TAG_BUFFER_INLINE uint32_t ReadU32(void)
Definition:
tag-buffer.h:199
ns3::FlowIdTag::Print
virtual void Print(std::ostream &os) const
Definition:
flow-id-tag.cc:62
flow-id-tag.h
ns3::FlowIdTag::GetTypeId
static TypeId GetTypeId(void)
Definition:
flow-id-tag.cc:30
NS_LOG_COMPONENT_DEFINE
NS_LOG_COMPONENT_DEFINE("FlowIdTag")
ns3::TagBuffer::WriteU32
TAG_BUFFER_INLINE void WriteU32(uint32_t v)
Definition:
tag-buffer.h:170
ns3::NS_OBJECT_ENSURE_REGISTERED
NS_OBJECT_ENSURE_REGISTERED(AntennaModel)
ns3::FlowIdTag::GetFlowId
uint32_t GetFlowId(void) const
Definition:
flow-id-tag.cc:87
ns3::FlowIdTag::Deserialize
virtual void Deserialize(TagBuffer buf)
Definition:
flow-id-tag.cc:56
ns3::Tag
tag a set of bytes in a packet
Definition:
tag.h:36
ns3::TagBuffer
read and write tag data
Definition:
tag-buffer.h:51
ns3::FlowIdTag::GetSerializedSize
virtual uint32_t GetSerializedSize(void) const
Definition:
flow-id-tag.cc:44
ns3::FlowIdTag::AllocateFlowId
static uint32_t AllocateFlowId(void)
Definition:
flow-id-tag.cc:94
ns3::FlowIdTag::SetFlowId
void SetFlowId(uint32_t flowId)
Definition:
flow-id-tag.cc:81
ns3::FlowIdTag::m_flowId
uint32_t m_flowId
Definition:
flow-id-tag.h:42
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:49
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Definition:
type-id.cc:610
ns3::FlowIdTag::FlowIdTag
FlowIdTag()
Definition:
flow-id-tag.cc:67
src
network
utils
flow-id-tag.cc
Generated on Sun Apr 20 2014 11:15:00 for ns-3 by
1.8.6