2 # NEPI, a framework to manage network experiments
3 # Copyright (C) 2014 INRIA
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;
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.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18 from nepi.execution.attribute import Attribute, Flags, Types
19 from nepi.execution.trace import Trace, TraceAttr
20 from nepi.execution.resource import ResourceManager, clsinit_copy, \
22 from nepi.resources.ns3.ns3wifimac import NS3BaseWifiMac
25 class NS3AdhocWifiMac(NS3BaseWifiMac):
26 _rtype = "ns3::AdhocWifiMac"
29 def _register_attributes(cls):
31 attr_qossupported = Attribute("QosSupported",
32 "This Boolean attribute is set to enable 802.11e/WMM-style QoS support at this STA",
37 flags = Flags.Reserved | Flags.Construct)
39 cls._register_attribute(attr_qossupported)
41 attr_htsupported = Attribute("HtSupported",
42 "This Boolean attribute is set to enable 802.11n support at this STA",
47 flags = Flags.Reserved | Flags.Construct)
49 cls._register_attribute(attr_htsupported)
51 attr_ctstoselfsupported = Attribute("CtsToSelfSupported",
52 "Use CTS to Self when using a rate that is not in the basic set rate",
57 flags = Flags.Reserved | Flags.Construct)
59 cls._register_attribute(attr_ctstoselfsupported)
61 attr_ctstimeout = Attribute("CtsTimeout",
62 "When this timeout expires, the RTS/CTS handshake has failed.",
64 default = "+75000.0ns",
67 flags = Flags.Reserved | Flags.Construct)
69 cls._register_attribute(attr_ctstimeout)
71 attr_acktimeout = Attribute("AckTimeout",
72 "When this timeout expires, the DATA/ACK handshake has failed.",
74 default = "+75000.0ns",
77 flags = Flags.Reserved | Flags.Construct)
79 cls._register_attribute(attr_acktimeout)
81 attr_basicblockacktimeout = Attribute("BasicBlockAckTimeout",
82 "When this timeout expires, the BASIC_BLOCK_ACK_REQ/BASIC_BLOCK_ACK handshake has failed.",
84 default = "+281000.0ns",
87 flags = Flags.Reserved | Flags.Construct)
89 cls._register_attribute(attr_basicblockacktimeout)
91 attr_compressedblockacktimeout = Attribute("CompressedBlockAckTimeout",
92 "When this timeout expires, the COMPRESSED_BLOCK_ACK_REQ/COMPRESSED_BLOCK_ACK handshake has failed.",
94 default = "+107000.0ns",
97 flags = Flags.Reserved | Flags.Construct)
99 cls._register_attribute(attr_compressedblockacktimeout)
101 attr_sifs = Attribute("Sifs",
102 "The value of the SIFS constant.",
104 default = "+16000.0ns",
107 flags = Flags.Reserved | Flags.Construct)
109 cls._register_attribute(attr_sifs)
111 attr_eifsnodifs = Attribute("EifsNoDifs",
112 "The value of EIFS-DIFS",
114 default = "+60000.0ns",
117 flags = Flags.Reserved | Flags.Construct)
119 cls._register_attribute(attr_eifsnodifs)
121 attr_slot = Attribute("Slot",
122 "The duration of a Slot.",
124 default = "+9000.0ns",
127 flags = Flags.Reserved | Flags.Construct)
129 cls._register_attribute(attr_slot)
131 attr_pifs = Attribute("Pifs",
132 "The value of the PIFS constant.",
134 default = "+25000.0ns",
137 flags = Flags.Reserved | Flags.Construct)
139 cls._register_attribute(attr_pifs)
141 attr_rifs = Attribute("Rifs",
142 "The value of the RIFS constant.",
144 default = "+2000.0ns",
147 flags = Flags.Reserved | Flags.Construct)
149 cls._register_attribute(attr_rifs)
151 attr_maxpropagationdelay = Attribute("MaxPropagationDelay",
152 "The maximum propagation delay. Unused for now.",
154 default = "+3333.0ns",
157 flags = Flags.Reserved | Flags.Construct)
159 cls._register_attribute(attr_maxpropagationdelay)
161 attr_ssid = Attribute("Ssid",
162 "The ssid we want to belong to.",
167 flags = Flags.Reserved | Flags.Construct)
169 cls._register_attribute(attr_ssid)
174 def _register_traces(cls):
176 txokheader = Trace("TxOkHeader", "The header of successfully transmitted packet")
178 cls._register_trace(txokheader)
180 txerrheader = Trace("TxErrHeader", "The header of unsuccessfully transmitted packet")
182 cls._register_trace(txerrheader)
184 mactx = Trace("MacTx", "A packet has been received from higher layers and is being processed in preparation for queueing for transmission.")
186 cls._register_trace(mactx)
188 mactxdrop = Trace("MacTxDrop", "A packet has been dropped in the MAC layer before being queued for transmission.")
190 cls._register_trace(mactxdrop)
192 macpromiscrx = Trace("MacPromiscRx", "A packet has been received by this device, has been passed up from the physical layer and is being forwarded up the local protocol stack. This is a promiscuous trace,")
194 cls._register_trace(macpromiscrx)
196 macrx = Trace("MacRx", "A packet has been received by this device, has been passed up from the physical layer and is being forwarded up the local protocol stack. This is a non-promiscuous trace,")
198 cls._register_trace(macrx)
200 macrxdrop = Trace("MacRxDrop", "A packet has been dropped in the MAC layer after it has been passed up from the physical layer.")
202 cls._register_trace(macrxdrop)
206 def __init__(self, ec, guid):
207 super(NS3AdhocWifiMac, self).__init__(ec, guid)
208 self._home = "ns3-adhoc-wifi-mac-%s" % self.guid