lib/Net/SinFP3/Ext/IP/IPv4.pm

filter: Statementstmt 41.6% 25 / 60 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 41.1% 7 / 17 Podpod 12.5% 1 / 8 totaltotal 37.9% 33 / 87 CC 2 SCAR 7.2
CC
2
Cov
40%
_getInitial16bits
6.0
new
2.0
getResponseIpTtl
2.0
CRAP 2.1
« lib/Net/SinFP3/Worker.pm ↑ Summary lib/Net/SinFP3/Log/Null.pm »
1 #
2 # $Id: IPv4.pm,v 008243d3e89a 2018/07/21 14:54:07 gomor $
3 #
4 package Net::SinFP3::Ext::IP::IPv4;
5 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 ▶use base qw(Net::SinFP3::Ext::IP);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 our @AS = qw(
10 global
11 next
12 _ipid
13 _tcp
14 );
15 1 __PACKAGE__->cgBuildIndices;
16 1 __PACKAGE__->cgBuildAccessorsScalar(\@AS);
17  
18 1 ▶use Net::Frame::Layer qw(:subs);
Subroutine BEGIN: called CC=1 SCAR=0.0
19 1 ▶use Net::Frame::Layer::ETH qw(:consts);
Subroutine BEGIN: called CC=1 SCAR=0.0
20 1 ▶use Net::Frame::Layer::IPv4 qw(:consts);
Subroutine BEGIN: called CC=1 SCAR=0.0
21 1 ▶use Net::Frame::Layer::TCP qw(:consts);
Subroutine BEGIN: called CC=1 SCAR=0.0
22  
23 0 ▶sub new {
Subroutine new: not called CC=1 SCAR=6.9
Pod documented
24 0 my $self = shift->SUPER::new(
25 @_,
26 );
27  
28 0 my $ipid = $self->_getInitial16bits;
29 0 $self->_ipid($ipid);
30  
31 0 return $self;
32 }
33  
34 0 ▶sub _getInitial16bits {
Subroutine _getInitial16bits: not called CC=2 SCAR=17.9
35 0 my $self = shift;
36 0 my $i16 = getRandom16bitsInt();
37 0 ▶ $i16 += 666 unless $i16 > 0;
Branch: 1 branch
BranchTrueFalseTotal
unless $i16 > 0 0 0 0
38 0 return $i16;
39 }
40  
41 0 ▶sub getResponseIpTtl {
Subroutine getResponseIpTtl: not called CC=1 SCAR=6.9
Pod undocumented
42 0 my $self = shift;
43 0 my ($response) = @_;
44 0 return $response->reply->ref->{IPv4}->ttl;
45 }
46  
47 0 ▶sub getResponseIpId {
Subroutine getResponseIpId: not called CC=1 SCAR=6.9
Pod undocumented
48 0 my $self = shift;
49 0 my ($response) = @_;
50 0 return $response->reply->ref->{IPv4}->id;
51 }
52  
53 0 ▶sub getResponseIpDfBit {
Subroutine getResponseIpDfBit: not called CC=1 SCAR=6.9
Pod undocumented
54 0 my $self = shift;
55 0 my ($response) = @_;
56 0 return $response->reply->ref->{IPv4}->flags & NF_IPv4_DONT_FRAGMENT;
57 }
58  
59 0 ▶sub getProbeIpId {
Subroutine getProbeIpId: not called CC=1 SCAR=6.9
Pod undocumented
60 0 my $self = shift;
61 0 my ($response) = @_;
62 0 return $response->ref->{IPv4}->id;
63 }
64  
65 0 ▶sub _getIpv4Header {
Subroutine _getIpv4Header: not called CC=1 SCAR=6.9
66 0 my $self = shift;
67 0 my ($id) = @_;
68 0 return Net::Frame::Layer::IPv4->new(
69 tos => 0,
70 id => $id,
71 flags => 0,
72 offset => 0,
73 ttl => 255,
74 protocol => NF_IPv4_PROTOCOL_TCP,
75 src => $self->global->ip,
76 dst => $self->next->ip,
77 );
78 }
79  
80 0 ▶sub getP1 {
Subroutine getP1: not called CC=1 SCAR=6.9
Pod undocumented
81 0 my $self = shift;
82 0 my $ip4 = $self->_getIpv4Header($self->_ipid);
83 0 my $tcp = $self->_tcp->_getP1Tcp;
84 0 return Net::Frame::Simple->new(layers => [ $ip4, $tcp, ]);
85 }
86  
87 0 ▶sub getP2 {
Subroutine getP2: not called CC=1 SCAR=6.9
Pod undocumented
88 0 my $self = shift;
89 0 my $ip4 = $self->_getIpv4Header($self->_ipid + 1);
90 0 my $tcp = $self->_tcp->_getP2Tcp;
91 0 return Net::Frame::Simple->new(layers => [ $ip4, $tcp, ]);
92 }
93  
94 0 ▶sub getP3 {
Subroutine getP3: not called CC=1 SCAR=6.9
Pod undocumented
95 0 my $self = shift;
96 0 my $ip4 = $self->_getIpv4Header($self->_ipid + 2);
97 0 my $tcp = $self->_tcp->_getP3Tcp;
98 0 return Net::Frame::Simple->new(layers => [ $ip4, $tcp, ]);
99 }
100  
101 1 1;
102  
103 __END__
« lib/Net/SinFP3/Worker.pm ↑ Summary lib/Net/SinFP3/Log/Null.pm »