A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
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
37namespace ns3
38{
39
40class Node;
41class Ipv4RoutingHelper;
42
50class 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
109 void SetClickFile(NodeContainer c, std::string clickfile);
110
116 void SetClickFile(Ptr<Node> node, std::string clickfile);
117
123 void SetDefines(NodeContainer c, std::map<std::string, std::string> defines);
124
130 void SetDefines(Ptr<Node> node, std::map<std::string, std::string> defines);
131
137 void SetRoutingTableElement(NodeContainer c, std::string rt);
138
144 void SetRoutingTableElement(Ptr<Node> node, std::string rt);
145
146 private:
154 void EnablePcapIpv4Internal(std::string prefix,
155 Ptr<Ipv4> ipv4,
156 uint32_t interface,
157 bool explicitFilename) override;
158
168 void EnableAsciiIpv4Internal(Ptr<OutputStreamWrapper> stream,
169 std::string prefix,
170 Ptr<Ipv4> ipv4,
171 uint32_t interface,
172 bool explicitFilename) override;
173
174 void Initialize();
175
176 static void CreateAndAggregateObjectFromTypeId(Ptr<Node> node, const std::string typeId);
177
178 static void Cleanup();
179
180 bool PcapHooked(Ptr<Ipv4> ipv4);
181
182 bool AsciiHooked(Ptr<Ipv4> ipv4);
183
187 bool m_ipv4Enabled;
188
192 std::map<Ptr<Node>, std::string> m_nodeToClickFileMap;
193
197 std::map<Ptr<Node>, std::map<std::string, std::string>> m_nodeToDefinesMap;
198
202 std::map<Ptr<Node>, std::string> m_nodeToRoutingTableElementMap;
203};
204
205} // namespace ns3
206
207#endif /* CLICK_INTERNET_STACK_HELPER_H */
208
209#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.