README moves to markdown
[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 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.ns3ipv4l3protocol import NS3BaseIpv4L3Protocol 
23
24 @clsinit_copy
25 class NS3Ipv4L3Protocol(NS3BaseIpv4L3Protocol):
26     _rtype = "ns3::Ipv4L3Protocol"
27
28     @classmethod
29     def _register_attributes(cls):
30         
31         attr_defaulttos = Attribute("DefaultTos",
32             "The TOS value set by default on all outgoing packets generated on this node.",
33             type = Types.Integer,
34             default = "0",  
35             allowed = None,
36             range = None,    
37             flags = Flags.Reserved | Flags.Construct)
38
39         cls._register_attribute(attr_defaulttos)
40
41         attr_defaultttl = Attribute("DefaultTtl",
42             "The TTL value set by default on all outgoing packets generated on this node.",
43             type = Types.Integer,
44             default = "64",  
45             allowed = None,
46             range = None,    
47             flags = Flags.Reserved | Flags.Construct)
48
49         cls._register_attribute(attr_defaultttl)
50
51         attr_fragmentexpirationtimeout = Attribute("FragmentExpirationTimeout",
52             "When this timeout expires, the fragments will be cleared from the buffer.",
53             type = Types.String,
54             default = "+30000000000.0ns",  
55             allowed = None,
56             range = None,    
57             flags = Flags.Reserved | Flags.Construct)
58
59         cls._register_attribute(attr_fragmentexpirationtimeout)
60
61         attr_ipforward = Attribute("IpForward",
62             "Globally enable or disable IP forwarding for all current and future Ipv4 devices.",
63             type = Types.Bool,
64             default = "True",  
65             allowed = None,
66             range = None,    
67             flags = Flags.Reserved | Flags.Construct)
68
69         cls._register_attribute(attr_ipforward)
70
71         attr_weakesmodel = Attribute("WeakEsModel",
72             "RFC1122 term for whether host accepts datagram with a dest. address on another interface",
73             type = Types.Bool,
74             default = "True",  
75             allowed = None,
76             range = None,    
77             flags = Flags.Reserved | Flags.Construct)
78
79         cls._register_attribute(attr_weakesmodel)
80
81
82
83     @classmethod
84     def _register_traces(cls):
85         
86         tx = Trace("Tx", "Send ipv4 packet to outgoing interface.")
87
88         cls._register_trace(tx)
89
90         rx = Trace("Rx", "Receive ipv4 packet from incoming interface.")
91
92         cls._register_trace(rx)
93
94         drop = Trace("Drop", "Drop ipv4 packet")
95
96         cls._register_trace(drop)
97
98         sendoutgoing = Trace("SendOutgoing", "A newly-generated packet by this node is about to be queued for transmission")
99
100         cls._register_trace(sendoutgoing)
101
102         unicastforward = Trace("UnicastForward", "A unicast IPv4 packet was received by this node and is being forwarded to another node")
103
104         cls._register_trace(unicastforward)
105
106         localdeliver = Trace("LocalDeliver", "An IPv4 packet was received by/for this node, and it is being forward up the stack")
107
108         cls._register_trace(localdeliver)
109
110
111
112     def __init__(self, ec, guid):
113         super(NS3Ipv4L3Protocol, self).__init__(ec, guid)
114         self._home = "ns3-ipv4l3protocol-%s" % self.guid