twisted.pair
-based applications.Class | MemoryIOSystem |
An in-memory implementation of basic I/O primitives, useful in the context of unit testing as a drop-in replacement for parts of the os module. |
Class | Tunnel |
An in-memory implementation of a tun or tap device. |
Class | _FakePort |
A socket-like object which can be used to read UDP datagrams from tunnel-like file descriptors managed by a MemoryIOSystem . |
Function | _ethernet |
Construct an ethernet frame. |
Function | _H |
Pack an integer into a network-order two-byte string. |
Function | _ip |
Construct an IP datagram with the given source, destination, and application payload. |
Function | _privileged |
No summary |
Function | _udp |
Construct a UDP datagram with the given source, destination, and application payload. |
Constant | _PI_SIZE |
Undocumented |
Variable | _IPv4 |
Undocumented |
Parameters | |
src:bytes | The source ethernet address, encoded. |
dst:bytes | The destination ethernet address, encoded. |
protocol:int | The protocol number of the payload of this datagram. |
payload:bytes | The content of the ethernet frame (such as an IP datagram). |
Returns | |
bytes | The full ethernet frame. |
Parameters | |
n | The integer to pack. Only values that fit into 16 bits are supported. |
Returns | |
bytes | The packed representation of the integer. |
Parameters | |
src:bytes | The source IPv4 address as a dotted-quad string. |
dst:bytes | The destination IPv4 address as a dotted-quad string. |
payload:bytes | The content of the IP datagram (such as a UDP datagram). |
Returns | |
bytes | An IP datagram header and payload. |
MemoryIOSystem
method with permission-checking logic. The returned function will check self.permissions and raise IOError
with errno.EPERM
if the function name is not listed as an available permission.Parameters | |
original | The MemoryIOSystem instance to wrap. |
Returns | |
A wrapper around original that applies permission checks. |