slc

Special Line Character support for Telnet Linemode Option (RFC 1184).

class SLC(mask=b'x03', value=b'x00')

Bases: object

Defines the willingness to support a Special Linemode Character.

Defined by its SLC support level, mask and default keyboard ASCII byte value (may be negotiated by client).

ack

Returns True if SLC_ACK bit is set.

cantchange

Returns True if SLC level is SLC_CANTCHANGE.

default

Returns True if SLC level is SLC_DEFAULT.

flushin

Returns True if SLC_FLUSHIN bit is set.

flushout

Returns True if SLC_FLUSHIN bit is set.

level

Returns SLC level of support.

nosupport

Returns True if SLC level is SLC_NOSUPPORT.

set_flag(flag)

Set SLC option flag, flag.

set_mask(mask)

Set SLC option mask, mask.

set_value(value)

Set SLC keyboard ascii value to byte.

variable

Returns True if SLC level is SLC_VARIABLE.

generate_slctab(tabset={b'\x07': <telnetlib3.slc.SLC object>, b'\x01': <telnetlib3.slc.SLC object>, b'\x0e': <telnetlib3.slc.SLC object>, b'\x08': <telnetlib3.slc.SLC object>, b'\t': <telnetlib3.slc.SLC object>, b'\x06': <telnetlib3.slc.SLC object>, b'\x04': <telnetlib3.slc.SLC object>, b'\x10': <telnetlib3.slc.SLC object>, b'\x03': <telnetlib3.slc.SLC object>, b'\x0c': <telnetlib3.slc.SLC object>, b'\x02': <telnetlib3.slc.SLC object>, b'\x12': <telnetlib3.slc.SLC_nosupport object>, b'\x0b': <telnetlib3.slc.SLC object>, b'\n': <telnetlib3.slc.SLC object>, b'\x0f': <telnetlib3.slc.SLC object>, b'\x11': <telnetlib3.slc.SLC_nosupport object>, b'\r': <telnetlib3.slc.SLC object>, b'\x05': <telnetlib3.slc.SLC object>})

Returns full ‘SLC Tab’ for definitions found using tabset. Functions not listed in tabset are set as SLC_NOSUPPORT.

class Linemode(mask=b'x00')

Bases: object

A mask of LMODE_MODE_LOCAL means that all line editing is performed on the client side (default). A mask of theNULL () indicates that editing is performed on the remote side. Valid bit flags of mask are: LMODE_MODE_TRAPSIG, LMODE_MODE_ACK, LMODE_MODE_SOFT_TAB, and LMODE_MODE_LIT_ECHO.

ack

Returns True if mode has been acknowledged.

lit_echo

Returns True if non-printable characters are displayed as-is.

local

True if linemode is local.

remote

True if linemode is remote.

soft_tab

Returns True if client will expand horizontal tab ( ).

trapsig

True if signals are trapped by client.

snoop(byte, slctab, slc_callbacks)

Scan slctab for matching byte values.

Returns (callback, func_byte, slc_definition) on match. Otherwise, (None, None, None). If no callback is assigned, the value of callback is always None.

generate_forwardmask(binary_mode, tabset, ack=False)

Generate a 32-byte (binary_mode is True) or 16-byte (False) Forwardmask class instance appropriate for the specified slctab.

Forwardmask is formed by a bitmask of all 256 possible 8-bit keyboard ascii input, or, when not ‘outbinary’, a 16-byte 7-bit representation of each value, and whether or not they should be “forwarded” by the client on the transport stream

class Forwardmask(value, ack=False)

Bases: object

ForwardMask object using the bytemask value received by server.

bytemask value received by server after IAC SB LINEMODE DO FORWARDMASK. It must be a bytearray of length 16 or 32.

description_table()

Returns list of strings describing obj as a tabular ASCII map.

name_slc_command(byte)

Given an SLC byte, return global mnemonic as string.

class SLC(mask=b'x03', value=b'x00')

Bases: object

Defines the willingness to support a Special Linemode Character.

Defined by its SLC support level, mask and default keyboard ASCII byte value (may be negotiated by client).

ack

Returns True if SLC_ACK bit is set.

cantchange

Returns True if SLC level is SLC_CANTCHANGE.

default

Returns True if SLC level is SLC_DEFAULT.

flushin

Returns True if SLC_FLUSHIN bit is set.

flushout

Returns True if SLC_FLUSHIN bit is set.

level

Returns SLC level of support.

nosupport

Returns True if SLC level is SLC_NOSUPPORT.

set_flag(flag)

Set SLC option flag, flag.

set_mask(mask)

Set SLC option mask, mask.

set_value(value)

Set SLC keyboard ascii value to byte.

variable

Returns True if SLC level is SLC_VARIABLE.

class SLC_nosupport

Bases: telnetlib3.slc.SLC

SLC definition inferring our unwillingness to support the option.

ack

Returns True if SLC_ACK bit is set.

cantchange

Returns True if SLC level is SLC_CANTCHANGE.

default

Returns True if SLC level is SLC_DEFAULT.

flushin

Returns True if SLC_FLUSHIN bit is set.

flushout

Returns True if SLC_FLUSHIN bit is set.

level

Returns SLC level of support.

nosupport

Returns True if SLC level is SLC_NOSUPPORT.

set_flag(flag)

Set SLC option flag, flag.

set_mask(mask)

Set SLC option mask, mask.

set_value(value)

Set SLC keyboard ascii value to byte.

variable

Returns True if SLC level is SLC_VARIABLE.