[Twisted-Python] Writing new transports / a tunnel Protocol
Hello, I'm hoping to use existing protocol implementations in twisted, but over a custom tunneling protocol that I'll call CTP for the remainder of this thread. CTP is basically TCP with a couple of strange characteristics. Besides a custom handshake, two actual tcp connections are used for the data transport, each of which is considered uni-directional; one connection is used for "upstream" and one for "downstream". I know how to create a twisted factory / protocol implementation for CTP such that you could write a CTP based protocol by inheriting from CTPProtocol and overriding the "dataRead" function. But this means I have to do more work to get each existing twisted protocol working with my CTP implementation. So my question is, what is the best way to take an implementation of this protocol and integrate it tightly with twisted's internals? It seems like I would need a new reactor implementation with a listenCTP function, for one. Of course, I wouldn't want to just inherit from the SelectReactor, because I want to be able to use Epoll (or others) as well. Please excuse my ignorance of twisted's architecture. I already have a prototype of this (see orbited 0.5.x) but I want my next release to integrate tightly with twisted's infrastructure instead of re-inventing an API on top. -Michael Carter
On Sun, 27 Jul 2008 02:28:37 -0700, Michael Carter
Hello,
[snip]
So my question is, what is the best way to take an implementation of this protocol and integrate it tightly with twisted's internals? It seems like I would need a new reactor implementation with a listenCTP function, for one. Of course, I wouldn't want to just inherit from the SelectReactor, because I want to be able to use Epoll (or others) as well.
Please excuse my ignorance of twisted's architecture. I already have a prototype of this (see orbited 0.5.x) but I want my next release to integrate tightly with twisted's infrastructure instead of re-inventing an API on top.
You don't have to add a method to the reactor. You can make a free function which takes a reactor as an argument. Jean-Paul
participants (2)
-
Jean-Paul Calderone
-
Michael Carter