line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package AnyEvent::Ident::Request; |
2
|
|
|
|
|
|
|
|
3
|
6
|
|
|
6
|
|
46217
|
use strict; |
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
261
|
|
4
|
6
|
|
|
6
|
|
33
|
use warnings; |
|
6
|
|
|
|
|
10
|
|
|
6
|
|
|
|
|
206
|
|
5
|
6
|
|
|
6
|
|
35
|
use Carp qw( croak ); |
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
2209
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
# ABSTRACT: Simple asynchronous ident response |
8
|
|
|
|
|
|
|
our $VERSION = '0.06'; # VERSION |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub new |
11
|
|
|
|
|
|
|
{ |
12
|
15
|
|
|
15
|
0
|
865
|
my $class = shift; |
13
|
15
|
|
|
|
|
53
|
my $self = bless {}, $class; |
14
|
15
|
100
|
|
|
|
53
|
if(@_ == 1) |
|
|
50
|
|
|
|
|
|
15
|
|
|
|
|
|
|
{ |
16
|
12
|
|
|
|
|
53
|
my $raw = $self->{raw} = shift; |
17
|
12
|
100
|
|
|
|
72
|
if($raw =~ /^\s*(\d+)\s*,\s*(\d+)\s*$/) |
18
|
|
|
|
|
|
|
{ |
19
|
10
|
100
|
33
|
|
|
477
|
croak "invalid port" if $1 == 0 || $2 == 0 |
|
|
|
66
|
|
|
|
|
|
|
|
100
|
|
|
|
|
20
|
|
|
|
|
|
|
|| $1 > 65535 || $2 > 65535; |
21
|
8
|
|
|
|
|
43
|
($self->{server_port}, $self->{client_port}) = ($1, $2); |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
else |
24
|
|
|
|
|
|
|
{ |
25
|
2
|
|
|
|
|
402
|
croak "bad request: $raw"; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
elsif(@_ == 2) |
29
|
|
|
|
|
|
|
{ |
30
|
3
|
|
|
|
|
17
|
$self->{raw} = join(',', ($self->{server_port}, $self->{client_port}) = @_); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
else |
33
|
|
|
|
|
|
|
{ |
34
|
0
|
|
|
|
|
0
|
croak 'usage: AnyEvent::Ident::Request->new( [ $raw | $server_port, $client_port ] )'; |
35
|
|
|
|
|
|
|
} |
36
|
11
|
|
|
|
|
104
|
$self; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
40
|
17
|
|
|
17
|
1
|
724
|
sub server_port { shift->{server_port} } |
41
|
14
|
|
|
14
|
1
|
124
|
sub client_port { shift->{client_port} } |
42
|
2
|
|
|
2
|
1
|
7
|
sub as_string { shift->{raw} } |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
1; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
__END__ |