A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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:
181  virtual void EnablePcapIpv4Internal (std::string prefix,
182  Ptr<Ipv4> ipv4,
183  uint32_t interface,
184  bool explicitFilename);
185 
196  virtual void EnableAsciiIpv4Internal (Ptr<OutputStreamWrapper> stream,
197  std::string prefix,
198  Ptr<Ipv4> ipv4,
199  uint32_t interface,
200  bool explicitFilename);
201 
202  void Initialize (void);
203  ObjectFactory m_tcpFactory;
204 
208  static void CreateAndAggregateObjectFromTypeId (Ptr<Node> node, const std::string typeId);
209 
213  static void Cleanup (void);
214 
218  bool PcapHooked (Ptr<Ipv4> ipv4);
219 
223  bool AsciiHooked (Ptr<Ipv4> ipv4);
224 
228  bool m_ipv4Enabled;
229 
233  std::map < Ptr<Node>, std::string > m_nodeToClickFileMap;
234 
238  std::map < Ptr<Node>, std::map<std::string, std::string> > m_nodeToDefinesMap;
239 
243  std::map < Ptr<Node>, std::string > m_nodeToRoutingTableElementMap;
244 };
245 
246 } // namespace ns3
247 
248 #endif /* CLICK_INTERNET_STACK_HELPER_H */
249 
250 #endif /* NS3_CLICK */
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:642