blob: b05aa62c7ad885503ca31de34f87c792e88b214b [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: module gdata.tlslite.integration.TLSTwistedProtocolWrapper</title>
</head><body bgcolor="#f0f0f8">
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial">&nbsp;<br><big><big><strong><a href="gdata.html"><font color="#ffffff">gdata</font></a>.<a href="gdata.tlslite.html"><font color="#ffffff">tlslite</font></a>.<a href="gdata.tlslite.integration.html"><font color="#ffffff">integration</font></a>.TLSTwistedProtocolWrapper</strong></big></big></font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/usr/local/google/home/afshar/src/external-gdata-release/google3/src/gdata/tlslite/integration/TLSTwistedProtocolWrapper.py">/usr/local/google/home/afshar/src/external-gdata-release/google3/src/gdata/tlslite/integration/TLSTwistedProtocolWrapper.py</a></font></td></tr></table>
<p><tt>TLS&nbsp;Lite&nbsp;+&nbsp;Twisted.</tt></p>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#aa55cc">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
<tr><td bgcolor="#aa55cc"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="errno.html">errno</a><br>
</td><td width="25%" valign=top><a href="socket.html">socket</a><br>
</td><td width="25%" valign=top></td><td width="25%" valign=top></td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ee77aa">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
<tr><td bgcolor="#ee77aa"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><dl>
<dt><font face="helvetica, arial"><a href="gdata.tlslite.integration.AsyncStateMachine.html#AsyncStateMachine">gdata.tlslite.integration.AsyncStateMachine.AsyncStateMachine</a>
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="gdata.tlslite.integration.TLSTwistedProtocolWrapper.html#TLSTwistedProtocolWrapper">TLSTwistedProtocolWrapper</a>(<a href="twisted.protocols.policies.html#ProtocolWrapper">twisted.protocols.policies.ProtocolWrapper</a>, <a href="gdata.tlslite.integration.AsyncStateMachine.html#AsyncStateMachine">gdata.tlslite.integration.AsyncStateMachine.AsyncStateMachine</a>)
</font></dt></dl>
</dd>
<dt><font face="helvetica, arial"><a href="twisted.protocols.policies.html#ProtocolWrapper">twisted.protocols.policies.ProtocolWrapper</a>(<a href="twisted.internet.protocol.html#Protocol">twisted.internet.protocol.Protocol</a>)
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="gdata.tlslite.integration.TLSTwistedProtocolWrapper.html#TLSTwistedProtocolWrapper">TLSTwistedProtocolWrapper</a>(<a href="twisted.protocols.policies.html#ProtocolWrapper">twisted.protocols.policies.ProtocolWrapper</a>, <a href="gdata.tlslite.integration.AsyncStateMachine.html#AsyncStateMachine">gdata.tlslite.integration.AsyncStateMachine.AsyncStateMachine</a>)
</font></dt></dl>
</dd>
</dl>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="TLSTwistedProtocolWrapper">class <strong>TLSTwistedProtocolWrapper</strong></a>(<a href="twisted.protocols.policies.html#ProtocolWrapper">twisted.protocols.policies.ProtocolWrapper</a>, <a href="gdata.tlslite.integration.AsyncStateMachine.html#AsyncStateMachine">gdata.tlslite.integration.AsyncStateMachine.AsyncStateMachine</a>)</font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt>This&nbsp;class&nbsp;can&nbsp;wrap&nbsp;Twisted&nbsp;protocols&nbsp;to&nbsp;add&nbsp;TLS&nbsp;support.<br>
&nbsp;<br>
Below&nbsp;is&nbsp;a&nbsp;complete&nbsp;example&nbsp;of&nbsp;using&nbsp;TLS&nbsp;Lite&nbsp;with&nbsp;a&nbsp;Twisted&nbsp;echo<br>
server.<br>
&nbsp;<br>
There&nbsp;are&nbsp;two&nbsp;server&nbsp;implementations&nbsp;below.&nbsp;&nbsp;Echo&nbsp;is&nbsp;the&nbsp;original<br>
protocol,&nbsp;which&nbsp;is&nbsp;oblivious&nbsp;to&nbsp;TLS.&nbsp;&nbsp;Echo1&nbsp;subclasses&nbsp;Echo&nbsp;and<br>
negotiates&nbsp;TLS&nbsp;when&nbsp;the&nbsp;client&nbsp;connects.&nbsp;&nbsp;Echo2&nbsp;subclasses&nbsp;Echo&nbsp;and<br>
negotiates&nbsp;TLS&nbsp;when&nbsp;the&nbsp;client&nbsp;sends&nbsp;"STARTTLS"::<br>
&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;twisted.internet.protocol&nbsp;import&nbsp;Protocol,&nbsp;Factory<br>
&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;twisted.internet&nbsp;import&nbsp;reactor<br>
&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;twisted.protocols.policies&nbsp;import&nbsp;WrappingFactory<br>
&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;twisted.protocols.basic&nbsp;import&nbsp;LineReceiver<br>
&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;twisted.python&nbsp;import&nbsp;log<br>
&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;twisted.python.failure&nbsp;import&nbsp;Failure<br>
&nbsp;&nbsp;&nbsp;&nbsp;import&nbsp;sys<br>
&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;tlslite.api&nbsp;import&nbsp;*<br>
&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;s&nbsp;=&nbsp;open("./serverX509Cert.pem").read()<br>
&nbsp;&nbsp;&nbsp;&nbsp;x509&nbsp;=&nbsp;X509()<br>
&nbsp;&nbsp;&nbsp;&nbsp;x509.parse(s)<br>
&nbsp;&nbsp;&nbsp;&nbsp;certChain&nbsp;=&nbsp;X509CertChain([x509])<br>
&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;s&nbsp;=&nbsp;open("./serverX509Key.pem").read()<br>
&nbsp;&nbsp;&nbsp;&nbsp;privateKey&nbsp;=&nbsp;parsePEMKey(s,&nbsp;private=True)<br>
&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;verifierDB&nbsp;=&nbsp;VerifierDB("verifierDB")<br>
&nbsp;&nbsp;&nbsp;&nbsp;verifierDB.open()<br>
&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;class&nbsp;Echo(LineReceiver):<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;def&nbsp;<a href="#TLSTwistedProtocolWrapper-connectionMade">connectionMade</a>(self):<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;self.<strong>transport</strong>.<a href="#TLSTwistedProtocolWrapper-write">write</a>("Welcome&nbsp;to&nbsp;the&nbsp;echo&nbsp;server!\r\n")<br>
&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;def&nbsp;lineReceived(self,&nbsp;line):<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;self.<strong>transport</strong>.<a href="#TLSTwistedProtocolWrapper-write">write</a>(line&nbsp;+&nbsp;"\r\n")<br>
&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;class&nbsp;Echo1(Echo):<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;def&nbsp;<a href="#TLSTwistedProtocolWrapper-connectionMade">connectionMade</a>(self):<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;not&nbsp;self.<strong>transport</strong>.tlsStarted:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;self.<strong>transport</strong>.<a href="#TLSTwistedProtocolWrapper-setServerHandshakeOp">setServerHandshakeOp</a>(certChain=certChain,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;privateKey=privateKey,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;verifierDB=verifierDB)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Echo.<a href="#TLSTwistedProtocolWrapper-connectionMade">connectionMade</a>(self)<br>
&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;def&nbsp;<a href="#TLSTwistedProtocolWrapper-connectionLost">connectionLost</a>(self,&nbsp;reason):<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pass&nbsp;#Handle&nbsp;any&nbsp;TLS&nbsp;exceptions&nbsp;here<br>
&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;class&nbsp;Echo2(Echo):<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;def&nbsp;lineReceived(self,&nbsp;data):<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;data&nbsp;==&nbsp;"STARTTLS":<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;self.<strong>transport</strong>.<a href="#TLSTwistedProtocolWrapper-setServerHandshakeOp">setServerHandshakeOp</a>(certChain=certChain,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;privateKey=privateKey,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;verifierDB=verifierDB)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Echo.lineReceived(self,&nbsp;data)<br>
&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;def&nbsp;<a href="#TLSTwistedProtocolWrapper-connectionLost">connectionLost</a>(self,&nbsp;reason):<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pass&nbsp;#Handle&nbsp;any&nbsp;TLS&nbsp;exceptions&nbsp;here<br>
&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;factory&nbsp;=&nbsp;Factory()<br>
&nbsp;&nbsp;&nbsp;&nbsp;factory.protocol&nbsp;=&nbsp;Echo1<br>
&nbsp;&nbsp;&nbsp;&nbsp;#factory.protocol&nbsp;=&nbsp;Echo2<br>
&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;wrappingFactory&nbsp;=&nbsp;WrappingFactory(factory)<br>
&nbsp;&nbsp;&nbsp;&nbsp;wrappingFactory.protocol&nbsp;=&nbsp;<a href="#TLSTwistedProtocolWrapper">TLSTwistedProtocolWrapper</a><br>
&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;log.startLogging(sys.stdout)<br>
&nbsp;&nbsp;&nbsp;&nbsp;reactor.listenTCP(1079,&nbsp;wrappingFactory)<br>
&nbsp;&nbsp;&nbsp;&nbsp;reactor.run()<br>
&nbsp;<br>
This&nbsp;class&nbsp;works&nbsp;as&nbsp;follows:<br>
&nbsp;<br>
Data&nbsp;comes&nbsp;in&nbsp;and&nbsp;is&nbsp;given&nbsp;to&nbsp;the&nbsp;<a href="gdata.tlslite.integration.AsyncStateMachine.html#AsyncStateMachine">AsyncStateMachine</a>&nbsp;for&nbsp;handling.<br>
<a href="gdata.tlslite.integration.AsyncStateMachine.html#AsyncStateMachine">AsyncStateMachine</a>&nbsp;will&nbsp;forward&nbsp;events&nbsp;to&nbsp;this&nbsp;class,&nbsp;and&nbsp;we'll<br>
pass&nbsp;them&nbsp;on&nbsp;to&nbsp;the&nbsp;ProtocolHandler,&nbsp;which&nbsp;will&nbsp;proxy&nbsp;them&nbsp;to&nbsp;the<br>
wrapped&nbsp;protocol.&nbsp;&nbsp;The&nbsp;wrapped&nbsp;protocol&nbsp;may&nbsp;then&nbsp;call&nbsp;back&nbsp;into<br>
this&nbsp;class,&nbsp;and&nbsp;these&nbsp;calls&nbsp;will&nbsp;be&nbsp;proxied&nbsp;into&nbsp;the<br>
<a href="gdata.tlslite.integration.AsyncStateMachine.html#AsyncStateMachine">AsyncStateMachine</a>.<br>
&nbsp;<br>
The&nbsp;call&nbsp;graph&nbsp;looks&nbsp;like&nbsp;this:<br>
&nbsp;-&nbsp;self.<strong>dataReceived</strong><br>
&nbsp;&nbsp;&nbsp;-&nbsp;<a href="gdata.tlslite.integration.AsyncStateMachine.html#AsyncStateMachine">AsyncStateMachine</a>.inReadEvent<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;out(Connect|Close|Read)Event<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;<a href="twisted.protocols.policies.html#ProtocolWrapper">ProtocolWrapper</a>.(connectionMade|loseConnection|dataReceived)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;self.(loseConnection|write|writeSequence)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;<a href="gdata.tlslite.integration.AsyncStateMachine.html#AsyncStateMachine">AsyncStateMachine</a>.(setCloseOp|setWriteOp)<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%"><dl><dt>Method resolution order:</dt>
<dd><a href="gdata.tlslite.integration.TLSTwistedProtocolWrapper.html#TLSTwistedProtocolWrapper">TLSTwistedProtocolWrapper</a></dd>
<dd><a href="twisted.protocols.policies.html#ProtocolWrapper">twisted.protocols.policies.ProtocolWrapper</a></dd>
<dd><a href="twisted.internet.protocol.html#Protocol">twisted.internet.protocol.Protocol</a></dd>
<dd><a href="twisted.internet.protocol.html#BaseProtocol">twisted.internet.protocol.BaseProtocol</a></dd>
<dd><a href="gdata.tlslite.integration.AsyncStateMachine.html#AsyncStateMachine">gdata.tlslite.integration.AsyncStateMachine.AsyncStateMachine</a></dd>
</dl>
<hr>
Methods defined here:<br>
<dl><dt><a name="TLSTwistedProtocolWrapper-__init__"><strong>__init__</strong></a>(self, factory, wrappedProtocol)</dt></dl>
<dl><dt><a name="TLSTwistedProtocolWrapper-connectionLost"><strong>connectionLost</strong></a>(self, reason)</dt></dl>
<dl><dt><a name="TLSTwistedProtocolWrapper-connectionMade"><strong>connectionMade</strong></a>(self)</dt></dl>
<dl><dt><a name="TLSTwistedProtocolWrapper-dataReceived"><strong>dataReceived</strong></a>(self, data)</dt></dl>
<dl><dt><a name="TLSTwistedProtocolWrapper-loseConnection"><strong>loseConnection</strong></a>(self)</dt></dl>
<dl><dt><a name="TLSTwistedProtocolWrapper-outCloseEvent"><strong>outCloseEvent</strong></a>(self)</dt></dl>
<dl><dt><a name="TLSTwistedProtocolWrapper-outConnectEvent"><strong>outConnectEvent</strong></a>(self)</dt></dl>
<dl><dt><a name="TLSTwistedProtocolWrapper-outReadEvent"><strong>outReadEvent</strong></a>(self, data)</dt></dl>
<dl><dt><a name="TLSTwistedProtocolWrapper-setServerHandshakeOp"><strong>setServerHandshakeOp</strong></a>(self, **args)</dt></dl>
<dl><dt><a name="TLSTwistedProtocolWrapper-write"><strong>write</strong></a>(self, data)</dt></dl>
<dl><dt><a name="TLSTwistedProtocolWrapper-writeSequence"><strong>writeSequence</strong></a>(self, seq)</dt></dl>
<hr>
Methods inherited from <a href="twisted.protocols.policies.html#ProtocolWrapper">twisted.protocols.policies.ProtocolWrapper</a>:<br>
<dl><dt><a name="TLSTwistedProtocolWrapper-__getattr__"><strong>__getattr__</strong></a>(self, name)</dt></dl>
<dl><dt><a name="TLSTwistedProtocolWrapper-getHost"><strong>getHost</strong></a>(self)</dt></dl>
<dl><dt><a name="TLSTwistedProtocolWrapper-getPeer"><strong>getPeer</strong></a>(self)</dt></dl>
<dl><dt><a name="TLSTwistedProtocolWrapper-logPrefix"><strong>logPrefix</strong></a>(self)</dt><dd><tt>Use&nbsp;a&nbsp;customized&nbsp;log&nbsp;prefix&nbsp;mentioning&nbsp;both&nbsp;the&nbsp;wrapped&nbsp;protocol&nbsp;and<br>
the&nbsp;current&nbsp;one.</tt></dd></dl>
<dl><dt><a name="TLSTwistedProtocolWrapper-makeConnection"><strong>makeConnection</strong></a>(self, transport)</dt><dd><tt>When&nbsp;a&nbsp;connection&nbsp;is&nbsp;made,&nbsp;register&nbsp;this&nbsp;wrapper&nbsp;with&nbsp;its&nbsp;factory,<br>
save&nbsp;the&nbsp;real&nbsp;transport,&nbsp;and&nbsp;connect&nbsp;the&nbsp;wrapped&nbsp;protocol&nbsp;to&nbsp;this<br>
L{<a href="twisted.protocols.policies.html#ProtocolWrapper">ProtocolWrapper</a>}&nbsp;to&nbsp;intercept&nbsp;any&nbsp;transport&nbsp;calls&nbsp;it&nbsp;makes.</tt></dd></dl>
<dl><dt><a name="TLSTwistedProtocolWrapper-registerProducer"><strong>registerProducer</strong></a>(self, producer, streaming)</dt></dl>
<dl><dt><a name="TLSTwistedProtocolWrapper-stopConsuming"><strong>stopConsuming</strong></a>(self)</dt></dl>
<dl><dt><a name="TLSTwistedProtocolWrapper-unregisterProducer"><strong>unregisterProducer</strong></a>(self)</dt></dl>
<hr>
Data and other attributes inherited from <a href="twisted.protocols.policies.html#ProtocolWrapper">twisted.protocols.policies.ProtocolWrapper</a>:<br>
<dl><dt><strong>disconnecting</strong> = 0</dl>
<hr>
Methods inherited from <a href="twisted.internet.protocol.html#Protocol">twisted.internet.protocol.Protocol</a>:<br>
<dl><dt><strong>__provides__</strong></dt>
<dd><tt>Special&nbsp;descriptor&nbsp;for&nbsp;class&nbsp;__provides__<br>
&nbsp;<br>
The&nbsp;descriptor&nbsp;caches&nbsp;the&nbsp;implementedBy&nbsp;info,&nbsp;so&nbsp;that<br>
we&nbsp;can&nbsp;get&nbsp;declarations&nbsp;for&nbsp;objects&nbsp;without&nbsp;instance-specific<br>
interfaces&nbsp;a&nbsp;bit&nbsp;quicker.<br>
&nbsp;<br>
For&nbsp;example:<br>
&nbsp;<br>
&nbsp;&nbsp;&gt;&gt;&gt;&nbsp;from&nbsp;zope.interface&nbsp;import&nbsp;Interface<br>
&nbsp;&nbsp;&gt;&gt;&gt;&nbsp;class&nbsp;IFooFactory(Interface):<br>
&nbsp;&nbsp;...&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pass<br>
&nbsp;&nbsp;&gt;&gt;&gt;&nbsp;class&nbsp;IFoo(Interface):<br>
&nbsp;&nbsp;...&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pass<br>
&nbsp;&nbsp;&gt;&gt;&gt;&nbsp;class&nbsp;C(object):<br>
&nbsp;&nbsp;...&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;implements(IFoo)<br>
&nbsp;&nbsp;...&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;classProvides(IFooFactory)<br>
&nbsp;&nbsp;&gt;&gt;&gt;&nbsp;[i.getName()&nbsp;for&nbsp;i&nbsp;in&nbsp;C.__provides__]<br>
&nbsp;&nbsp;['IFooFactory']<br>
&nbsp;<br>
&nbsp;&nbsp;&gt;&gt;&gt;&nbsp;[i.getName()&nbsp;for&nbsp;i&nbsp;in&nbsp;C().__provides__]<br>
&nbsp;&nbsp;['IFoo']</tt></dd>
</dl>
<hr>
Data and other attributes inherited from <a href="twisted.internet.protocol.html#Protocol">twisted.internet.protocol.Protocol</a>:<br>
<dl><dt><strong>__implemented__</strong> = &lt;implementedBy twisted.internet.protocol.Protocol&gt;</dl>
<hr>
Methods inherited from <a href="twisted.internet.protocol.html#BaseProtocol">twisted.internet.protocol.BaseProtocol</a>:<br>
<strong>__providedBy__</strong> = &lt;zope.interface.declarations.Declaration object&gt;
<hr>
Data and other attributes inherited from <a href="twisted.internet.protocol.html#BaseProtocol">twisted.internet.protocol.BaseProtocol</a>:<br>
<dl><dt><strong>connected</strong> = 0</dl>
<dl><dt><strong>transport</strong> = None</dl>
<hr>
Methods inherited from <a href="gdata.tlslite.integration.AsyncStateMachine.html#AsyncStateMachine">gdata.tlslite.integration.AsyncStateMachine.AsyncStateMachine</a>:<br>
<dl><dt><a name="TLSTwistedProtocolWrapper-inReadEvent"><strong>inReadEvent</strong></a>(self)</dt><dd><tt>Tell&nbsp;the&nbsp;state&nbsp;machine&nbsp;it&nbsp;can&nbsp;read&nbsp;from&nbsp;the&nbsp;socket.</tt></dd></dl>
<dl><dt><a name="TLSTwistedProtocolWrapper-inWriteEvent"><strong>inWriteEvent</strong></a>(self)</dt><dd><tt>Tell&nbsp;the&nbsp;state&nbsp;machine&nbsp;it&nbsp;can&nbsp;write&nbsp;to&nbsp;the&nbsp;socket.</tt></dd></dl>
<dl><dt><a name="TLSTwistedProtocolWrapper-outWriteEvent"><strong>outWriteEvent</strong></a>(self)</dt><dd><tt>Called&nbsp;when&nbsp;a&nbsp;write&nbsp;operation&nbsp;completes.<br>
&nbsp;<br>
May&nbsp;be&nbsp;overridden&nbsp;in&nbsp;subclass.</tt></dd></dl>
<dl><dt><a name="TLSTwistedProtocolWrapper-setCloseOp"><strong>setCloseOp</strong></a>(self)</dt><dd><tt>Start&nbsp;a&nbsp;close&nbsp;operation.</tt></dd></dl>
<dl><dt><a name="TLSTwistedProtocolWrapper-setHandshakeOp"><strong>setHandshakeOp</strong></a>(self, handshaker)</dt><dd><tt>Start&nbsp;a&nbsp;handshake&nbsp;operation.<br>
&nbsp;<br>
@type&nbsp;handshaker:&nbsp;generator<br>
@param&nbsp;handshaker:&nbsp;A&nbsp;generator&nbsp;created&nbsp;by&nbsp;using&nbsp;one&nbsp;of&nbsp;the<br>
asynchronous&nbsp;handshake&nbsp;functions&nbsp;(i.e.&nbsp;handshakeServerAsync,&nbsp;or<br>
handshakeClientxxx(...,&nbsp;async=True).</tt></dd></dl>
<dl><dt><a name="TLSTwistedProtocolWrapper-setWriteOp"><strong>setWriteOp</strong></a>(self, writeBuffer)</dt><dd><tt>Start&nbsp;a&nbsp;write&nbsp;operation.<br>
&nbsp;<br>
@type&nbsp;writeBuffer:&nbsp;str<br>
@param&nbsp;writeBuffer:&nbsp;The&nbsp;string&nbsp;to&nbsp;transmit.</tt></dd></dl>
<dl><dt><a name="TLSTwistedProtocolWrapper-wantsReadEvent"><strong>wantsReadEvent</strong></a>(self)</dt><dd><tt>If&nbsp;the&nbsp;state&nbsp;machine&nbsp;wants&nbsp;to&nbsp;read.<br>
&nbsp;<br>
If&nbsp;an&nbsp;operation&nbsp;is&nbsp;active,&nbsp;this&nbsp;returns&nbsp;whether&nbsp;or&nbsp;not&nbsp;the<br>
operation&nbsp;wants&nbsp;to&nbsp;read&nbsp;from&nbsp;the&nbsp;socket.&nbsp;&nbsp;If&nbsp;an&nbsp;operation&nbsp;is<br>
not&nbsp;active,&nbsp;this&nbsp;returns&nbsp;None.<br>
&nbsp;<br>
@rtype:&nbsp;bool&nbsp;or&nbsp;None<br>
@return:&nbsp;If&nbsp;the&nbsp;state&nbsp;machine&nbsp;wants&nbsp;to&nbsp;read.</tt></dd></dl>
<dl><dt><a name="TLSTwistedProtocolWrapper-wantsWriteEvent"><strong>wantsWriteEvent</strong></a>(self)</dt><dd><tt>If&nbsp;the&nbsp;state&nbsp;machine&nbsp;wants&nbsp;to&nbsp;write.<br>
&nbsp;<br>
If&nbsp;an&nbsp;operation&nbsp;is&nbsp;active,&nbsp;this&nbsp;returns&nbsp;whether&nbsp;or&nbsp;not&nbsp;the<br>
operation&nbsp;wants&nbsp;to&nbsp;write&nbsp;to&nbsp;the&nbsp;socket.&nbsp;&nbsp;If&nbsp;an&nbsp;operation&nbsp;is<br>
not&nbsp;active,&nbsp;this&nbsp;returns&nbsp;None.<br>
&nbsp;<br>
@rtype:&nbsp;bool&nbsp;or&nbsp;None<br>
@return:&nbsp;If&nbsp;the&nbsp;state&nbsp;machine&nbsp;wants&nbsp;to&nbsp;write.</tt></dd></dl>
</td></tr></table></td></tr></table>
</body></html>