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.ns3ipv4l3protocol import NS3BaseIpv4L3Protocol
25 class NS3Ipv4L3Protocol(NS3BaseIpv4L3Protocol):
26 _rtype = "ns3::Ipv4L3Protocol"
29 def _register_attributes(cls):
31 attr_defaulttos = Attribute("DefaultTos",
32 "The TOS value set by default on all outgoing packets generated on this node.",
37 flags = Flags.Reserved | Flags.Construct)
39 cls._register_attribute(attr_defaulttos)
41 attr_defaultttl = Attribute("DefaultTtl",
42 "The TTL value set by default on all outgoing packets generated on this node.",
47 flags = Flags.Reserved | Flags.Construct)
49 cls._register_attribute(attr_defaultttl)
51 attr_fragmentexpirationtimeout = Attribute("FragmentExpirationTimeout",
52 "When this timeout expires, the fragments will be cleared from the buffer.",
54 default = "+30000000000.0ns",
57 flags = Flags.Reserved | Flags.Construct)
59 cls._register_attribute(attr_fragmentexpirationtimeout)
61 attr_ipforward = Attribute("IpForward",
62 "Globally enable or disable IP forwarding for all current and future Ipv4 devices.",
67 flags = Flags.Reserved | Flags.Construct)
69 cls._register_attribute(attr_ipforward)
71 attr_weakesmodel = Attribute("WeakEsModel",
72 "RFC1122 term for whether host accepts datagram with a dest. address on another interface",
77 flags = Flags.Reserved | Flags.Construct)
79 cls._register_attribute(attr_weakesmodel)
84 def _register_traces(cls):
86 tx = Trace("Tx", "Send ipv4 packet to outgoing interface.")
88 cls._register_trace(tx)
90 rx = Trace("Rx", "Receive ipv4 packet from incoming interface.")
92 cls._register_trace(rx)
94 drop = Trace("Drop", "Drop ipv4 packet")
96 cls._register_trace(drop)
98 sendoutgoing = Trace("SendOutgoing", "A newly-generated packet by this node is about to be queued for transmission")
100 cls._register_trace(sendoutgoing)
102 unicastforward = Trace("UnicastForward", "A unicast IPv4 packet was received by this node and is being forwarded to another node")
104 cls._register_trace(unicastforward)
106 localdeliver = Trace("LocalDeliver", "An IPv4 packet was received by/for this node, and it is being forward up the stack")
108 cls._register_trace(localdeliver)
112 def __init__(self, ec, guid):
113 super(NS3Ipv4L3Protocol, self).__init__(ec, guid)
114 self._home = "ns3-ipv4l3protocol-%s" % self.guid