line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Beekeeper::Worker::Extension::RemoteSession; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
1007
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
31
|
|
4
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
43
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.10'; |
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
5
|
use Exporter 'import'; |
|
1
|
|
|
|
|
11
|
|
|
1
|
|
|
|
|
573
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our @EXPORT = qw( |
11
|
|
|
|
|
|
|
bind_remote_session |
12
|
|
|
|
|
|
|
unbind_remote_session |
13
|
|
|
|
|
|
|
unbind_remote_address |
14
|
|
|
|
|
|
|
); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# Show errors from perspective of caller |
17
|
|
|
|
|
|
|
$Carp::Internal{(__PACKAGE__)}++; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub bind_remote_session { |
21
|
0
|
|
|
0
|
1
|
|
my ($self, %args) = @_; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
my $params = { |
24
|
|
|
|
|
|
|
address => $args{'address'}, |
25
|
|
|
|
|
|
|
caller_id => $self->{_CLIENT}->{caller_id}, |
26
|
|
|
|
|
|
|
caller_addr => $self->{_CLIENT}->{caller_addr}, |
27
|
|
|
|
|
|
|
auth_data => $self->{_CLIENT}->{auth_data}, |
28
|
0
|
|
|
|
|
|
}; |
29
|
|
|
|
|
|
|
|
30
|
0
|
|
|
|
|
|
my $guard = $self->__use_authorization_token('BKPR_ROUTER'); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
$self->call_remote( |
33
|
|
|
|
|
|
|
method => '_bkpr.router.bind', |
34
|
|
|
|
|
|
|
params => $params, |
35
|
0
|
|
|
|
|
|
timeout => $args{'timeout'}, |
36
|
|
|
|
|
|
|
); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub bind_remote_session_async { |
40
|
0
|
|
|
0
|
1
|
|
my ($self, %args) = @_; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
my $params = { |
43
|
|
|
|
|
|
|
address => $args{'address'}, |
44
|
|
|
|
|
|
|
caller_id => $self->{_CLIENT}->{caller_id}, |
45
|
|
|
|
|
|
|
caller_addr => $self->{_CLIENT}->{caller_addr}, |
46
|
|
|
|
|
|
|
auth_data => $self->{_CLIENT}->{auth_data}, |
47
|
0
|
|
|
|
|
|
}; |
48
|
|
|
|
|
|
|
|
49
|
0
|
|
|
|
|
|
my $guard = $self->__use_authorization_token('BKPR_ROUTER'); |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
$self->call_remote_async( |
52
|
|
|
|
|
|
|
method => '_bkpr.router.bind', |
53
|
|
|
|
|
|
|
params => $params, |
54
|
|
|
|
|
|
|
timeout => $args{'timeout'}, |
55
|
|
|
|
|
|
|
on_success => $args{'on_success'}, |
56
|
0
|
|
|
|
|
|
on_error => $args{'on_error'}, |
57
|
|
|
|
|
|
|
); |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub unbind_remote_session { |
61
|
0
|
|
|
0
|
1
|
|
my ($self, %args) = @_; |
62
|
|
|
|
|
|
|
|
63
|
0
|
|
|
|
|
|
my $params = { caller_id => $self->{_CLIENT}->{caller_id} }; |
64
|
|
|
|
|
|
|
|
65
|
0
|
|
|
|
|
|
my $guard = $self->__use_authorization_token('BKPR_ROUTER'); |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
$self->call_remote( |
68
|
|
|
|
|
|
|
method => '_bkpr.router.unbind', |
69
|
|
|
|
|
|
|
params => $params, |
70
|
0
|
|
|
|
|
|
timeout => $args{'timeout'}, |
71
|
|
|
|
|
|
|
); |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub unbind_remote_session_async { |
75
|
0
|
|
|
0
|
1
|
|
my ($self, %args) = @_; |
76
|
|
|
|
|
|
|
|
77
|
0
|
|
|
|
|
|
my $params = { caller_id => $self->{_CLIENT}->{caller_id} }; |
78
|
|
|
|
|
|
|
|
79
|
0
|
|
|
|
|
|
my $guard = $self->__use_authorization_token('BKPR_ROUTER'); |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
$self->call_remote_async( |
82
|
|
|
|
|
|
|
method => '_bkpr.router.unbind', |
83
|
|
|
|
|
|
|
params => $params, |
84
|
|
|
|
|
|
|
timeout => $args{'timeout'}, |
85
|
|
|
|
|
|
|
on_success => $args{'on_success'}, |
86
|
0
|
|
|
|
|
|
on_error => $args{'on_error'}, |
87
|
|
|
|
|
|
|
); |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
sub unbind_remote_address { |
91
|
0
|
|
|
0
|
1
|
|
my ($self, %args) = @_; |
92
|
|
|
|
|
|
|
|
93
|
0
|
|
|
|
|
|
my $params = { address => $args{'address'} }; |
94
|
|
|
|
|
|
|
|
95
|
0
|
|
|
|
|
|
my $guard = $self->__use_authorization_token('BKPR_ROUTER'); |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
$self->call_remote( |
98
|
|
|
|
|
|
|
method => '_bkpr.router.unbind', |
99
|
|
|
|
|
|
|
params => $params, |
100
|
0
|
|
|
|
|
|
timeout => $args{'timeout'}, |
101
|
|
|
|
|
|
|
); |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
sub unbind_remote_address_async { |
105
|
0
|
|
|
0
|
1
|
|
my ($self, %args) = @_; |
106
|
|
|
|
|
|
|
|
107
|
0
|
|
|
|
|
|
my $params = { address => $args{'address'} }; |
108
|
|
|
|
|
|
|
|
109
|
0
|
|
|
|
|
|
my $guard = $self->__use_authorization_token('BKPR_ROUTER'); |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
$self->call_remote_async( |
112
|
|
|
|
|
|
|
method => '_bkpr.router.unbind', |
113
|
|
|
|
|
|
|
params => $params, |
114
|
|
|
|
|
|
|
timeout => $args{'timeout'}, |
115
|
|
|
|
|
|
|
on_success => $args{'on_success'}, |
116
|
0
|
|
|
|
|
|
on_error => $args{'on_error'}, |
117
|
|
|
|
|
|
|
); |
118
|
|
|
|
|
|
|
} |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
1; |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
__END__ |