author | Pavel Boyko <boyko@iitp.ru> |
Tue, 16 Jun 2009 17:58:16 +0400 | |
changeset 5074 | 355de6af8ea9 |
parent 4404 | e10005ac0701 |
child 4692 | f4cd995f1718 |
permissions | -rw-r--r-- |
4404
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
1 |
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
2 |
/* |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
3 |
* Copyright (c) 2009 MIRKO BANCHI |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
4 |
* |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
5 |
* This program is free software; you can redistribute it and/or modify |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
6 |
* it under the terms of the GNU General Public License version 2 as |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation; |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
8 |
* |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
9 |
* This program is distributed in the hope that it will be useful, |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
12 |
* GNU General Public License for more details. |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
13 |
* |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
15 |
* along with this program; if not, write to the Free Software |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
16 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
17 |
* |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
18 |
* Author: Mirko Banchi <mk.banchi@gmail.com> |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
19 |
*/ |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
20 |
#include "qos-tag.h" |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
21 |
#include "ns3/tag.h" |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
22 |
#include "ns3/uinteger.h" |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
23 |
|
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
24 |
namespace ns3 { |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
25 |
|
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
26 |
TypeId |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
27 |
QosTag::GetTypeId (void) |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
28 |
{ |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
29 |
static TypeId tid = TypeId ("ns3::QosTag") |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
30 |
.SetParent<Tag> () |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
31 |
.AddConstructor<QosTag> () |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
32 |
.AddAttribute ("tid", "The tid that indicates AC which packet belongs", |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
33 |
UintegerValue (0), |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
34 |
MakeUintegerAccessor (&QosTag::Get), |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
35 |
MakeUintegerChecker<uint8_t> ()) |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
36 |
; |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
37 |
return tid; |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
38 |
} |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
39 |
|
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
40 |
TypeId |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
41 |
QosTag::GetInstanceTypeId (void) const |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
42 |
{ |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
43 |
return GetTypeId (); |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
44 |
} |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
45 |
|
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
46 |
QosTag::QosTag() |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
47 |
{} |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
48 |
|
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
49 |
uint32_t |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
50 |
QosTag::GetSerializedSize (void) const |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
51 |
{ |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
52 |
return 1; |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
53 |
} |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
54 |
|
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
55 |
void |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
56 |
QosTag::Serialize (TagBuffer i) const |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
57 |
{ |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
58 |
i.WriteU8 (m_tid); |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
59 |
} |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
60 |
|
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
61 |
void |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
62 |
QosTag::Deserialize (TagBuffer i) |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
63 |
{ |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
64 |
m_tid = i.ReadU8 (); |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
65 |
} |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
66 |
|
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
67 |
void |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
68 |
QosTag::Set (uint8_t tid) |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
69 |
{ |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
70 |
m_tid = tid; |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
71 |
} |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
72 |
|
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
73 |
uint8_t |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
74 |
QosTag::Get () const |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
75 |
{ |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
76 |
return m_tid; |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
77 |
} |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
78 |
|
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
79 |
void |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
80 |
QosTag::Print (std::ostream &os) const |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
81 |
{ |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
82 |
os << "Tid=" << m_tid; |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
83 |
} |
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
84 |
|
e10005ac0701
shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff
changeset
|
85 |
} //namespace ns3 |