AnyEvent::Radius::Client - module to implement AnyEvent based RADIUS client
use AnyEvent; use AnyEvent::Radius::Client; my $dict = AnyEvent::Radius::Client->load_dictionary('path-to-radius-dictionary'); sub read_reply_callback { # $h is HASH-REF {type, request_id, av_list, from, authenticator} my ($self, $h) = @_; ... } my $client = AnyEvent::Radius::Client->new( ip => $ip, port => $port, on_read => \&read_reply_callback, dictionary => $dict, secret => $secret, ); $client->send_auth(AV_LIST1); $client->send_auth(AV_LIST2); ... $client->wait; ... $client->destroy;
The AnyEvent::Radius::Client module allows to send multiple RADIUS requests in non-blocking way, and then wait for responses.
Class method to load dictionary - returns the object to be passed to constructor
Builds RADIUS packet using Data::Radius::Packet and store it to outgoing queue.
The type can be either the direct RFC packet type id, or one of its aliases, like COA, DM, POD, ACCT, AUTH ... see Data::Radius::Constants
Data::Radius::Constants
Passing the optional callback $cb to be called upon receiving response to this request in form
$cb->($resp_type, $resp_av_list)
or with empty parameters in case of missing response - eg. being timed out or unmatched authenticator
$cb->()
Returns request id. Note that it's not possible to schedule more than 255 requests - trying to add more will return undef
Alias methods to send RADIUS request of required type by send_packet()
Blocks until all requests are received or read timeout reached
Used to coordinate multiple clients instead of wait()
Example:
my $cv = AnyEvent->condvar; $client1->on_ready($cv); $client2->on_ready($cv); $client3->on_ready($cv); $cv->recv;
Will be blocked until all clients finish their queue.
Destroy the internal socket handle. Must be called when object is no longer required. When called from callback, it is recommended to wrap this call into AnyEvent::postpone { ... } block.
Authen::Radius, AnyEvent::Radius::Server, Data::Radius
Sergey Leschenko <sergle.ua at gmail.com>
PortaOne Development Team <perl-radius at portaone.com> is the current module's maintainer at CPAN.
To install AnyEvent::Radius, copy and paste the appropriate command in to your terminal.
cpanm
cpanm AnyEvent::Radius
CPAN shell
perl -MCPAN -e shell install AnyEvent::Radius
For more information on module installation, please visit the detailed CPAN module installation guide.