Package pyrad :: Module client :: Class Client
[show private | hide private]
[frames | no frames]

Class Client

Host --+
       |
      Client


Basic RADIUS client.

This class implements a basic RADIUS client. It can send requests to a RADIUS server, taking care of timeouts and retries, and validate its replies.
Method Summary
  __init__(self, server, authport, acctport, secret, dict)
Constructor.
  bind(self, addr)
Bind socket to an address.
pyrad.packet.Packet CreateAcctPacket(self, **args)
Create a new RADIUS packet.
pyrad.packet.Packet CreateAuthPacket(self, **args)
Create a new RADIUS packet.
pyrad.packet.Packet SendPacket(self, pkt)
Send a packet to a RADIUS server.

Instance Variable Summary
integer retries: number of times to retry sending a RADIUS request
integer timeout: number of seconds to wait for an answer

Method Details

__init__(self, server, authport=1812, acctport=1813, secret='', dict=None)
(Constructor)

Constructor.
Parameters:
server - hostname or IP address of RADIUS server
           (type=string)
authport - port to use for authentication packets
           (type=integer)
acctport - port to use for accounting packets
           (type=integer)
secret - RADIUS secret
           (type=string)
dict - RADIUS dictionary
           (type=pyrad.dictionary.Dictionary)
Overrides:
pyrad.host.Host.__init__

bind(self, addr)

Bind socket to an address.

Binding the socket used for communicating to an address can be usefull when working on a machine with multiple addresses.
Parameters:
addr - network address (hostname or IP) and port to bind to
           (type=host,port tuple)

CreateAcctPacket(self, **args)

Create a new RADIUS packet.

This utility function creates a new RADIUS packet which can be used to communicate with the RADIUS server this client talks to. This is initializing the new packet with the dictionary and secret used for the client.
Returns:
a new empty packet instance
           (type=pyrad.packet.Packet)
Overrides:
pyrad.host.Host.CreateAcctPacket

CreateAuthPacket(self, **args)

Create a new RADIUS packet.

This utility function creates a new RADIUS packet which can be used to communicate with the RADIUS server this client talks to. This is initializing the new packet with the dictionary and secret used for the client.
Returns:
a new empty packet instance
           (type=pyrad.packet.Packet)
Overrides:
pyrad.host.Host.CreateAuthPacket

SendPacket(self, pkt)

Send a packet to a RADIUS server.
Parameters:
pkt - the packet to send
           (type=pyrad.packet.Packet)
Returns:
the reply packet received
           (type=pyrad.packet.Packet)
Raises:
Timeout - RADIUS server does not reply
Overrides:
pyrad.host.Host.SendPacket

Instance Variable Details

retries

number of times to retry sending a RADIUS request
Type:
integer

timeout

number of seconds to wait for an answer
Type:
integer

Generated by Epydoc 2.1 on Wed Jun 2 14:19:55 2004 http://epydoc.sf.net