Module Proxy

This module defines the class Proxy, encapsulating the ZorpProxy component implemented by the Zorp core. Each protocol specific proxy is derived from this class.

Imported modules

Functions

Function proxyLog

Log a proxy message.

Synopsis

proxyLog (
        self,
        type,
        level,
        msg,
        )

Description

Log messages about proxies. Automatically puts session_id into each message.

Arguments

Table 4-81. Arguments for .proxyLog()

self should be a Proxy derivative
type log class
levelmessage verbosity level
msg msg to log

Class DatagramProxy

This class is similar to [Proxy] with the exception that it's used for datagram based protocols.

.. [Proxy] Proxy

Attributes

Table 4-82. Attributes for class DatagramProxy

self this instance
sessionthe session we belong to

Constructor __init__

Initializes a DatagramProxy instance.

Synopsis

__init__ (
        self,
        name,
        session,
        )

Description

Sets attributes based on arguments.

Arguments

Table 4-83. Arguments for DatagramProxy.__init__()

self this instance
name The type of the proxy
sessionThe descriptor of the connection

Class Proxy

This class is inherited from an ExtensionClass implemented by the Zorp core. It encapsulates a protocol specific proxy. As an instance is created, the required module is loaded (identified by the name attribute), and a new thread is started to handle the connection.

Attributes

Table 4-84. Attributes for class Proxy

session descriptor of the connection
name the native proxy module used for this session

Constructor __init__

Initializes a Proxy instance.

Synopsis

__init__ (
        self,
        name,
        session,
        )

Description

Initializes a Proxy instance and sets attributes.

Arguments

Table 4-85. Arguments for Proxy.__init__()

name The type of the proxy
sessionreference to the session

Method addPolicy

Adds a policy to the proxy.

Synopsis

addPolicy ( self,  klass )

Description

This function extends this class with another parent class at runtime. It can be used to add methods to this event handler class based on some runtime variable.

Arguments

Table 4-86. Arguments for Proxy.addPolicy()

self this instance
klass the class implementing the policy

Method connectServer

Callback method called when a connection established

Synopsis

connectServer (
        self,
        host,
        port,
        )

Description

If the chainer is defined, it is called with the given host and port parameters to connect to the remote server.

If there is no chainer defined, it tries to return the server-side fd from the session. If there's no server_fd it raises an error.

Arguments

Table 4-87. Arguments for Proxy.connectServer()

self this instance
host The address of the server
port The port of the server

Exceptions

  • InternalError

Returns

The descriptor of the server stream