| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Protocol::BitTorrent::Message::Bitfield; |
|
2
|
|
|
|
|
|
|
{ |
|
3
|
|
|
|
|
|
|
$Protocol::BitTorrent::Message::Bitfield::VERSION = '0.004'; |
|
4
|
|
|
|
|
|
|
} |
|
5
|
1
|
|
|
1
|
|
4
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
30
|
|
|
6
|
1
|
|
|
1
|
|
4
|
use warnings FATAL => 'all', NONFATAL => 'redefine'; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
34
|
|
|
7
|
1
|
|
|
1
|
|
4
|
use parent qw(Protocol::BitTorrent::Message); |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
3
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 NAME |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
Protocol::BitTorrent::Message::Bitfield - bitfield support |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 VERSION |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
version 0.004 |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=cut |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 METHODS |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=cut |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head2 new |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=cut |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub new { |
|
28
|
1
|
|
|
1
|
1
|
3
|
my $class = shift; |
|
29
|
1
|
|
|
|
|
4
|
my %args = @_; |
|
30
|
1
|
|
|
|
|
5
|
my $self = bless { |
|
31
|
|
|
|
|
|
|
bitfield => $args{bitfield}, |
|
32
|
|
|
|
|
|
|
}, $class; |
|
33
|
1
|
|
|
|
|
8
|
$self; |
|
34
|
|
|
|
|
|
|
} |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub new_from_data { |
|
37
|
1
|
|
|
1
|
0
|
3
|
my $class = shift; |
|
38
|
1
|
|
|
|
|
2
|
my $data = shift; |
|
39
|
1
|
|
|
|
|
6
|
$class->new( |
|
40
|
|
|
|
|
|
|
bitfield => $data |
|
41
|
|
|
|
|
|
|
); |
|
42
|
|
|
|
|
|
|
} |
|
43
|
|
|
|
|
|
|
|
|
44
|
2
|
|
|
2
|
1
|
21
|
sub type { 'bitfield' } |
|
45
|
|
|
|
|
|
|
|
|
46
|
1
|
|
|
1
|
0
|
14
|
sub bitfield { shift->{bitfield} } |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub as_data { |
|
49
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
|
50
|
0
|
|
|
|
|
0
|
return pack 'N1C1a*', 1 + length($self->bitfield), $self->type_id, $self->bitfield; |
|
51
|
|
|
|
|
|
|
} |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub as_string { |
|
54
|
1
|
|
|
1
|
1
|
2
|
my $self = shift; |
|
55
|
1
|
|
|
|
|
5
|
return sprintf '%s, %d bytes, pieces %s', $self->type, $self->packet_length, unpack 'B*', $self->bitfield; |
|
56
|
|
|
|
|
|
|
} |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
1; |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
__END__ |