A Discrete-Event Network Simulator
API
click-internet-stack-helper.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2008 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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19  * Author: Lalith Suresh <suresh.lalith@gmail.com>
20  */
21 
22 #ifdef NS3_CLICK
23 
24 #ifndef CLICK_INTERNET_STACK_HELPER_H
25 #define CLICK_INTERNET_STACK_HELPER_H
26 
27 #include "ns3/node-container.h"
28 #include "ns3/net-device-container.h"
29 #include "ns3/packet.h"
30 #include "ns3/ptr.h"
31 #include "ns3/object-factory.h"
32 #include "ns3/ipv4-l3-protocol.h"
33 #include "ns3/ipv6-l3-protocol.h"
34 #include "ns3/internet-trace-helper.h"
35 #include <map>
36 
37 namespace ns3 {
38 
39 class Node;
40 class Ipv4RoutingHelper;
41 
49 class ClickInternetStackHelper : public PcapHelperForIpv4,
50  public AsciiTraceHelperForIpv4
51 {
52 public:
56  ClickInternetStackHelper (void);
57 
61  virtual ~ClickInternetStackHelper (void);
62  ClickInternetStackHelper (const ClickInternetStackHelper &);
63  ClickInternetStackHelper &operator = (const ClickInternetStackHelper &o);
64 
68  void Reset (void);
69 
77  void Install (std::string nodeName) const;
78 
86  void Install (Ptr<Node> node) const;
87 
97  void Install (NodeContainer c) const;
98 
102  void InstallAll (void) const;
103 
115  void SetTcp (std::string tid);
116 
129  void SetTcp (std::string tid, std::string attr, const AttributeValue &val);
130 
136  void SetClickFile (NodeContainer c, std::string clickfile);
137 
143  void SetClickFile (Ptr<Node> node, std::string clickfile);
144 
150  void SetDefines (NodeContainer c, std::map<std::string, std::string> defines);
151 
157  void SetDefines (Ptr<Node> node, std::map<std::string, std::string> defines);
158 
164  void SetRoutingTableElement (NodeContainer c, std::string rt);
165 
171  void SetRoutingTableElement (Ptr<Node> node, std::string rt);
172 private:
180  virtual void EnablePcapIpv4Internal (std::string prefix,
181  Ptr<Ipv4> ipv4,
182  uint32_t interface,
183  bool explicitFilename);
184 
194  virtual void EnableAsciiIpv4Internal (Ptr<OutputStreamWrapper> stream,
195  std::string prefix,
196  Ptr<Ipv4> ipv4,
197  uint32_t interface,
198  bool explicitFilename);
199 
200  void Initialize (void);
201  ObjectFactory m_tcpFactory;
202 
203  static void CreateAndAggregateObjectFromTypeId (Ptr<Node> node, const std::string typeId);
204 
205  static void Cleanup (void);
206 
207  bool PcapHooked (Ptr<Ipv4> ipv4);
208 
209  bool AsciiHooked (Ptr<Ipv4> ipv4);
210 
214  bool m_ipv4Enabled;
215 
219  std::map < Ptr<Node>, std::string > m_nodeToClickFileMap;
220 
224  std::map < Ptr<Node>, std::map<std::string, std::string> > m_nodeToDefinesMap;
225 
229  std::map < Ptr<Node>, std::string > m_nodeToRoutingTableElementMap;
230 };
231 
232 } // namespace ns3
233 
234 #endif /* CLICK_INTERNET_STACK_HELPER_H */
235 
236 #endif /* NS3_CLICK */
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void Reset(void)
Reset the initial value of every attribute as well as the value of every global to what they were bef...
Definition: config.cc:749