Class t.p.a.AMP(StatefulStringProtocol, Int16StringReceiver, _AmpParserBase):

Part of twisted.protocols.amp View Source View In Hierarchy

Known subclasses: twisted.protocols.amp._ParserHelper

This protocol is an AMP connection. See the module docstring for protocol details.
Class __metaclass__ Metaclass hack to record decorators.
Method __repr__ A verbose string representation which gives us information about this AMP
Method _lock Lock this Amp instance so that no further Amp traffic may be sent.
Method _switchTo Switch this Amp instance to a new protocol. You need to do this
Method _sendBox Send a amp.Box to my peer.
Method makeConnection When a connection is first established, AMP clients send a greeting but
Method _getPeerCertificate Undocumented
Method _prepareTLS Used by StartTLSCommand to put us into the state where we don't
Method _startTLS Used by TLSBox to initiate the SSL handshake.
Method _defaultStartTLSResponder The default TLS responder doesn't specify any certificate or anything.
Method connectionLost Terminate all outstanding request deferreds, and notify nested protocol
Method dataReceived Either parse incoming data as AMP packets or relay it to our nested
Method proto_init String received in the 'init' state.
Method proto_key String received in the 'key' state. If the key is empty, a complete
Method proto_value String received in the 'value' state.

Inherited from StatefulStringProtocol:

Method stringReceived Choose a protocol phase function and call it.

Inherited from Int16StringReceiver:

Method stringReceived Override this.
Method sendString Send an int16-prefixed string to the other end of the connection.

Inherited from BaseProtocol (via Int16StringReceiver, Protocol):

Method connectionMade Called when a connection is made.

Inherited from _PauseableMixin (via Int16StringReceiver):

Method pauseProducing Undocumented
Method resumeProducing Undocumented
Method stopProducing Undocumented

Inherited from _AmpParserBase:

Method __init__ Create an _AmpParserBase, initializing request-response tracking state.
Method _puke This is a terminal callback called after application code has had a
Method _nextTag Generate protocol-local serial numbers for _ask keys.
Method failAllOutgoing Call the errback on all outstanding requests awaiting responses.
Method ampBoxReceived An AmpBox was received. Respond to it according to its contents.
Method _sendBoxCommand Send a command across the wire with the given amp.Box.
Method callRemoteString This is a low-level API, designed only for opitmizing simple messages
Method callRemote This is the primary high-level API for sending messages via AMP. Invoke it

Inherited from _DispatchMixin (via _AmpParserBase):

Method _wrapWithSerialization Wrap aCallable with its command's argument de-serialization
Method lookupFunction Return a callable to invoke when executing the named command.
Method dispatchCommand A box with a _command key was received.
def __repr__(self): (source)
A verbose string representation which gives us information about this AMP connection.
def _lock(self): (source)
Lock this Amp instance so that no further Amp traffic may be sent. This is used when sending a request to switch underlying protocols. You probably want to subclass ProtocolSwitchCommand rather than calling this directly.
def _switchTo(self, newProto, clientFactory=None): (source)
Switch this Amp instance to a new protocol. You need to do this 'simultaneously' on both ends of a connection; the easiest way to do this is to use a subclass of ProtocolSwitchCommand.
ParametersnewProtothe new protocol instance.
clientFactorythe ClientFactory to send notifications to.
def _sendBox(self, completeBox): (source)

Send a amp.Box to my peer.

Note: transport.write is never called outside of this method.
ParameterscompleteBoxan AmpBox.
def makeConnection(self, transport): (source)
When a connection is first established, AMP clients send a greeting but servers do not.
def _getPeerCertificate(self): (source)
Undocumented
def _prepareTLS(self, certificate, verifyAuthorities): (source)
Used by StartTLSCommand to put us into the state where we don't actually send things that get sent, instead we buffer them. see _sendBox.
def _startTLS(self, certificate, verifyAuthorities): (source)
Used by TLSBox to initiate the SSL handshake.
Parameterscertificatea twisted.internet.ssl.PrivateCertificate for use locally.
verifyAuthoritiestwisted.internet.ssl.Certificate instances representing certificate authorities which will verify our peer.
def _defaultStartTLSResponder(self): (source)

The default TLS responder doesn't specify any certificate or anything.

From a security perspective, it's little better than a plain-text connection - but it is still a *bit* better, so it's included for convenience.

You probably want to override this by providing your own StartTLS.responder.
def connectionLost(self, reason): (source)
Terminate all outstanding request deferreds, and notify nested protocol that the connection has terminated.
def dataReceived(self, data): (source)
Either parse incoming data as AMP packets or relay it to our nested protocol.
def proto_init(self, string): (source)
String received in the 'init' state.
def proto_key(self, string): (source)
String received in the 'key' state. If the key is empty, a complete box has been received.
def proto_value(self, string): (source)
String received in the 'value' state.
API Documentation for twisted, generated by pydoctor.