The server module

The server module contains the necessary classes for creating a concrete connection which is responsible for managing the connection between pysiriproxy and Apple’s web server.

The ClientTLSContext class

Inheritance diagram of pysiriproxy.connections.server.ClientTLSContext

class pysiriproxy.connections.server.ClientTLSContext[source]

The ClientTLSContext class creates a concrete factory class responsible for creating a client connection.

getContext()[source]

Get the context for this client connection.

isClient

Indicate that this is a client connection.

The ConnectionManager class

Inheritance diagram of pysiriproxy.connections.server.ConnectionManager

class pysiriproxy.connections.server.ConnectionManager(logger=None)

The ConnectionManager object managers incoming connection directions and provides the ability to forward data between them.

It allows a connection direction to be connected to an opposite connection direction which allows data to be forwarded from the direction to the connected direction.

connect(connection)

Add a connection to our set of connections.

  • connection – The connection object to add
disconnect(direction)

Remove a directed connection from our set of connections.

  • direction – The direction of the connection object to remove
forward(direction, data)

Forward the data from one connection to another.

  • direction – The direction of the data
  • data – The data to forward
getConnection(direction)

Get the connection for the specific direction.

  • direction – The direction for the connection to retrieve
getForwardName(direction)

Get the formatted name of the forward direction for the given direction.

  • direction – The data direction
getRefId(direction)

Get the most recently used reference id for the connection with the given direction.

  • direction – The direction for the connection
hasConnection(direction)

Determine if there is a connection to forward data to.

  • direction – The incoming data direction
injectObject(direction, obj)

Inject an object into the connection with the given direction.

  • direction – The direction to inject the object
  • obj – The object to inject
resetConnections()

Reset all of the connections that are being managed.

setRefId(refId, direction)

Set the ref id for the forward connection.

  • refId – The ref id
  • direction – The data direction

The Connection class

Inheritance diagram of pysiriproxy.connections.server.Connection

class pysiriproxy.connections.server.Connection(name, direction, logger, logColor=0)

The Connection class implements the base functionaltiy for creating a concrete twisted internet protocol which is able to receive data in the form of lines.

This base class implements the functionality of receiving data from the iPhone or from Apple’s web server. The iPhone Apple’s web server transmit plist objects which are compressed using zlib compression. This class implements the necessary functionality for receiving the data, and decompressing it to retrieve the plist object data that is being transmitted.

The Connection objects are connected to the connections.ConnectionManager which provides the ability for one Connection to forward data to another Connection.

Note

This class is intended to be subclassed to create a connection between two specific machines.

connectionFailed(reason)

This function is called when a connection failed.

  • reason – The reason the connection was lost
connectionLost(reason)

This function is called when a connection is lost.

  • reason – The reason the connection was lost
connectionMade()

This function is called when a connection is made.

getConnectionManager()

Get the ConnectionManager object for this Connection.

getDirection()

Get the direction for this connection.

getMode()

Get the current receiving mode the server is in.

getRefId()

Get the most recently used reference id.

injectObjectToOutputStream(obj)

Inject the given object into the output stream of this connection. This effectively sends the object to the foward destination connection for this connection.

  • obj – The object to inject into the output stream
lineReceived(line)

This function is called when a line of data is received.

  • line – The line of data
rawDataReceived(data)

This function is called when raw data is received.

  • data – The raw data
reset()

Reset this connection.

setLineMode()

Set the server to receive lines.

setRawMode()

Set the server to receive raw data.

setRefId(refId)

Set the reference id.

  • refId – The reference id

The _Server class

Inheritance diagram of pysiriproxy.connections.server._Server

class pysiriproxy.connections.server._Server(logger)[source]

The _Server class manages a connection to the Apple server which proceses Siri requests and responds accordingly.

connectionMade()[source]

Called when the connection has been made successfully.

receiveObject(obj)[source]

Called when an object has been received.

  • obj – The received object

The _Factory class

Inheritance diagram of pysiriproxy.connections.server._Factory

class pysiriproxy.connections.server._Factory(logger=None)[source]

The _Factory class is responsible for creating a _Server connection.

buildProtocol(_addr)[source]

Build the protocol for the _Server connection.

  • _addr – The address

Table Of Contents

Previous topic

The manager module

Next topic

The connection module

This Page