8 #include "ns3/random-variable.h"
9 #include "ns3/uinteger.h"
10 #include "ns3/string.h"
11 #include "ns3/config.h"
16 #include "ns3/ipv4-routing-protocol.h"
17 #include "ns3/ipv4-global-routing.h"
34 static TypeId tid = TypeId (
"ns3::DceManagerHelper")
35 .SetParent<ObjectBase> ()
36 .AddAttribute (
"LoaderFactory",
37 "The kind of loader factory created when Install is called",
38 StringValue (
"ns3::CoojaLoaderFactory[]"),
40 MakeObjectFactoryChecker ())
52 ConstructSelf (AttributeConstructionList ());
62 std::string n0,
const AttributeValue &v0,
63 std::string n1,
const AttributeValue &v1)
71 std::string n0,
const AttributeValue &v0,
72 std::string n1,
const AttributeValue &v1)
90 std::string n0,
const AttributeValue &v0)
103 for (NodeContainer::Iterator i = nodes.Begin (); i != nodes.End (); ++i)
112 taskManager->SetScheduler (scheduler);
113 taskManager->SetDelayModel (delay);
114 manager->SetAttribute (
"FirstPid", UintegerValue (
g_firstPid.GetInteger (0, 0xffff)));
116 node->AggregateObject (taskManager);
117 node->AggregateObject (loader);
118 node->AggregateObject (manager);
119 node->AggregateObject (networkStack);
120 node->AggregateObject (CreateObject<LocalSocketFdFactory> ());
121 manager->AggregateObject (CreateObject<DceNodeContext> ());
136 std::vector<ProcStatus>
139 FILE *f = fopen (
"exitprocs",
"r");
140 std::vector<ProcStatus> res;
144 char buffer[10 * 1024];
146 while ((!feof (f)) && (fgets (buffer,
sizeof(buffer),f)))
148 if (0 == strncmp (buffer,
"NODE",4))
159 ret = strtol (crsr, &next, 10);
160 if ((ret == LONG_MIN) || (ret == LONG_MAX) || (ERANGE ==
errno) || (next == crsr))
164 int node = (int) ret;
169 ret = strtol (crsr, &next, 10);
170 if ((ret == LONG_MIN) || (ret == LONG_MAX) || (ERANGE ==
errno) || (next == crsr))
174 int exitcode = (int) ret;
179 ret = strtol (crsr, &next, 10);
180 if ((ret == LONG_MIN) || (ret == LONG_MAX) || (ERANGE ==
errno) || (next == crsr))
188 unsigned long long int ret2 = 0;
190 ret2 = strtoll (crsr, &next, 10);
191 if ((ret == LLONG_MIN) || (ret == LLONG_MAX) || (ERANGE ==
errno) || (next == crsr))
195 int64_t nst = (int64_t) ret2;
200 ret2 = strtoll (crsr, &next, 10);
201 if ((ret == LLONG_MIN) || (ret == LLONG_MAX) || (ERANGE ==
errno) || (next == crsr))
205 int64_t ned = (int64_t) ret2;
210 ret = strtol (crsr, &next, 10);
211 if ((ret == LONG_MIN) || (ret == LONG_MAX) || (ERANGE ==
errno) || (next == crsr))
215 long rst = (long) ret;
220 ret = strtol (crsr, &next, 10);
221 if ((ret == LONG_MIN) || (ret == LONG_MAX) || (ERANGE ==
errno) || (next == crsr))
225 long red = (long) ret;
231 ret3 = strtod (crsr, &next);
232 if ((ERANGE ==
errno) || (next == crsr))
241 ret = strtol (crsr, &next, 10);
242 if ((ret == LONG_MIN) || (ret == LONG_MAX) || (ERANGE ==
errno) || (next == crsr))
246 long durr = (long) ret;
250 ProcStatus st (node, exitcode, pid, nst, ned, rst, red, dur3, durr, crsr + 1);
262 ProcStatus::ProcStatus (
int n,
int e,
int p, int64_t ns, int64_t ne,
long rs,
long re,
double nd,
long rd, std::string cmd)
268 m_realStartTime (rs),