class documentation

class TunHelper: (source)

View In Hierarchy

A helper for tests of tun-related functionality (ip-level tunnels).

Method __init__ No summary
Method encapsulate Construct an ip datagram containing a udp datagram containing the given application-level payload.
Method parser Get a function for parsing a datagram read from a tun device.
Instance Variable tunnelLocal Undocumented
Instance Variable tunnelRemote Undocumented
Property TUNNEL_TYPE Undocumented
def __init__(self, tunnelRemote, tunnelLocal): (source)
Parameters
tunnelRemote:bytesThe source address for UDP datagrams originated from this helper. This is an IPv4 dotted-quad string.
tunnelLocal:bytesThe destination address for UDP datagrams originated from this helper. This is an IPv4 dotted-quad string.
def encapsulate(self, source, destination, payload): (source)

Construct an ip datagram containing a udp datagram containing the given application-level payload.

Parameters
source:intThe source port for the UDP datagram being encapsulated.
destination:intThe destination port for the UDP datagram being encapsulated.
payload:bytesThe application data to include in the udp datagram.
Returns
bytesAn ethernet frame.
def parser(self): (source)

Get a function for parsing a datagram read from a tun device.

Returns
A function which accepts a datagram exactly as might be read from a tun device. The datagram is expected to ultimately carry a UDP datagram. When called, it returns a list of tuples. Each tuple has the UDP application data as the first element and the sender address as the second element.
tunnelLocal = (source)

Undocumented

tunnelRemote = (source)

Undocumented

@property
TUNNEL_TYPE = (source)

Undocumented