line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package AnyEvent::Ident::Request; |
2
|
|
|
|
|
|
|
|
3
|
6
|
|
|
6
|
|
144903
|
use strict; |
|
6
|
|
|
|
|
33
|
|
|
6
|
|
|
|
|
193
|
|
4
|
6
|
|
|
6
|
|
65
|
use warnings; |
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
196
|
|
5
|
6
|
|
|
6
|
|
48
|
use Carp qw( croak ); |
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
2123
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
# ABSTRACT: Simple asynchronous ident response |
8
|
|
|
|
|
|
|
our $VERSION = '0.08'; # VERSION |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub new |
11
|
|
|
|
|
|
|
{ |
12
|
15
|
|
|
15
|
0
|
701
|
my $class = shift; |
13
|
15
|
|
|
|
|
36
|
my $self = bless {}, $class; |
14
|
15
|
100
|
|
|
|
56
|
if(@_ == 1) |
|
|
50
|
|
|
|
|
|
15
|
|
|
|
|
|
|
{ |
16
|
12
|
|
|
|
|
44
|
my $raw = $self->{raw} = shift; |
17
|
12
|
100
|
|
|
|
74
|
if($raw =~ /^\s*(\d+)\s*,\s*(\d+)\s*$/) |
18
|
|
|
|
|
|
|
{ |
19
|
10
|
100
|
33
|
|
|
342
|
croak "invalid port" if $1 == 0 || $2 == 0 |
|
|
|
66
|
|
|
|
|
|
|
|
100
|
|
|
|
|
20
|
|
|
|
|
|
|
|| $1 > 65535 || $2 > 65535; |
21
|
8
|
|
|
|
|
38
|
($self->{server_port}, $self->{client_port}) = ($1, $2); |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
else |
24
|
|
|
|
|
|
|
{ |
25
|
2
|
|
|
|
|
410
|
croak "bad request: $raw"; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
elsif(@_ == 2) |
29
|
|
|
|
|
|
|
{ |
30
|
3
|
|
|
|
|
22
|
$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
|
|
|
|
|
36
|
$self; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
40
|
17
|
|
|
17
|
1
|
1080
|
sub server_port { shift->{server_port} } |
41
|
14
|
|
|
14
|
1
|
66
|
sub client_port { shift->{client_port} } |
42
|
2
|
|
|
2
|
1
|
12
|
sub as_string { shift->{raw} } |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
1; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
__END__ |