Package lyntin :: Module net
[show private | hide private]
[frames | no frames]

Module lyntin.net

This holds the SocketCommunicator class which handles socket connections with a mud and polling the connection for data.

bell_hook:
  When the mud sends a bell character, we spam this hook.  Typically
  the ui's will register with this hook and handle the bell however
  they see fit.

  Arg mapping: { "session": Session }

  session - the session that received the bell
prompt_hook:
  We try to do some prompt detection and separate prompts into their
  own events (separate from mud data).

  Arg mapping: { "session": Session, "prompt": string }

  session - the Session that this prompt came from

  prompt - the prompt string
connect_hook:
  This hook gets spammed every time we make a successful connection.

  Arg mapping: { "session": Session, "host": String, "port": int }

  session - the Session object for this connection

  host - the host we connected to

  port - the port number for the host
net_read_data_filter:
  This allows you to filter incoming data before it passes through
  Lyntin.  If you were going to write an MCCP module, this is the
  hook it would register with to decompress incoming mud data.

  Functions that register with this hook should return the dataadj
  if they did nothing or the adjusted dataadj if they transformed it.
  Look at the user_filter_hook examples in the alias and speedwalk
  modules.

  Arg mapping: { "session": Session, "data": String, "dataadj": String }

  session - the Session that this data came from

  data - the original data we got from the mud

  dataadj - the data the previous function in the hook returned
net_write_data_filter:
  This allows you to filter outgoing data after it has passed through
  Lyntin and just before it gets sent out on the socket.  If you were 
  going to write an MCCP module, this is the hook it would register 
  with to compress outgoing mud data.

  Functions that register with this hook should return the dataadj
  if they did nothing or the adjusted dataadj if they transformed it.
  Look at the user_filter_hook examples in the alias and speedwalk
  modules.

  Arg mapping: { "session": Session, "data": String, "dataadj": String }

  session - the Session that this data is going to

  data - the original data we wanted to send to the mud

  dataadj - the data the previous function in the hook returned
net_handle_telnet_option:
  There are a series of Telnet options that Lyntin doesn't handle.
  So we allow module writers to handle them if they so desire.
  The data argument is the telnet option string.  So if they
  send us 255 251 24, then that's what you're getting.  We handle
  all the buffering of telnet option stuff--so you needn't worry
  about that.

  We send along the IAC DO TERMTYPE kinds of things as well as the
  IAC SB blah blah IAC SE kinds of things.  This is a handler--so
  if you've handled it, raise an exported.StopSpammingException() .

  Arg mapping: { "session": Session, "data": String }

  session - the Session that this telnet option came from

  data - the telnet option itself

Classes
SocketCommunicator The SocketCommunicator handles all incoming and outgoing data from and to the mud, telnet control codes, and some data transformations.

Variable Summary
str BELL = '\x07'
dict CODES = {0: '<IS>', 1: '[<ECHO> or <SEND/MODE>]', 3: '<S...
str DD = '\xfd\xfe'
str DDWW = '\xfd\xfe\xfb\xfc'
str DO = '\xfd'
str DONT = '\xfe'
str ECHO = '\x01'
str ENV = "'"
str EOR = '\x19'
str FORWARDMASK = '\x02'
str GA = '\xf9'
str IAC = '\xff'
str IS = '\x00'
str LINEMODE = '"'
str MODE = '\x01'
str NAWS = '\x1f'
str NOP = '\xf1'
str SB = '\xfa'
str SE = '\xf0'
str SEND = '\x01'
str SGA = '\x03'
str TELOPT_EOR = '\xef'
str TERMTYPE = '\x18'
str WILL = '\xfb'
str WONT = '\xfc'
str WW = '\xfb\xfc'

Variable Details

BELL

Type:
str
Value:
'\x07'                                                                 

CODES

Type:
dict
Value:
{0: '<IS>',
 1: '[<ECHO> or <SEND/MODE>]',
 3: '<SGA>',
 5: 'STATUS',
 24: '<TERMTYPE>',
 25: '<EOR>',
 31: '<NegoWindoSize>',
 32: '<TERMSPEED>',
...                                                                    

DD

Type:
str
Value:
'\xfd\xfe'                                                             

DDWW

Type:
str
Value:
'\xfd\xfe\xfb\xfc'                                                     

DO

Type:
str
Value:
'\xfd'                                                                 

DONT

Type:
str
Value:
'\xfe'                                                                 

ECHO

Type:
str
Value:
'\x01'                                                                 

ENV

Type:
str
Value:
"'"                                                                    

EOR

Type:
str
Value:
'\x19'                                                                 

FORWARDMASK

Type:
str
Value:
'\x02'                                                                 

GA

Type:
str
Value:
'\xf9'                                                                 

IAC

Type:
str
Value:
'\xff'                                                                 

IS

Type:
str
Value:
'\x00'                                                                 

LINEMODE

Type:
str
Value:
'"'                                                                    

MODE

Type:
str
Value:
'\x01'                                                                 

NAWS

Type:
str
Value:
'\x1f'                                                                 

NOP

Type:
str
Value:
'\xf1'                                                                 

SB

Type:
str
Value:
'\xfa'                                                                 

SE

Type:
str
Value:
'\xf0'                                                                 

SEND

Type:
str
Value:
'\x01'                                                                 

SGA

Type:
str
Value:
'\x03'                                                                 

TELOPT_EOR

Type:
str
Value:
'\xef'                                                                 

TERMTYPE

Type:
str
Value:
'\x18'                                                                 

WILL

Type:
str
Value:
'\xfb'                                                                 

WONT

Type:
str
Value:
'\xfc'                                                                 

WW

Type:
str
Value:
'\xfb\xfc'                                                             

Generated by Epydoc 2.1 on Mon Aug 9 09:17:42 2004 http://epydoc.sf.net