class ServerProtocol(protocol.Protocol): (source)
Constructor: ServerProtocol(protocolFactory, *a, **kw)
Implements interfaces: twisted.conch.insults.insults.ITerminalTransport
Undocumented
Class |
|
Undocumented |
Method | __init__ |
No summary |
Method | application |
Cause keypad to generate control functions. |
Method | connection |
Called when the connection is shut down. |
Method | connection |
Called when a connection is made. |
Method | cursor |
Move the cursor left n columns. |
Method | cursor |
Move the cursor down n lines. |
Method | cursor |
Move the cursor right n columns. |
Method | cursor |
Move the cursor home. |
Method | cursor |
Move the cursor to the given line and column. |
Method | cursor |
Move the cursor up n lines. |
Method | data |
Called whenever data is received. |
Method | delete |
Delete n characters starting at the cursor position. |
Method | delete |
Delete n lines starting at the cursor position. |
Method | double |
Make the current line the top or bottom half of a double-height, double-width line. |
Method | double |
Make the current line a double-width line. |
Method | erase |
Erase the entire display. |
Method | erase |
Erase the entire cursor line. |
Method | erase |
Erase from the cursor to the beginning of the display, including the cursor position. |
Method | erase |
Erase from the cursor to the end of the display, including the cursor position. |
Method | erase |
Erase from the cursor to the beginning of the line, including the cursor position. |
Method | erase |
Erase from the cursor to the end of line, including cursor position. |
Method | get |
Similar to getPeer, but returns an address describing this side of the connection. |
Method | get |
Get the remote address of this connection. |
Method | horizontal |
Set a tab stop at the current cursor position. |
Method | index |
Move the cursor down one line, performing scrolling if necessary. |
Method | insert |
Insert n lines at the cursor position. |
Method | lose |
Close my connection, after writing all pending data. |
Method | next |
Move the cursor to the first position on the next line, performing scrolling if necessary. |
Method | numeric |
Cause keypad to generate normal characters. |
Method | report |
Return a Deferred that fires with a two-tuple of (x, y) indicating the cursor position. |
Method | reset |
Reset the terminal to its initial state. |
Method | reset |
Reset the given modes on the terminal. |
Method | reset |
Reset the given DEC private modes on the terminal. |
Method | reset |
Undocumented |
Method | restore |
Restore the previously saved cursor position, character attribute, character set, and origin mode selection. |
Method | reverse |
Move the cursor up one line, performing scrolling if necessary. |
Method | save |
Save the cursor position, character attribute, character set, and origin mode selection. |
Method | select |
Select a character set. |
Method | select |
Enabled one or more character attributes. |
Method | set |
Set the given modes on the terminal. |
Method | set |
Set the given DEC private modes on the terminal. |
Method | set |
Undocumented |
Method | shift |
Activate the G0 character set. |
Method | shift |
Activate the G1 character set. |
Method | single |
Shift to the G2 character set for a single character. |
Method | single |
Shift to the G3 character set for a single character. |
Method | single |
Make the current line a single-width, single-height line. |
Method | tabulation |
Clear the tab stop at the current cursor position. |
Method | tabulation |
Clear all tab stops. |
Method | unhandled |
Called when an unsupported control sequence is received. |
Method | write |
Write some data to the physical connection, in sequence, in a non-blocking fashion. |
Method | write |
Write an iterable of byte strings to the physical connection. |
Constant | BACKSPACE |
Undocumented |
Constant | TAB |
Undocumented |
Class Variable | control |
Undocumented |
Class Variable | factory |
Undocumented |
Class Variable | scroll |
Undocumented |
Class Variable | term |
Undocumented |
Instance Variable | cursor |
Undocumented |
Instance Variable | last |
Undocumented |
Instance Variable | protocol |
Undocumented |
Instance Variable | protocol |
Undocumented |
Instance Variable | protocol |
Undocumented |
Instance Variable | state |
Undocumented |
Instance Variable | terminal |
Undocumented |
Method | _handle |
Undocumented |
Method | _handle |
Undocumented |
Method | _handle |
Undocumented |
Instance Variable | _cursor |
Undocumented |
Instance Variable | _saved |
Undocumented |
Inherited from Protocol
:
Method | log |
Return a prefix matching the class name, to identify log messages related to this protocol instance. |
Inherited from BaseProtocol
(via Protocol
):
Method | make |
Make a connection to a transport and a server. |
Instance Variable | connected |
Undocumented |
Instance Variable | transport |
Undocumented |
Parameters | |
protocol | A callable which will be invoked with *a, **kw and should return an ITerminalProtocol implementor. This will be invoked when a connection to this ServerProtocol is established. |
*a | Any positional arguments to pass to protocolFactory. |
**kw | Any keyword arguments to pass to protocolFactory. |
Cause keypad to generate control functions.
Cursor key mode selects the type of characters generated by cursor keys.
Called when the connection is shut down.
Clear any circular references here, and any external references to this Protocol. The connection has been closed.
Parameters | |
reason:twisted.python.failure.Failure | Undocumented |
Called when a connection is made.
This may be considered the initializer of the protocol, because it is called when the connection is completed. For clients, this is called once the connection to the server has been established; for servers, this is called after an accept() call stops blocking and a socket has been received. If you need to send any greeting or initial message, do it here.
Called whenever data is received.
Use this method to translate to a higher-level message. Usually, some callback will be made upon the receipt of each complete protocol message.
Parameters | |
data | a string of indeterminate length. Please keep in mind that you will probably need to buffer some data, as partial (or multiple) protocol messages may be received! I recommend that unit tests for protocols call through to this method with differing chunk sizes, down to one byte at a time. |
Delete n characters starting at the cursor position.
Characters to the right of deleted characters are shifted to the left.
Delete n lines starting at the cursor position.
Lines below the cursor are shifted up. This command is ignored when the cursor is outside the scroll region.
Make the current line the top or bottom half of a double-height, double-width line.
If top is True, the current line is the top half. Otherwise, it is the bottom half.
Similar to getPeer, but returns an address describing this side of the connection.
Returns | |
An IAddress provider. |
Get the remote address of this connection.
Treat this method with caution. It is the unfortunate result of the CGI and Jabber standards, but should not be considered reliable for the usual host of reasons; port forwarding, proxying, firewalls, IP masquerading, etc.
Returns | |
An IAddress provider. |
Insert n lines at the cursor position.
Lines below the cursor are shifted down. Lines moved past the bottom margin are lost. This command is ignored when the cursor is outside the scroll region.
Close my connection, after writing all pending data.
Note that if there is a registered producer on a transport it will not be closed until the producer has been unregistered.
Restore the previously saved cursor position, character attribute, character set, and origin mode selection.
If no cursor state was previously saved, move the cursor to the home position.
Select a character set.
charSet should be one of CS_US, CS_UK, CS_DRAWING, CS_ALTERNATE, or CS_ALTERNATE_SPECIAL.
which should be one of G0 or G1.
Enabled one or more character attributes.
Arguments should be one or more of UNDERLINE, REVERSE_VIDEO, BLINK, or BOLD. NORMAL may also be specified to disable all character attributes.
Called when an unsupported control sequence is received.
Parameters | |
buf | Undocumented |
seq:str | The whole control sequence which could not be interpreted. |
Write some data to the physical connection, in sequence, in a non-blocking fashion.
If possible, make sure that it is all written. No data will ever be lost, although (obviously) the connection may be closed before it all gets through.
Parameters | |
data | The data to write. |