| 1 | # SMB Perl library, Copyright (C) 2014 Mikhael Goikhman, migo@cpan.org | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | # This program is free software: you can redistribute it and/or modify | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | # it under the terms of the GNU General Public License as published by | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | # the Free Software Foundation, either version 3 of the License, or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | # (at your option) any later version. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | # This program is distributed in the hope that it will be useful, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | # GNU General Public License for more details. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | # You should have received a copy of the GNU General Public License | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | package SMB::v2::Header; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 1 | ▶ | use parent 'SMB::Header'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | use constant { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | # the command is a response, otherwise a request | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 1 | FLAGS_RESPONSE => 0x1, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | # the command is asynchronous | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | FLAGS_ASYNC_COMMAND => 0x2, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | # the command is continued, part of the chain | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | FLAGS_CHAINED => 0x4, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | # the command is signed */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | FLAGS_SIGNED => 0x8, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | # DFS resolution is required | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | FLAGS_DFS => 0x10000000, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 1 | ▶ | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | sub new ($%) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 0 | ▶ | my $class = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 0 | my %options = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | return $class->SUPER::new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | aid => delete $options{aid} || 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | credits => delete $options{credits} || 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | credit_charge => delete $options{credit_charge} || ($options{code} ? 1 : 0), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 0 | ▶ | struct_size => delete $options{struct_size} || 2, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/9
delete $options{'aid'} || 0
delete $options{'credits'} || 0
delete $options{'credit_charge'} || ($options{'code'} ? 1 : 0)
delete $options{'struct_size'} || 2
MC/DC0%0/1
delete $options{'aid'} || 0
delete $options{'aid'}
MC/DC0%0/1
delete $options{'credits'} || 0
delete $options{'credits'}
MC/DC0%0/2
delete $options{'credit_charge'} || ($options{'code'} ? 1 : 0)
delete $options{'credit_charge'}
($options{'code'} ? 1 : 0)
MC/DC0%0/1
delete $options{'struct_size'} || 2
delete $options{'struct_size'}
Truth table0%0/2
A
A= delete $options{'aid'}
Truth table0%0/2
A
A= delete $options{'credits'}
Truth table0%0/3
A || B
A= delete $options{'credit_charge'}B= ($options{'code'} ? 1 : 0)
Truth table0%0/2
A
A= delete $options{'struct_size'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | %options, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | sub is_response ($) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_response: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 0 | ▶ | return $self->flags & FLAGS_RESPONSE ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | sub is_signed ($) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_signed: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 0 | my $signature = $self->signature; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 0 | ▶ | return ref($signature) eq 'ARRAY' && @$signature == 16 && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/9
ref $signature eq 'ARRAY' && @$signature == 16 && "$signature" ne "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" && ($self->flags & 8) != 0
ref $signature eq "ARRAY" and @$signature == 16 and "$signature" ne "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
ref $signature eq "ARRAY" and @$signature == 16
MC/DC0%0/4
ref $signature eq 'ARRAY' && @$signature == 16 && "$signature" ne "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" && ($self->flags & 8) != 0
ref $signature eq "ARRAY"
@$signature == 16
"$signature" ne "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
($self->flags & 8) != 0
Truth table0%0/5
A and B and C && D
A= ref $signature eq "ARRAY"B= @$signature == 16C= "$signature" ne "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"D= ($self->flags & 8) != 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | (join('', $signature) ne "\0" x 16) && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | ($self->flags & FLAGS_SIGNED) != 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||