TacacsPlus/Packet/AuthenContinueBody.pm

filter: Statementstmt 100% 37 / 37 Branchbran 75.0% 3 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 9 / 9 Podpod 100% 3 / 3 totaltotal 98.1% 52 / 53 CC 3 SCAR 4.4
CC
3
Cov
98%
new
3.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.5
« TacacsPlus/Packet/AuthenReplyBody.pm ↑ Summary TacacsPlus/Packet/AuthorResponseBody.pm »
1 package Net::TacacsPlus::Packet::AuthenContinueBody;
2  
3 =head1 NAME
4  
5 Net::TacacsPlus::Packet::AuthenContinueBody - Tacacs+ authentication continue body
6  
7 =head1 DESCRIPTION
8  
9 8. The authentication CONTINUE packet body
10
11 This packet is sent from the NAS to the daemon following the receipt
12 of a REPLY packet.
13
14
15 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8
16
17 +----------------+----------------+----------------+----------------+
18 | user_msg len | data len |
19 +----------------+----------------+----------------+----------------+
20 | flags | user_msg ...
21 +----------------+----------------+----------------+----------------+
22 | data ...
23 +----------------+
24  
25 =cut
26  
27  
28 11 our $VERSION = '1.10';
29  
30 11 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
31 11 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
32  
33 11 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
34 11 ▶use Net::TacacsPlus::Constants 1.03;
Subroutine BEGIN: called CC=1 SCAR=0.0
35 11 ▶use Carp::Clan;
Subroutine BEGIN: called CC=1 SCAR=0.0
36  
37 11 ▶use base qw{ Class::Accessor::Fast };
Subroutine BEGIN: called CC=1 SCAR=0.0
38  
39 11 __PACKAGE__->mk_accessors(qw{
40 continue_flags
41 user_msg
42 data
43 });
44  
45 =head1 METHODS
46  
47 =over 4
48  
49 =item new( somekey => somevalue)
50  
51 Construct tacacs+ authentication CONTINUE packet body object
52  
53 Parameters:
54  
55 'continue_flags' : TAC_PLUS_CONTINUE_FLAG_ABORT - default none
56 'user_msg' : user message requested by server
57 'data' : data requested by server
58  
59 =cut
60  
61 2 ▶sub new() {
Subroutine new: called CC=3 SCAR=11.0
Pod documented
62 2 my $class = shift;
63 2 my %params = @_;
64  
65 #let the class accessor contruct the object
66 2 my $self = $class->SUPER::new(\%params);
67  
68 2 ▶ if ($params{'raw_body'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($params{"raw_body"}) 1 1 2
69 1 $self->decode($params{'raw_body'});
70 1 delete $self->{'raw_body'};
71 1 return $self;
72 }
73  
74 1 ▶ $self->continue_flags(0) if not defined $self->continue_flags;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->continue_flags 0 1 1
75  
76 1 return $self;
77 }
78  
79  
80 =item decode($raw_body)
81  
82 Construct body object from raw data.
83  
84 =cut
85  
86 1 ▶sub decode {
Subroutine decode: called CC=1 SCAR=0.0
Pod documented
87 1 my ($self, $raw_body) = @_;
88  
89 1 my $user_msg_length;
90 my $data_length;
91 1 my $payload;
92
93 (
94 $user_msg_length,
95 $data_length,
96 1 $self->{'continue_flags'},
97 $payload,
98 ) = unpack('nnCa*', $raw_body);
99  
100 (
101 $self->{'user_msg'},
102 1 $self->{'data'},
103 ) = unpack('a'.$user_msg_length.'a'.$data_length, $payload);
104 }
105  
106  
107 =item raw()
108  
109 Return binary data of packet body.
110  
111 =cut
112  
113 1 ▶sub raw {
Subroutine raw: called CC=1 SCAR=0.0
Pod documented
114 1 my $self = shift;
115  
116 my $body = pack("nnC",
117 length($self->{'user_msg'}),
118 length($self->{'data'}),
119 $self->{'continue_flags'},
120 1 ).$self->{'user_msg'}.$self->{'data'};
121  
122 1 return $body;
123 }
124  
125 11 1;
126  
127 =back
128  
129 =cut
« TacacsPlus/Packet/AuthenReplyBody.pm ↑ Summary TacacsPlus/Packet/AuthorResponseBody.pm »