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
qos-tag.cc
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2009 MIRKO BANCHI
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: Mirko Banchi <mk.banchi@gmail.com>
19
*/
20
21
#include "
qos-tag.h
"
22
#include "ns3/tag.h"
23
#include "ns3/uinteger.h"
24
25
namespace
ns3
{
26
27
NS_OBJECT_ENSURE_REGISTERED
(QosTag);
28
29
TypeId
30
QosTag::GetTypeId
(
void
)
31
{
32
static
TypeId
tid =
TypeId
(
"ns3::QosTag"
)
33
.
SetParent
<
Tag
> ()
34
.SetGroupName (
"Wifi"
)
35
.AddConstructor<
QosTag
> ()
36
.AddAttribute (
"tid"
,
"The tid that indicates AC which packet belongs"
,
37
UintegerValue
(0),
38
MakeUintegerAccessor
(&
QosTag::GetTid
),
39
MakeUintegerChecker<uint8_t> ())
40
;
41
return
tid;
42
}
43
44
TypeId
45
QosTag::GetInstanceTypeId
(
void
)
const
46
{
47
return
GetTypeId
();
48
}
49
50
QosTag::QosTag
()
51
: m_tid (0)
52
{
53
}
54
QosTag::QosTag
(uint8_t tid)
55
: m_tid (tid)
56
{
57
}
58
59
void
60
QosTag::SetTid
(uint8_t tid)
61
{
62
m_tid
= tid;
63
}
64
65
void
66
QosTag::SetUserPriority
(
UserPriority
up)
67
{
68
m_tid
= up;
69
}
70
71
uint32_t
72
QosTag::GetSerializedSize
(
void
)
const
73
{
74
return
1;
75
}
76
77
void
78
QosTag::Serialize
(
TagBuffer
i)
const
79
{
80
i.
WriteU8
(
m_tid
);
81
}
82
83
void
84
QosTag::Deserialize
(
TagBuffer
i)
85
{
86
m_tid
= (
UserPriority
) i.
ReadU8
();
87
}
88
89
uint8_t
90
QosTag::GetTid
()
const
91
{
92
return
m_tid
;
93
}
94
95
void
96
QosTag::Print
(std::ostream &os)
const
97
{
98
os <<
"Tid="
<<
m_tid
;
99
}
100
101
}
// namespace ns3
qos-tag.h
ns3::QosTag::SetUserPriority
void SetUserPriority(UserPriority up)
Set the TID to the value that corresponds to the requested UserPriority.
Definition:
qos-tag.cc:66
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition:
object-base.h:44
ns3::QosTag::Deserialize
virtual void Deserialize(TagBuffer i)
Definition:
qos-tag.cc:84
ns3::TagBuffer::ReadU8
TAG_BUFFER_INLINE uint8_t ReadU8(void)
Definition:
tag-buffer.h:195
ns3::QosTag::SetTid
void SetTid(uint8_t tid)
Set the TID to the given value.
Definition:
qos-tag.cc:60
ns3::QosTag::GetSerializedSize
virtual uint32_t GetSerializedSize() const
Definition:
qos-tag.cc:72
ns3::QosTag::Serialize
virtual void Serialize(TagBuffer i) const
Definition:
qos-tag.cc:78
ns3::UintegerValue
Hold an unsigned integer type.
Definition:
uinteger.h:44
ns3::QosTag
The aim of the QosTag is to provide means for an Application to specify the TID which will be used by...
Definition:
qos-tag.h:61
ns3::QosTag::GetInstanceTypeId
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
Definition:
qos-tag.cc:45
ns3::QosTag::Print
virtual void Print(std::ostream &os) const
Definition:
qos-tag.cc:96
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::QosTag::GetTypeId
static TypeId GetTypeId(void)
Definition:
qos-tag.cc:30
ns3::UserPriority
UserPriority
As per IEEE Std.
Definition:
qos-tag.h:40
ns3::TagBuffer::WriteU8
TAG_BUFFER_INLINE void WriteU8(uint8_t v)
Definition:
tag-buffer.h:172
ns3::QosTag::QosTag
QosTag()
Create a QosTag with the default TID = 0 (best effort traffic)
Definition:
qos-tag.cc:50
ns3::TagBuffer
read and write tag data
Definition:
tag-buffer.h:51
ns3::QosTag::m_tid
uint8_t m_tid
Traffic ID.
Definition:
qos-tag.h:113
ns3::MakeUintegerAccessor
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
Definition:
uinteger.h:45
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:826
ns3::QosTag::GetTid
uint8_t GetTid(void) const
Return the Type ID.
Definition:
qos-tag.cc:90
src
wifi
model
qos-tag.cc
Generated on Wed Sep 30 2015 15:55:53 for ns-3 by
1.8.9.1