Created
July 30, 2010 17:50
-
-
Save shylent/500993 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ExpectTelnetWrapper(object): | |
implements(ITelnetProtocol) | |
def __init__(self, expect): | |
""" | |
@param expect: Instance of L{Expect} class, that we are wrapping | |
@type expect: L{Expect} | |
""" | |
self.expect = expect | |
self.expect.transport = self | |
def dataReceived(self, bytes): | |
self.expect.dataReceived(bytes) | |
def connectionLost(self, reason): | |
# t.c.telnet.TelnetTransport does exactly this! | |
try: | |
self.expect.connectionLost(reason) | |
finally: | |
del self.expect.transport | |
del self.expect | |
del self.transport | |
# Do I really need to do this? | |
def write(self, data): | |
self.transport.write(data) | |
def makeConnection(self, telnet_transport): | |
""" | |
@param telnet_transport: | |
@type telnet_transport: L{TelnetTransport<twisted.conch.telnet.TelnetTransport>} | |
""" | |
self.transport = telnet_transport | |
# Dummy ITelnetProtocol implementation, somehow forward these to | |
# t.c.telnet.Telnet instance, that is a part of t.c.telnet.TelnetTransport? | |
def enableLocal(self, option): | |
""" """ | |
def enableRemote(self, option): | |
""" """ | |
def disableLocal(self, option): | |
""" """ | |
def disableRemote(self, option): | |
""" """ | |
def unhandledSubnegotiation(self, command, bytes): | |
""" """ | |
def unhandledCommand(self, command, argument): | |
""" """ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment