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 #ifndef CLICK_INTERNET_STACK_HELPER_H
22 #define CLICK_INTERNET_STACK_HELPER_H
23 
24 #include "ns3/internet-trace-helper.h"
25 #include "ns3/ipv4-l3-protocol.h"
26 #include "ns3/ipv6-l3-protocol.h"
27 #include "ns3/net-device-container.h"
28 #include "ns3/node-container.h"
29 #include "ns3/object-factory.h"
30 #include "ns3/packet.h"
31 #include "ns3/ptr.h"
32 
33 #include <map>
34 
35 namespace ns3
36 {
37 
38 class Node;
39 class Ipv4RoutingHelper;
40 
49 {
50  public:
55 
59  ~ClickInternetStackHelper() override;
60 
67 
75 
79  void Reset();
80 
88  void Install(std::string nodeName) const;
89 
97  void Install(Ptr<Node> node) const;
98 
108  void Install(NodeContainer c) const;
109 
113  void InstallAll() const;
114 
120  void SetClickFile(NodeContainer c, std::string clickfile);
121 
127  void SetClickFile(Ptr<Node> node, std::string clickfile);
128 
134  void SetDefines(NodeContainer c, std::map<std::string, std::string> defines);
135 
141  void SetDefines(Ptr<Node> node, std::map<std::string, std::string> defines);
142 
148  void SetRoutingTableElement(NodeContainer c, std::string rt);
149 
155  void SetRoutingTableElement(Ptr<Node> node, std::string rt);
156 
157  private:
166  void EnablePcapIpv4Internal(std::string prefix,
167  Ptr<Ipv4> ipv4,
168  uint32_t interface,
169  bool explicitFilename) override;
170 
182  std::string prefix,
183  Ptr<Ipv4> ipv4,
184  uint32_t interface,
185  bool explicitFilename) override;
186 
191  void Initialize();
192 
199  static void CreateAndAggregateObjectFromTypeId(Ptr<Node> node, const std::string typeId);
200 
207  bool PcapHooked(Ptr<Ipv4> ipv4);
208 
215  bool AsciiHooked(Ptr<Ipv4> ipv4);
216 
221 
225  std::map<Ptr<Node>, std::string> m_nodeToClickFileMap;
226 
230  std::map<Ptr<Node>, std::map<std::string, std::string>> m_nodeToDefinesMap;
231 
235  std::map<Ptr<Node>, std::string> m_nodeToRoutingTableElementMap;
236 };
237 
238 } // namespace ns3
239 
240 #endif /* CLICK_INTERNET_STACK_HELPER_H */
Base class providing common user-level ascii trace operations for helpers representing IPv4 protocols...
aggregate Click/IP/TCP/UDP functionality to existing Nodes.
std::map< Ptr< Node >, std::string > m_nodeToClickFileMap
Node to Click file mapping.
~ClickInternetStackHelper() override
Destroy the ClickInternetStackHelper.
ClickInternetStackHelper & operator=(const ClickInternetStackHelper &o)
Assignment operator.
bool PcapHooked(Ptr< Ipv4 > ipv4)
Check if PCAP is hooked.
void SetDefines(NodeContainer c, std::map< std::string, std::string > defines)
Set defines to be used for a group of nodes.
static void CreateAndAggregateObjectFromTypeId(Ptr< Node > node, const std::string typeId)
Create and aggregate object from type ID.
std::map< Ptr< Node >, std::string > m_nodeToRoutingTableElementMap
Node to Routing Table Element mapping.
void Initialize()
Initialize stack helper.
bool m_ipv4Enabled
IPv4 install state (enabled/disabled) ?
void SetClickFile(NodeContainer c, std::string clickfile)
Set a Click file to be used for a group of nodes.
bool AsciiHooked(Ptr< Ipv4 > ipv4)
Check if ASCII is hooked.
ClickInternetStackHelper()
Create a new ClickInternetStackHelper which uses Ipv4ClickRouting for routing.
void SetRoutingTableElement(NodeContainer c, std::string rt)
Set a Click routing table element for a group of nodes.
void InstallAll() const
Aggregate IPv4, UDP, and TCP stacks to all nodes in the simulation.
void Install(std::string nodeName) const
Aggregate implementations of the ns3::Ipv4L3ClickProtocol, ns3::ArpL3Protocol, ns3::Udp,...
void EnablePcapIpv4Internal(std::string prefix, Ptr< Ipv4 > ipv4, uint32_t interface, bool explicitFilename) override
Enable pcap output the indicated Ipv4 and interface pair.
void Reset()
Return helper internal state to that of a newly constructed one.
std::map< Ptr< Node >, std::map< std::string, std::string > > m_nodeToDefinesMap
Node to Click defines mapping.
void EnableAsciiIpv4Internal(Ptr< OutputStreamWrapper > stream, std::string prefix, Ptr< Ipv4 > ipv4, uint32_t interface, bool explicitFilename) override
Enable ascii trace output on the indicated Ipv4 and interface pair.
keep track of a set of node pointers.
Base class providing common user-level pcap operations for helpers representing IPv4 protocols .
Every class exported by the ns3 library is enclosed in the ns3 namespace.