self.netmask = None
self.up = None
- self.device_name = None
self.mtu = None
self.snat = False
self.txqueuelen = None
self.pointopoint = None
+ self.multicast = False
+ self.bwlimit = None
# Enabled traces
self.capture = False
# These get initialized when the iface is connected to any filter
self.filter_module = None
+ self.multicast_forwarder = None
# These get initialized when the iface is configured
self.external_iface = None
if self.tun_cipher != 'PLAIN' and self.peer_proto not in ('udp','tcp',None):
raise RuntimeError, "Miscofnigured TUN: %s - ciphered tunnels only work with udp or tcp links" % (self,)
- def _impl_instance(self, home_path, listening):
+ def _impl_instance(self, home_path):
impl = self._PROTO_MAP[self.peer_proto](
- self, self.peer_iface, home_path, self.tun_key, listening)
+ self, self.peer_iface, home_path, self.tun_key)
impl.port = self.tun_port
+ impl.cross_slice = not self.peer_iface or isinstance(self.peer_iface, _CrossIface)
return impl
def recover(self):
else:
self._delay_recover = True
- def prepare(self, home_path, listening):
- if not self.peer_iface and (self.peer_proto and (listening or (self.peer_addr and self.peer_port))):
+ def prepare(self, home_path):
+ if not self.peer_iface and (self.peer_proto and self.peer_addr and self.peer_port):
# Ad-hoc peer_iface
self.peer_iface = _CrossIface(
self.peer_proto,
self.peer_cipher)
if self.peer_iface:
if not self.peer_proto_impl:
- self.peer_proto_impl = self._impl_instance(home_path, listening)
+ self.peer_proto_impl = self._impl_instance(home_path)
if self._delay_recover:
self.peer_proto_impl.recover()
- else:
- self.peer_proto_impl.prepare()
- def setup(self):
+ def launch(self):
if self.peer_proto_impl:
- self.peer_proto_impl.setup()
+ self.peer_proto_impl.launch()
def cleanup(self):
if self.peer_proto_impl:
self.peer_proto_impl.destroy()
self.peer_proto_impl = None
- def async_launch_wait(self):
+ def wait(self):
if self.peer_proto_impl:
- self.peer_proto_impl.async_launch_wait()
+ self.peer_proto_impl.wait()
- def sync_trace(self, local_dir, whichtrace):
+ def sync_trace(self, local_dir, whichtrace, tracemap = None):
if self.peer_proto_impl:
- return self.peer_proto_impl.sync_trace(local_dir, whichtrace)
+ return self.peer_proto_impl.sync_trace(local_dir, whichtrace,
+ tracemap)
else:
return None
- def remote_trace_path(self, whichtrace):
+ def remote_trace_path(self, whichtrace, tracemap = None):
if self.peer_proto_impl:
- return self.peer_proto_impl.remote_trace_path(whichtrace)
+ return self.peer_proto_impl.remote_trace_path(whichtrace, tracemap)
else:
return None
+ def remote_trace_name(self, whichtrace):
+ return whichtrace
+
class TapIface(TunIface):
_PROTO_MAP = tunproto.TAP_PROTO_MAP
_KIND = 'TAP'
return local_path
class TunFilter(object):
+ _TRACEMAP = {
+ # tracename : (remotename, localname)
+ }
+
def __init__(self, api=None):
if not api:
api = plcapi.PLCAPI()
# Attributes
self.module = None
+ self.args = None
# These get initialised when the filter is connected
self.peer_guid = None
del _get
del _set
+ def remote_trace_path(self, whichtrace):
+ iface = self.iface()
+ if iface is not None:
+ return iface.remote_trace_path(whichtrace, self._TRACEMAP)
+ return None
+
+ def remote_trace_name(self, whichtrace):
+ iface = self.iface()
+ if iface is not None:
+ return iface.remote_trace_name(whichtrace, self._TRACEMAP)
+ return None
+
+ def sync_trace(self, local_dir, whichtrace):
+ iface = self.iface()
+ if iface is not None:
+ return iface.sync_trace(local_dir, whichtrace, self._TRACEMAP)
+ return None
+
+class ClassQueueFilter(TunFilter):
+ _TRACEMAP = {
+ # tracename : (remotename, localname)
+ 'dropped_stats' : ('dropped_stats', 'dropped_stats')
+ }
+
+ def __init__(self, api=None):
+ super(ClassQueueFilter, self).__init__(api)
+ # Attributes
+ self.module = "classqueue.py"
+
+class ToSQueueFilter(TunFilter):
+ def __init__(self, api=None):
+ super(ToSQueueFilter, self).__init__(api)
+ # Attributes
+ self.module = "tosqueue.py"
+