class documentation

class TuntapPort(abstract.FileDescriptor): (source)

Implements interfaces: twisted.internet.interfaces.IListeningPort

View In Hierarchy

A Port that reads and writes packets from/to a TUN/TAP-device.
Method __init__
Method __repr__ Undocumented
Method connection​Lost Cleans up my socket.
Method do​Read Called when my socket is ready for reading.
Method fileno File Descriptor number for select().
Method get​Host Get the local address of this TuntapPort.
Method log​Prefix Returns the name of my class, to prefix log entries with.
Method lose​Connection Close this tunnel. Use TuntapPort.stopListening instead.
Method start​Listening Create and bind my socket, and begin listening on it.
Method stop​Listening Stop accepting connections on this port.
Method write Write the given data as a single datagram.
Method write​Sequence Write a datagram constructed from a list of bytes.
Class Variable max​Throughput Undocumented
Instance Variable connected Undocumented
Instance Variable ethernet Undocumented
Instance Variable interface Undocumented
Instance Variable logstr Undocumented
Instance Variable max​Packet​Size Undocumented
Instance Variable protocol Undocumented
Method _bind​Socket Open the tunnel.
Method _open​Tunnel Open the named tunnel using the given mode.
Instance Variable _fileno Undocumented
Instance Variable _mode Undocumented
Instance Variable _system Undocumented

Inherited from FileDescriptor:

Method do​Write Called when data can be written.
Method get​Peer Get the remote address of this connection.
Method lose​Write​Connection Undocumented
Method pause​Producing Pause producing data.
Method read​Connection​Lost Indicates read connection was lost.
Method resume​Producing Resume producing data.
Method start​Reading Start waiting for read availability.
Method start​Writing Start waiting for write availability.
Method stop​Consuming Stop consuming data.
Method stop​Producing Stop producing data.
Method stop​Reading Stop waiting for read availability.
Method stop​Writing Stop waiting for write availability.
Method write​Connection​Lost Indicates write connection was lost.
Method write​Some​Data Write as much as possible of the given data, immediately.
Constant SEND​_LIMIT Undocumented
Class Variable buffer​Size Undocumented
Class Variable disconnecting Undocumented
Instance Variable data​Buffer Undocumented
Instance Variable disconnected Undocumented
Instance Variable offset Undocumented
Instance Variable producer Undocumented
Instance Variable producer​Paused Undocumented
Instance Variable reactor Undocumented
Method _close​Write​Connection Undocumented
Method _is​Send​Buffer​Full Determine whether the user-space send buffer for this transport is full or not.
Method _maybe​Pause​Producer Possibly pause a producer, if there is one and the send buffer is full.
Method _post​Lose​Connection Called after a loseConnection(), when all data has been written.
Class Variable _write​Disconnected Undocumented
Instance Variable _temp​Data​Buffer Undocumented
Instance Variable _temp​Data​Len Undocumented
Instance Variable _write​Disconnecting Undocumented

Inherited from _ConsumerMixin (via FileDescriptor):

Method register​Producer Register to receive data from a producer.
Method unregister​Producer Stop consuming data from a producer, without disconnecting.
Instance Variable streaming​Producer bool or int

Inherited from _LogOwner (via FileDescriptor):

Method _get​Log​Prefix Determine the log prefix to use for messages related to applicationObject, which may or may not be an interfaces.ILoggingContext provider.
def __init__(self, interface, proto, maxPacketSize=8192, reactor=None, system=None): (source)
Parameters
interfaceUndocumented
protoUndocumented
max​Packet​SizeUndocumented
reactorAn IReactorFDSet provider which this descriptor will use to get readable and writeable event notifications. If no value is given, the global reactor will be used.
systemUndocumented
def __repr__(self): (source)

Undocumented

Returns
strUndocumented
def connectionLost(self, reason=None): (source)
Cleans up my socket.
Parameters
reasonIgnored. Do not use this.
def doRead(self): (source)
Called when my socket is ready for reading.
def fileno(self): (source)

File Descriptor number for select().

This method must be overridden or assigned in subclasses to indicate a valid file descriptor for the operating system.

def getHost(self): (source)
Get the local address of this TuntapPort.
Returns
TunnelAddressA TunnelAddress which describes the tunnel device to which this object is bound.
def logPrefix(self): (source)
Returns the name of my class, to prefix log entries with.
def loseConnection(self): (source)
Close this tunnel. Use TuntapPort.stopListening instead.
def startListening(self): (source)

Create and bind my socket, and begin listening on it.

This must be called after creating a server to begin listening on the specified tunnel.

def stopListening(self): (source)

Stop accepting connections on this port.

This will shut down my socket and call self.connectionLost().

Returns
A Deferred that fires when this port has stopped.
def write(self, datagram): (source)
Write the given data as a single datagram.
Parameters
datagram:bytesThe data that will make up the complete datagram to be written.
def writeSequence(self, seq): (source)
Write a datagram constructed from a list of bytes.
Parameters
seq:list of bytesThe data that will make up the complete datagram to be written.
maxThroughput = (source)

Undocumented

ethernet: int = (source)

Undocumented

interface = (source)

Undocumented

logstr = (source)

Undocumented

maxPacketSize = (source)

Undocumented

protocol = (source)

Undocumented

def _bindSocket(self): (source)
Open the tunnel.
def _openTunnel(self, name, mode): (source)
Open the named tunnel using the given mode.
Parameters
name:bytesThe name of the tunnel to open.
modeFlags from TunnelFlags with exactly one of TunnelFlags.IFF_TUN or TunnelFlags.IFF_TAP set.
Returns
A _TunnelDescription representing the newly opened tunnel.
_fileno: int = (source)

Undocumented

_mode = (source)

Undocumented

_system = (source)

Undocumented