Table of contents Index

class Listener - Class to listen on the selected address.

Declared in module Listener

Synopsis

class Listener:
    def Listener.Listener.__init__(self, bindto, service) # Constructor to initialize a Listen instance
    def Listener.Listener.accepted(self, client, fd) # Callback to inform the python layer about incoming connections.
    def Listener.Listener.destroy(self) # Stops the listener on the given port
    def Listener.Listener.getService(self, session) # Returns the service associated with the listener

None listen = None
None service = None

Description

This is the starting point of Zorp services. It listens on the given port, and when a connection is accepted it starts a session and the given service.

Attributes:

listen
A Zorp.Listen instance
service
the service to be started
local
local address where the listener is bound


Listener.Listener.__init__(self, bindto, service)

Constructor to initialize a Listen instance

self
this instance
bindto
the address to bind to
service
the service name to start
Creates the instance, sets the initial attributes, and starts the listener

Listener.Listener.accepted(self, client, fd)

Callback to inform the python layer about incoming connections.

self
this instance
client
the address of the client
fd
the fd of the connection to the client
This callback is called by the core when a connection is accepted. Creates and starts a service.

Returns:

TRUE if the connection is accepted

Notes:

This function does the access control checks (in setService and setClient), sets initial session parameters, logs a debug message, and starts the service. Exceptions raised due to policy violations are handled here. (client not allowed to use this service, or couldn't authenticate himself)

Listener.Listener.destroy(self)

Stops the listener on the given port

self
this instance
Calls the destroy method of the low-level object

Listener.Listener.getService(self, session)

Returns the service associated with the listener

self
this instance
session
session reference
Returns the service to start.

Notes:

FIXME: this function is not yet used
Copyright © 2000 BalaBit IT Ltd.
Written by: Balázs Scheidler