author | Tom Henderson <tomh@tomh.org> |
Wed, 08 Apr 2009 16:07:34 -0700 | |
changeset 4373 | e493e80274bd |
parent 3010 | ad669f4f7e58 |
permissions | -rw-r--r-- |
2623
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
2 |
/* |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
3 |
* Copyright (c) 2008 University of Washington |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
4 |
* |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
5 |
* This program is free software; you can redistribute it and/or modify |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
6 |
* it under the terms of the GNU General Public License version 2 as |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation; |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
8 |
* |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
9 |
* This program is distributed in the hope that it will be useful, |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
12 |
* GNU General Public License for more details. |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
13 |
* |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
15 |
* along with this program; if not, write to the Free Software |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
16 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
17 |
* |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
18 |
* Author: Tom Henderson <tomh@tomh.org> |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
19 |
*/ |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
20 |
|
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
21 |
#include "ns3/log.h" |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
22 |
#include "ns3/command-line.h" |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
23 |
#include "ns3/ptr.h" |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
24 |
#include "ns3/config.h" |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
25 |
#include "ns3/uinteger.h" |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
26 |
#include "ns3/string.h" |
2927
73b47ce1d805
get rid of implicit conversion of Attribute to/from Ptr<>. Replace this with an explicit Pointer class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2623
diff
changeset
|
27 |
#include "ns3/pointer.h" |
2623
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
28 |
#include "ns3/simulator.h" |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
29 |
|
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
30 |
#include "ns3/node.h" |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
31 |
#include "ns3/queue.h" |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
32 |
#include "ns3/drop-tail-queue.h" |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
33 |
#include "ns3/point-to-point-net-device.h" |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
34 |
|
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
35 |
using namespace ns3; |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
36 |
|
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
37 |
NS_LOG_COMPONENT_DEFINE ("AttributeValueSample"); |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
38 |
|
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
39 |
// |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
40 |
// This is a basic example of how to use the attribute system to |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
41 |
// set and get a value in the underlying system; namely, an unsigned |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
42 |
// integer of the maximum number of packets in a queue |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
43 |
// |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
44 |
|
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
45 |
int |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
46 |
main (int argc, char *argv[]) |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
47 |
{ |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
48 |
LogComponentEnable ("AttributeValueSample", LOG_LEVEL_INFO); |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
49 |
|
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
50 |
// By default, the MaxPackets attribute has a value of 100 packets |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
51 |
// (this default can be observed in the function DropTailQueue::GetTypeId) |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
52 |
// |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
53 |
// Here, we set it to 80 packets. We could use one of two value types: |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2927
diff
changeset
|
54 |
// a string-based value or a UintegerValue value |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2927
diff
changeset
|
55 |
Config::SetDefault ("ns3::DropTailQueue::MaxPackets", StringValue ("80")); |
2623
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
56 |
// The below function call is redundant |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2927
diff
changeset
|
57 |
Config::SetDefault ("ns3::DropTailQueue::MaxPackets", UintegerValue (80)); |
2623
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
58 |
|
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
59 |
// Allow the user to override any of the defaults and the above |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
60 |
// SetDefaults() at run-time, via command-line arguments |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
61 |
CommandLine cmd; |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
62 |
cmd.Parse (argc, argv); |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
63 |
|
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
64 |
// Now, we will create a few objects using the low-level API |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
65 |
Ptr<Node> n0 = CreateObject<Node> (); |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
66 |
|
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
67 |
Ptr<PointToPointNetDevice> net0 = CreateObject<PointToPointNetDevice> (); |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
68 |
n0->AddDevice (net0); |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
69 |
|
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
70 |
Ptr<Queue> q = CreateObject<DropTailQueue> (); |
3010 | 71 |
net0->SetQueue(q); |
2623
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
72 |
|
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
73 |
// At this point, we have created a single node (Node 0) and a |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
74 |
// single PointToPointNetDevice (NetDevice 0) and added a |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
75 |
// DropTailQueue to it. |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
76 |
|
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
77 |
// Now, we can manipulate the MaxPackets value of the already |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
78 |
// instantiated DropTailQueue. Here are various ways to do that. |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
79 |
|
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
80 |
// We assume that a smart pointer (Ptr) to a relevant network device |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
81 |
// is in hand; here, it is the net0 pointer. |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
82 |
|
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
83 |
// 1. Pointer-based access |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
84 |
// |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
85 |
// One way to change the value is to access a pointer to the |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
86 |
// underlying queue and modify its attribute. |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
87 |
// |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
88 |
// First, we observe that we can get a pointer to the (base class) |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
89 |
// queue via the PointToPointNetDevice attributes, where it is called |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
90 |
// TxQueue |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2927
diff
changeset
|
91 |
PointerValue ptr; |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2927
diff
changeset
|
92 |
net0->GetAttribute ("TxQueue", ptr); |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2927
diff
changeset
|
93 |
Ptr<Queue> txQueue = ptr.Get<Queue> (); |
2623
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
94 |
|
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
95 |
// Using the GetObject function, we can perform a safe downcast |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
96 |
// to a DropTailQueue, where MaxPackets is a member |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
97 |
Ptr<DropTailQueue> dtq = txQueue->GetObject <DropTailQueue> (); |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
98 |
NS_ASSERT (dtq); |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
99 |
|
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
100 |
// Next, we can get the value of an attribute on this queue |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
101 |
// We have introduced wrapper "Value" classes for the underlying |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
102 |
// data types, similar to Java wrappers around these types, since |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
103 |
// the attribute system stores values and not disparate types. |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
104 |
// Here, the attribute value is assigned to a Uinteger, and |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
105 |
// the Get() method on this value produces the (unwrapped) uint32_t. |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2927
diff
changeset
|
106 |
UintegerValue limit; |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2927
diff
changeset
|
107 |
dtq->GetAttribute ("MaxPackets", limit); |
2623
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
108 |
NS_LOG_INFO ("1. dtq limit: " << limit.Get () << " packets"); |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
109 |
|
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
110 |
// Note that the above downcast is not really needed; we could have |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
111 |
// done the same using the Ptr<Queue> even though the attribute |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
112 |
// is a member of the subclass |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2927
diff
changeset
|
113 |
txQueue->GetAttribute ("MaxPackets", limit); |
2623
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
114 |
NS_LOG_INFO ("2. txQueue limit: " << limit.Get () << " packets"); |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
115 |
|
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
116 |
// Now, let's set it to another value (60 packets) |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2927
diff
changeset
|
117 |
txQueue->SetAttribute("MaxPackets", UintegerValue (60)); |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2927
diff
changeset
|
118 |
txQueue->GetAttribute ("MaxPackets", limit); |
2623
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
119 |
NS_LOG_INFO ("3. txQueue limit changed: " << limit.Get () << " packets"); |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
120 |
|
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
121 |
// 2. Namespace-based access |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
122 |
// |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
123 |
// An alternative way to get at the attribute is to use the configuration |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
124 |
// namespace. Here, this attribute resides on a known path in this |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
125 |
// namespace; this approach is useful if one doesn't have access to |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
126 |
// the underlying pointers and would like to configure a specific |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
127 |
// attribute with a single statement. |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2927
diff
changeset
|
128 |
Config::Set ("/NodeList/0/DeviceList/0/TxQueue/MaxPackets", UintegerValue (25)); |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2927
diff
changeset
|
129 |
txQueue->GetAttribute ("MaxPackets", limit); |
2623
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
130 |
NS_LOG_INFO ("4. txQueue limit changed through namespace: " << |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2927
diff
changeset
|
131 |
limit.Get () << " packets"); |
2623
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
132 |
|
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
133 |
// we could have also used wildcards to set this value for all nodes |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
134 |
// and all net devices (which in this simple example has the same |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
135 |
// effect as the previous Set()) |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2927
diff
changeset
|
136 |
Config::Set ("/NodeList/*/DeviceList/*/TxQueue/MaxPackets", UintegerValue (15)); |
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2927
diff
changeset
|
137 |
txQueue->GetAttribute ("MaxPackets", limit); |
2623
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
138 |
NS_LOG_INFO ("5. txQueue limit changed through wildcarded namespace: " << |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2927
diff
changeset
|
139 |
limit.Get () << " packets"); |
2623
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
140 |
|
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
141 |
Simulator::Destroy (); |
bdd52bd78977
Add sample file for attribute values
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
142 |
} |