Changing reschedule_delay internals
[nepi.git] / src / nepi / resources / ns3 / classes / ipv4l3protocol.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 as published by
7 #    the Free Software Foundation, either version 3 of the License, or
8 #    (at your option) any later version.
9 #
10 #    This program is distributed in the hope that it will be useful,
11 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
12 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 #    GNU General Public License for more details.
14 #
15 #    You should have received a copy of the GNU General Public License
16 #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
17 #
18
19 from nepi.execution.attribute import Attribute, Flags, Types
20 from nepi.execution.trace import Trace, TraceAttr
21 from nepi.execution.resource import ResourceManager, clsinit_copy, \
22         ResourceState
23 from nepi.resources.ns3.ns3ipv4l3protocol import NS3BaseIpv4L3Protocol 
24
25 @clsinit_copy
26 class NS3Ipv4L3Protocol(NS3BaseIpv4L3Protocol):
27     _rtype = "ns3::Ipv4L3Protocol"
28
29     @classmethod
30     def _register_attributes(cls):
31         
32         attr_defaulttos = Attribute("DefaultTos",
33             "The TOS value set by default on all outgoing packets generated on this node.",
34             type = Types.Integer,
35             default = "0",  
36             allowed = None,
37             range = None,    
38             flags = Flags.Reserved | Flags.Construct)
39
40         cls._register_attribute(attr_defaulttos)
41
42         attr_defaultttl = Attribute("DefaultTtl",
43             "The TTL value set by default on all outgoing packets generated on this node.",
44             type = Types.Integer,
45             default = "64",  
46             allowed = None,
47             range = None,    
48             flags = Flags.Reserved | Flags.Construct)
49
50         cls._register_attribute(attr_defaultttl)
51
52         attr_fragmentexpirationtimeout = Attribute("FragmentExpirationTimeout",
53             "When this timeout expires, the fragments will be cleared from the buffer.",
54             type = Types.String,
55             default = "+30000000000.0ns",  
56             allowed = None,
57             range = None,    
58             flags = Flags.Reserved | Flags.Construct)
59
60         cls._register_attribute(attr_fragmentexpirationtimeout)
61
62         attr_ipforward = Attribute("IpForward",
63             "Globally enable or disable IP forwarding for all current and future Ipv4 devices.",
64             type = Types.Bool,
65             default = "True",  
66             allowed = None,
67             range = None,    
68             flags = Flags.Reserved | Flags.Construct)
69
70         cls._register_attribute(attr_ipforward)
71
72         attr_weakesmodel = Attribute("WeakEsModel",
73             "RFC1122 term for whether host accepts datagram with a dest. address on another interface",
74             type = Types.Bool,
75             default = "True",  
76             allowed = None,
77             range = None,    
78             flags = Flags.Reserved | Flags.Construct)
79
80         cls._register_attribute(attr_weakesmodel)
81
82
83
84     @classmethod
85     def _register_traces(cls):
86         
87         tx = Trace("Tx", "Send ipv4 packet to outgoing interface.")
88
89         cls._register_trace(tx)
90
91         rx = Trace("Rx", "Receive ipv4 packet from incoming interface.")
92
93         cls._register_trace(rx)
94
95         drop = Trace("Drop", "Drop ipv4 packet")
96
97         cls._register_trace(drop)
98
99         sendoutgoing = Trace("SendOutgoing", "A newly-generated packet by this node is about to be queued for transmission")
100
101         cls._register_trace(sendoutgoing)
102
103         unicastforward = Trace("UnicastForward", "A unicast IPv4 packet was received by this node and is being forwarded to another node")
104
105         cls._register_trace(unicastforward)
106
107         localdeliver = Trace("LocalDeliver", "An IPv4 packet was received by/for this node, and it is being forward up the stack")
108
109         cls._register_trace(localdeliver)
110
111
112
113     def __init__(self, ec, guid):
114         super(NS3Ipv4L3Protocol, self).__init__(ec, guid)
115         self._home = "ns3-ipv4l3protocol-%s" % self.guid