| 1 | package POE::Filter::TacacsPlus; | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | POE::Filter::TacacsPlus - TacacsPlus packet filter | ||
| 6 | |||
| 7 | =cut | ||
| 8 | |||
| 9 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | |||
| 12 | 1 | our $VERSION = '1.10_01'; | |
| 13 | |||
| 14 | |||
| 15 | 1 | ▶ | use Net::TacacsPlus::Packet 1.05; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 16 | |||
| 17 | |||
| 18 | =head1 METHODS | ||
| 19 | |||
| 20 | =head2 new() | ||
| 21 | |||
| 22 | Construct a filter object. | ||
| 23 | |||
| 24 | =cut | ||
| 25 | |||
| 26 | sub new { | ||
| 27 | 0 | ▶ | my $class = shift; |
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 28 | 0 | my %args = @_; | |
| 29 | |||
| 30 | my $self = { | ||
| 31 | 0 | 'key' => $args{'key'} | |
| 32 | }; | ||
| 33 | |||
| 34 | 0 | bless $self, $class; | |
| 35 | |||
| 36 | 0 | return $self; | |
| 37 | } | ||
| 38 | |||
| 39 | |||
| 40 | =head2 get(@raw_packets) | ||
| 41 | |||
| 42 | Transforms raw packets to the Net::TacacsPlus::Packet object. | ||
| 43 | |||
| 44 | =cut | ||
| 45 | |||
| 46 | sub get { | ||
| 47 | 0 | ▶ | my $self = shift; |
|
Subroutine
get: not called CC=2 SCAR=17.9
Pod
documented
| |||
| 48 | 0 | my $raw_packets = shift; | |
| 49 | |||
| 50 | 0 | my @tacacs_packets; | |
| 51 | 0 | foreach my $raw (@{$raw_packets}) { | |
| 52 | push(@tacacs_packets, Net::TacacsPlus::Packet->new( | ||
| 53 | 'raw' => $raw, | ||
| 54 | 0 | 'key' => $self->{'key'}, | |
| 55 | )); | ||
| 56 | } | ||
| 57 | |||
| 58 | 0 | return \@tacacs_packets; | |
| 59 | } | ||
| 60 | |||
| 61 | |||
| 62 | =head2 put(@packet_objects) | ||
| 63 | |||
| 64 | Transforms Net::TacacsPlus::Packet to the binary packet form. | ||
| 65 | |||
| 66 | =cut | ||
| 67 | |||
| 68 | sub put { | ||
| 69 | 0 | ▶ | my $self = shift; |
|
Subroutine
put: not called CC=2 SCAR=17.9
Pod
documented
| |||
| 70 | 0 | my $packets = shift; | |
| 71 | |||
| 72 | 0 | my @tacacs_raw_packets; | |
| 73 | 0 | foreach my $packet (@{$packets}) { | |
| 74 | 0 | push(@tacacs_raw_packets, $packet->raw); | |
| 75 | } | ||
| 76 | |||
| 77 | 0 | return \@tacacs_raw_packets; | |
| 78 | } | ||
| 79 | |||
| 80 | 1 | 1; | |