This module defines the class Proxy, encapsulating the ZorpProxy component implemented by the Zorp core. Each protocol specific proxy is derived from this class.
from Stream import Stream
Module exporting an interface to the Zorp.Stream component.
from Zorp import *
Module defining global constants, and interface entry points to the Zorp core.
import new
from traceback import print_exc
Log a proxy message.
proxyLog ( self, type, level, msg, ) |
Log messages about proxies. Automatically puts session_id into each message.
Table 4-81. Arguments for .proxyLog()
self | should be a Proxy derivative |
type | log class |
level | message verbosity level |
msg | msg to log |
This class is similar to [Proxy] with the exception that it's used for datagram based protocols.
.. [Proxy] Proxy
Table 4-82. Attributes for class DatagramProxy
self | this instance |
session | the session we belong to |
Initializes a DatagramProxy instance.
__init__ ( self, name, session, ) |
Sets attributes based on arguments.
Table 4-83. Arguments for DatagramProxy.__init__()
self | this instance |
name | The type of the proxy |
session | The descriptor of the connection |
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.
Table 4-84. Attributes for class Proxy
session | descriptor of the connection |
name | the native proxy module used for this session |
Initializes a Proxy instance.
__init__ ( self, name, session, ) |
Initializes a Proxy instance and sets attributes.
Table 4-85. Arguments for Proxy.__init__()
name | The type of the proxy |
session | reference to the session |
Adds a policy to the proxy.
addPolicy ( self, klass ) |
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.
Table 4-86. Arguments for Proxy.addPolicy()
self | this instance |
klass | the class implementing the policy |
Callback method called when a connection established
connectServer ( self, host, port, ) |
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.
Table 4-87. Arguments for Proxy.connectServer()
self | this instance |
host | The address of the server |
port | The port of the server |
InternalError
The descriptor of the server stream