-
Notifications
You must be signed in to change notification settings - Fork 0
/
ManetSim.hh
84 lines (67 loc) · 2.11 KB
/
ManetSim.hh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#ifndef __MANETSIM_HH__
#define __MANETSIM_HH__
#include <map>
#include <string>
#include "ns3/core-module.h"
#include "ns3/network-module.h"
#include "ns3/applications-module.h"
#include "ns3/mobility-module.h"
#include "ns3/config-store-module.h"
#include "ns3/wifi-module.h"
#include "ns3/csma-module.h"
#include "ns3/olsr-helper.h"
#include "ns3/aodv-helper.h"
#include "ns3/dsdv-helper.h"
#include "ns3/internet-module.h"
#include "ns3/flow-monitor.h"
class ManetSim
{
public:
ManetSim(
unsigned int numNodes,
const std::string & mobilityModel,
bool allowCollisions,
unsigned int numPackets,
unsigned int packetSize,
double sendInterval,
double sendStartTime,
const std::string & routingProtocol,
const std::string & whichApp);
virtual ~ManetSim()
{ }
void logResults() const;
protected:
typedef std::map<std::string, unsigned int> PacketCounterType;
void printNumPacketsReceived() const;
//void printGnutellaStats() const;
void createNode();
void setupRoutingForNode(ns3::Ptr<ns3::Node> target_node);
void installAppsForNode(
const std::string & whichApp,
ns3::Ptr<ns3::Node> node,
double startTime);
void installPacketFlooder(ns3::Ptr<ns3::Node> node, double startTime);
void installBaselineGnutella(ns3::Ptr<ns3::Node> node, double startTime);
void packetReceived(
std::string path,
ns3::Ptr<const ns3::Packet> packet,
const ns3::Address & address);
ns3::NodeContainer m_nodes;
ns3::WifiHelper m_wifi;
ns3::NqosWifiMacHelper m_wifiMac;
ns3::YansWifiPhyHelper m_wifiPhy;
ns3::YansWifiChannelHelper m_wifiChannel;
ns3::NetDeviceContainer m_nodeDevices;
ns3::MobilityHelper m_mobility;
ns3::Ipv4AddressHelper m_ipv4;
ns3::Ipv4InterfaceContainer m_addrs;
unsigned int m_numPackets;
unsigned int m_packetSize;
double m_sendInterval;
double m_sendStartTime;
std::string m_routingProtocol;
std::string m_whichApplication;
PacketCounterType m_packetCounter;
ns3::Ptr<ns3::FlowMonitor> m_fm;
};
#endif