| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package POE::Component::IKC::Protocol; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
############################################################ |
|
4
|
|
|
|
|
|
|
# $Id$ |
|
5
|
|
|
|
|
|
|
# Copyright 2011-2014 Philip Gwyn. All rights reserved. |
|
6
|
|
|
|
|
|
|
# This program is free software; you can redistribute it and/or modify |
|
7
|
|
|
|
|
|
|
# it under the same terms as Perl itself. |
|
8
|
|
|
|
|
|
|
# |
|
9
|
|
|
|
|
|
|
# Contributed portions of IKC may be copyright by their respective |
|
10
|
|
|
|
|
|
|
# contributors. |
|
11
|
|
|
|
|
|
|
|
|
12
|
2
|
|
|
2
|
|
11
|
use strict; |
|
|
2
|
|
|
|
|
6
|
|
|
|
2
|
|
|
|
|
68
|
|
|
13
|
2
|
|
|
2
|
|
10
|
use Socket; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
2617
|
|
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub __build_setup |
|
17
|
|
|
|
|
|
|
{ |
|
18
|
0
|
|
|
0
|
|
|
my( $aliases, $freezers ) = @_; |
|
19
|
0
|
|
|
|
|
|
return 'SETUP '.join ';', 'KERNEL='.join( ',', @$aliases ), |
|
20
|
|
|
|
|
|
|
'FREEZER='.join( ',', @$freezers ), |
|
21
|
|
|
|
|
|
|
"PID=$$"; |
|
22
|
|
|
|
|
|
|
} |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub __neg_setup |
|
25
|
|
|
|
|
|
|
{ |
|
26
|
0
|
|
|
0
|
|
|
my( $setup ) = @_; |
|
27
|
0
|
|
|
|
|
|
my $neg = { |
|
28
|
|
|
|
|
|
|
kernel => [], |
|
29
|
|
|
|
|
|
|
freezer => [], |
|
30
|
|
|
|
|
|
|
bad => 0, |
|
31
|
|
|
|
|
|
|
pid => 0 |
|
32
|
|
|
|
|
|
|
}; |
|
33
|
0
|
|
|
|
|
|
foreach my $bit ( split ';', $1 ) { |
|
34
|
0
|
0
|
|
|
|
|
if( $bit =~ m/KERNEL=(.+)/ ) { |
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
35
|
0
|
|
|
|
|
|
push @{ $neg->{kernel} }, split ',', $1; |
|
|
0
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
} |
|
37
|
|
|
|
|
|
|
elsif( $bit =~ m/FREEZER=(.+)/ ) { |
|
38
|
0
|
|
|
|
|
|
push @{ $neg->{freezer} }, split ',', $1; |
|
|
0
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
} |
|
40
|
|
|
|
|
|
|
elsif( $bit =~ m/PID=(\d+)/ ) { |
|
41
|
|
|
|
|
|
|
# warn "pid=$1"; |
|
42
|
0
|
|
|
|
|
|
$neg->{pid} = $1; |
|
43
|
|
|
|
|
|
|
} |
|
44
|
|
|
|
|
|
|
else { |
|
45
|
0
|
|
|
|
|
|
warn "Server sent unknown setup '$bit' during negociation\n"; |
|
46
|
0
|
|
|
|
|
|
$neg->{bad}++; |
|
47
|
|
|
|
|
|
|
} |
|
48
|
|
|
|
|
|
|
} |
|
49
|
0
|
0
|
|
|
|
|
unless( @{ $neg->{kernel} } ) { |
|
|
0
|
|
|
|
|
|
|
|
50
|
0
|
|
|
|
|
|
warn "Server didn't send KERNEL in $setup\n"; |
|
51
|
0
|
|
|
|
|
|
$neg->{bad}++; |
|
52
|
|
|
|
|
|
|
} |
|
53
|
0
|
|
|
|
|
|
return $neg; |
|
54
|
|
|
|
|
|
|
} |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
1; |