README moves to markdown
[nepi.git] / nepi / resources / ns3 / classes / six_low_pan_net_device.py
1 #
2 #    NEPI, a framework to manage network experiments
3 #    Copyright (C) 2014 INRIA
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, see <http://www.gnu.org/licenses/>.
16 #
17
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, \
21         ResourceState
22 from nepi.resources.ns3.ns3netdevice import NS3BaseNetDevice 
23
24 @clsinit_copy
25 class NS3SixLowPanNetDevice(NS3BaseNetDevice):
26     _rtype = "ns3::SixLowPanNetDevice"
27
28     @classmethod
29     def _register_attributes(cls):
30         
31         attr_rfc6282 = Attribute("Rfc6282",
32             "Use RFC6282 (IPHC) if true, RFC4944 (HC1) otherwise.",
33             type = Types.Bool,
34             default = "True",  
35             allowed = None,
36             range = None,    
37             flags = Flags.Reserved | Flags.Construct)
38
39         cls._register_attribute(attr_rfc6282)
40
41         attr_omitudpchecksum = Attribute("OmitUdpChecksum",
42             "Omit the UDP checksum in IPHC compression.",
43             type = Types.Bool,
44             default = "True",  
45             allowed = None,
46             range = None,    
47             flags = Flags.Reserved | Flags.Construct)
48
49         cls._register_attribute(attr_omitudpchecksum)
50
51         attr_fragmentreassemblylistsize = Attribute("FragmentReassemblyListSize",
52             "The maximum size of the reassembly buffer (in packets). Zero meaning infinite.",
53             type = Types.Integer,
54             default = "0",  
55             allowed = None,
56             range = None,    
57             flags = Flags.Reserved | Flags.Construct)
58
59         cls._register_attribute(attr_fragmentreassemblylistsize)
60
61         attr_fragmentexpirationtimeout = Attribute("FragmentExpirationTimeout",
62             "When this timeout expires, the fragments will be cleared from the buffer.",
63             type = Types.String,
64             default = "+60000000000.0ns",  
65             allowed = None,
66             range = None,    
67             flags = Flags.Reserved | Flags.Construct)
68
69         cls._register_attribute(attr_fragmentexpirationtimeout)
70
71         attr_compressionthreshold = Attribute("CompressionThreshold",
72             "The minimum MAC layer payload size.",
73             type = Types.Integer,
74             default = "0",  
75             allowed = None,
76             range = None,    
77             flags = Flags.Reserved | Flags.Construct)
78
79         cls._register_attribute(attr_compressionthreshold)
80
81         attr_forceethertype = Attribute("ForceEtherType",
82             "Force a specific EtherType in L2 frames.",
83             type = Types.Bool,
84             default = "False",  
85             allowed = None,
86             range = None,    
87             flags = Flags.Reserved | Flags.Construct)
88
89         cls._register_attribute(attr_forceethertype)
90
91         attr_ethertype = Attribute("EtherType",
92             "The specific EtherType to be used in L2 frames.",
93             type = Types.Integer,
94             default = "65535",  
95             allowed = None,
96             range = None,    
97             flags = Flags.Reserved | Flags.Construct)
98
99         cls._register_attribute(attr_ethertype)
100
101
102
103     @classmethod
104     def _register_traces(cls):
105         
106         tx = Trace("Tx", "Send - packet (including 6LoWPAN header), SixLoWPanNetDevice Ptr, interface index.")
107
108         cls._register_trace(tx)
109
110         rx = Trace("Rx", "Receive - packet (including 6LoWPAN header), SixLoWPanNetDevice Ptr, interface index.")
111
112         cls._register_trace(rx)
113
114         drop = Trace("Drop", "Drop - DropReason, packet (including 6LoWPAN header), SixLoWPanNetDevice Ptr, interface index.")
115
116         cls._register_trace(drop)
117
118
119
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