A Discrete-Event Network Simulator
API
click-internet-stack-helper.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008 INRIA
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation;
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16  *
17  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
18  * Author: Lalith Suresh <suresh.lalith@gmail.com>
19  */
20 
21 #ifdef NS3_CLICK
22 
23 #ifndef CLICK_INTERNET_STACK_HELPER_H
24 #define CLICK_INTERNET_STACK_HELPER_H
25 
26 #include "ns3/internet-trace-helper.h"
27 #include "ns3/ipv4-l3-protocol.h"
28 #include "ns3/ipv6-l3-protocol.h"
29 #include "ns3/net-device-container.h"
30 #include "ns3/node-container.h"
31 #include "ns3/object-factory.h"
32 #include "ns3/packet.h"
33 #include "ns3/ptr.h"
34 
35 #include <map>
36 
37 namespace ns3
38 {
39 
40 class Node;
41 class Ipv4RoutingHelper;
42 
50 class ClickInternetStackHelper : public PcapHelperForIpv4, public AsciiTraceHelperForIpv4
51 {
52  public:
56  ClickInternetStackHelper();
57 
61  ~ClickInternetStackHelper() override;
62  ClickInternetStackHelper(const ClickInternetStackHelper&);
63  ClickInternetStackHelper& operator=(const ClickInternetStackHelper& o);
64 
68  void Reset();
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() const;
103 
115  void SetTcp(std::string tid);
116 
130  void SetTcp(std::string tid, std::string attr, const AttributeValue& val);
131 
137  void SetClickFile(NodeContainer c, std::string clickfile);
138 
144  void SetClickFile(Ptr<Node> node, std::string clickfile);
145 
151  void SetDefines(NodeContainer c, std::map<std::string, std::string> defines);
152 
158  void SetDefines(Ptr<Node> node, std::map<std::string, std::string> defines);
159 
165  void SetRoutingTableElement(NodeContainer c, std::string rt);
166 
172  void SetRoutingTableElement(Ptr<Node> node, std::string rt);
173 
174  private:
182  void EnablePcapIpv4Internal(std::string prefix,
183  Ptr<Ipv4> ipv4,
184  uint32_t interface,
185  bool explicitFilename) override;
186 
196  void EnableAsciiIpv4Internal(Ptr<OutputStreamWrapper> stream,
197  std::string prefix,
198  Ptr<Ipv4> ipv4,
199  uint32_t interface,
200  bool explicitFilename) override;
201 
202  void Initialize();
203  ObjectFactory m_tcpFactory;
204 
205  static void CreateAndAggregateObjectFromTypeId(Ptr<Node> node, const std::string typeId);
206 
207  static void Cleanup();
208 
209  bool PcapHooked(Ptr<Ipv4> ipv4);
210 
211  bool AsciiHooked(Ptr<Ipv4> ipv4);
212 
216  bool m_ipv4Enabled;
217 
221  std::map<Ptr<Node>, std::string> m_nodeToClickFileMap;
222 
226  std::map<Ptr<Node>, std::map<std::string, std::string>> m_nodeToDefinesMap;
227 
231  std::map<Ptr<Node>, std::string> m_nodeToRoutingTableElementMap;
232 };
233 
234 } // namespace ns3
235 
236 #endif /* CLICK_INTERNET_STACK_HELPER_H */
237 
238 #endif /* NS3_CLICK */
void Reset()
Reset the initial value of every attribute as well as the value of every global to what they were bef...
Definition: config.cc:856
Every class exported by the ns3 library is enclosed in the ns3 namespace.