Author image PortaOne, Inc.
and 2 contributors

NAME

Data::Radius::Constants - export constants for Data::Radius::Packet

SYNOPSIS

    use Data::Radius::Constants qw(:all);

or

    use Data::Radius::Constants qw(ACCESS_REQUEST ACCESS_ACCEPT ACCESS_REJECT %RADIUS_PACKET_TYPES);

DESCRIPTION

Exports RADIUS RFC established constants and utilities for easy packet handling.

In addition to RFC packet type constants enables following aliases:

    'COA' => COA_REQUEST,

    'DM' => DISCONNECT_REQUEST,

    'POD' => DISCONNECT_REQUEST,

    'ACCT' => ACCOUNTING_REQUEST,

    'AUTH' => ACCESS_REQUEST,

    my $type = ACCESS_REQUEST;

... is equivalent to

    my $type = $RADIUS_PACKET_TYPES{AUTH}; # using aliases

METHODS

accepting_packet_type($request_type, $response_type)

Convenience method to test if a request was accepted by received response.

Returns true if the response type is the accepting type for the given request type. Returns 0 for corresponding rejections, undef for everything else

You can use packet type ids or its aliases as arguments

Example:

($response_type) = $response_packet->parse();

print "Accepted\n" if accepting_packet_type(ACCESS_REQUEST, $response_type);

but also

print "Accepted\n" if accepting_packet_type('AUTH', ACCESS_ACCEPT);

print "Accepted\n" if accepting_packet_type('AUTH', 'ACCESS_ACCEPT'); # same

SEE ALSO

Data::Radius::Packet

AUTHOR

Sergey Leschenko <sergle.ua at gmail.com>

PortaOne Development Team <perl-radius at portaone.com> is the current module's maintainer at CPAN.