author | Tom Henderson <tomh@tomh.org> |
Sat, 26 Apr 2014 22:21:03 -0700 | |
changeset 10754 | e02848bde991 |
parent 10724 | eb3a25906dcd |
child 10760 | d7d73e3ceb3c |
permissions | -rw-r--r-- |
10711 | 1 |
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
2 |
/* |
|
3 |
* Copyright (c) 2011 The Boeing Company |
|
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 |
* Authors: |
|
19 |
* Gary Pei <guangyu.pei@boeing.com> |
|
10712
b953606d11fa
roll-up of many updates to models, tests, examples
Tom Henderson <tomh@tomh.org>
parents:
10711
diff
changeset
|
20 |
* Tom Henderson <thomas.r.henderson@boeing.com> |
10711 | 21 |
*/ |
22 |
#ifndef LR_WPAN_HELPER_H |
|
23 |
#define LR_WPAN_HELPER_H |
|
24 |
||
10720
4e4a0de88982
ACK (Sascha Jopen), NetDevice (Tommaso Pecorella and Margherita Filippetti), FCS changes (Erwan Livolant), and clang compliance
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10712
diff
changeset
|
25 |
#include <ns3/node-container.h> |
4e4a0de88982
ACK (Sascha Jopen), NetDevice (Tommaso Pecorella and Margherita Filippetti), FCS changes (Erwan Livolant), and clang compliance
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10712
diff
changeset
|
26 |
#include <ns3/lr-wpan-phy.h> |
4e4a0de88982
ACK (Sascha Jopen), NetDevice (Tommaso Pecorella and Margherita Filippetti), FCS changes (Erwan Livolant), and clang compliance
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10712
diff
changeset
|
27 |
#include <ns3/lr-wpan-mac.h> |
4e4a0de88982
ACK (Sascha Jopen), NetDevice (Tommaso Pecorella and Margherita Filippetti), FCS changes (Erwan Livolant), and clang compliance
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10712
diff
changeset
|
28 |
#include <ns3/trace-helper.h> |
10711 | 29 |
|
30 |
namespace ns3 { |
|
31 |
||
10720
4e4a0de88982
ACK (Sascha Jopen), NetDevice (Tommaso Pecorella and Margherita Filippetti), FCS changes (Erwan Livolant), and clang compliance
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10712
diff
changeset
|
32 |
class SingleModelSpectrumChannel; |
4e4a0de88982
ACK (Sascha Jopen), NetDevice (Tommaso Pecorella and Margherita Filippetti), FCS changes (Erwan Livolant), and clang compliance
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10712
diff
changeset
|
33 |
class MobilityModel; |
4e4a0de88982
ACK (Sascha Jopen), NetDevice (Tommaso Pecorella and Margherita Filippetti), FCS changes (Erwan Livolant), and clang compliance
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10712
diff
changeset
|
34 |
|
10711 | 35 |
/** |
10712
b953606d11fa
roll-up of many updates to models, tests, examples
Tom Henderson <tomh@tomh.org>
parents:
10711
diff
changeset
|
36 |
* \ingroup lr-wpan |
b953606d11fa
roll-up of many updates to models, tests, examples
Tom Henderson <tomh@tomh.org>
parents:
10711
diff
changeset
|
37 |
* |
b953606d11fa
roll-up of many updates to models, tests, examples
Tom Henderson <tomh@tomh.org>
parents:
10711
diff
changeset
|
38 |
* \brief helps to manage and create IEEE 802.15.4 NetDevice objects |
10711 | 39 |
* |
10712
b953606d11fa
roll-up of many updates to models, tests, examples
Tom Henderson <tomh@tomh.org>
parents:
10711
diff
changeset
|
40 |
* This class can help to create IEEE 802.15.4 NetDevice objects |
b953606d11fa
roll-up of many updates to models, tests, examples
Tom Henderson <tomh@tomh.org>
parents:
10711
diff
changeset
|
41 |
* and to configure their attributes during creation. It also contains |
b953606d11fa
roll-up of many updates to models, tests, examples
Tom Henderson <tomh@tomh.org>
parents:
10711
diff
changeset
|
42 |
* additional helper functions used by client code. |
10711 | 43 |
*/ |
44 |
||
10712
b953606d11fa
roll-up of many updates to models, tests, examples
Tom Henderson <tomh@tomh.org>
parents:
10711
diff
changeset
|
45 |
class LrWpanHelper : public PcapHelperForDevice, |
b953606d11fa
roll-up of many updates to models, tests, examples
Tom Henderson <tomh@tomh.org>
parents:
10711
diff
changeset
|
46 |
public AsciiTraceHelperForDevice |
10711 | 47 |
{ |
48 |
public: |
|
49 |
/** |
|
50 |
* \brief Create a LrWpan helper in an empty state. |
|
51 |
*/ |
|
52 |
LrWpanHelper (void); |
|
10720
4e4a0de88982
ACK (Sascha Jopen), NetDevice (Tommaso Pecorella and Margherita Filippetti), FCS changes (Erwan Livolant), and clang compliance
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10712
diff
changeset
|
53 |
virtual ~LrWpanHelper (void); |
10711 | 54 |
|
55 |
/** |
|
56 |
* \brief Add mobility model to a physical device |
|
57 |
* \param phy the physical device |
|
58 |
* \param m the mobility model |
|
59 |
*/ |
|
10712
b953606d11fa
roll-up of many updates to models, tests, examples
Tom Henderson <tomh@tomh.org>
parents:
10711
diff
changeset
|
60 |
void AddMobility (Ptr<LrWpanPhy> phy, Ptr<MobilityModel> m); |
10711 | 61 |
|
62 |
/** |
|
63 |
* \param c a set of nodes |
|
64 |
*/ |
|
65 |
NetDeviceContainer Install (NodeContainer c); |
|
66 |
||
67 |
/** |
|
10724
eb3a25906dcd
Helper: associate nodes to a PAN
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10720
diff
changeset
|
68 |
* \brief Associate the nodes to the same PAN |
eb3a25906dcd
Helper: associate nodes to a PAN
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10720
diff
changeset
|
69 |
* |
eb3a25906dcd
Helper: associate nodes to a PAN
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10720
diff
changeset
|
70 |
* \param c a set of nodes |
eb3a25906dcd
Helper: associate nodes to a PAN
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10720
diff
changeset
|
71 |
* \param panId the PAN Id |
eb3a25906dcd
Helper: associate nodes to a PAN
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10720
diff
changeset
|
72 |
*/ |
eb3a25906dcd
Helper: associate nodes to a PAN
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10720
diff
changeset
|
73 |
void AssociateToPan (NetDeviceContainer c, uint16_t panId); |
eb3a25906dcd
Helper: associate nodes to a PAN
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10720
diff
changeset
|
74 |
|
eb3a25906dcd
Helper: associate nodes to a PAN
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10720
diff
changeset
|
75 |
/** |
10711 | 76 |
* Helper to enable all LrWpan log components with one statement |
77 |
*/ |
|
78 |
void EnableLogComponents (void); |
|
79 |
||
10712
b953606d11fa
roll-up of many updates to models, tests, examples
Tom Henderson <tomh@tomh.org>
parents:
10711
diff
changeset
|
80 |
static std::string LrWpanPhyEnumerationPrinter (LrWpanPhyEnumeration); |
b953606d11fa
roll-up of many updates to models, tests, examples
Tom Henderson <tomh@tomh.org>
parents:
10711
diff
changeset
|
81 |
static std::string LrWpanMacStatePrinter (LrWpanMacState e); |
b953606d11fa
roll-up of many updates to models, tests, examples
Tom Henderson <tomh@tomh.org>
parents:
10711
diff
changeset
|
82 |
|
10754
e02848bde991
enable assignment of lr-wpan random variable stream indices
Tom Henderson <tomh@tomh.org>
parents:
10724
diff
changeset
|
83 |
/** |
e02848bde991
enable assignment of lr-wpan random variable stream indices
Tom Henderson <tomh@tomh.org>
parents:
10724
diff
changeset
|
84 |
* Assign a fixed random variable stream number to the random variables |
e02848bde991
enable assignment of lr-wpan random variable stream indices
Tom Henderson <tomh@tomh.org>
parents:
10724
diff
changeset
|
85 |
* used by this model. Return the number of streams that have been |
e02848bde991
enable assignment of lr-wpan random variable stream indices
Tom Henderson <tomh@tomh.org>
parents:
10724
diff
changeset
|
86 |
* assigned. The Install() method should have previously been |
e02848bde991
enable assignment of lr-wpan random variable stream indices
Tom Henderson <tomh@tomh.org>
parents:
10724
diff
changeset
|
87 |
* called by the user. |
e02848bde991
enable assignment of lr-wpan random variable stream indices
Tom Henderson <tomh@tomh.org>
parents:
10724
diff
changeset
|
88 |
* |
e02848bde991
enable assignment of lr-wpan random variable stream indices
Tom Henderson <tomh@tomh.org>
parents:
10724
diff
changeset
|
89 |
* \param c NetDeviceContainer of the set of net devices for which the |
e02848bde991
enable assignment of lr-wpan random variable stream indices
Tom Henderson <tomh@tomh.org>
parents:
10724
diff
changeset
|
90 |
* CsmaNetDevice should be modified to use a fixed stream |
e02848bde991
enable assignment of lr-wpan random variable stream indices
Tom Henderson <tomh@tomh.org>
parents:
10724
diff
changeset
|
91 |
* \param stream first stream index to use |
e02848bde991
enable assignment of lr-wpan random variable stream indices
Tom Henderson <tomh@tomh.org>
parents:
10724
diff
changeset
|
92 |
* \return the number of stream indices assigned by this helper |
e02848bde991
enable assignment of lr-wpan random variable stream indices
Tom Henderson <tomh@tomh.org>
parents:
10724
diff
changeset
|
93 |
*/ |
e02848bde991
enable assignment of lr-wpan random variable stream indices
Tom Henderson <tomh@tomh.org>
parents:
10724
diff
changeset
|
94 |
int64_t AssignStreams (NetDeviceContainer c, int64_t stream); |
e02848bde991
enable assignment of lr-wpan random variable stream indices
Tom Henderson <tomh@tomh.org>
parents:
10724
diff
changeset
|
95 |
|
10712
b953606d11fa
roll-up of many updates to models, tests, examples
Tom Henderson <tomh@tomh.org>
parents:
10711
diff
changeset
|
96 |
private: |
b953606d11fa
roll-up of many updates to models, tests, examples
Tom Henderson <tomh@tomh.org>
parents:
10711
diff
changeset
|
97 |
/** |
b953606d11fa
roll-up of many updates to models, tests, examples
Tom Henderson <tomh@tomh.org>
parents:
10711
diff
changeset
|
98 |
* \internal |
b953606d11fa
roll-up of many updates to models, tests, examples
Tom Henderson <tomh@tomh.org>
parents:
10711
diff
changeset
|
99 |
* |
b953606d11fa
roll-up of many updates to models, tests, examples
Tom Henderson <tomh@tomh.org>
parents:
10711
diff
changeset
|
100 |
* \brief Enable pcap output on the indicated net device. |
b953606d11fa
roll-up of many updates to models, tests, examples
Tom Henderson <tomh@tomh.org>
parents:
10711
diff
changeset
|
101 |
* \internal |
b953606d11fa
roll-up of many updates to models, tests, examples
Tom Henderson <tomh@tomh.org>
parents:
10711
diff
changeset
|
102 |
* |
b953606d11fa
roll-up of many updates to models, tests, examples
Tom Henderson <tomh@tomh.org>
parents:
10711
diff
changeset
|
103 |
* NetDevice-specific implementation mechanism for hooking the trace and |
b953606d11fa
roll-up of many updates to models, tests, examples
Tom Henderson <tomh@tomh.org>
parents:
10711
diff
changeset
|
104 |
* writing to the trace file. |
b953606d11fa
roll-up of many updates to models, tests, examples
Tom Henderson <tomh@tomh.org>
parents:
10711
diff
changeset
|
105 |
* |
b953606d11fa
roll-up of many updates to models, tests, examples
Tom Henderson <tomh@tomh.org>
parents:
10711
diff
changeset
|
106 |
* \param prefix Filename prefix to use for pcap files. |
b953606d11fa
roll-up of many updates to models, tests, examples
Tom Henderson <tomh@tomh.org>
parents:
10711
diff
changeset
|
107 |
* \param nd Net device for which you want to enable tracing. |
b953606d11fa
roll-up of many updates to models, tests, examples
Tom Henderson <tomh@tomh.org>
parents:
10711
diff
changeset
|
108 |
* \param promiscuous If true capture all possible packets available at the device. |
b953606d11fa
roll-up of many updates to models, tests, examples
Tom Henderson <tomh@tomh.org>
parents:
10711
diff
changeset
|
109 |
* \param explicitFilename Treat the prefix as an explicit filename if true |
b953606d11fa
roll-up of many updates to models, tests, examples
Tom Henderson <tomh@tomh.org>
parents:
10711
diff
changeset
|
110 |
*/ |
b953606d11fa
roll-up of many updates to models, tests, examples
Tom Henderson <tomh@tomh.org>
parents:
10711
diff
changeset
|
111 |
virtual void EnablePcapInternal (std::string prefix, Ptr<NetDevice> nd, bool promiscuous, bool explicitFilename); |
b953606d11fa
roll-up of many updates to models, tests, examples
Tom Henderson <tomh@tomh.org>
parents:
10711
diff
changeset
|
112 |
|
b953606d11fa
roll-up of many updates to models, tests, examples
Tom Henderson <tomh@tomh.org>
parents:
10711
diff
changeset
|
113 |
/** |
b953606d11fa
roll-up of many updates to models, tests, examples
Tom Henderson <tomh@tomh.org>
parents:
10711
diff
changeset
|
114 |
* \brief Enable ascii trace output on the indicated net device. |
b953606d11fa
roll-up of many updates to models, tests, examples
Tom Henderson <tomh@tomh.org>
parents:
10711
diff
changeset
|
115 |
* \internal |
b953606d11fa
roll-up of many updates to models, tests, examples
Tom Henderson <tomh@tomh.org>
parents:
10711
diff
changeset
|
116 |
* |
b953606d11fa
roll-up of many updates to models, tests, examples
Tom Henderson <tomh@tomh.org>
parents:
10711
diff
changeset
|
117 |
* NetDevice-specific implementation mechanism for hooking the trace and |
b953606d11fa
roll-up of many updates to models, tests, examples
Tom Henderson <tomh@tomh.org>
parents:
10711
diff
changeset
|
118 |
* writing to the trace file. |
b953606d11fa
roll-up of many updates to models, tests, examples
Tom Henderson <tomh@tomh.org>
parents:
10711
diff
changeset
|
119 |
* |
b953606d11fa
roll-up of many updates to models, tests, examples
Tom Henderson <tomh@tomh.org>
parents:
10711
diff
changeset
|
120 |
* \param stream The output stream object to use when logging ascii traces. |
b953606d11fa
roll-up of many updates to models, tests, examples
Tom Henderson <tomh@tomh.org>
parents:
10711
diff
changeset
|
121 |
* \param prefix Filename prefix to use for ascii trace files. |
b953606d11fa
roll-up of many updates to models, tests, examples
Tom Henderson <tomh@tomh.org>
parents:
10711
diff
changeset
|
122 |
* \param nd Net device for which you want to enable tracing. |
b953606d11fa
roll-up of many updates to models, tests, examples
Tom Henderson <tomh@tomh.org>
parents:
10711
diff
changeset
|
123 |
*/ |
b953606d11fa
roll-up of many updates to models, tests, examples
Tom Henderson <tomh@tomh.org>
parents:
10711
diff
changeset
|
124 |
virtual void EnableAsciiInternal (Ptr<OutputStreamWrapper> stream, |
b953606d11fa
roll-up of many updates to models, tests, examples
Tom Henderson <tomh@tomh.org>
parents:
10711
diff
changeset
|
125 |
std::string prefix, |
b953606d11fa
roll-up of many updates to models, tests, examples
Tom Henderson <tomh@tomh.org>
parents:
10711
diff
changeset
|
126 |
Ptr<NetDevice> nd, |
b953606d11fa
roll-up of many updates to models, tests, examples
Tom Henderson <tomh@tomh.org>
parents:
10711
diff
changeset
|
127 |
bool explicitFilename); |
b953606d11fa
roll-up of many updates to models, tests, examples
Tom Henderson <tomh@tomh.org>
parents:
10711
diff
changeset
|
128 |
|
10711 | 129 |
private: |
130 |
Ptr<SingleModelSpectrumChannel> m_channel; |
|
131 |
||
132 |
}; |
|
133 |
||
134 |
} |
|
135 |
||
136 |
#endif /* LR_WPAN_HELPER_H */ |