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 SetRoutingTableElement (NodeContainer c, std::string rt);
151 
157  void SetRoutingTableElement (Ptr<Node> node, std::string rt);
158 private:
167  virtual void EnablePcapIpv4Internal (std::string prefix,
168  Ptr<Ipv4> ipv4,
169  uint32_t interface,
170  bool explicitFilename);
171 
182  virtual void EnableAsciiIpv4Internal (Ptr<OutputStreamWrapper> stream,
183  std::string prefix,
184  Ptr<Ipv4> ipv4,
185  uint32_t interface,
186  bool explicitFilename);
187 
188  void Initialize (void);
189  ObjectFactory m_tcpFactory;
190 
194  static void CreateAndAggregateObjectFromTypeId (Ptr<Node> node, const std::string typeId);
195 
199  static void Cleanup (void);
200 
204  bool PcapHooked (Ptr<Ipv4> ipv4);
205 
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::string > m_nodeToRoutingTableElementMap;
225 };
226 
227 } // namespace ns3
228 
229 #endif /* CLICK_INTERNET_STACK_HELPER_H */
230 
231 #endif /* NS3_CLICK */