class documentation

class twisted.conch.insults.insults.ServerProtocol(protocol.Protocol): (source)

Implements interfaces: twisted.conch.insults.insults.ITerminalTransport

View In Hierarchy

Undocumented

Instance Variable protocolFactory Undocumented
Instance Variable terminalProtocol Undocumented
Class Variable TAB Undocumented
Class Variable BACKSPACE Undocumented
Instance Variable lastWrite Undocumented
Instance Variable state Undocumented
Class Variable termSize Undocumented
Instance Variable cursorPos Undocumented
Class Variable scrollRegion Undocumented
Class Variable factory Undocumented
Method __init__ No summary
Instance Variable protocolArgs Undocumented
Instance Variable protocolKwArgs Undocumented
Method getHost Similar to getPeer, but returns an address describing this side of the connection.
Method getPeer Get the remote address of this connection.
Method connectionMade Called when a connection is made.
Method dataReceived Called whenever data is received.
Instance Variable escBuf Undocumented
Method unhandledControlSequence Called when an unsupported control sequence is received.
Class ControlSequenceParser Undocumented
Class Variable controlSequenceParser Undocumented
Method cursorUp Move the cursor up n lines.
Method cursorDown Move the cursor down n lines.
Method cursorForward Move the cursor right n columns.
Method cursorBackward Move the cursor left n columns.
Method cursorPosition Move the cursor to the given line and column.
Method cursorHome Move the cursor home.
Method index Move the cursor down one line, performing scrolling if necessary.
Method reverseIndex Move the cursor up one line, performing scrolling if necessary.
Method nextLine Move the cursor to the first position on the next line, performing scrolling if necessary.
Method saveCursor Save the cursor position, character attribute, character set, and origin mode selection.
Method restoreCursor Restore the previously saved cursor position, character attribute, character set, and origin mode selection.
Method setModes Set the given modes on the terminal.
Method setPrivateModes Set the given DEC private modes on the terminal.
Method resetModes Reset the given modes on the terminal.
Method resetPrivateModes Reset the given DEC private modes on the terminal.
Method applicationKeypadMode Cause keypad to generate control functions.
Method numericKeypadMode Cause keypad to generate normal characters.
Method selectCharacterSet Select a character set.
Method shiftIn Activate the G0 character set.
Method shiftOut Activate the G1 character set.
Method singleShift2 Shift to the G2 character set for a single character.
Method singleShift3 Shift to the G3 character set for a single character.
Method selectGraphicRendition Enabled one or more character attributes.
Method horizontalTabulationSet Set a tab stop at the current cursor position.
Method tabulationClear Clear the tab stop at the current cursor position.
Method tabulationClearAll Clear all tab stops.
Method doubleHeightLine Make the current line the top or bottom half of a double-height, double-width line.
Method singleWidthLine Make the current line a single-width, single-height line.
Method doubleWidthLine Make the current line a double-width line.
Method eraseToLineEnd Erase from the cursor to the end of line, including cursor position.
Method eraseToLineBeginning Erase from the cursor to the beginning of the line, including the cursor position.
Method eraseLine Erase the entire cursor line.
Method eraseToDisplayEnd Erase from the cursor to the end of the display, including the cursor position.
Method eraseToDisplayBeginning Erase from the cursor to the beginning of the display, including the cursor position.
Method eraseDisplay Erase the entire display.
Method deleteCharacter Delete n characters starting at the cursor position.
Method insertLine Insert n lines at the cursor position.
Method deleteLine Delete n lines starting at the cursor position.
Method setScrollRegion Undocumented
Method resetScrollRegion Undocumented
Method reportCursorPosition 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 write Write some data to the physical connection, in sequence, in a non-blocking fashion.
Method writeSequence Write an iterable of byte strings to the physical connection.
Method loseConnection Close my connection, after writing all pending data.
Method connectionLost Called when the connection is shut down.
Instance Variable _cursorReports Undocumented
Method _handleShortControlSequence Undocumented
Method _handleControlSequence Undocumented
Method _handleLowFunctionControlSequence Undocumented
Instance Variable _savedCursorPos Undocumented

Inherited from Protocol:

Method logPrefix Return a prefix matching the class name, to identify log messages related to this protocol instance.

Inherited from BaseProtocol (via Protocol):

Instance Variable connected Undocumented
Instance Variable transport Undocumented
Method makeConnection Make a connection to a transport and a server.
protocolFactory = (source)

Undocumented

terminalProtocol = (source)

Undocumented

Undocumented

(type: bytes)
BACKSPACE = (source)

Undocumented

(type: bytes)
lastWrite = (source)

Undocumented

state = (source)

Undocumented

(type: bytes)
termSize = (source)

Undocumented

cursorPos = (source)

Undocumented

scrollRegion = (source)

Undocumented

def __init__(self, protocolFactory=None, *a, **kw): (source)
ParametersprotocolFactoryA 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.
aAny positional arguments to pass to protocolFactory.
kwAny keyword arguments to pass to protocolFactory.
protocolArgs = (source)

Undocumented

protocolKwArgs = (source)

Undocumented

_cursorReports = (source)

Undocumented

(type: list)
def getHost(self): (source)

Similar to getPeer, but returns an address describing this side of the connection.

ReturnsAn IAddress provider.
def getPeer(self): (source)

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.

ReturnsAn IAddress provider.
def connectionMade(self): (source)

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.

def dataReceived(self, data): (source)

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.

Parametersdataa 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.
escBuf = (source)

Undocumented

(type: list)
def _handleShortControlSequence(self, ch): (source)

Undocumented

def _handleControlSequence(self, buf): (source)

Undocumented

def unhandledControlSequence(self, buf): (source)

Called when an unsupported control sequence is received.

ParametersbufUndocumented
seqThe whole control sequence which could not be interpreted. (type: str)
def _handleLowFunctionControlSequence(self, ch): (source)

Undocumented

controlSequenceParser = (source)

Undocumented

def cursorUp(self, n=1): (source)

Move the cursor up n lines.

def cursorDown(self, n=1): (source)

Move the cursor down n lines.

def cursorForward(self, n=1): (source)

Move the cursor right n columns.

def cursorBackward(self, n=1): (source)

Move the cursor left n columns.

def cursorPosition(self, column, line): (source)

Move the cursor to the given line and column.

def cursorHome(self): (source)
def index(self): (source)

Move the cursor down one line, performing scrolling if necessary.

def reverseIndex(self): (source)

Move the cursor up one line, performing scrolling if necessary.

def nextLine(self): (source)

Move the cursor to the first position on the next line, performing scrolling if necessary.

def saveCursor(self): (source)

Save the cursor position, character attribute, character set, and origin mode selection.

_savedCursorPos = (source)

Undocumented

def restoreCursor(self): (source)

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.

def setModes(self, modes): (source)

Set the given modes on the terminal.

def setPrivateModes(self, modes): (source)

Set the given DEC private modes on the terminal.

def resetModes(self, modes): (source)

Reset the given modes on the terminal.

def resetPrivateModes(self, modes): (source)

Reset the given DEC private modes on the terminal.

def applicationKeypadMode(self): (source)

Cause keypad to generate control functions.

Cursor key mode selects the type of characters generated by cursor keys.

def numericKeypadMode(self): (source)

Cause keypad to generate normal characters.

def selectCharacterSet(self, charSet, which): (source)

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.

def shiftIn(self): (source)

Activate the G0 character set.

def shiftOut(self): (source)

Activate the G1 character set.

def singleShift2(self): (source)

Shift to the G2 character set for a single character.

def singleShift3(self): (source)

Shift to the G3 character set for a single character.

def selectGraphicRendition(self, *attributes): (source)

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.

def horizontalTabulationSet(self): (source)

Set a tab stop at the current cursor position.

def tabulationClear(self): (source)

Clear the tab stop at the current cursor position.

def tabulationClearAll(self): (source)
def doubleHeightLine(self, top=True): (source)

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.

def singleWidthLine(self): (source)

Make the current line a single-width, single-height line.

def doubleWidthLine(self): (source)

Make the current line a double-width line.

def eraseToLineEnd(self): (source)

Erase from the cursor to the end of line, including cursor position.

def eraseToLineBeginning(self): (source)

Erase from the cursor to the beginning of the line, including the cursor position.

def eraseLine(self): (source)

Erase the entire cursor line.

def eraseToDisplayEnd(self): (source)

Erase from the cursor to the end of the display, including the cursor position.

def eraseToDisplayBeginning(self): (source)

Erase from the cursor to the beginning of the display, including the cursor position.

def eraseDisplay(self): (source)

Erase the entire display.

def deleteCharacter(self, n=1): (source)

Delete n characters starting at the cursor position.

Characters to the right of deleted characters are shifted to the left.

def insertLine(self, n=1): (source)

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.

def deleteLine(self, n=1): (source)

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.

def setScrollRegion(self, first=None, last=None): (source)

Undocumented

def resetScrollRegion(self): (source)

Undocumented

def reportCursorPosition(self): (source)

Return a Deferred that fires with a two-tuple of (x, y) indicating the cursor position.

def reset(self): (source)

Reset the terminal to its initial state.

def write(self, data): (source)

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.

ParametersdataThe data to write.
def writeSequence(self, data): (source)

Write an iterable of byte strings to the physical connection.

If possible, make sure that all of the data is written to the socket at once, without first copying it all into a single byte string.

ParametersdataThe data to write.
def loseConnection(self): (source)

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.

def connectionLost(self, reason): (source)

Called when the connection is shut down.

Clear any circular references here, and any external references to this Protocol. The connection has been closed.

ParametersreasonUndocumented (type: twisted.python.failure.Failure)
API Documentation for Twisted, generated by pydoctor 20.12.1 at 2021-02-28 19:53:36.