| 1 | # | ||||||||||||||||||||||||||||
| 2 | # $Id: ETH.pm,v ce68fbcc7f6d 2019/05/23 05:58:40 gomor $ | ||||||||||||||||||||||||||||
| 3 | # | ||||||||||||||||||||||||||||
| 4 | package Net::Frame::Layer::ETH; | ||||||||||||||||||||||||||||
| 5 | 3 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 3 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 3 | ▶ | use Net::Frame::Layer qw(:consts :subs); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 3 | require Exporter; | |||||||||||||||||||||||||||
| 10 | 3 | our @ISA = qw(Net::Frame::Layer Exporter); | |||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 3 | our %EXPORT_TAGS = ( | |||||||||||||||||||||||||||
| 13 | consts => [qw( | ||||||||||||||||||||||||||||
| 14 | NF_ETH_HDR_LEN | ||||||||||||||||||||||||||||
| 15 | NF_ETH_ADDR_BROADCAST | ||||||||||||||||||||||||||||
| 16 | NF_ETH_TYPE_IPv4 | ||||||||||||||||||||||||||||
| 17 | NF_ETH_TYPE_X25 | ||||||||||||||||||||||||||||
| 18 | NF_ETH_TYPE_ARP | ||||||||||||||||||||||||||||
| 19 | NF_ETH_TYPE_CGMP | ||||||||||||||||||||||||||||
| 20 | NF_ETH_TYPE_80211 | ||||||||||||||||||||||||||||
| 21 | NF_ETH_TYPE_PPPIPCP | ||||||||||||||||||||||||||||
| 22 | NF_ETH_TYPE_RARP | ||||||||||||||||||||||||||||
| 23 | NF_ETH_TYPE_DDP | ||||||||||||||||||||||||||||
| 24 | NF_ETH_TYPE_AARP | ||||||||||||||||||||||||||||
| 25 | NF_ETH_TYPE_PPPCCP | ||||||||||||||||||||||||||||
| 26 | NF_ETH_TYPE_WCP | ||||||||||||||||||||||||||||
| 27 | NF_ETH_TYPE_8021Q | ||||||||||||||||||||||||||||
| 28 | NF_ETH_TYPE_IPX | ||||||||||||||||||||||||||||
| 29 | NF_ETH_TYPE_STP | ||||||||||||||||||||||||||||
| 30 | NF_ETH_TYPE_IPv6 | ||||||||||||||||||||||||||||
| 31 | NF_ETH_TYPE_WLCCP | ||||||||||||||||||||||||||||
| 32 | NF_ETH_TYPE_MPLS | ||||||||||||||||||||||||||||
| 33 | NF_ETH_TYPE_PPPoED | ||||||||||||||||||||||||||||
| 34 | NF_ETH_TYPE_PPPoES | ||||||||||||||||||||||||||||
| 35 | NF_ETH_TYPE_8021X | ||||||||||||||||||||||||||||
| 36 | NF_ETH_TYPE_AoE | ||||||||||||||||||||||||||||
| 37 | NF_ETH_TYPE_80211I | ||||||||||||||||||||||||||||
| 38 | NF_ETH_TYPE_LLDP | ||||||||||||||||||||||||||||
| 39 | NF_ETH_TYPE_LLTD | ||||||||||||||||||||||||||||
| 40 | NF_ETH_TYPE_LOOP | ||||||||||||||||||||||||||||
| 41 | NF_ETH_TYPE_VLAN | ||||||||||||||||||||||||||||
| 42 | NF_ETH_TYPE_PPPPAP | ||||||||||||||||||||||||||||
| 43 | NF_ETH_TYPE_PPPCHAP | ||||||||||||||||||||||||||||
| 44 | )], | ||||||||||||||||||||||||||||
| 45 | ); | ||||||||||||||||||||||||||||
| 46 | our @EXPORT_OK = ( | ||||||||||||||||||||||||||||
| 47 | 3 | @{$EXPORT_TAGS{consts}}, | |||||||||||||||||||||||||||
| 48 | ); | ||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | 3 | ▶ | use constant NF_ETH_HDR_LEN => 14; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 51 | 3 | ▶ | use constant NF_ETH_ADDR_BROADCAST => 'ff:ff:ff:ff:ff:ff'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 52 | 3 | ▶ | use constant NF_ETH_TYPE_IPv4 => 0x0800; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 53 | 3 | ▶ | use constant NF_ETH_TYPE_X25 => 0x0805; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 54 | 3 | ▶ | use constant NF_ETH_TYPE_ARP => 0x0806; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 55 | 3 | ▶ | use constant NF_ETH_TYPE_CGMP => 0x2001; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 56 | 3 | ▶ | use constant NF_ETH_TYPE_80211 => 0x2452; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 57 | 3 | ▶ | use constant NF_ETH_TYPE_PPPIPCP => 0x8021; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 58 | 3 | ▶ | use constant NF_ETH_TYPE_RARP => 0x8035; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 59 | 3 | ▶ | use constant NF_ETH_TYPE_DDP => 0x809b; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 60 | 3 | ▶ | use constant NF_ETH_TYPE_AARP => 0x80f3; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 61 | 3 | ▶ | use constant NF_ETH_TYPE_PPPCCP => 0x80fd; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 62 | 3 | ▶ | use constant NF_ETH_TYPE_WCP => 0x80ff; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 63 | 3 | ▶ | use constant NF_ETH_TYPE_8021Q => 0x8100; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 64 | 3 | ▶ | use constant NF_ETH_TYPE_IPX => 0x8137; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 65 | 3 | ▶ | use constant NF_ETH_TYPE_STP => 0x8181; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 66 | 3 | ▶ | use constant NF_ETH_TYPE_IPv6 => 0x86dd; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 67 | 3 | ▶ | use constant NF_ETH_TYPE_WLCCP => 0x872d; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 68 | 3 | ▶ | use constant NF_ETH_TYPE_MPLS => 0x8847; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 69 | 3 | ▶ | use constant NF_ETH_TYPE_PPPoED => 0x8863; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 70 | 3 | ▶ | use constant NF_ETH_TYPE_PPPoES => 0x8864; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 71 | 3 | ▶ | use constant NF_ETH_TYPE_8021X => 0x888e; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 72 | 3 | ▶ | use constant NF_ETH_TYPE_AoE => 0x88a2; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 73 | 3 | ▶ | use constant NF_ETH_TYPE_80211I => 0x88c7; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 74 | 3 | ▶ | use constant NF_ETH_TYPE_LLDP => 0x88cc; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 75 | 3 | ▶ | use constant NF_ETH_TYPE_LLTD => 0x88d9; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 76 | 3 | ▶ | use constant NF_ETH_TYPE_LOOP => 0x9000; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 77 | 3 | ▶ | use constant NF_ETH_TYPE_VLAN => 0x9100; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 78 | 3 | ▶ | use constant NF_ETH_TYPE_PPPPAP => 0xc023; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 79 | 3 | ▶ | use constant NF_ETH_TYPE_PPPCHAP => 0xc223; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||
| 81 | 3 | our @AS = qw( | |||||||||||||||||||||||||||
| 82 | dst | ||||||||||||||||||||||||||||
| 83 | src | ||||||||||||||||||||||||||||
| 84 | type | ||||||||||||||||||||||||||||
| 85 | ); | ||||||||||||||||||||||||||||
| 86 | 3 | __PACKAGE__->cgBuildIndices; | |||||||||||||||||||||||||||
| 87 | 3 | __PACKAGE__->cgBuildAccessorsScalar(\@AS); | |||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||
| 89 | 3 | ▶ | BEGIN { | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 90 | 3 | *length = \&type; | |||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||
| 93 | 3 | ▶ | no strict 'vars'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||
| 95 | 1 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=3 SCAR=11.4
Pod
documented
| |||||||||||||||||||||||||||||
| 96 | 1 | my $self = shift->SUPER::new( | |||||||||||||||||||||||||||
| 97 | src => '00:00:00:00:00:00', | ||||||||||||||||||||||||||||
| 98 | dst => NF_ETH_ADDR_BROADCAST, | ||||||||||||||||||||||||||||
| 99 | type => NF_ETH_TYPE_IPv4, | ||||||||||||||||||||||||||||
| 100 | @_, | ||||||||||||||||||||||||||||
| 101 | ); | ||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||
| 103 | 1 | ▶ | $self->[$__src] = lc($self->[$__src]) if $self->[$__src]; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 104 | 1 | ▶ | $self->[$__dst] = lc($self->[$__dst]) if $self->[$__dst]; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||
| 106 | 1 | $self; | |||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||
| 109 | 0 | ▶ | sub getLength { NF_ETH_HDR_LEN } | ||||||||||||||||||||||||||
|
Subroutine
getLength: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||
| 111 | 1 | ▶ | sub pack { | ||||||||||||||||||||||||||
|
Subroutine
pack: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||
| 112 | 1 | my $self = shift; | |||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||
| 114 | 1 | (my $dst = $self->[$__dst]) =~ s/://g; | |||||||||||||||||||||||||||
| 115 | 1 | (my $src = $self->[$__src]) =~ s/://g; | |||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||
| 117 | 1 | ▶ | $self->[$__raw] = $self->SUPER::pack('H12H12n', $dst, $src, $self->[$__type]) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 118 | or return undef; | ||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||
| 120 | 1 | $self->[$__raw]; | |||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||
| 123 | 1 | ▶ | sub unpack { | ||||||||||||||||||||||||||
|
Subroutine
unpack: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||
| 124 | 1 | my $self = shift; | |||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||
| 126 | 1 | ▶ | my ($dst, $src, $type, $payload) = | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 127 | $self->SUPER::unpack('H12H12n a*', $self->[$__raw]) | ||||||||||||||||||||||||||||
| 128 | or return undef; | ||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||
| 130 | 1 | $self->[$__dst] = convertMac($dst); | |||||||||||||||||||||||||||
| 131 | 1 | $self->[$__src] = convertMac($src); | |||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||
| 133 | 1 | $self->[$__type] = $type; | |||||||||||||||||||||||||||
| 134 | 1 | $self->[$__payload] = $payload; | |||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||
| 136 | 1 | $self; | |||||||||||||||||||||||||||
| 137 | } | ||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||
| 139 | 0 | ▶ | sub computeLengths { | ||||||||||||||||||||||||||
|
Subroutine
computeLengths: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||
| 140 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 141 | 0 | my ($layers) = @_; | |||||||||||||||||||||||||||
| 142 | 0 | ▶ | if ($self->[$__type] <= 1500) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 143 | 0 | my $len = 0; | |||||||||||||||||||||||||||
| 144 | 0 | for my $l (@$layers) { | |||||||||||||||||||||||||||
| 145 | 0 | ▶ | next if $l->layer eq 'ETH'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 146 | # We do not use getLength(), because the layer may | ||||||||||||||||||||||||||||
| 147 | # have a fake length, due to fuzzing or stress | ||||||||||||||||||||||||||||
| 148 | # testing attempts from the user | ||||||||||||||||||||||||||||
| 149 | 0 | $len += CORE::length($l->pack), | |||||||||||||||||||||||||||
| 150 | } | ||||||||||||||||||||||||||||
| 151 | 0 | $self->type($len); | |||||||||||||||||||||||||||
| 152 | } | ||||||||||||||||||||||||||||
| 153 | 0 | return 1; | |||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||
| 156 | 3 | our $Next = { | |||||||||||||||||||||||||||
| 157 | NF_ETH_TYPE_IPv4() => 'IPv4', | ||||||||||||||||||||||||||||
| 158 | NF_ETH_TYPE_X25() => 'X25', | ||||||||||||||||||||||||||||
| 159 | NF_ETH_TYPE_ARP() => 'ARP', | ||||||||||||||||||||||||||||
| 160 | NF_ETH_TYPE_CGMP() => 'CGMP', | ||||||||||||||||||||||||||||
| 161 | NF_ETH_TYPE_80211() => '80211', | ||||||||||||||||||||||||||||
| 162 | NF_ETH_TYPE_PPPIPCP() => 'PPPIPCP', | ||||||||||||||||||||||||||||
| 163 | NF_ETH_TYPE_RARP() => 'RARP', | ||||||||||||||||||||||||||||
| 164 | NF_ETH_TYPE_DDP () => 'DDP', | ||||||||||||||||||||||||||||
| 165 | NF_ETH_TYPE_AARP() => 'AARP', | ||||||||||||||||||||||||||||
| 166 | NF_ETH_TYPE_PPPCCP() => 'PPPCCP', | ||||||||||||||||||||||||||||
| 167 | NF_ETH_TYPE_WCP() => 'WCP', | ||||||||||||||||||||||||||||
| 168 | NF_ETH_TYPE_8021Q() => '8021Q', | ||||||||||||||||||||||||||||
| 169 | NF_ETH_TYPE_IPX() => 'IPX', | ||||||||||||||||||||||||||||
| 170 | NF_ETH_TYPE_STP() => 'STP', | ||||||||||||||||||||||||||||
| 171 | NF_ETH_TYPE_IPv6() => 'IPv6', | ||||||||||||||||||||||||||||
| 172 | NF_ETH_TYPE_WLCCP() => 'WLCCP', | ||||||||||||||||||||||||||||
| 173 | NF_ETH_TYPE_MPLS() => 'MPLS', | ||||||||||||||||||||||||||||
| 174 | NF_ETH_TYPE_PPPoED() => 'PPPoED', | ||||||||||||||||||||||||||||
| 175 | NF_ETH_TYPE_PPPoES() => 'PPPoES', | ||||||||||||||||||||||||||||
| 176 | NF_ETH_TYPE_8021X() => '8021X', | ||||||||||||||||||||||||||||
| 177 | NF_ETH_TYPE_AoE() => 'AoE', | ||||||||||||||||||||||||||||
| 178 | NF_ETH_TYPE_80211I() => '80211I', | ||||||||||||||||||||||||||||
| 179 | NF_ETH_TYPE_LLDP() => 'LLDP', | ||||||||||||||||||||||||||||
| 180 | NF_ETH_TYPE_LLTD() => 'LLTD', | ||||||||||||||||||||||||||||
| 181 | NF_ETH_TYPE_LOOP() => 'LOOP', | ||||||||||||||||||||||||||||
| 182 | NF_ETH_TYPE_VLAN() => 'VLAN', | ||||||||||||||||||||||||||||
| 183 | NF_ETH_TYPE_PPPPAP() => 'PPPPAP', | ||||||||||||||||||||||||||||
| 184 | NF_ETH_TYPE_PPPCHAP() => 'PPPCHAP', | ||||||||||||||||||||||||||||
| 185 | }; | ||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||
| 187 | 1 | ▶ | sub encapsulate { | ||||||||||||||||||||||||||
|
Subroutine
encapsulate: called CC=6 SCAR=25.6
Pod
documented
| |||||||||||||||||||||||||||||
| 188 | 1 | my $self = shift; | |||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||
| 190 | 1 | ▶ | return $self->[$__nextLayer] if $self->[$__nextLayer]; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||
| 192 | # Is this a 802.3 layer ? | ||||||||||||||||||||||||||||
| 193 | 1 | ▶ | if ($self->[$__type] <= 1500 && $self->[$__payload]) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->[$__type] <= 1500 and $self->[$__payload]
MC/DC0%0/2
$self->[$__type] <= 1500 and $self->[$__payload]
$self->[$__type] <= 1500
$self->[$__payload]
Truth table33%1/3
A and B
A= $self->[$__type] <= 1500B= $self->[$__payload]
| |||||||||||||||||||||||||||||
| 194 | 0 | my $payload = CORE::unpack('H*', $self->[$__payload]); | |||||||||||||||||||||||||||
| 195 | # We consider this is a LLC layer if the payload is more than 6 bytes long | ||||||||||||||||||||||||||||
| 196 | 0 | ▶ | if (CORE::length($payload) > 6) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 197 | 0 | return 'LLC'; | |||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||
| 199 | 0 | return NF_LAYER_UNKNOWN; | |||||||||||||||||||||||||||
| 200 | } | ||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||
| 202 | 1 | ▶ | $Next->{$self->[$__type]} || NF_LAYER_UNKNOWN; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 203 | } | ||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||
| 205 | 1 | ▶ | sub print { | ||||||||||||||||||||||||||
|
Subroutine
print: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||
| 206 | 1 | my $self = shift; | |||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||
| 208 | 1 | my $l = $self->layer; | |||||||||||||||||||||||||||
| 209 | 1 | my $buf = sprintf "$l: dst:%s src:%s ", $self->[$__dst], $self->[$__src]; | |||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||
| 211 | 1 | ▶ | if ($self->[$__type] <= 1500) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 212 | 0 | $buf .= sprintf "length:%d", $self->[$__type]; | |||||||||||||||||||||||||||
| 213 | } | ||||||||||||||||||||||||||||
| 214 | else { | ||||||||||||||||||||||||||||
| 215 | 1 | $buf .= sprintf "type:0x%04x", $self->[$__type]; | |||||||||||||||||||||||||||
| 216 | } | ||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||
| 218 | 1 | $buf; | |||||||||||||||||||||||||||
| 219 | } | ||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||
| 221 | 3 | 1; | |||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||
| 223 | __END__ | ||||||||||||||||||||||||||||