AnyEvent-Radius
view release on metacpan or search on metacpan
or calling init($initial_last_request_id) to be followed in queue for next request
1.1.5 2024-07-16
- Require Data::Radius v1.2.8
- The attribute Message-Authenticator now is added by the default,
except for the accounting request/response
1.1.4 2022-06-24
- Extended AnyEvent::Radius::Client with bind_ip option
- Fixed missing AnyEvent::Radius::Client destroy on fatal error in AnyEvent::Handle::UDP
- Fixed the request id generation to avoid queue mismatches
1.1.3 2020-10-19
- Fixed MIN_PERL_VERSION in Makefile.PL, required by ExtUtils::MakeMaker@7.48
1.1.2 2020-07-02
- Added the callback support allowing to collect timed out results
lib/AnyEvent/Radius/Client.pm view on Meta::CPAN
use constant MAX_QUEUE => MAX_REQUEST_ID() + 1;
# new 'NAS'
# args:
# ip
# port
# secret
# dictionary
# read_timeout
# write_timeout
# bind_ip
# initial_last_request_id - random by default
#- callbacks:
# on_read
# on_read_raw
# on_read_timeout
# on_write_timeout
# on_error
sub new {
my ($class, %h) = @_;
lib/AnyEvent/Radius/Client.pm view on Meta::CPAN
die "No radius secret";
}
my %udp_handle_args = (
rtimeout => $h{read_timeout} // READ_TIMEOUT_SEC,
wtimeout => $h{write_timeout} // WRITE_TIMEOUT_SEC,
);
die "No IP argument" if ! exists $h{ip};
$udp_handle_args{connect} = [ $h{ip}, $h{port} // RADIUS_PORT ];
$udp_handle_args{bind} = [$h{bind_ip}, 0] if exists $h{bind_ip};
$udp_handle_args{on_recv} = sub {
my ($data, $handle, $from) = @_;
$obj->read_cv->end;
$obj->reply_cnt($obj->reply_cnt + 1);
if ($h{on_read_raw}) {
# dump raw data
$h{on_read_raw}->($obj, $data, $from);
}
lib/AnyEvent/Radius/Client.pm view on Meta::CPAN
=over
=item ip
=item port - where to connect
=item secret - RADIUS secret string for remote server
=item dictionary - optional, dictionary loaded by L<load_dictionary()> method
=item bind_ip - optional, the local ip address to bind client to
=item read_timeout
=item write_timeout - network I/O timeouts (default is 5 second)
=item initial_last_request_id - explicit radius id initialization, the next request will use it+1
=item Callbacks:
=over
lib/AnyEvent/Radius/Server.pm view on Meta::CPAN
my ($handle, $fatal, $error) = @_;
if ($h{on_error}) {
$h{on_error}->($obj, $error);
}
else {
warn "Error occured: $error";
}
};
my $server = AnyEvent::Handle::UDP->new(
bind => [$h{ip}, $h{port} // RADIUS_PORT ],
on_recv => $on_read_cb,
on_error => $on_error_cb,
);
$obj->handler($server);
# allow to pass custom object
my $packer = $h{packer} || Data::Radius::Packet->new(dict => $h{dictionary}, secret => $h{secret});
$obj->packer($packer);
return $obj;
( run in 1.106 second using v1.01-cache-2.11-cpan-140bd7fdf52 )