Package spoon :: Package transports :: Module spoontransport :: Class SpoonTransport
[hide private]
[frames] | no frames]

Class SpoonTransport

source code

object --+
         |
        SpoonTransport

The spoon transport base class. This will probably mostly be responsible for handling locking on the transport. It also takes care of removing itself from the transport hub if it is made inactive.

Any reads or writes on the socket should be performed with the SpoonTransport, or otherwise synchronized once this is created.

Instance Methods [hide private]
  __init__(self, t, network=None)
Creates a spoon transport link out of an existing socket and joins it to a network.
  __repr__(self)
repr(x)
  write(self, obj)
  read(self)
  fileno(self)
Returns the fileno for use in a select or poll call if one exists for the socket or file wrapped by this SpoonTransport.
  close(self)
  start(self)
Starts the spoon protocol on the socket.
  getAuthedNodeId(self)
override this if your class does any pre authentication.
  __get_active(self)
  __set_active(self, newval)
  getNetwork(self)

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __str__


Instance Variables [hide private]
  active
Indicates if the transport is currently active.
  sock
The raw socket or file object that the transport is bound to
  spoon
The SpoonStream wrapper around the socket.

Properties [hide private]

Inherited from object: __class__


Method Details [hide private]

__init__(self, t, network=None)
(Constructor)

source code 
Creates a spoon transport link out of an existing socket and joins it to a network. This network is either a mesh network or a point to point network (just a direct connection.)
Parameters:
  • t - Some sort of a socket or file like object.
  • network - An instance of a mesh network or a point to point network that the transport will be joined to.
Overrides: object.__init__

__repr__(self)
(Representation operator)

source code 
repr(x)
Overrides: object.__repr__
(inherited documentation)

write(self, obj)

source code 
None

read(self)

source code 
None

fileno(self)

source code 
Returns the fileno for use in a select or poll call if one exists for the socket or file wrapped by this SpoonTransport. If the socket or file does not have a fileno method, None will be returned. For proper behavior with paramiko, fileno on the socket isn't called any time before fileno is called on the SpoonTransport.

close(self)

source code 
None

start(self)

source code 
Starts the spoon protocol on the socket. Must be called before writing/reading with the SpoonTransport object. Will cause the Transport to be registered with TransportHub.

getAuthedNodeId(self)

source code 
override this if your class does any pre authentication.

__get_active(self)

source code 
None

__set_active(self, newval)

source code 
None

getNetwork(self)

source code 
None

Instance Variable Details [hide private]

active

Indicates if the transport is currently active.

sock

The raw socket or file object that the transport is bound to

spoon

The SpoonStream wrapper around the socket.