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.ns3netdevice import NS3BaseNetDevice
25 class NS3SixLowPanNetDevice(NS3BaseNetDevice):
26 _rtype = "ns3::SixLowPanNetDevice"
29 def _register_attributes(cls):
31 attr_rfc6282 = Attribute("Rfc6282",
32 "Use RFC6282 (IPHC) if true, RFC4944 (HC1) otherwise.",
37 flags = Flags.Reserved | Flags.Construct)
39 cls._register_attribute(attr_rfc6282)
41 attr_omitudpchecksum = Attribute("OmitUdpChecksum",
42 "Omit the UDP checksum in IPHC compression.",
47 flags = Flags.Reserved | Flags.Construct)
49 cls._register_attribute(attr_omitudpchecksum)
51 attr_fragmentreassemblylistsize = Attribute("FragmentReassemblyListSize",
52 "The maximum size of the reassembly buffer (in packets). Zero meaning infinite.",
57 flags = Flags.Reserved | Flags.Construct)
59 cls._register_attribute(attr_fragmentreassemblylistsize)
61 attr_fragmentexpirationtimeout = Attribute("FragmentExpirationTimeout",
62 "When this timeout expires, the fragments will be cleared from the buffer.",
64 default = "+60000000000.0ns",
67 flags = Flags.Reserved | Flags.Construct)
69 cls._register_attribute(attr_fragmentexpirationtimeout)
71 attr_compressionthreshold = Attribute("CompressionThreshold",
72 "The minimum MAC layer payload size.",
77 flags = Flags.Reserved | Flags.Construct)
79 cls._register_attribute(attr_compressionthreshold)
81 attr_forceethertype = Attribute("ForceEtherType",
82 "Force a specific EtherType in L2 frames.",
87 flags = Flags.Reserved | Flags.Construct)
89 cls._register_attribute(attr_forceethertype)
91 attr_ethertype = Attribute("EtherType",
92 "The specific EtherType to be used in L2 frames.",
97 flags = Flags.Reserved | Flags.Construct)
99 cls._register_attribute(attr_ethertype)
104 def _register_traces(cls):
106 tx = Trace("Tx", "Send - packet (including 6LoWPAN header), SixLoWPanNetDevice Ptr, interface index.")
108 cls._register_trace(tx)
110 rx = Trace("Rx", "Receive - packet (including 6LoWPAN header), SixLoWPanNetDevice Ptr, interface index.")
112 cls._register_trace(rx)
114 drop = Trace("Drop", "Drop - DropReason, packet (including 6LoWPAN header), SixLoWPanNetDevice Ptr, interface index.")
116 cls._register_trace(drop)
120 def __init__(self, ec, guid):
121 super(NS3SixLowPanNetDevice, self).__init__(ec, guid)
122 self._home = "ns3-six-low-pan-net-device-%s" % self.guid