ns-3 Direct Code Execution
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
dce-node-context.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2011 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: Frederic Urbani <frederic.urbani@inria.fr>
19  */
20 
21 #ifndef DCE_NODE_CONTEXT_H
22 #define DCE_NODE_CONTEXT_H
23 
24 #include <string>
25 #include "ns3/object.h"
26 #include "ns3/nstime.h"
27 #include "ns3/traced-callback.h"
28 #include "ns3/simulator.h"
29 #include <sys/utsname.h>
30 #include "ns3/random-variable.h"
31 
32 extern "C" struct Libc;
33 
34 namespace ns3 {
35 
36 struct Process;
37 struct Thread;
38 
42 class DceNodeContext : public Object
43 {
44 public:
45  static TypeId GetTypeId (void);
46  virtual TypeId GetInstanceTypeId (void) const;
47 
48  DceNodeContext ();
49  virtual ~DceNodeContext ();
50 
51  int UName (struct utsname *buf);
52 
53  static Ptr<DceNodeContext> GetNodeContext ();
54 
55  int RandomRead (void *buf, size_t count);
56 
57 private:
58  inline uint8_t GetNextRnd ();
59 
60  std::string m_sysName;
61  std::string m_nodeName;
62  std::string m_release;
63  std::string m_version;
64  std::string m_hardId;
65  RandomVariable m_randomCtx;
66  uint32_t m_rndBuffer;
67  uint8_t m_rndOffset;
68 };
69 
70 } // namespace ns3
71 
72 #endif /* DCE_NODE_CONTEXT_H */