| 1 | package POE::Component::Server::IRC::Backend; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | BEGIN { | ||||||||||||||||||||||||||||||||||||||||||
| 3 | 21 | ▶ | $POE::Component::Server::IRC::Backend::AUTHORITY = 'cpan:HINRIK'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | } | ||||||||||||||||||||||||||||||||||||||||||
| 5 | { | ||||||||||||||||||||||||||||||||||||||||||
| 6 | 21 | $POE::Component::Server::IRC::Backend::VERSION = '1.54'; | |||||||||||||||||||||||||||||||||||||||||
| 7 | } | ||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||
| 9 | 21 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | 21 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | 21 | ▶ | use Carp qw(croak); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 12 | 21 | ▶ | use List::Util qw(first); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 13 | 21 | use POE qw(Wheel::SocketFactory Wheel::ReadWrite Filter::Stackable | |||||||||||||||||||||||||||||||||||||||||
| 14 | 21 | ▶ | Filter::Line Filter::IRCD); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 15 | 21 | ▶ | use Net::Netmask; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 16 | 21 | ▶ | use Socket qw(unpack_sockaddr_in inet_ntoa); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 17 | 21 | ▶ | use base qw(POE::Component::Syndicator); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||
| 19 | use constant { | ||||||||||||||||||||||||||||||||||||||||||
| 20 | 21 | OBJECT_STATES_HASHREF => { | |||||||||||||||||||||||||||||||||||||||||
| 21 | syndicator_started => '_start', | ||||||||||||||||||||||||||||||||||||||||||
| 22 | add_connector => '_add_connector', | ||||||||||||||||||||||||||||||||||||||||||
| 23 | add_listener => '_add_listener', | ||||||||||||||||||||||||||||||||||||||||||
| 24 | del_listener => '_del_listener', | ||||||||||||||||||||||||||||||||||||||||||
| 25 | send_output => '_send_output', | ||||||||||||||||||||||||||||||||||||||||||
| 26 | shutdown => '_shutdown', | ||||||||||||||||||||||||||||||||||||||||||
| 27 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 28 | OBJECT_STATES_ARRAYREF => [qw( | ||||||||||||||||||||||||||||||||||||||||||
| 29 | _accept_connection | ||||||||||||||||||||||||||||||||||||||||||
| 30 | _accept_failed | ||||||||||||||||||||||||||||||||||||||||||
| 31 | _conn_alarm | ||||||||||||||||||||||||||||||||||||||||||
| 32 | _conn_input | ||||||||||||||||||||||||||||||||||||||||||
| 33 | _conn_error | ||||||||||||||||||||||||||||||||||||||||||
| 34 | _conn_flushed | ||||||||||||||||||||||||||||||||||||||||||
| 35 | _event_dispatcher | ||||||||||||||||||||||||||||||||||||||||||
| 36 | _sock_failed | ||||||||||||||||||||||||||||||||||||||||||
| 37 | _sock_up | ||||||||||||||||||||||||||||||||||||||||||
| 38 | )], | ||||||||||||||||||||||||||||||||||||||||||
| 39 | 21 | ▶ | }; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||
| 41 | sub create { | ||||||||||||||||||||||||||||||||||||||||||
| 42 | 22 | ▶ | my $package = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
create: called CC=17 SCAR=30.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 43 | 22 | ▶ | croak("$package requires an even number of parameters") if @_ & 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 44 | 22 | my %args = @_; | |||||||||||||||||||||||||||||||||||||||||
| 45 | 22 | $args{ lc $_ } = delete $args{$_} for keys %args; | |||||||||||||||||||||||||||||||||||||||||
| 46 | 22 | my $self = bless { }, $package; | |||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||
| 48 | 22 | ▶ | $self->{raw_events} = $args{raw_events} if defined $args{raw_events}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 49 | $self->{prefix} = defined $args{prefix} | ||||||||||||||||||||||||||||||||||||||||||
| 50 | ? $args{prefix} | ||||||||||||||||||||||||||||||||||||||||||
| 51 | 22 | ▶ | : 'ircd_'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 52 | $self->{antiflood} = defined $args{antiflood} | ||||||||||||||||||||||||||||||||||||||||||
| 53 | ? $args{antiflood} | ||||||||||||||||||||||||||||||||||||||||||
| 54 | 22 | ▶ | : 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||
| 56 | $self->{auth} = defined $args{auth} | ||||||||||||||||||||||||||||||||||||||||||
| 57 | ? $args{auth} | ||||||||||||||||||||||||||||||||||||||||||
| 58 | 22 | ▶ | : 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||
| 60 | 22 | ▶ | if ($args{sslify_options} && ref $args{sslify_options} eq 'ARRAY') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$args{"sslify_options"} and ref $args{"sslify_options"} eq "ARRAY"
MC/DC50%1/2
$args{"sslify_options"} and ref $args{"sslify_options"} eq "ARRAY"
$args{"sslify_options"}
ref $args{"sslify_options"} eq "ARRAY"
Truth table66%2/3
A and B
A= $args{"sslify_options"}B= ref $args{"sslify_options"} eq "ARRAY"
| |||||||||||||||||||||||||||||||||||||||||||
| 61 | 1 | eval { | |||||||||||||||||||||||||||||||||||||||||
| 62 | 1 | require POE::Component::SSLify; | |||||||||||||||||||||||||||||||||||||||||
| 63 | 1 | POE::Component::SSLify->import( | |||||||||||||||||||||||||||||||||||||||||
| 64 | qw(SSLify_Options Server_SSLify Client_SSLify) | ||||||||||||||||||||||||||||||||||||||||||
| 65 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 66 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 67 | 1 | chomp $@; | |||||||||||||||||||||||||||||||||||||||||
| 68 | 1 | ▶ | croak("Can't use ssl: $@") if $@; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||
| 70 | 1 | eval { SSLify_Options(@{ $args{sslify_options} }); }; | |||||||||||||||||||||||||||||||||||||||||
| 71 | 1 | chomp $@; | |||||||||||||||||||||||||||||||||||||||||
| 72 | 1 | ▶ | croak("Can't use ssl: $@") if $@; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | $self->{got_ssl} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||
| 76 | 21 | ▶ | if ($args{states}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 77 | 20 | my $error = $self->_validate_states($args{states}); | |||||||||||||||||||||||||||||||||||||||||
| 78 | 20 | ▶ | croak($error) if defined $error; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||
| 81 | $self->_syndicator_init( | ||||||||||||||||||||||||||||||||||||||||||
| 82 | prefix => $self->{prefix}, | ||||||||||||||||||||||||||||||||||||||||||
| 83 | reg_prefix => 'PCSI_', | ||||||||||||||||||||||||||||||||||||||||||
| 84 | types => [ SERVER => 'IRCD', USER => 'U' ], | ||||||||||||||||||||||||||||||||||||||||||
| 85 | object_states => [ | ||||||||||||||||||||||||||||||||||||||||||
| 86 | $self => OBJECT_STATES_HASHREF, | ||||||||||||||||||||||||||||||||||||||||||
| 87 | $self => OBJECT_STATES_ARRAYREF, | ||||||||||||||||||||||||||||||||||||||||||
| 88 | ($args{states} | ||||||||||||||||||||||||||||||||||||||||||
| 89 | 40 | ▶ | ? map { $self => $_ } @{ $args{states} } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 90 | : () | ||||||||||||||||||||||||||||||||||||||||||
| 91 | ), | ||||||||||||||||||||||||||||||||||||||||||
| 92 | ], | ||||||||||||||||||||||||||||||||||||||||||
| 93 | ($args{plugin_debug} ? (debug => 1) : () ), | ||||||||||||||||||||||||||||||||||||||||||
| 94 | 21 | ▶ | (ref $args{options} eq 'HASH' ? (options => $args{options}) : ()), | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 95 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||
| 97 | 21 | ▶ | if ($self->{auth}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 98 | 0 | require POE::Component::Server::IRC::Plugin::Auth; | |||||||||||||||||||||||||||||||||||||||||
| 99 | 0 | $self->plugin_add( | |||||||||||||||||||||||||||||||||||||||||
| 100 | 'Auth_'.$self->session_id(), | ||||||||||||||||||||||||||||||||||||||||||
| 101 | POE::Component::Server::IRC::Plugin::Auth->new(), | ||||||||||||||||||||||||||||||||||||||||||
| 102 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 103 | } | ||||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||
| 105 | 21 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||
| 108 | sub _validate_states { | ||||||||||||||||||||||||||||||||||||||||||
| 109 | 20 | ▶ | my ($self, $states) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_validate_states: called CC=10 SCAR=25.9
| |||||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||
| 111 | 20 | for my $events (@$states) { | |||||||||||||||||||||||||||||||||||||||||
| 112 | 40 | ▶ | if (ref $events eq 'HASH') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 113 | 20 | for my $event (keys %$events) { | |||||||||||||||||||||||||||||||||||||||||
| 114 | 300 | ▶ | if (OBJECT_STATES_HASHREF->{$event} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
{"add_connector" => "_add_connector","add_listener" => "_add_listener","del_listener" => "_del_listener","send_output" => "_send_output","shutdown" => "_shutdown","syndicator_started" => "_start"}->{$event} or &first(sub {
$event eq $_;
}
, @{["_accept_connection","_accept_failed","_conn_alarm","_conn_input","_conn_error","_conn_flushed","_event_dispatcher","_sock_failed","_sock_up"];})
MC/DC0%0/2
{"add_connector" => "_add_connector","add_listener" => "_add_listener","del_listener" => "_del_listener","send_output" => "_send_output","shutdown" => "_shutdown","syndicator_started" => "_start"}->{$event} or &first(sub {
$event eq $_;
}
, @{["_accept_connection","_accept_failed","_conn_alarm","_conn_input","_conn_error","_conn_flushed","_event_dispatcher","_sock_failed","_sock_up"];})
{"add_connector" => "_add_connector","add_listener" => "_add_listener","del_listener" => "_del_listener","send_output" => "_send_output","shutdown" => "_shutdown","syndicator_started" => "_start"}->{$event}
&first(sub {
$event eq $_;
}
, @{["_accept_connection","_accept_failed","_conn_alarm","_conn_input","_conn_error","_conn_flushed","_event_dispatcher","_sock_failed","_sock_up"];})
Truth table33%1/3
A or B
A= {"add_connector" => "_add_connector","add_listener" => "_add_listener","del_listener" => "_del_listener","send_output" => "_send_output","shutdown" => "_shutdown","syndicator_started" => "_start"}->{$event}B= &first(sub {
$event eq $_;
}
, @{["_accept_connection","_accept_failed","_conn_alarm","_conn_input","_conn_error","_conn_flushed","_event_dispatcher","_sock_failed","_sock_up"];})
| |||||||||||||||||||||||||||||||||||||||||||
| 115 | 300 | ▶ | || first { $event eq $_ } @{ +OBJECT_STATES_ARRAYREF }) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | return "Event $event is reserved by ". __PACKAGE__; | |||||||||||||||||||||||||||||||||||||||||
| 117 | } | ||||||||||||||||||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||||||||||||||||
| 119 | } | ||||||||||||||||||||||||||||||||||||||||||
| 120 | elsif (ref $events eq 'ARRAY') { | ||||||||||||||||||||||||||||||||||||||||||
| 121 | 20 | for my $event (@$events) { | |||||||||||||||||||||||||||||||||||||||||
| 122 | 40 | ▶ | if (OBJECT_STATES_HASHREF->{$event} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
{"add_connector" => "_add_connector","add_listener" => "_add_listener","del_listener" => "_del_listener","send_output" => "_send_output","shutdown" => "_shutdown","syndicator_started" => "_start"}->{$event} or &first(sub {
$event eq $_;
}
, @{["_accept_connection","_accept_failed","_conn_alarm","_conn_input","_conn_error","_conn_flushed","_event_dispatcher","_sock_failed","_sock_up"];})
MC/DC0%0/2
{"add_connector" => "_add_connector","add_listener" => "_add_listener","del_listener" => "_del_listener","send_output" => "_send_output","shutdown" => "_shutdown","syndicator_started" => "_start"}->{$event} or &first(sub {
$event eq $_;
}
, @{["_accept_connection","_accept_failed","_conn_alarm","_conn_input","_conn_error","_conn_flushed","_event_dispatcher","_sock_failed","_sock_up"];})
{"add_connector" => "_add_connector","add_listener" => "_add_listener","del_listener" => "_del_listener","send_output" => "_send_output","shutdown" => "_shutdown","syndicator_started" => "_start"}->{$event}
&first(sub {
$event eq $_;
}
, @{["_accept_connection","_accept_failed","_conn_alarm","_conn_input","_conn_error","_conn_flushed","_event_dispatcher","_sock_failed","_sock_up"];})
Truth table33%1/3
A or B
A= {"add_connector" => "_add_connector","add_listener" => "_add_listener","del_listener" => "_del_listener","send_output" => "_send_output","shutdown" => "_shutdown","syndicator_started" => "_start"}->{$event}B= &first(sub {
$event eq $_;
}
, @{["_accept_connection","_accept_failed","_conn_alarm","_conn_input","_conn_error","_conn_flushed","_event_dispatcher","_sock_failed","_sock_up"];})
| |||||||||||||||||||||||||||||||||||||||||||
| 123 | 40 | ▶ | || first { $event eq $_ } @{ +OBJECT_STATES_ARRAYREF }) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | return "Event $event is reserved by ". __PACKAGE__; | |||||||||||||||||||||||||||||||||||||||||
| 125 | } | ||||||||||||||||||||||||||||||||||||||||||
| 126 | } | ||||||||||||||||||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||
| 130 | 20 | return; | |||||||||||||||||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||
| 133 | sub _start { | ||||||||||||||||||||||||||||||||||||||||||
| 134 | 21 | ▶ | my ($kernel, $self, $sender) = @_[KERNEL, OBJECT, SENDER]; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_start: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||
| 136 | 21 | $self->{ircd_filter} = POE::Filter::IRCD->new( | |||||||||||||||||||||||||||||||||||||||||
| 137 | colonify => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 138 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 139 | 21 | $self->{line_filter} = POE::Filter::Line->new( | |||||||||||||||||||||||||||||||||||||||||
| 140 | InputRegexp => '\015?\012', | ||||||||||||||||||||||||||||||||||||||||||
| 141 | OutputLiteral => "\015\012", | ||||||||||||||||||||||||||||||||||||||||||
| 142 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 143 | $self->{filter} = POE::Filter::Stackable->new( | ||||||||||||||||||||||||||||||||||||||||||
| 144 | 21 | Filters => [$self->{line_filter}, $self->{ircd_filter}], | |||||||||||||||||||||||||||||||||||||||||
| 145 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||||||||||
| 147 | 21 | return; | |||||||||||||||||||||||||||||||||||||||||
| 148 | } | ||||||||||||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||||||||||||
| 150 | sub raw_events { | ||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | ▶ | my ($self, $value) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
raw_events: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | ▶ | $self->{raw_events} = 1 if $value; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||
| 156 | sub shutdown { | ||||||||||||||||||||||||||||||||||||||||||
| 157 | 1 | ▶ | my ($self) = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
shutdown: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 158 | 1 | $self->yield('shutdown', @_); | |||||||||||||||||||||||||||||||||||||||||
| 159 | 1 | return; | |||||||||||||||||||||||||||||||||||||||||
| 160 | } | ||||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||
| 162 | sub _shutdown { | ||||||||||||||||||||||||||||||||||||||||||
| 163 | 22 | ▶ | my ($kernel, $self) = @_[KERNEL, OBJECT]; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_shutdown: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||
| 165 | 22 | $self->{terminating} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 166 | 22 | delete $self->{listeners}; | |||||||||||||||||||||||||||||||||||||||||
| 167 | 22 | delete $self->{connectors}; | |||||||||||||||||||||||||||||||||||||||||
| 168 | 22 | delete $self->{wheels}; | |||||||||||||||||||||||||||||||||||||||||
| 169 | 22 | $self->_syndicator_destroy(); | |||||||||||||||||||||||||||||||||||||||||
| 170 | 22 | return; | |||||||||||||||||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||||||||
| 173 | sub _accept_failed { | ||||||||||||||||||||||||||||||||||||||||||
| 174 | 0 | ▶ | my ($kernel, $self, $operation, $errnum, $errstr, $listener_id) | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_accept_failed: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 175 | = @_[KERNEL, OBJECT, ARG0..ARG3]; | ||||||||||||||||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | my $port = $self->{listeners}{$listener_id}{port}; | |||||||||||||||||||||||||||||||||||||||||
| 178 | 0 | my $addr = $self->{listeners}{$listener_id}{addr}; | |||||||||||||||||||||||||||||||||||||||||
| 179 | 0 | delete $self->{listeners}{$listener_id}; | |||||||||||||||||||||||||||||||||||||||||
| 180 | 0 | $self->send_event( | |||||||||||||||||||||||||||||||||||||||||
| 181 | "$self->{prefix}listener_failure", | ||||||||||||||||||||||||||||||||||||||||||
| 182 | $listener_id, | ||||||||||||||||||||||||||||||||||||||||||
| 183 | $operation, | ||||||||||||||||||||||||||||||||||||||||||
| 184 | $errnum, | ||||||||||||||||||||||||||||||||||||||||||
| 185 | $errstr, | ||||||||||||||||||||||||||||||||||||||||||
| 186 | $port, | ||||||||||||||||||||||||||||||||||||||||||
| 187 | $addr, | ||||||||||||||||||||||||||||||||||||||||||
| 188 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||
| 192 | sub _accept_connection { | ||||||||||||||||||||||||||||||||||||||||||
| 193 | 22 | ▶ | my ($kernel, $self, $socket, $peeraddr, $peerport, $listener_id) | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_accept_connection: called CC=8 SCAR=24.7
| |||||||||||||||||||||||||||||||||||||||||||
| 194 | = @_[KERNEL, OBJECT, ARG0..ARG3]; | ||||||||||||||||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||||||||||||||||
| 196 | 22 | my $sockaddr = inet_ntoa((unpack_sockaddr_in(getsockname $socket))[1]); | |||||||||||||||||||||||||||||||||||||||||
| 197 | 22 | my $sockport = (unpack_sockaddr_in(getsockname $socket))[0]; | |||||||||||||||||||||||||||||||||||||||||
| 198 | 22 | $peeraddr = inet_ntoa($peeraddr); | |||||||||||||||||||||||||||||||||||||||||
| 199 | 22 | my $listener = $self->{listeners}{$listener_id}; | |||||||||||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||||||||||||
| 201 | 22 | ▶ | if ($self->{got_ssl} && $listener->{usessl}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->{"got_ssl"} and $listener->{"usessl"}
MC/DC0%0/2
$self->{"got_ssl"} and $listener->{"usessl"}
$self->{"got_ssl"}
$listener->{"usessl"}
Truth table33%1/3
A and B
A= $self->{"got_ssl"}B= $listener->{"usessl"}
| |||||||||||||||||||||||||||||||||||||||||||
| 202 | 0 | eval { | |||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | $socket = POE::Component::SSLify::Server_SSLify($socket); | |||||||||||||||||||||||||||||||||||||||||
| 204 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 205 | 0 | chomp $@; | |||||||||||||||||||||||||||||||||||||||||
| 206 | 0 | ▶ | die "Failed to SSLify server socket: $@" if $@; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 207 | } | ||||||||||||||||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||||||||||||||||
| 209 | 22 | ▶ | return if $self->denied($peeraddr); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||||||||||||
| 211 | my $wheel = POE::Wheel::ReadWrite->new( | ||||||||||||||||||||||||||||||||||||||||||
| 212 | Handle => $socket, | ||||||||||||||||||||||||||||||||||||||||||
| 213 | Filter => $self->{filter}, | ||||||||||||||||||||||||||||||||||||||||||
| 214 | 22 | InputEvent => '_conn_input', | |||||||||||||||||||||||||||||||||||||||||
| 215 | ErrorEvent => '_conn_error', | ||||||||||||||||||||||||||||||||||||||||||
| 216 | FlushedEvent => '_conn_flushed', | ||||||||||||||||||||||||||||||||||||||||||
| 217 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||||||||||||||||
| 219 | 22 | ▶ | if ($wheel) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 220 | 22 | my $wheel_id = $wheel->ID(); | |||||||||||||||||||||||||||||||||||||||||
| 221 | my $ref = { | ||||||||||||||||||||||||||||||||||||||||||
| 222 | wheel => $wheel, | ||||||||||||||||||||||||||||||||||||||||||
| 223 | peeraddr => $peeraddr, | ||||||||||||||||||||||||||||||||||||||||||
| 224 | peerport => $peerport, | ||||||||||||||||||||||||||||||||||||||||||
| 225 | flooded => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 226 | sockaddr => $sockaddr, | ||||||||||||||||||||||||||||||||||||||||||
| 227 | sockport => $sockport, | ||||||||||||||||||||||||||||||||||||||||||
| 228 | idle => time(), | ||||||||||||||||||||||||||||||||||||||||||
| 229 | antiflood => $listener->{antiflood}, | ||||||||||||||||||||||||||||||||||||||||||
| 230 | 22 | compress => 0 | |||||||||||||||||||||||||||||||||||||||||
| 231 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||||||||||||
| 233 | 22 | ▶ | my $needs_auth = $listener->{auth} && $self->{auth} ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$listener->{"auth"} and $self->{"auth"}
MC/DC0%0/2
$listener->{"auth"} and $self->{"auth"}
$listener->{"auth"}
$self->{"auth"}
Truth table33%1/3
A and B
A= $listener->{"auth"}B= $self->{"auth"}
| |||||||||||||||||||||||||||||||||||||||||||
| 234 | 22 | $self->send_event( | |||||||||||||||||||||||||||||||||||||||||
| 235 | "$self->{prefix}connection", | ||||||||||||||||||||||||||||||||||||||||||
| 236 | $wheel_id, | ||||||||||||||||||||||||||||||||||||||||||
| 237 | $peeraddr, | ||||||||||||||||||||||||||||||||||||||||||
| 238 | $peerport, | ||||||||||||||||||||||||||||||||||||||||||
| 239 | $sockaddr, | ||||||||||||||||||||||||||||||||||||||||||
| 240 | $sockport, | ||||||||||||||||||||||||||||||||||||||||||
| 241 | $needs_auth, | ||||||||||||||||||||||||||||||||||||||||||
| 242 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||||||||||
| 244 | $ref->{alarm} = $kernel->delay_set( | ||||||||||||||||||||||||||||||||||||||||||
| 245 | '_conn_alarm', | ||||||||||||||||||||||||||||||||||||||||||
| 246 | $listener->{idle}, | ||||||||||||||||||||||||||||||||||||||||||
| 247 | 22 | $wheel_id, | |||||||||||||||||||||||||||||||||||||||||
| 248 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 249 | 22 | $self->{wheels}{$wheel_id} = $ref; | |||||||||||||||||||||||||||||||||||||||||
| 250 | } | ||||||||||||||||||||||||||||||||||||||||||
| 251 | 22 | return; | |||||||||||||||||||||||||||||||||||||||||
| 252 | } | ||||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||
| 254 | sub add_listener { | ||||||||||||||||||||||||||||||||||||||||||
| 255 | 13 | ▶ | my ($self) = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_listener: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 256 | 13 | ▶ | croak('add_listener requires an even number of parameters') if @_ & 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 257 | 13 | $self->yield('add_listener', @_); | |||||||||||||||||||||||||||||||||||||||||
| 258 | 13 | return; | |||||||||||||||||||||||||||||||||||||||||
| 259 | } | ||||||||||||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||||||||||||
| 261 | sub _add_listener { | ||||||||||||||||||||||||||||||||||||||||||
| 262 | 17 | ▶ | my ($kernel, $self) = @_[KERNEL, OBJECT]; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_add_listener: called CC=12 SCAR=26.6
| |||||||||||||||||||||||||||||||||||||||||||
| 263 | 17 | my %args = @_[ARG0..$#_]; | |||||||||||||||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||||||||||||||||
| 265 | 17 | $args{ lc($_) } = delete $args{$_} for keys %args; | |||||||||||||||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||||||||||||||||
| 267 | 17 | ▶ | my $bindaddr = $args{bindaddr} || '0.0.0.0'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$args{'bindaddr'} || '0.0.0.0'
MC/DC0%0/1
$args{'bindaddr'} || '0.0.0.0'
$args{'bindaddr'}
Truth table50%1/2
A
A= $args{'bindaddr'}
| |||||||||||||||||||||||||||||||||||||||||||
| 268 | 17 | ▶ | my $bindport = $args{port} || 0; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$args{'port'} || 0
MC/DC0%0/1
$args{'port'} || 0
$args{'port'}
Truth table50%1/2
A
A= $args{'port'}
| |||||||||||||||||||||||||||||||||||||||||||
| 269 | 17 | ▶ | my $idle = $args{idle} || 180; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$args{'idle'} || 180
MC/DC0%0/1
$args{'idle'} || 180
$args{'idle'}
Truth table50%1/2
A
A= $args{'idle'}
| |||||||||||||||||||||||||||||||||||||||||||
| 270 | 17 | my $auth = 1; | |||||||||||||||||||||||||||||||||||||||||
| 271 | 17 | my $antiflood = 1; | |||||||||||||||||||||||||||||||||||||||||
| 272 | 17 | my $usessl = 0; | |||||||||||||||||||||||||||||||||||||||||
| 273 | 17 | ▶ | $usessl = 1 if $args{usessl}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 274 | 17 | ▶ | $auth = 0 if defined $args{auth} && $args{auth} eq '0'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $args{"auth"} and $args{"auth"} eq 0
MC/DC0%0/2
defined $args{"auth"} and $args{"auth"} eq 0
defined $args{"auth"}
$args{"auth"} eq 0
Truth table33%1/3
A and B
A= defined $args{"auth"}B= $args{"auth"} eq 0
| |||||||||||||||||||||||||||||||||||||||||||
| 275 | 17 | ▶ | $antiflood = 0 if defined $args{antiflood} && $args{antiflood} eq '0'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $args{"antiflood"} and $args{"antiflood"} eq 0
MC/DC0%0/2
defined $args{"antiflood"} and $args{"antiflood"} eq 0
defined $args{"antiflood"}
$args{"antiflood"} eq 0
Truth table33%1/3
A and B
A= defined $args{"antiflood"}B= $args{"antiflood"} eq 0
| |||||||||||||||||||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||||||||||||||||
| 277 | my $listener = POE::Wheel::SocketFactory->new( | ||||||||||||||||||||||||||||||||||||||||||
| 278 | BindAddress => $bindaddr, | ||||||||||||||||||||||||||||||||||||||||||
| 279 | BindPort => $bindport, | ||||||||||||||||||||||||||||||||||||||||||
| 280 | SuccessEvent => '_accept_connection', | ||||||||||||||||||||||||||||||||||||||||||
| 281 | FailureEvent => '_accept_failed', | ||||||||||||||||||||||||||||||||||||||||||
| 282 | Reuse => 'on', | ||||||||||||||||||||||||||||||||||||||||||
| 283 | 17 | ▶ | ($args{listenqueue} ? (ListenQueue => $args{listenqueue}) : ()), | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 284 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 285 | |||||||||||||||||||||||||||||||||||||||||||
| 286 | 17 | my $id = $listener->ID(); | |||||||||||||||||||||||||||||||||||||||||
| 287 | 17 | $self->{listeners}{$id}{wheel} = $listener; | |||||||||||||||||||||||||||||||||||||||||
| 288 | 17 | $self->{listeners}{$id}{port} = $bindport; | |||||||||||||||||||||||||||||||||||||||||
| 289 | 17 | $self->{listeners}{$id}{addr} = $bindaddr; | |||||||||||||||||||||||||||||||||||||||||
| 290 | 17 | $self->{listeners}{$id}{idle} = $idle; | |||||||||||||||||||||||||||||||||||||||||
| 291 | 17 | $self->{listeners}{$id}{auth} = $auth; | |||||||||||||||||||||||||||||||||||||||||
| 292 | 17 | $self->{listeners}{$id}{antiflood} = $antiflood; | |||||||||||||||||||||||||||||||||||||||||
| 293 | 17 | $self->{listeners}{$id}{usessl} = $usessl; | |||||||||||||||||||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||||||||||||||||||
| 295 | 17 | my ($port, $addr) = unpack_sockaddr_in($listener->getsockname); | |||||||||||||||||||||||||||||||||||||||||
| 296 | 17 | ▶ | if ($port) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 297 | 17 | $self->{listeners}{$id}{port} = $port; | |||||||||||||||||||||||||||||||||||||||||
| 298 | $self->send_event( | ||||||||||||||||||||||||||||||||||||||||||
| 299 | 17 | $self->{prefix} . 'listener_add', | |||||||||||||||||||||||||||||||||||||||||
| 300 | $port, | ||||||||||||||||||||||||||||||||||||||||||
| 301 | $id, | ||||||||||||||||||||||||||||||||||||||||||
| 302 | $bindaddr, | ||||||||||||||||||||||||||||||||||||||||||
| 303 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 304 | } | ||||||||||||||||||||||||||||||||||||||||||
| 305 | 17 | return; | |||||||||||||||||||||||||||||||||||||||||
| 306 | } | ||||||||||||||||||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||||||||||||||||
| 308 | sub del_listener { | ||||||||||||||||||||||||||||||||||||||||||
| 309 | 7 | ▶ | my ($self) = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
del_listener: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 310 | 7 | ▶ | croak("add_listener requires an even number of parameters") if @_ & 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 311 | 7 | $self->yield('del_listener', @_); | |||||||||||||||||||||||||||||||||||||||||
| 312 | 7 | return; | |||||||||||||||||||||||||||||||||||||||||
| 313 | } | ||||||||||||||||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||||||||||||||||
| 315 | sub _del_listener { | ||||||||||||||||||||||||||||||||||||||||||
| 316 | 7 | ▶ | my ($kernel, $self) = @_[KERNEL, OBJECT]; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_del_listener: called CC=6 SCAR=19.2
| |||||||||||||||||||||||||||||||||||||||||||
| 317 | 7 | my %args = @_[ARG0..$#_]; | |||||||||||||||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||||||||||||||||
| 319 | 7 | $args{lc $_} = delete $args{$_} for keys %args; | |||||||||||||||||||||||||||||||||||||||||
| 320 | 7 | my $listener_id = delete $args{listener}; | |||||||||||||||||||||||||||||||||||||||||
| 321 | 7 | my $port = delete $args{port}; | |||||||||||||||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||||||||||||||||
| 323 | 7 | ▶ | if ($self->_listener_exists($listener_id)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 324 | 0 | my $port = $self->{listeners}{$listener_id}{port}; | |||||||||||||||||||||||||||||||||||||||||
| 325 | 0 | my $addr = $self->{listeners}{$listener_id}{addr}; | |||||||||||||||||||||||||||||||||||||||||
| 326 | 0 | delete $self->{listeners}{$listener_id}; | |||||||||||||||||||||||||||||||||||||||||
| 327 | $self->send_event( | ||||||||||||||||||||||||||||||||||||||||||
| 328 | 0 | $self->{prefix} . 'listener_del', | |||||||||||||||||||||||||||||||||||||||||
| 329 | $port, | ||||||||||||||||||||||||||||||||||||||||||
| 330 | $listener_id, | ||||||||||||||||||||||||||||||||||||||||||
| 331 | $addr, | ||||||||||||||||||||||||||||||||||||||||||
| 332 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 333 | } | ||||||||||||||||||||||||||||||||||||||||||
| 334 | elsif (defined $port) { | ||||||||||||||||||||||||||||||||||||||||||
| 335 | 7 | ▶ | while (my ($id, $listener) = each %{ $self->{listeners } }) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 336 | 7 | ▶ | if ($listener->{port} == $port) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 337 | 7 | my $addr = $listener->{addr}; | |||||||||||||||||||||||||||||||||||||||||
| 338 | 7 | delete $self->{listeners}{$id}; | |||||||||||||||||||||||||||||||||||||||||
| 339 | $self->send_event( | ||||||||||||||||||||||||||||||||||||||||||
| 340 | 7 | $self->{prefix} . 'listener_del', | |||||||||||||||||||||||||||||||||||||||||
| 341 | $port, | ||||||||||||||||||||||||||||||||||||||||||
| 342 | $listener_id, | ||||||||||||||||||||||||||||||||||||||||||
| 343 | $addr, | ||||||||||||||||||||||||||||||||||||||||||
| 344 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 345 | } | ||||||||||||||||||||||||||||||||||||||||||
| 346 | } | ||||||||||||||||||||||||||||||||||||||||||
| 347 | } | ||||||||||||||||||||||||||||||||||||||||||
| 348 | |||||||||||||||||||||||||||||||||||||||||||
| 349 | 7 | return; | |||||||||||||||||||||||||||||||||||||||||
| 350 | } | ||||||||||||||||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||||||||||||||||
| 352 | sub _listener_exists { | ||||||||||||||||||||||||||||||||||||||||||
| 353 | 7 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_listener_exists: called CC=3 SCAR=16.5
| |||||||||||||||||||||||||||||||||||||||||||
| 354 | 7 | ▶ | my $listener_id = shift || return; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
shift() || (return)
MC/DC0%0/1
shift() || (return)
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||
| 355 | 0 | ▶ | return 1 if defined $self->{listeners}{$listener_id}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 356 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 357 | } | ||||||||||||||||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||||||||||||||||
| 359 | sub add_connector { | ||||||||||||||||||||||||||||||||||||||||||
| 360 | 2 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_connector: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 361 | 2 | ▶ | croak("add_connector requires an even number of parameters") if @_ & 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 362 | 2 | $self->yield('add_connector', @_); | |||||||||||||||||||||||||||||||||||||||||
| 363 | 2 | return; | |||||||||||||||||||||||||||||||||||||||||
| 364 | } | ||||||||||||||||||||||||||||||||||||||||||
| 365 | |||||||||||||||||||||||||||||||||||||||||||
| 366 | sub _add_connector { | ||||||||||||||||||||||||||||||||||||||||||
| 367 | 2 | ▶ | my ($kernel, $self, $sender) = @_[KERNEL, OBJECT, SENDER]; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_add_connector: called CC=6 SCAR=18.8
| |||||||||||||||||||||||||||||||||||||||||||
| 368 | 2 | my %args = @_[ARG0..$#_]; | |||||||||||||||||||||||||||||||||||||||||
| 369 | |||||||||||||||||||||||||||||||||||||||||||
| 370 | 2 | $args{lc $_} = delete $args{$_} for keys %args; | |||||||||||||||||||||||||||||||||||||||||
| 371 | |||||||||||||||||||||||||||||||||||||||||||
| 372 | 2 | my $remoteaddress = $args{remoteaddress}; | |||||||||||||||||||||||||||||||||||||||||
| 373 | 2 | my $remoteport = $args{remoteport}; | |||||||||||||||||||||||||||||||||||||||||
| 374 | |||||||||||||||||||||||||||||||||||||||||||
| 375 | 2 | ▶ | return if !$remoteaddress || !$remoteport; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$remoteaddress and $remoteport
MC/DC0%0/2
$remoteaddress and $remoteport
$remoteaddress
$remoteport
Truth table33%1/3
A and B
A= $remoteaddressB= $remoteport
| |||||||||||||||||||||||||||||||||||||||||||
| 376 | |||||||||||||||||||||||||||||||||||||||||||
| 377 | my $wheel = POE::Wheel::SocketFactory->new( | ||||||||||||||||||||||||||||||||||||||||||
| 378 | SocketProtocol => 'tcp', | ||||||||||||||||||||||||||||||||||||||||||
| 379 | RemoteAddress => $remoteaddress, | ||||||||||||||||||||||||||||||||||||||||||
| 380 | RemotePort => $remoteport, | ||||||||||||||||||||||||||||||||||||||||||
| 381 | SuccessEvent => '_sock_up', | ||||||||||||||||||||||||||||||||||||||||||
| 382 | FailureEvent => '_sock_failed', | ||||||||||||||||||||||||||||||||||||||||||
| 383 | 2 | ▶ | ($args{bindaddress} ? (BindAddress => $args{bindaddress}) : ()), | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 384 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 385 | |||||||||||||||||||||||||||||||||||||||||||
| 386 | 2 | ▶ | if ($wheel) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 387 | 2 | $args{wheel} = $wheel; | |||||||||||||||||||||||||||||||||||||||||
| 388 | 2 | $self->{connectors}{$wheel->ID()} = \%args; | |||||||||||||||||||||||||||||||||||||||||
| 389 | } | ||||||||||||||||||||||||||||||||||||||||||
| 390 | 2 | return; | |||||||||||||||||||||||||||||||||||||||||
| 391 | } | ||||||||||||||||||||||||||||||||||||||||||
| 392 | |||||||||||||||||||||||||||||||||||||||||||
| 393 | sub _sock_failed { | ||||||||||||||||||||||||||||||||||||||||||
| 394 | 0 | ▶ | my ($kernel, $self, $op, $errno, $errstr, $connector_id) | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_sock_failed: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 395 | = @_[KERNEL, OBJECT, ARG0..ARG3]; | ||||||||||||||||||||||||||||||||||||||||||
| 396 | |||||||||||||||||||||||||||||||||||||||||||
| 397 | 0 | my $ref = delete $self->{connectors}{$connector_id}; | |||||||||||||||||||||||||||||||||||||||||
| 398 | 0 | delete $ref->{wheel}; | |||||||||||||||||||||||||||||||||||||||||
| 399 | 0 | $self->send_event("$self->{prefix}socketerr", $ref, $op, $errno, $errstr); | |||||||||||||||||||||||||||||||||||||||||
| 400 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 401 | } | ||||||||||||||||||||||||||||||||||||||||||
| 402 | |||||||||||||||||||||||||||||||||||||||||||
| 403 | sub _sock_up { | ||||||||||||||||||||||||||||||||||||||||||
| 404 | 2 | ▶ | my ($kernel, $self, $socket, $peeraddr, $peerport, $connector_id) | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_sock_up: called CC=5 SCAR=18.6
| |||||||||||||||||||||||||||||||||||||||||||
| 405 | = @_[KERNEL, OBJECT, ARG0..ARG3]; | ||||||||||||||||||||||||||||||||||||||||||
| 406 | 2 | $peeraddr = inet_ntoa($peeraddr); | |||||||||||||||||||||||||||||||||||||||||
| 407 | |||||||||||||||||||||||||||||||||||||||||||
| 408 | 2 | my $cntr = delete $self->{connectors}{$connector_id}; | |||||||||||||||||||||||||||||||||||||||||
| 409 | 2 | ▶ | if ($self->{got_ssl} && $cntr->{usessl}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->{"got_ssl"} and $cntr->{"usessl"}
MC/DC0%0/2
$self->{"got_ssl"} and $cntr->{"usessl"}
$self->{"got_ssl"}
$cntr->{"usessl"}
Truth table33%1/3
A and B
A= $self->{"got_ssl"}B= $cntr->{"usessl"}
| |||||||||||||||||||||||||||||||||||||||||||
| 410 | 0 | eval { | |||||||||||||||||||||||||||||||||||||||||
| 411 | 0 | $socket = POE::Component::SSLify::Client_SSLify($socket); | |||||||||||||||||||||||||||||||||||||||||
| 412 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 413 | 0 | chomp $@; | |||||||||||||||||||||||||||||||||||||||||
| 414 | 0 | ▶ | die "Failed to SSLify client socket: $@" if $@; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 415 | } | ||||||||||||||||||||||||||||||||||||||||||
| 416 | |||||||||||||||||||||||||||||||||||||||||||
| 417 | my $wheel = POE::Wheel::ReadWrite->new( | ||||||||||||||||||||||||||||||||||||||||||
| 418 | Handle => $socket, | ||||||||||||||||||||||||||||||||||||||||||
| 419 | InputEvent => '_conn_input', | ||||||||||||||||||||||||||||||||||||||||||
| 420 | ErrorEvent => '_conn_error', | ||||||||||||||||||||||||||||||||||||||||||
| 421 | FlushedEvent => '_conn_flushed', | ||||||||||||||||||||||||||||||||||||||||||
| 422 | Filter => POE::Filter::Stackable->new( | ||||||||||||||||||||||||||||||||||||||||||
| 423 | 2 | Filters => [$self->{filter}], | |||||||||||||||||||||||||||||||||||||||||
| 424 | ), | ||||||||||||||||||||||||||||||||||||||||||
| 425 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 426 | |||||||||||||||||||||||||||||||||||||||||||
| 427 | 2 | ▶ | return if !$wheel; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 428 | 2 | my $wheel_id = $wheel->ID(); | |||||||||||||||||||||||||||||||||||||||||
| 429 | 2 | my $sockaddr = inet_ntoa((unpack_sockaddr_in(getsockname $socket))[1]); | |||||||||||||||||||||||||||||||||||||||||
| 430 | 2 | my $sockport = (unpack_sockaddr_in(getsockname $socket))[0]; | |||||||||||||||||||||||||||||||||||||||||
| 431 | 2 | my $ref = { | |||||||||||||||||||||||||||||||||||||||||
| 432 | wheel => $wheel, | ||||||||||||||||||||||||||||||||||||||||||
| 433 | peeraddr => $peeraddr, | ||||||||||||||||||||||||||||||||||||||||||
| 434 | peerport => $peerport, | ||||||||||||||||||||||||||||||||||||||||||
| 435 | sockaddr => $sockaddr, | ||||||||||||||||||||||||||||||||||||||||||
| 436 | sockport => $sockport, | ||||||||||||||||||||||||||||||||||||||||||
| 437 | idle => time(), | ||||||||||||||||||||||||||||||||||||||||||
| 438 | antiflood => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 439 | compress => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 440 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 441 | |||||||||||||||||||||||||||||||||||||||||||
| 442 | 2 | $self->{wheels}{$wheel_id} = $ref; | |||||||||||||||||||||||||||||||||||||||||
| 443 | $self->send_event( | ||||||||||||||||||||||||||||||||||||||||||
| 444 | "$self->{prefix}connected", | ||||||||||||||||||||||||||||||||||||||||||
| 445 | $wheel_id, | ||||||||||||||||||||||||||||||||||||||||||
| 446 | $peeraddr, | ||||||||||||||||||||||||||||||||||||||||||
| 447 | $peerport, | ||||||||||||||||||||||||||||||||||||||||||
| 448 | $sockaddr, | ||||||||||||||||||||||||||||||||||||||||||
| 449 | $sockport, | ||||||||||||||||||||||||||||||||||||||||||
| 450 | $cntr->{name} | ||||||||||||||||||||||||||||||||||||||||||
| 451 | 2 | ); | |||||||||||||||||||||||||||||||||||||||||
| 452 | 2 | return; | |||||||||||||||||||||||||||||||||||||||||
| 453 | } | ||||||||||||||||||||||||||||||||||||||||||
| 454 | |||||||||||||||||||||||||||||||||||||||||||
| 455 | sub _anti_flood { | ||||||||||||||||||||||||||||||||||||||||||
| 456 | 0 | ▶ | my ($self, $wheel_id, $input) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_anti_flood: not called CC=8 SCAR=42.8
| |||||||||||||||||||||||||||||||||||||||||||
| 457 | 0 | my $current_time = time(); | |||||||||||||||||||||||||||||||||||||||||
| 458 | |||||||||||||||||||||||||||||||||||||||||||
| 459 | 0 | ▶ | return if !$wheel_id || !$self->connection_exists($wheel_id) || !$input; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$wheel_id and $self->connection_exists($wheel_id) and $input
$wheel_id and $self->connection_exists($wheel_id)
MC/DC0%0/3
$wheel_id and $self->connection_exists($wheel_id) and $input
$wheel_id
$self->connection_exists($wheel_id)
$input
Truth table0%0/4
A and B and C
A= $wheel_idB= $self->connection_exists($wheel_id)C= $input
| |||||||||||||||||||||||||||||||||||||||||||
| 460 | |||||||||||||||||||||||||||||||||||||||||||
| 461 | SWITCH: { | ||||||||||||||||||||||||||||||||||||||||||
| 462 | 0 | ▶ | if ($self->{wheels}->{ $wheel_id }->{flooded}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 463 | 0 | last SWITCH; | |||||||||||||||||||||||||||||||||||||||||
| 464 | } | ||||||||||||||||||||||||||||||||||||||||||
| 465 | 0 | ▶ | if (!$self->{wheels}{$wheel_id}{timer} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not $self->{"wheels"}{$wheel_id}{"timer"} or $self->{"wheels"}{$wheel_id}{"timer"} < $current_time
MC/DC0%0/2
not $self->{"wheels"}{$wheel_id}{"timer"} or $self->{"wheels"}{$wheel_id}{"timer"} < $current_time
not $self->{"wheels"}{$wheel_id}{"timer"}
$self->{"wheels"}{$wheel_id}{"timer"} < $current_time
Truth table0%0/3
not(A) or B
A= not $self->{"wheels"}{$wheel_id}{"timer"}B= $self->{"wheels"}{$wheel_id}{"timer"} < $current_time
| |||||||||||||||||||||||||||||||||||||||||||
| 466 | || $self->{wheels}{$wheel_id}{timer} < $current_time) { | ||||||||||||||||||||||||||||||||||||||||||
| 467 | |||||||||||||||||||||||||||||||||||||||||||
| 468 | 0 | $self->{wheels}{$wheel_id}{timer} = $current_time; | |||||||||||||||||||||||||||||||||||||||||
| 469 | 0 | my $event = "$self->{prefix}cmd_" . lc $input->{command}; | |||||||||||||||||||||||||||||||||||||||||
| 470 | 0 | $self->send_event($event, $wheel_id, $input); | |||||||||||||||||||||||||||||||||||||||||
| 471 | 0 | last SWITCH; | |||||||||||||||||||||||||||||||||||||||||
| 472 | } | ||||||||||||||||||||||||||||||||||||||||||
| 473 | 0 | ▶ | if ($self->{wheels}{$wheel_id}{timer} <= $current_time + 10) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 474 | 0 | $self->{wheels}{$wheel_id}{timer} += 1; | |||||||||||||||||||||||||||||||||||||||||
| 475 | 0 | push @{ $self->{wheels}{$wheel_id}{msq} }, $input; | |||||||||||||||||||||||||||||||||||||||||
| 476 | 0 | push @{ $self->{wheels}{$wheel_id}{alarm_ids} }, | |||||||||||||||||||||||||||||||||||||||||
| 477 | $poe_kernel->alarm_set( | ||||||||||||||||||||||||||||||||||||||||||
| 478 | '_event_dispatcher', | ||||||||||||||||||||||||||||||||||||||||||
| 479 | $self->{wheels}{$wheel_id}{timer}, | ||||||||||||||||||||||||||||||||||||||||||
| 480 | 0 | $wheel_id | |||||||||||||||||||||||||||||||||||||||||
| 481 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 482 | 0 | last SWITCH; | |||||||||||||||||||||||||||||||||||||||||
| 483 | } | ||||||||||||||||||||||||||||||||||||||||||
| 484 | |||||||||||||||||||||||||||||||||||||||||||
| 485 | 0 | $self->{wheels}{$wheel_id}{flooded} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 486 | 0 | $self->send_event("$self->{prefix}connection_flood", $wheel_id); | |||||||||||||||||||||||||||||||||||||||||
| 487 | } | ||||||||||||||||||||||||||||||||||||||||||
| 488 | |||||||||||||||||||||||||||||||||||||||||||
| 489 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 490 | } | ||||||||||||||||||||||||||||||||||||||||||
| 491 | |||||||||||||||||||||||||||||||||||||||||||
| 492 | sub _conn_error { | ||||||||||||||||||||||||||||||||||||||||||
| 493 | 0 | ▶ | my ($self, $errstr, $wheel_id) = @_[OBJECT, ARG2, ARG3]; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_conn_error: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||
| 494 | 0 | ▶ | return if !$self->connection_exists($wheel_id); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 495 | $self->_disconnected( | ||||||||||||||||||||||||||||||||||||||||||
| 496 | $wheel_id, | ||||||||||||||||||||||||||||||||||||||||||
| 497 | $errstr || $self->{wheels}{$wheel_id}{disconnecting} | ||||||||||||||||||||||||||||||||||||||||||
| 498 | 0 | ▶ | ); | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$errstr || $self->{'wheels'}{$wheel_id}{'disconnecting'}
MC/DC0%0/2
$errstr || $self->{'wheels'}{$wheel_id}{'disconnecting'}
$errstr
$self->{'wheels'}{$wheel_id}{'disconnecting'}
Truth table0%0/3
A || B
A= $errstrB= $self->{'wheels'}{$wheel_id}{'disconnecting'}
| |||||||||||||||||||||||||||||||||||||||||||
| 499 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 500 | } | ||||||||||||||||||||||||||||||||||||||||||
| 501 | |||||||||||||||||||||||||||||||||||||||||||
| 502 | sub _conn_alarm { | ||||||||||||||||||||||||||||||||||||||||||
| 503 | 0 | ▶ | my ($kernel, $self, $wheel_id) = @_[KERNEL, OBJECT, ARG0]; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_conn_alarm: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 504 | 0 | ▶ | return if !$self->connection_exists($wheel_id); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 505 | 0 | my $conn = $self->{wheels}{$wheel_id}; | |||||||||||||||||||||||||||||||||||||||||
| 506 | |||||||||||||||||||||||||||||||||||||||||||
| 507 | $self->send_event( | ||||||||||||||||||||||||||||||||||||||||||
| 508 | "$self->{prefix}connection_idle", | ||||||||||||||||||||||||||||||||||||||||||
| 509 | $wheel_id, | ||||||||||||||||||||||||||||||||||||||||||
| 510 | $conn->{idle}, | ||||||||||||||||||||||||||||||||||||||||||
| 511 | 0 | ); | |||||||||||||||||||||||||||||||||||||||||
| 512 | $conn->{alarm} = $kernel->delay_set( | ||||||||||||||||||||||||||||||||||||||||||
| 513 | '_conn_alar', | ||||||||||||||||||||||||||||||||||||||||||
| 514 | $conn->{idle}, | ||||||||||||||||||||||||||||||||||||||||||
| 515 | 0 | $wheel_id, | |||||||||||||||||||||||||||||||||||||||||
| 516 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 517 | |||||||||||||||||||||||||||||||||||||||||||
| 518 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 519 | } | ||||||||||||||||||||||||||||||||||||||||||
| 520 | |||||||||||||||||||||||||||||||||||||||||||
| 521 | sub _conn_flushed { | ||||||||||||||||||||||||||||||||||||||||||
| 522 | 81 | ▶ | my ($kernel, $self, $wheel_id) = @_[KERNEL, OBJECT, ARG0]; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_conn_flushed: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||
| 523 | 81 | ▶ | return if !$self->connection_exists($wheel_id); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 524 | |||||||||||||||||||||||||||||||||||||||||||
| 525 | 81 | ▶ | if ($self->{wheels}{$wheel_id}{disconnecting}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 526 | $self->_disconnected( | ||||||||||||||||||||||||||||||||||||||||||
| 527 | $wheel_id, | ||||||||||||||||||||||||||||||||||||||||||
| 528 | $self->{wheels}{$wheel_id}{disconnecting}, | ||||||||||||||||||||||||||||||||||||||||||
| 529 | 12 | ); | |||||||||||||||||||||||||||||||||||||||||
| 530 | 12 | return; | |||||||||||||||||||||||||||||||||||||||||
| 531 | } | ||||||||||||||||||||||||||||||||||||||||||
| 532 | |||||||||||||||||||||||||||||||||||||||||||
| 533 | 69 | ▶ | if ($self->{wheels}{$wheel_id}{compress_pending}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 534 | 1 | delete $self->{wheels}{$wheel_id}{compress_pending}; | |||||||||||||||||||||||||||||||||||||||||
| 535 | 1 | $self->{wheels}{$wheel_id}{wheel}->get_input_filter()->unshift( | |||||||||||||||||||||||||||||||||||||||||
| 536 | POE::Filter::Zlib::Stream->new(), | ||||||||||||||||||||||||||||||||||||||||||
| 537 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 538 | 1 | $self->send_event("$self->{prefix}compressed_conn", $wheel_id); | |||||||||||||||||||||||||||||||||||||||||
| 539 | 1 | return; | |||||||||||||||||||||||||||||||||||||||||
| 540 | } | ||||||||||||||||||||||||||||||||||||||||||
| 541 | 68 | return; | |||||||||||||||||||||||||||||||||||||||||
| 542 | } | ||||||||||||||||||||||||||||||||||||||||||
| 543 | |||||||||||||||||||||||||||||||||||||||||||
| 544 | sub _conn_input { | ||||||||||||||||||||||||||||||||||||||||||
| 545 | 181 | ▶ | my ($kernel, $self, $input, $wheel_id) = @_[KERNEL, OBJECT, ARG0, ARG1]; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_conn_input: called CC=3 SCAR=11.5
| |||||||||||||||||||||||||||||||||||||||||||
| 546 | 181 | my $conn = $self->{wheels}{$wheel_id}; | |||||||||||||||||||||||||||||||||||||||||
| 547 | |||||||||||||||||||||||||||||||||||||||||||
| 548 | 181 | ▶ | if ($self->{raw_events}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 549 | $self->send_event( | ||||||||||||||||||||||||||||||||||||||||||
| 550 | "$self->{prefix}raw_input", | ||||||||||||||||||||||||||||||||||||||||||
| 551 | $wheel_id, | ||||||||||||||||||||||||||||||||||||||||||
| 552 | $input->{raw_line}, | ||||||||||||||||||||||||||||||||||||||||||
| 553 | 0 | ); | |||||||||||||||||||||||||||||||||||||||||
| 554 | } | ||||||||||||||||||||||||||||||||||||||||||
| 555 | 181 | $conn->{seen} = time(); | |||||||||||||||||||||||||||||||||||||||||
| 556 | 181 | $kernel->delay_adjust($conn->{alarm}, $conn->{idle}); | |||||||||||||||||||||||||||||||||||||||||
| 557 | |||||||||||||||||||||||||||||||||||||||||||
| 558 | # TODO: Antiflood code | ||||||||||||||||||||||||||||||||||||||||||
| 559 | 181 | ▶ | if ($self->antiflood($wheel_id)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 560 | 0 | $self->_anti_flood($wheel_id, $input); | |||||||||||||||||||||||||||||||||||||||||
| 561 | } | ||||||||||||||||||||||||||||||||||||||||||
| 562 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 563 | 181 | my $event = "$self->{prefix}cmd_" . lc $input->{command}; | |||||||||||||||||||||||||||||||||||||||||
| 564 | 181 | $self->send_event($event, $wheel_id, $input); | |||||||||||||||||||||||||||||||||||||||||
| 565 | } | ||||||||||||||||||||||||||||||||||||||||||
| 566 | 181 | return; | |||||||||||||||||||||||||||||||||||||||||
| 567 | } | ||||||||||||||||||||||||||||||||||||||||||
| 568 | |||||||||||||||||||||||||||||||||||||||||||
| 569 | sub _event_dispatcher { | ||||||||||||||||||||||||||||||||||||||||||
| 570 | 0 | ▶ | my ($kernel, $self, $wheel_id) = @_[KERNEL, OBJECT, ARG0]; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_event_dispatcher: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||
| 571 | |||||||||||||||||||||||||||||||||||||||||||
| 572 | 0 | ▶ | if (!$self->connection_exists($wheel_id) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not $self->connection_exists($wheel_id) or $self->{"wheels"}{$wheel_id}{"flooded"}
MC/DC0%0/2
not $self->connection_exists($wheel_id) or $self->{"wheels"}{$wheel_id}{"flooded"}
not $self->connection_exists($wheel_id)
$self->{"wheels"}{$wheel_id}{"flooded"}
Truth table0%0/3
not(A) or B
A= not $self->connection_exists($wheel_id)B= $self->{"wheels"}{$wheel_id}{"flooded"}
| |||||||||||||||||||||||||||||||||||||||||||
| 573 | || $self->{wheels}{$wheel_id}{flooded}) { | ||||||||||||||||||||||||||||||||||||||||||
| 574 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 575 | } | ||||||||||||||||||||||||||||||||||||||||||
| 576 | |||||||||||||||||||||||||||||||||||||||||||
| 577 | 0 | shift @{ $self->{wheels}{$wheel_id}{alarm_ids} }; | |||||||||||||||||||||||||||||||||||||||||
| 578 | 0 | my $input = shift @{ $self->{wheels}{$wheel_id}{msq} }; | |||||||||||||||||||||||||||||||||||||||||
| 579 | |||||||||||||||||||||||||||||||||||||||||||
| 580 | 0 | ▶ | if ($input) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 581 | 0 | my $event = "$self->{prefix}cmd_" . lc $input->{command}; | |||||||||||||||||||||||||||||||||||||||||
| 582 | 0 | $self->send_event($event, $wheel_id, $input); | |||||||||||||||||||||||||||||||||||||||||
| 583 | } | ||||||||||||||||||||||||||||||||||||||||||
| 584 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 585 | } | ||||||||||||||||||||||||||||||||||||||||||
| 586 | |||||||||||||||||||||||||||||||||||||||||||
| 587 | sub send_output { | ||||||||||||||||||||||||||||||||||||||||||
| 588 | 473 | ▶ | my ($self, $output) = splice @_, 0, 2; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
send_output: called CC=5 SCAR=19.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 589 | |||||||||||||||||||||||||||||||||||||||||||
| 590 | 473 | ▶ | if ($output && ref $output eq 'HASH') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$output and ref $output eq "HASH"
MC/DC0%0/2
$output and ref $output eq "HASH"
$output
ref $output eq "HASH"
Truth table33%1/3
A and B
A= $outputB= ref $output eq "HASH"
| |||||||||||||||||||||||||||||||||||||||||||
| 591 | 473 | for my $id (grep { $self->connection_exists($_) } @_) { | |||||||||||||||||||||||||||||||||||||||||
| 592 | 396 | ▶ | if ($self->{raw_events}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 593 | 0 | my $out = $self->{filter}->put([$output])->[0]; | |||||||||||||||||||||||||||||||||||||||||
| 594 | 0 | $out =~ s/\015\012$//; | |||||||||||||||||||||||||||||||||||||||||
| 595 | 0 | $self->send_event("$self->{prefix}raw_output", $id, $out); | |||||||||||||||||||||||||||||||||||||||||
| 596 | } | ||||||||||||||||||||||||||||||||||||||||||
| 597 | 396 | $self->{wheels}{$id}{wheel}->put($output); | |||||||||||||||||||||||||||||||||||||||||
| 598 | } | ||||||||||||||||||||||||||||||||||||||||||
| 599 | } | ||||||||||||||||||||||||||||||||||||||||||
| 600 | |||||||||||||||||||||||||||||||||||||||||||
| 601 | 473 | return; | |||||||||||||||||||||||||||||||||||||||||
| 602 | } | ||||||||||||||||||||||||||||||||||||||||||
| 603 | |||||||||||||||||||||||||||||||||||||||||||
| 604 | sub _send_output { | ||||||||||||||||||||||||||||||||||||||||||
| 605 | 0 | ▶ | $_[OBJECT]->send_output(@_[ARG0..$#_]); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_send_output: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 606 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 607 | } | ||||||||||||||||||||||||||||||||||||||||||
| 608 | |||||||||||||||||||||||||||||||||||||||||||
| 609 | sub antiflood { | ||||||||||||||||||||||||||||||||||||||||||
| 610 | 191 | ▶ | my ($self, $wheel_id, $value) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
antiflood: called CC=7 SCAR=35.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 611 | |||||||||||||||||||||||||||||||||||||||||||
| 612 | 191 | ▶ | return if !$self->connection_exists($wheel_id); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 613 | 191 | ▶ | return 0 if !$self->{antiflood}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 614 | 0 | ▶ | return $self->{wheels}{$wheel_id}{antiflood} if !defined $value; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 615 | |||||||||||||||||||||||||||||||||||||||||||
| 616 | 0 | ▶ | if (!$value) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 617 | # Flush pending messages from that wheel | ||||||||||||||||||||||||||||||||||||||||||
| 618 | 0 | ▶ | while (my $alarm_id = shift @{ $self->{wheels}{$wheel_id}{alarm_ids} }) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 619 | 0 | $poe_kernel->alarm_remove($alarm_id); | |||||||||||||||||||||||||||||||||||||||||
| 620 | 0 | my $input = shift @{ $self->{wheels}{$wheel_id}{msq} }; | |||||||||||||||||||||||||||||||||||||||||
| 621 | |||||||||||||||||||||||||||||||||||||||||||
| 622 | 0 | ▶ | if ($input) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 623 | 0 | my $event = "$self->{prefix}cmd_" . lc $input->{command}; | |||||||||||||||||||||||||||||||||||||||||
| 624 | 0 | $self->send_event($event, $wheel_id, $input); | |||||||||||||||||||||||||||||||||||||||||
| 625 | } | ||||||||||||||||||||||||||||||||||||||||||
| 626 | } | ||||||||||||||||||||||||||||||||||||||||||
| 627 | } | ||||||||||||||||||||||||||||||||||||||||||
| 628 | |||||||||||||||||||||||||||||||||||||||||||
| 629 | 0 | $self->{wheels}{$wheel_id}{antiflood} = $value; | |||||||||||||||||||||||||||||||||||||||||
| 630 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 631 | } | ||||||||||||||||||||||||||||||||||||||||||
| 632 | |||||||||||||||||||||||||||||||||||||||||||
| 633 | sub compressed_link { | ||||||||||||||||||||||||||||||||||||||||||
| 634 | 2 | ▶ | my ($self, $wheel_id, $value, $cntr) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
compressed_link: called CC=7 SCAR=20.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 635 | 2 | ▶ | return if !$self->connection_exists($wheel_id); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 636 | 2 | ▶ | return $self->{wheels}{$wheel_id}{compress} if !defined $value; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 637 | |||||||||||||||||||||||||||||||||||||||||||
| 638 | 2 | ▶ | if ($value) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 639 | 2 | ▶ | if (!$self->{got_zlib}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 640 | 2 | eval { | |||||||||||||||||||||||||||||||||||||||||
| 641 | 2 | require POE::Filter::Zlib::Stream; | |||||||||||||||||||||||||||||||||||||||||
| 642 | 2 | $self->{got_zlib} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 643 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 644 | 2 | chomp $@; | |||||||||||||||||||||||||||||||||||||||||
| 645 | 2 | ▶ | croak($@) if !$self->{got_zlib}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 646 | } | ||||||||||||||||||||||||||||||||||||||||||
| 647 | 2 | ▶ | if ($cntr) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 648 | 1 | $self->{wheels}{$wheel_id}{wheel}->get_input_filter()->unshift( | |||||||||||||||||||||||||||||||||||||||||
| 649 | POE::Filter::Zlib::Stream->new() | ||||||||||||||||||||||||||||||||||||||||||
| 650 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 651 | 1 | $self->send_event( | |||||||||||||||||||||||||||||||||||||||||
| 652 | "$self->{prefix}compressed_conn", | ||||||||||||||||||||||||||||||||||||||||||
| 653 | $wheel_id, | ||||||||||||||||||||||||||||||||||||||||||
| 654 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 655 | } | ||||||||||||||||||||||||||||||||||||||||||
| 656 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 657 | 1 | $self->{wheels}{$wheel_id}{compress_pending} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 658 | } | ||||||||||||||||||||||||||||||||||||||||||
| 659 | } | ||||||||||||||||||||||||||||||||||||||||||
| 660 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 661 | 0 | $self->{wheels}{$wheel_id}{wheel}->get_input_filter()->shift(); | |||||||||||||||||||||||||||||||||||||||||
| 662 | } | ||||||||||||||||||||||||||||||||||||||||||
| 663 | |||||||||||||||||||||||||||||||||||||||||||
| 664 | 2 | $self->{wheels}{$wheel_id}{compress} = $value; | |||||||||||||||||||||||||||||||||||||||||
| 665 | 2 | return; | |||||||||||||||||||||||||||||||||||||||||
| 666 | } | ||||||||||||||||||||||||||||||||||||||||||
| 667 | |||||||||||||||||||||||||||||||||||||||||||
| 668 | sub disconnect { | ||||||||||||||||||||||||||||||||||||||||||
| 669 | 12 | ▶ | my ($self, $wheel_id, $string) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
disconnect: called CC=4 SCAR=15.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 670 | 12 | ▶ | return if !$wheel_id || !$self->connection_exists($wheel_id); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$wheel_id and $self->connection_exists($wheel_id)
MC/DC0%0/2
$wheel_id and $self->connection_exists($wheel_id)
$wheel_id
$self->connection_exists($wheel_id)
Truth table33%1/3
A and B
A= $wheel_idB= $self->connection_exists($wheel_id)
| |||||||||||||||||||||||||||||||||||||||||||
| 671 | 12 | ▶ | $self->{wheels}{$wheel_id}{disconnecting} = $string || 'Client Quit'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$string || 'Client Quit'
MC/DC0%0/1
$string || 'Client Quit'
$string
Truth table50%1/2
A
A= $string
| |||||||||||||||||||||||||||||||||||||||||||
| 672 | 12 | return; | |||||||||||||||||||||||||||||||||||||||||
| 673 | } | ||||||||||||||||||||||||||||||||||||||||||
| 674 | |||||||||||||||||||||||||||||||||||||||||||
| 675 | sub _disconnected { | ||||||||||||||||||||||||||||||||||||||||||
| 676 | 12 | ▶ | my ($self, $wheel_id, $errstr) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_disconnected: called CC=6 SCAR=20.2
| |||||||||||||||||||||||||||||||||||||||||||
| 677 | 12 | ▶ | return if !$wheel_id || !$self->connection_exists($wheel_id); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$wheel_id and $self->connection_exists($wheel_id)
MC/DC0%0/2
$wheel_id and $self->connection_exists($wheel_id)
$wheel_id
$self->connection_exists($wheel_id)
Truth table33%1/3
A and B
A= $wheel_idB= $self->connection_exists($wheel_id)
| |||||||||||||||||||||||||||||||||||||||||||
| 678 | |||||||||||||||||||||||||||||||||||||||||||
| 679 | 12 | my $conn = delete $self->{wheels}{$wheel_id}; | |||||||||||||||||||||||||||||||||||||||||
| 680 | 12 | for my $alarm_id ($conn->{alarm}, @{ $conn->{alarm_ids} }) { | |||||||||||||||||||||||||||||||||||||||||
| 681 | 12 | $poe_kernel->alarm_remove($_); | |||||||||||||||||||||||||||||||||||||||||
| 682 | } | ||||||||||||||||||||||||||||||||||||||||||
| 683 | $self->send_event( | ||||||||||||||||||||||||||||||||||||||||||
| 684 | 12 | ▶ | "$self->{prefix}disconnected", | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$errstr || 'Client Quit'
MC/DC0%0/1
$errstr || 'Client Quit'
$errstr
Truth table50%1/2
A
A= $errstr
| |||||||||||||||||||||||||||||||||||||||||||
| 685 | $wheel_id, | ||||||||||||||||||||||||||||||||||||||||||
| 686 | $errstr || 'Client Quit', | ||||||||||||||||||||||||||||||||||||||||||
| 687 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 688 | |||||||||||||||||||||||||||||||||||||||||||
| 689 | 12 | ▶ | if ( $^O =~ /(cygwin|MSWin)/ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 690 | 0 | $conn->{wheel}->shutdown_input(); | |||||||||||||||||||||||||||||||||||||||||
| 691 | 0 | $conn->{wheel}->shutdown_output(); | |||||||||||||||||||||||||||||||||||||||||
| 692 | } | ||||||||||||||||||||||||||||||||||||||||||
| 693 | |||||||||||||||||||||||||||||||||||||||||||
| 694 | 12 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 695 | } | ||||||||||||||||||||||||||||||||||||||||||
| 696 | |||||||||||||||||||||||||||||||||||||||||||
| 697 | sub connection_info { | ||||||||||||||||||||||||||||||||||||||||||
| 698 | 0 | ▶ | my ($self, $wheel_id) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
connection_info: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 699 | 0 | ▶ | return if !$self->connection_exists($wheel_id); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 700 | return map { | ||||||||||||||||||||||||||||||||||||||||||
| 701 | 0 | $self->{wheels}{$wheel_id}{$_} | |||||||||||||||||||||||||||||||||||||||||
| 702 | } qw(peeraddr peerport sockaddr sockport); | ||||||||||||||||||||||||||||||||||||||||||
| 703 | } | ||||||||||||||||||||||||||||||||||||||||||
| 704 | |||||||||||||||||||||||||||||||||||||||||||
| 705 | sub connection_exists { | ||||||||||||||||||||||||||||||||||||||||||
| 706 | 706 | ▶ | my ($self, $wheel_id) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
connection_exists: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 707 | 706 | ▶ | return if !$wheel_id || !defined $self->{wheels}{$wheel_id}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$wheel_id and defined $self->{"wheels"}{$wheel_id}
MC/DC50%1/2
$wheel_id and defined $self->{"wheels"}{$wheel_id}
$wheel_id
defined $self->{"wheels"}{$wheel_id}
Truth table66%2/3
A and B
A= $wheel_idB= defined $self->{"wheels"}{$wheel_id}
| |||||||||||||||||||||||||||||||||||||||||||
| 708 | 694 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 709 | } | ||||||||||||||||||||||||||||||||||||||||||
| 710 | |||||||||||||||||||||||||||||||||||||||||||
| 711 | sub _conn_flooded { | ||||||||||||||||||||||||||||||||||||||||||
| 712 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_conn_flooded: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||
| 713 | 0 | ▶ | my $conn_id = shift || return; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
shift() || (return)
MC/DC0%0/1
shift() || (return)
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||
| 714 | 0 | ▶ | return if !$self->connection_exists($conn_id); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 715 | 0 | return $self->{wheels}{$conn_id}{flooded}; | |||||||||||||||||||||||||||||||||||||||||
| 716 | } | ||||||||||||||||||||||||||||||||||||||||||
| 717 | |||||||||||||||||||||||||||||||||||||||||||
| 718 | sub add_denial { | ||||||||||||||||||||||||||||||||||||||||||
| 719 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_denial: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 720 | 0 | ▶ | my $netmask = shift || return; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
shift() || (return)
MC/DC0%0/1
shift() || (return)
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||
| 721 | 0 | ▶ | my $reason = shift || 'Denied'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
shift() || 'Denied'
MC/DC0%0/1
shift() || 'Denied'
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||
| 722 | 0 | ▶ | return if !$netmask->isa('Net::Netmask'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 723 | |||||||||||||||||||||||||||||||||||||||||||
| 724 | 0 | $self->{denials}{$netmask} = { | |||||||||||||||||||||||||||||||||||||||||
| 725 | blk => $netmask, | ||||||||||||||||||||||||||||||||||||||||||
| 726 | reason => $reason, | ||||||||||||||||||||||||||||||||||||||||||
| 727 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 728 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 729 | } | ||||||||||||||||||||||||||||||||||||||||||
| 730 | |||||||||||||||||||||||||||||||||||||||||||
| 731 | sub del_denial { | ||||||||||||||||||||||||||||||||||||||||||
| 732 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
del_denial: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 733 | 0 | ▶ | my $netmask = shift || return; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
shift() || (return)
MC/DC0%0/1
shift() || (return)
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||
| 734 | 0 | ▶ | return if !$netmask->isa('Net::Netmask'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 735 | 0 | ▶ | return if !$self->{denials}{$netmask}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 736 | 0 | delete $self->{denials}{$netmask}; | |||||||||||||||||||||||||||||||||||||||||
| 737 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 738 | } | ||||||||||||||||||||||||||||||||||||||||||
| 739 | |||||||||||||||||||||||||||||||||||||||||||
| 740 | sub add_exemption { | ||||||||||||||||||||||||||||||||||||||||||
| 741 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_exemption: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 742 | 0 | ▶ | my $netmask = shift || return; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
shift() || (return)
MC/DC0%0/1
shift() || (return)
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||
| 743 | 0 | ▶ | return if !$netmask->isa('Net::Netmask'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 744 | |||||||||||||||||||||||||||||||||||||||||||
| 745 | 0 | ▶ | if (!$self->{exemptions}{$netmask}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 746 | 0 | $self->{exemptions}{$netmask} = $netmask; | |||||||||||||||||||||||||||||||||||||||||
| 747 | } | ||||||||||||||||||||||||||||||||||||||||||
| 748 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 749 | } | ||||||||||||||||||||||||||||||||||||||||||
| 750 | |||||||||||||||||||||||||||||||||||||||||||
| 751 | sub del_exemption { | ||||||||||||||||||||||||||||||||||||||||||
| 752 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
del_exemption: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 753 | 0 | ▶ | my $netmask = shift || return; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
shift() || (return)
MC/DC0%0/1
shift() || (return)
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||
| 754 | 0 | ▶ | return if !$netmask->isa('Net::Netmask'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 755 | 0 | ▶ | return if !$self->{exemptions}{$netmask}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 756 | 0 | delete $self->{exemptions}{$netmask}; | |||||||||||||||||||||||||||||||||||||||||
| 757 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 758 | } | ||||||||||||||||||||||||||||||||||||||||||
| 759 | |||||||||||||||||||||||||||||||||||||||||||
| 760 | sub denied { | ||||||||||||||||||||||||||||||||||||||||||
| 761 | 22 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
denied: called CC=5 SCAR=19.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 762 | 22 | ▶ | my $ipaddr = shift || return; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
shift() || (return)
MC/DC0%0/1
shift() || (return)
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||
| 763 | 22 | ▶ | return if $self->exempted($ipaddr); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 764 | |||||||||||||||||||||||||||||||||||||||||||
| 765 | 22 | for my $mask (keys %{ $self->{denials} }) { | |||||||||||||||||||||||||||||||||||||||||
| 766 | 0 | ▶ | if ($self->{denials}{$mask}{blk}->match($ipaddr)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 767 | 0 | return $self->{denials}{$mask}{reason}; | |||||||||||||||||||||||||||||||||||||||||
| 768 | } | ||||||||||||||||||||||||||||||||||||||||||
| 769 | } | ||||||||||||||||||||||||||||||||||||||||||
| 770 | |||||||||||||||||||||||||||||||||||||||||||
| 771 | 22 | return; | |||||||||||||||||||||||||||||||||||||||||
| 772 | } | ||||||||||||||||||||||||||||||||||||||||||
| 773 | |||||||||||||||||||||||||||||||||||||||||||
| 774 | sub exempted { | ||||||||||||||||||||||||||||||||||||||||||
| 775 | 22 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
exempted: called CC=4 SCAR=16.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 776 | 22 | ▶ | my $ipaddr = shift || return; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
shift() || (return)
MC/DC0%0/1
shift() || (return)
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||
| 777 | 22 | for my $mask (keys %{ $self->{exemptions} }) { | |||||||||||||||||||||||||||||||||||||||||
| 778 | 0 | ▶ | return 1 if $self->{exemptions}{$mask}->match($ipaddr); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 779 | } | ||||||||||||||||||||||||||||||||||||||||||
| 780 | 22 | return; | |||||||||||||||||||||||||||||||||||||||||
| 781 | } | ||||||||||||||||||||||||||||||||||||||||||
| 782 | |||||||||||||||||||||||||||||||||||||||||||
| 783 | 21 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 784 | |||||||||||||||||||||||||||||||||||||||||||
| 785 | =encoding utf8 | ||||||||||||||||||||||||||||||||||||||||||
| 786 | |||||||||||||||||||||||||||||||||||||||||||
| 787 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||
| 788 | |||||||||||||||||||||||||||||||||||||||||||
| 789 | POE::Component::Server::IRC::Backend - A POE component class that provides network connection abstraction for POE::Component::Server::IRC | ||||||||||||||||||||||||||||||||||||||||||
| 790 | |||||||||||||||||||||||||||||||||||||||||||
| 791 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||
| 792 | |||||||||||||||||||||||||||||||||||||||||||
| 793 | package MyIRCD; | ||||||||||||||||||||||||||||||||||||||||||
| 794 | |||||||||||||||||||||||||||||||||||||||||||
| 795 | use strict; | ||||||||||||||||||||||||||||||||||||||||||
| 796 | use warnings; | ||||||||||||||||||||||||||||||||||||||||||
| 797 | use base 'POE::Component::Server::IRC::Backend'; | ||||||||||||||||||||||||||||||||||||||||||
| 798 | |||||||||||||||||||||||||||||||||||||||||||
| 799 | sub spawn { | ||||||||||||||||||||||||||||||||||||||||||
| 800 | my ($package, %args) = @_; | ||||||||||||||||||||||||||||||||||||||||||
| 801 | |||||||||||||||||||||||||||||||||||||||||||
| 802 | my $self = $package->create(prefix => 'ircd_', @_); | ||||||||||||||||||||||||||||||||||||||||||
| 803 | |||||||||||||||||||||||||||||||||||||||||||
| 804 | # process %args ... | ||||||||||||||||||||||||||||||||||||||||||
| 805 | |||||||||||||||||||||||||||||||||||||||||||
| 806 | return $self; | ||||||||||||||||||||||||||||||||||||||||||
| 807 | } | ||||||||||||||||||||||||||||||||||||||||||
| 808 | |||||||||||||||||||||||||||||||||||||||||||
| 809 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||
| 810 | |||||||||||||||||||||||||||||||||||||||||||
| 811 | POE::Component::Server::IRC::Backend - A POE component class that provides | ||||||||||||||||||||||||||||||||||||||||||
| 812 | network connection abstraction for | ||||||||||||||||||||||||||||||||||||||||||
| 813 | L<POE::Component::Server::IRC|POE::Component::Server::IRC>. It uses a | ||||||||||||||||||||||||||||||||||||||||||
| 814 | plugin system. See | ||||||||||||||||||||||||||||||||||||||||||
| 815 | L<POE::Component::Server::IRC::Plugin|POE::Component::Server::IRC::Plugin> | ||||||||||||||||||||||||||||||||||||||||||
| 816 | for details. | ||||||||||||||||||||||||||||||||||||||||||
| 817 | |||||||||||||||||||||||||||||||||||||||||||
| 818 | =head1 CONSTRUCTOR | ||||||||||||||||||||||||||||||||||||||||||
| 819 | |||||||||||||||||||||||||||||||||||||||||||
| 820 | =head2 C<create> | ||||||||||||||||||||||||||||||||||||||||||
| 821 | |||||||||||||||||||||||||||||||||||||||||||
| 822 | Returns an object. Accepts the following parameters, all are optional: | ||||||||||||||||||||||||||||||||||||||||||
| 823 | |||||||||||||||||||||||||||||||||||||||||||
| 824 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 825 | |||||||||||||||||||||||||||||||||||||||||||
| 826 | =item * B<'alias'>, a POE::Kernel alias to set; | ||||||||||||||||||||||||||||||||||||||||||
| 827 | |||||||||||||||||||||||||||||||||||||||||||
| 828 | =item * B<'auth'>, set to a false value to globally disable IRC | ||||||||||||||||||||||||||||||||||||||||||
| 829 | authentication, default is auth is enabled; | ||||||||||||||||||||||||||||||||||||||||||
| 830 | |||||||||||||||||||||||||||||||||||||||||||
| 831 | =item * B<'antiflood'>, set to a false value to globally disable flood | ||||||||||||||||||||||||||||||||||||||||||
| 832 | protection, default is true; | ||||||||||||||||||||||||||||||||||||||||||
| 833 | |||||||||||||||||||||||||||||||||||||||||||
| 834 | =item * B<'prefix'>, this is the prefix that is used to generate event | ||||||||||||||||||||||||||||||||||||||||||
| 835 | names that the component produces. The default is 'ircd_'. | ||||||||||||||||||||||||||||||||||||||||||
| 836 | |||||||||||||||||||||||||||||||||||||||||||
| 837 | =item * B<'states'>, an array reference of extra objects states for the IRC | ||||||||||||||||||||||||||||||||||||||||||
| 838 | daemon's POE sessions. The elements can be array references of states | ||||||||||||||||||||||||||||||||||||||||||
| 839 | as well as hash references of state => handler pairs. | ||||||||||||||||||||||||||||||||||||||||||
| 840 | |||||||||||||||||||||||||||||||||||||||||||
| 841 | =item * B<'plugin_debug'>, set to a true value to print plugin debug info. | ||||||||||||||||||||||||||||||||||||||||||
| 842 | Default is false. | ||||||||||||||||||||||||||||||||||||||||||
| 843 | |||||||||||||||||||||||||||||||||||||||||||
| 844 | =item * B<'options'>, a hashref of options to L<POE::Session|POE::Session> | ||||||||||||||||||||||||||||||||||||||||||
| 845 | |||||||||||||||||||||||||||||||||||||||||||
| 846 | =item * B<'raw_events'>, whether to send L<raw|/ircd_raw_input> events. | ||||||||||||||||||||||||||||||||||||||||||
| 847 | False by default. Can be enabled later with L<C<raw_events>|/raw_events>; | ||||||||||||||||||||||||||||||||||||||||||
| 848 | |||||||||||||||||||||||||||||||||||||||||||
| 849 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 850 | |||||||||||||||||||||||||||||||||||||||||||
| 851 | If the component is created from within another session, that session will | ||||||||||||||||||||||||||||||||||||||||||
| 852 | be automagcially registered with the component to receive events and get | ||||||||||||||||||||||||||||||||||||||||||
| 853 | an 'ircd_backend_registered' event. | ||||||||||||||||||||||||||||||||||||||||||
| 854 | |||||||||||||||||||||||||||||||||||||||||||
| 855 | =head1 METHODS | ||||||||||||||||||||||||||||||||||||||||||
| 856 | |||||||||||||||||||||||||||||||||||||||||||
| 857 | =head2 General | ||||||||||||||||||||||||||||||||||||||||||
| 858 | |||||||||||||||||||||||||||||||||||||||||||
| 859 | =head3 C<shutdown> | ||||||||||||||||||||||||||||||||||||||||||
| 860 | |||||||||||||||||||||||||||||||||||||||||||
| 861 | Takes no arguments. Terminates the component. Removes all listeners and | ||||||||||||||||||||||||||||||||||||||||||
| 862 | connectors. Disconnects all current client and server connections. This | ||||||||||||||||||||||||||||||||||||||||||
| 863 | is a shorthand for C<< $ircd->yield('shutdown') >>. | ||||||||||||||||||||||||||||||||||||||||||
| 864 | |||||||||||||||||||||||||||||||||||||||||||
| 865 | =head3 C<session_id> | ||||||||||||||||||||||||||||||||||||||||||
| 866 | |||||||||||||||||||||||||||||||||||||||||||
| 867 | I<Inherited from L<POE::Component::Syndicator|POE::Component::Syndicator/session_id>> | ||||||||||||||||||||||||||||||||||||||||||
| 868 | |||||||||||||||||||||||||||||||||||||||||||
| 869 | Takes no arguments. Returns the ID of the component's session. Ideal for | ||||||||||||||||||||||||||||||||||||||||||
| 870 | posting events to the component. | ||||||||||||||||||||||||||||||||||||||||||
| 871 | |||||||||||||||||||||||||||||||||||||||||||
| 872 | =head3 C<session_alias> | ||||||||||||||||||||||||||||||||||||||||||
| 873 | |||||||||||||||||||||||||||||||||||||||||||
| 874 | I<Inherited from L<POE::Component::Syndicator|POE::Component::Syndicator/session_alias>> | ||||||||||||||||||||||||||||||||||||||||||
| 875 | |||||||||||||||||||||||||||||||||||||||||||
| 876 | Takes no arguments. Returns the session alias that has been set through | ||||||||||||||||||||||||||||||||||||||||||
| 877 | L<C<create>|/create>'s B<'alias'> argument. | ||||||||||||||||||||||||||||||||||||||||||
| 878 | |||||||||||||||||||||||||||||||||||||||||||
| 879 | =head3 C<yield> | ||||||||||||||||||||||||||||||||||||||||||
| 880 | |||||||||||||||||||||||||||||||||||||||||||
| 881 | I<Inherited from L<POE::Component::Syndicator|POE::Component::Syndicator/yield>> | ||||||||||||||||||||||||||||||||||||||||||
| 882 | |||||||||||||||||||||||||||||||||||||||||||
| 883 | This method provides an alternative object based means of posting events | ||||||||||||||||||||||||||||||||||||||||||
| 884 | to the component. First argument is the event to post, following arguments | ||||||||||||||||||||||||||||||||||||||||||
| 885 | are sent as arguments to the resultant post. | ||||||||||||||||||||||||||||||||||||||||||
| 886 | |||||||||||||||||||||||||||||||||||||||||||
| 887 | =head3 C<call> | ||||||||||||||||||||||||||||||||||||||||||
| 888 | |||||||||||||||||||||||||||||||||||||||||||
| 889 | I<Inherited from L<POE::Component::Syndicator|POE::Component::Syndicator/call>> | ||||||||||||||||||||||||||||||||||||||||||
| 890 | |||||||||||||||||||||||||||||||||||||||||||
| 891 | This method provides an alternative object based means of calling events | ||||||||||||||||||||||||||||||||||||||||||
| 892 | to the component. First argument is the event to call, following arguments | ||||||||||||||||||||||||||||||||||||||||||
| 893 | are sent as arguments to the resultant call. | ||||||||||||||||||||||||||||||||||||||||||
| 894 | |||||||||||||||||||||||||||||||||||||||||||
| 895 | =head3 C<delay> | ||||||||||||||||||||||||||||||||||||||||||
| 896 | |||||||||||||||||||||||||||||||||||||||||||
| 897 | I<Inherited from L<POE::Component::Syndicator|POE::Component::Syndicator/delay>> | ||||||||||||||||||||||||||||||||||||||||||
| 898 | |||||||||||||||||||||||||||||||||||||||||||
| 899 | This method provides a way of posting delayed events to the component. The | ||||||||||||||||||||||||||||||||||||||||||
| 900 | first argument is an arrayref consisting of the delayed command to post and | ||||||||||||||||||||||||||||||||||||||||||
| 901 | any command arguments. The second argument is the time in seconds that one | ||||||||||||||||||||||||||||||||||||||||||
| 902 | wishes to delay the command being posted. | ||||||||||||||||||||||||||||||||||||||||||
| 903 | |||||||||||||||||||||||||||||||||||||||||||
| 904 | Returns an alarm ID that can be used with L<C<delay_remove>|/delay_remove> | ||||||||||||||||||||||||||||||||||||||||||
| 905 | to cancel the delayed event. This will be undefined if something went | ||||||||||||||||||||||||||||||||||||||||||
| 906 | wrong. | ||||||||||||||||||||||||||||||||||||||||||
| 907 | |||||||||||||||||||||||||||||||||||||||||||
| 908 | =head3 C<delay_remove> | ||||||||||||||||||||||||||||||||||||||||||
| 909 | |||||||||||||||||||||||||||||||||||||||||||
| 910 | I<Inherited from L<POE::Component::Syndicator|POE::Component::Syndicator/delay_remove>> | ||||||||||||||||||||||||||||||||||||||||||
| 911 | |||||||||||||||||||||||||||||||||||||||||||
| 912 | This method removes a previously scheduled delayed event from the | ||||||||||||||||||||||||||||||||||||||||||
| 913 | component. Takes one argument, the C<alarm_id> that was returned by a | ||||||||||||||||||||||||||||||||||||||||||
| 914 | L<C<delay>|/delay> method call. | ||||||||||||||||||||||||||||||||||||||||||
| 915 | |||||||||||||||||||||||||||||||||||||||||||
| 916 | Returns an arrayref that was originally requested to be delayed. | ||||||||||||||||||||||||||||||||||||||||||
| 917 | |||||||||||||||||||||||||||||||||||||||||||
| 918 | =head3 C<send_event> | ||||||||||||||||||||||||||||||||||||||||||
| 919 | |||||||||||||||||||||||||||||||||||||||||||
| 920 | I<Inherited from L<POE::Component::Syndicator|POE::Component::Syndicator/send_event>> | ||||||||||||||||||||||||||||||||||||||||||
| 921 | |||||||||||||||||||||||||||||||||||||||||||
| 922 | Sends an event through the component's event handling system. These will | ||||||||||||||||||||||||||||||||||||||||||
| 923 | get processed by plugins then by registered sessions. First argument is | ||||||||||||||||||||||||||||||||||||||||||
| 924 | the event name, followed by any parameters for that event. | ||||||||||||||||||||||||||||||||||||||||||
| 925 | |||||||||||||||||||||||||||||||||||||||||||
| 926 | =head3 C<send_event_next> | ||||||||||||||||||||||||||||||||||||||||||
| 927 | |||||||||||||||||||||||||||||||||||||||||||
| 928 | I<Inherited from L<POE::Component::Syndicator|POE::Component::Syndicator/send_event_next>> | ||||||||||||||||||||||||||||||||||||||||||
| 929 | |||||||||||||||||||||||||||||||||||||||||||
| 930 | This sends an event right after the one that's currently being processed. | ||||||||||||||||||||||||||||||||||||||||||
| 931 | Useful if you want to generate some event which is directly related to | ||||||||||||||||||||||||||||||||||||||||||
| 932 | another event so you want them to appear together. This method can only be | ||||||||||||||||||||||||||||||||||||||||||
| 933 | called when POE::Component::IRC is processing an event, e.g. from one of | ||||||||||||||||||||||||||||||||||||||||||
| 934 | your event handlers. Takes the same arguments as | ||||||||||||||||||||||||||||||||||||||||||
| 935 | L<C<send_event>|/send_event>. | ||||||||||||||||||||||||||||||||||||||||||
| 936 | |||||||||||||||||||||||||||||||||||||||||||
| 937 | =head3 C<send_event_now> | ||||||||||||||||||||||||||||||||||||||||||
| 938 | |||||||||||||||||||||||||||||||||||||||||||
| 939 | I<Inherited from L<POE::Component::Syndicator|POE::Component::Syndicator/send_event_now>> | ||||||||||||||||||||||||||||||||||||||||||
| 940 | |||||||||||||||||||||||||||||||||||||||||||
| 941 | This will send an event to be processed immediately. This means that if an | ||||||||||||||||||||||||||||||||||||||||||
| 942 | event is currently being processed and there are plugins or sessions which | ||||||||||||||||||||||||||||||||||||||||||
| 943 | will receive it after you do, then an event sent with C<send_event_now> | ||||||||||||||||||||||||||||||||||||||||||
| 944 | will be received by those plugins/sessions I<before> the current event. | ||||||||||||||||||||||||||||||||||||||||||
| 945 | Takes the same arguments as L<C<send_event>|/send_event>. | ||||||||||||||||||||||||||||||||||||||||||
| 946 | |||||||||||||||||||||||||||||||||||||||||||
| 947 | =head3 C<raw_events> | ||||||||||||||||||||||||||||||||||||||||||
| 948 | |||||||||||||||||||||||||||||||||||||||||||
| 949 | If called with a true value, raw events (L<C<ircd_raw_input>|/ircd_raw_input> | ||||||||||||||||||||||||||||||||||||||||||
| 950 | and L<C<ircd_raw_output>|/ircd_raw_output>) will be enabled. | ||||||||||||||||||||||||||||||||||||||||||
| 951 | |||||||||||||||||||||||||||||||||||||||||||
| 952 | =head2 Connections | ||||||||||||||||||||||||||||||||||||||||||
| 953 | |||||||||||||||||||||||||||||||||||||||||||
| 954 | =head3 C<antiflood> | ||||||||||||||||||||||||||||||||||||||||||
| 955 | |||||||||||||||||||||||||||||||||||||||||||
| 956 | Takes two arguments, a connection id and true/false value. If value is | ||||||||||||||||||||||||||||||||||||||||||
| 957 | specified antiflood protection is enabled or disabled accordingly for the | ||||||||||||||||||||||||||||||||||||||||||
| 958 | specified connection. If a value is not specified the current status of | ||||||||||||||||||||||||||||||||||||||||||
| 959 | antiflood protection is returned. Returns undef on error. | ||||||||||||||||||||||||||||||||||||||||||
| 960 | |||||||||||||||||||||||||||||||||||||||||||
| 961 | =head3 C<compressed_link> | ||||||||||||||||||||||||||||||||||||||||||
| 962 | |||||||||||||||||||||||||||||||||||||||||||
| 963 | Takes two arguments, a connection id and true/false value. If a value is | ||||||||||||||||||||||||||||||||||||||||||
| 964 | specified, compression will be enabled or disabled accordingly for the | ||||||||||||||||||||||||||||||||||||||||||
| 965 | specified connection. If a value is not specified the current status of | ||||||||||||||||||||||||||||||||||||||||||
| 966 | compression is returned. Returns undef on error. | ||||||||||||||||||||||||||||||||||||||||||
| 967 | |||||||||||||||||||||||||||||||||||||||||||
| 968 | =head3 C<disconnect> | ||||||||||||||||||||||||||||||||||||||||||
| 969 | |||||||||||||||||||||||||||||||||||||||||||
| 970 | Requires on argument, the connection id you wish to disconnect. The | ||||||||||||||||||||||||||||||||||||||||||
| 971 | component will terminate the connection the next time that the wheel input | ||||||||||||||||||||||||||||||||||||||||||
| 972 | is flushed, so you may send some sort of error message to the client on | ||||||||||||||||||||||||||||||||||||||||||
| 973 | that connection. Returns true on success, undef on error. | ||||||||||||||||||||||||||||||||||||||||||
| 974 | |||||||||||||||||||||||||||||||||||||||||||
| 975 | =head3 C<connection_exists> | ||||||||||||||||||||||||||||||||||||||||||
| 976 | |||||||||||||||||||||||||||||||||||||||||||
| 977 | Requires one argument, a connection id. Returns true value if the connection | ||||||||||||||||||||||||||||||||||||||||||
| 978 | exists, false otherwise. | ||||||||||||||||||||||||||||||||||||||||||
| 979 | |||||||||||||||||||||||||||||||||||||||||||
| 980 | =head3 C<connection_info> | ||||||||||||||||||||||||||||||||||||||||||
| 981 | |||||||||||||||||||||||||||||||||||||||||||
| 982 | Takes one argument, a connection_id. Returns a list consisting of: the IP | ||||||||||||||||||||||||||||||||||||||||||
| 983 | address of the peer; the port on the peer; our socket address; our socket | ||||||||||||||||||||||||||||||||||||||||||
| 984 | port. Returns undef on error. | ||||||||||||||||||||||||||||||||||||||||||
| 985 | |||||||||||||||||||||||||||||||||||||||||||
| 986 | my ($peeraddr, $peerport, $sockaddr, $sockport) = $ircd->connection_info($conn_id); | ||||||||||||||||||||||||||||||||||||||||||
| 987 | |||||||||||||||||||||||||||||||||||||||||||
| 988 | =head3 C<add_denial> | ||||||||||||||||||||||||||||||||||||||||||
| 989 | |||||||||||||||||||||||||||||||||||||||||||
| 990 | Takes one mandatory argument and one optional. The first mandatory | ||||||||||||||||||||||||||||||||||||||||||
| 991 | argument is a L<Net::Netmask|Net::Netmask> object that will be used to | ||||||||||||||||||||||||||||||||||||||||||
| 992 | check connecting IP addresses against. The second optional argument is a | ||||||||||||||||||||||||||||||||||||||||||
| 993 | reason string for the denial. | ||||||||||||||||||||||||||||||||||||||||||
| 994 | |||||||||||||||||||||||||||||||||||||||||||
| 995 | =head3 C<del_denial> | ||||||||||||||||||||||||||||||||||||||||||
| 996 | |||||||||||||||||||||||||||||||||||||||||||
| 997 | Takes one mandatory argument, a L<Net::Netmask|Net::Netmask> object to | ||||||||||||||||||||||||||||||||||||||||||
| 998 | remove from the current denial list. | ||||||||||||||||||||||||||||||||||||||||||
| 999 | |||||||||||||||||||||||||||||||||||||||||||
| 1000 | =head3 C<denied> | ||||||||||||||||||||||||||||||||||||||||||
| 1001 | |||||||||||||||||||||||||||||||||||||||||||
| 1002 | Takes one argument, an IP address. Returns true or false depending on | ||||||||||||||||||||||||||||||||||||||||||
| 1003 | whether that IP is denied or not. | ||||||||||||||||||||||||||||||||||||||||||
| 1004 | |||||||||||||||||||||||||||||||||||||||||||
| 1005 | =head3 C<add_exemption> | ||||||||||||||||||||||||||||||||||||||||||
| 1006 | |||||||||||||||||||||||||||||||||||||||||||
| 1007 | Takes one mandatory argument, a L<Net::Netmask|Net::Netmask> object that | ||||||||||||||||||||||||||||||||||||||||||
| 1008 | will be checked against connecting IP addresses for exemption from denials. | ||||||||||||||||||||||||||||||||||||||||||
| 1009 | |||||||||||||||||||||||||||||||||||||||||||
| 1010 | =head3 C<del_exemption> | ||||||||||||||||||||||||||||||||||||||||||
| 1011 | |||||||||||||||||||||||||||||||||||||||||||
| 1012 | Takes one mandatory argument, a L<Net::Netmask|Net::Netmask> object to | ||||||||||||||||||||||||||||||||||||||||||
| 1013 | remove from the current exemption list. | ||||||||||||||||||||||||||||||||||||||||||
| 1014 | |||||||||||||||||||||||||||||||||||||||||||
| 1015 | =head3 C<exempted> | ||||||||||||||||||||||||||||||||||||||||||
| 1016 | |||||||||||||||||||||||||||||||||||||||||||
| 1017 | Takes one argument, an IP address. Returns true or false depending on | ||||||||||||||||||||||||||||||||||||||||||
| 1018 | whether that IP is exempt from denial or not. | ||||||||||||||||||||||||||||||||||||||||||
| 1019 | |||||||||||||||||||||||||||||||||||||||||||
| 1020 | =head2 Plugins | ||||||||||||||||||||||||||||||||||||||||||
| 1021 | |||||||||||||||||||||||||||||||||||||||||||
| 1022 | =head3 C<pipeline> | ||||||||||||||||||||||||||||||||||||||||||
| 1023 | |||||||||||||||||||||||||||||||||||||||||||
| 1024 | I<Inherited from L<Object::Pluggable|Object::Pluggable/pipeline>> | ||||||||||||||||||||||||||||||||||||||||||
| 1025 | |||||||||||||||||||||||||||||||||||||||||||
| 1026 | Returns the L<Object::Pluggable::Pipeline|Object::Pluggable::Pipeline> | ||||||||||||||||||||||||||||||||||||||||||
| 1027 | object. | ||||||||||||||||||||||||||||||||||||||||||
| 1028 | |||||||||||||||||||||||||||||||||||||||||||
| 1029 | =head3 C<plugin_add> | ||||||||||||||||||||||||||||||||||||||||||
| 1030 | |||||||||||||||||||||||||||||||||||||||||||
| 1031 | I<Inherited from L<Object::Pluggable|Object::Pluggable/plugin_add>> | ||||||||||||||||||||||||||||||||||||||||||
| 1032 | |||||||||||||||||||||||||||||||||||||||||||
| 1033 | Accepts two arguments: | ||||||||||||||||||||||||||||||||||||||||||
| 1034 | |||||||||||||||||||||||||||||||||||||||||||
| 1035 | The alias for the plugin | ||||||||||||||||||||||||||||||||||||||||||
| 1036 | The actual plugin object | ||||||||||||||||||||||||||||||||||||||||||
| 1037 | Any number of extra arguments | ||||||||||||||||||||||||||||||||||||||||||
| 1038 | |||||||||||||||||||||||||||||||||||||||||||
| 1039 | The alias is there for the user to refer to it, as it is possible to have | ||||||||||||||||||||||||||||||||||||||||||
| 1040 | multiple plugins of the same kind active in one Object::Pluggable object. | ||||||||||||||||||||||||||||||||||||||||||
| 1041 | |||||||||||||||||||||||||||||||||||||||||||
| 1042 | This method goes through the pipeline's C<push()> method, which will call | ||||||||||||||||||||||||||||||||||||||||||
| 1043 | C<< $plugin->plugin_register($pluggable, @args) >>. | ||||||||||||||||||||||||||||||||||||||||||
| 1044 | |||||||||||||||||||||||||||||||||||||||||||
| 1045 | Returns the number of plugins now in the pipeline if plugin was | ||||||||||||||||||||||||||||||||||||||||||
| 1046 | initialized, C<undef>/an empty list if not. | ||||||||||||||||||||||||||||||||||||||||||
| 1047 | |||||||||||||||||||||||||||||||||||||||||||
| 1048 | =head3 C<plugin_del> | ||||||||||||||||||||||||||||||||||||||||||
| 1049 | |||||||||||||||||||||||||||||||||||||||||||
| 1050 | I<Inherited from L<Object::Pluggable|Object::Pluggable/plugin_del>> | ||||||||||||||||||||||||||||||||||||||||||
| 1051 | |||||||||||||||||||||||||||||||||||||||||||
| 1052 | Accepts the following arguments: | ||||||||||||||||||||||||||||||||||||||||||
| 1053 | |||||||||||||||||||||||||||||||||||||||||||
| 1054 | The alias for the plugin or the plugin object itself | ||||||||||||||||||||||||||||||||||||||||||
| 1055 | Any number of extra arguments | ||||||||||||||||||||||||||||||||||||||||||
| 1056 | |||||||||||||||||||||||||||||||||||||||||||
| 1057 | This method goes through the pipeline's C<remove()> method, which will call | ||||||||||||||||||||||||||||||||||||||||||
| 1058 | C<< $plugin->plugin_unregister($pluggable, @args) >>. | ||||||||||||||||||||||||||||||||||||||||||
| 1059 | |||||||||||||||||||||||||||||||||||||||||||
| 1060 | Returns the plugin object if the plugin was removed, C<undef>/an empty list | ||||||||||||||||||||||||||||||||||||||||||
| 1061 | if not. | ||||||||||||||||||||||||||||||||||||||||||
| 1062 | |||||||||||||||||||||||||||||||||||||||||||
| 1063 | =head3 C<plugin_get> | ||||||||||||||||||||||||||||||||||||||||||
| 1064 | |||||||||||||||||||||||||||||||||||||||||||
| 1065 | I<Inherited from L<Object::Pluggable|Object::Pluggable/plugin_get>> | ||||||||||||||||||||||||||||||||||||||||||
| 1066 | |||||||||||||||||||||||||||||||||||||||||||
| 1067 | Accepts the following arguments: | ||||||||||||||||||||||||||||||||||||||||||
| 1068 | |||||||||||||||||||||||||||||||||||||||||||
| 1069 | The alias for the plugin | ||||||||||||||||||||||||||||||||||||||||||
| 1070 | |||||||||||||||||||||||||||||||||||||||||||
| 1071 | This method goes through the pipeline's C<get()> method. | ||||||||||||||||||||||||||||||||||||||||||
| 1072 | |||||||||||||||||||||||||||||||||||||||||||
| 1073 | Returns the plugin object if it was found, C<undef>/an empty list if not. | ||||||||||||||||||||||||||||||||||||||||||
| 1074 | |||||||||||||||||||||||||||||||||||||||||||
| 1075 | =head3 C<plugin_list> | ||||||||||||||||||||||||||||||||||||||||||
| 1076 | |||||||||||||||||||||||||||||||||||||||||||
| 1077 | I<Inherited from L<Object::Pluggable|Object::Pluggable/plugin_list>> | ||||||||||||||||||||||||||||||||||||||||||
| 1078 | |||||||||||||||||||||||||||||||||||||||||||
| 1079 | Takes no arguments. | ||||||||||||||||||||||||||||||||||||||||||
| 1080 | |||||||||||||||||||||||||||||||||||||||||||
| 1081 | Returns a hashref of plugin objects, keyed on alias, or an empty list if | ||||||||||||||||||||||||||||||||||||||||||
| 1082 | there are no plugins loaded. | ||||||||||||||||||||||||||||||||||||||||||
| 1083 | |||||||||||||||||||||||||||||||||||||||||||
| 1084 | =head3 C<plugin_order> | ||||||||||||||||||||||||||||||||||||||||||
| 1085 | |||||||||||||||||||||||||||||||||||||||||||
| 1086 | I<Inherited from L<Object::Pluggable|Object::Pluggable/plugin_order>> | ||||||||||||||||||||||||||||||||||||||||||
| 1087 | |||||||||||||||||||||||||||||||||||||||||||
| 1088 | Takes no arguments. | ||||||||||||||||||||||||||||||||||||||||||
| 1089 | |||||||||||||||||||||||||||||||||||||||||||
| 1090 | Returns an arrayref of plugin objects, in the order which they are | ||||||||||||||||||||||||||||||||||||||||||
| 1091 | encountered in the pipeline. | ||||||||||||||||||||||||||||||||||||||||||
| 1092 | |||||||||||||||||||||||||||||||||||||||||||
| 1093 | =head3 C<plugin_register> | ||||||||||||||||||||||||||||||||||||||||||
| 1094 | |||||||||||||||||||||||||||||||||||||||||||
| 1095 | I<Inherited from L<Object::Pluggable|Object::Pluggable/plugin_register>> | ||||||||||||||||||||||||||||||||||||||||||
| 1096 | |||||||||||||||||||||||||||||||||||||||||||
| 1097 | Accepts the following arguments: | ||||||||||||||||||||||||||||||||||||||||||
| 1098 | |||||||||||||||||||||||||||||||||||||||||||
| 1099 | The plugin object | ||||||||||||||||||||||||||||||||||||||||||
| 1100 | The type of the hook (the hook types are specified with _pluggable_init()'s 'types') | ||||||||||||||||||||||||||||||||||||||||||
| 1101 | The event name[s] to watch | ||||||||||||||||||||||||||||||||||||||||||
| 1102 | |||||||||||||||||||||||||||||||||||||||||||
| 1103 | The event names can be as many as possible, or an arrayref. They correspond | ||||||||||||||||||||||||||||||||||||||||||
| 1104 | to the prefixed events and naturally, arbitrary events too. | ||||||||||||||||||||||||||||||||||||||||||
| 1105 | |||||||||||||||||||||||||||||||||||||||||||
| 1106 | You do not need to supply events with the prefix in front of them, just the | ||||||||||||||||||||||||||||||||||||||||||
| 1107 | names. | ||||||||||||||||||||||||||||||||||||||||||
| 1108 | |||||||||||||||||||||||||||||||||||||||||||
| 1109 | It is possible to register for all events by specifying 'all' as an event. | ||||||||||||||||||||||||||||||||||||||||||
| 1110 | |||||||||||||||||||||||||||||||||||||||||||
| 1111 | Returns 1 if everything checked out fine, C<undef>/an empty list if | ||||||||||||||||||||||||||||||||||||||||||
| 1112 | something is seriously wrong. | ||||||||||||||||||||||||||||||||||||||||||
| 1113 | |||||||||||||||||||||||||||||||||||||||||||
| 1114 | =head3 C<plugin_unregister> | ||||||||||||||||||||||||||||||||||||||||||
| 1115 | |||||||||||||||||||||||||||||||||||||||||||
| 1116 | I<Inherited from L<Object::Pluggable|Object::Pluggable/plugin_unregister>> | ||||||||||||||||||||||||||||||||||||||||||
| 1117 | |||||||||||||||||||||||||||||||||||||||||||
| 1118 | Accepts the following arguments: | ||||||||||||||||||||||||||||||||||||||||||
| 1119 | |||||||||||||||||||||||||||||||||||||||||||
| 1120 | The plugin object | ||||||||||||||||||||||||||||||||||||||||||
| 1121 | The type of the hook (the hook types are specified with _pluggable_init()'s 'types') | ||||||||||||||||||||||||||||||||||||||||||
| 1122 | The event name[s] to unwatch | ||||||||||||||||||||||||||||||||||||||||||
| 1123 | |||||||||||||||||||||||||||||||||||||||||||
| 1124 | The event names can be as many as possible, or an arrayref. They correspond | ||||||||||||||||||||||||||||||||||||||||||
| 1125 | to the prefixed events and naturally, arbitrary events too. | ||||||||||||||||||||||||||||||||||||||||||
| 1126 | |||||||||||||||||||||||||||||||||||||||||||
| 1127 | You do not need to supply events with the prefix in front of them, just the | ||||||||||||||||||||||||||||||||||||||||||
| 1128 | names. | ||||||||||||||||||||||||||||||||||||||||||
| 1129 | |||||||||||||||||||||||||||||||||||||||||||
| 1130 | It is possible to register for all events by specifying 'all' as an event. | ||||||||||||||||||||||||||||||||||||||||||
| 1131 | |||||||||||||||||||||||||||||||||||||||||||
| 1132 | Returns 1 if all the event name[s] was unregistered, undef if some was not | ||||||||||||||||||||||||||||||||||||||||||
| 1133 | found. | ||||||||||||||||||||||||||||||||||||||||||
| 1134 | |||||||||||||||||||||||||||||||||||||||||||
| 1135 | =head1 INPUT EVENTS | ||||||||||||||||||||||||||||||||||||||||||
| 1136 | |||||||||||||||||||||||||||||||||||||||||||
| 1137 | These are POE events that the component will accept: | ||||||||||||||||||||||||||||||||||||||||||
| 1138 | |||||||||||||||||||||||||||||||||||||||||||
| 1139 | =head2 C<register> | ||||||||||||||||||||||||||||||||||||||||||
| 1140 | |||||||||||||||||||||||||||||||||||||||||||
| 1141 | I<Inherited from L<POE::Component::Syndicator|POE::Component::Syndicator/register>> | ||||||||||||||||||||||||||||||||||||||||||
| 1142 | |||||||||||||||||||||||||||||||||||||||||||
| 1143 | Takes N arguments: a list of event names that your session wants to listen | ||||||||||||||||||||||||||||||||||||||||||
| 1144 | for, minus the C<irc_> prefix. | ||||||||||||||||||||||||||||||||||||||||||
| 1145 | |||||||||||||||||||||||||||||||||||||||||||
| 1146 | $ircd->yield('register', qw(connected disconnected)); | ||||||||||||||||||||||||||||||||||||||||||
| 1147 | |||||||||||||||||||||||||||||||||||||||||||
| 1148 | The special argument 'all' will register your session for all events. | ||||||||||||||||||||||||||||||||||||||||||
| 1149 | Registering will generate an L<C<ircd_registered>|/ircd_registered> | ||||||||||||||||||||||||||||||||||||||||||
| 1150 | event that your session can trap. | ||||||||||||||||||||||||||||||||||||||||||
| 1151 | |||||||||||||||||||||||||||||||||||||||||||
| 1152 | =head2 C<unregister> | ||||||||||||||||||||||||||||||||||||||||||
| 1153 | |||||||||||||||||||||||||||||||||||||||||||
| 1154 | I<Inherited from L<POE::Component::Syndicator|POE::Component::Syndicator/unregister>> | ||||||||||||||||||||||||||||||||||||||||||
| 1155 | |||||||||||||||||||||||||||||||||||||||||||
| 1156 | Takes N arguments: a list of event names which you I<don't> want to | ||||||||||||||||||||||||||||||||||||||||||
| 1157 | receive. If you've previously done a L<C<register>|/register> | ||||||||||||||||||||||||||||||||||||||||||
| 1158 | for a particular event which you no longer care about, this event will | ||||||||||||||||||||||||||||||||||||||||||
| 1159 | tell the component to stop sending them to you. (If you haven't, it just | ||||||||||||||||||||||||||||||||||||||||||
| 1160 | ignores you. No big deal.) | ||||||||||||||||||||||||||||||||||||||||||
| 1161 | |||||||||||||||||||||||||||||||||||||||||||
| 1162 | If you have registered with 'all', attempting to unregister individual | ||||||||||||||||||||||||||||||||||||||||||
| 1163 | events such as 'connected', etc. will not work. This is a 'feature'. | ||||||||||||||||||||||||||||||||||||||||||
| 1164 | |||||||||||||||||||||||||||||||||||||||||||
| 1165 | =head2 C<add_listener> | ||||||||||||||||||||||||||||||||||||||||||
| 1166 | |||||||||||||||||||||||||||||||||||||||||||
| 1167 | Takes a number of arguments. Adds a new listener. | ||||||||||||||||||||||||||||||||||||||||||
| 1168 | |||||||||||||||||||||||||||||||||||||||||||
| 1169 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1170 | |||||||||||||||||||||||||||||||||||||||||||
| 1171 | =item * B<'port'>, the TCP port to listen on. Default is a random port; | ||||||||||||||||||||||||||||||||||||||||||
| 1172 | |||||||||||||||||||||||||||||||||||||||||||
| 1173 | =item * B<'auth'>, enable or disable auth sub-system for this listener. | ||||||||||||||||||||||||||||||||||||||||||
| 1174 | Enabled by default; | ||||||||||||||||||||||||||||||||||||||||||
| 1175 | |||||||||||||||||||||||||||||||||||||||||||
| 1176 | =item * B<'bindaddr'>, specify a local address to bind the listener to; | ||||||||||||||||||||||||||||||||||||||||||
| 1177 | |||||||||||||||||||||||||||||||||||||||||||
| 1178 | =item * B<'listenqueue'>, change the SocketFactory's ListenQueue; | ||||||||||||||||||||||||||||||||||||||||||
| 1179 | |||||||||||||||||||||||||||||||||||||||||||
| 1180 | =item * B<'usessl'>, whether the listener should use SSL. Default is | ||||||||||||||||||||||||||||||||||||||||||
| 1181 | false; | ||||||||||||||||||||||||||||||||||||||||||
| 1182 | |||||||||||||||||||||||||||||||||||||||||||
| 1183 | =item * B<'antiflood'>, whether the listener should use flood protection. | ||||||||||||||||||||||||||||||||||||||||||
| 1184 | Defaults is true; | ||||||||||||||||||||||||||||||||||||||||||
| 1185 | |||||||||||||||||||||||||||||||||||||||||||
| 1186 | =item * B<'idle'>, the time, in seconds, after which a connection will be | ||||||||||||||||||||||||||||||||||||||||||
| 1187 | considered idle. Defaults is 180. | ||||||||||||||||||||||||||||||||||||||||||
| 1188 | |||||||||||||||||||||||||||||||||||||||||||
| 1189 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1190 | |||||||||||||||||||||||||||||||||||||||||||
| 1191 | =head2 C<del_listener> | ||||||||||||||||||||||||||||||||||||||||||
| 1192 | |||||||||||||||||||||||||||||||||||||||||||
| 1193 | Takes one of the following arguments: | ||||||||||||||||||||||||||||||||||||||||||
| 1194 | |||||||||||||||||||||||||||||||||||||||||||
| 1195 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1196 | |||||||||||||||||||||||||||||||||||||||||||
| 1197 | =item * B<'listener'>, a previously returned listener ID; | ||||||||||||||||||||||||||||||||||||||||||
| 1198 | |||||||||||||||||||||||||||||||||||||||||||
| 1199 | =item * B<'port'>, a listening port; | ||||||||||||||||||||||||||||||||||||||||||
| 1200 | |||||||||||||||||||||||||||||||||||||||||||
| 1201 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1202 | |||||||||||||||||||||||||||||||||||||||||||
| 1203 | The listener will be deleted. Note: any connected clients on that port | ||||||||||||||||||||||||||||||||||||||||||
| 1204 | will not be disconnected. | ||||||||||||||||||||||||||||||||||||||||||
| 1205 | |||||||||||||||||||||||||||||||||||||||||||
| 1206 | =head2 C<add_connector> | ||||||||||||||||||||||||||||||||||||||||||
| 1207 | |||||||||||||||||||||||||||||||||||||||||||
| 1208 | Takes two mandatory arguments, B<'remoteaddress'> and B<'remoteport'>. | ||||||||||||||||||||||||||||||||||||||||||
| 1209 | Opens a TCP connection to specified address and port. | ||||||||||||||||||||||||||||||||||||||||||
| 1210 | |||||||||||||||||||||||||||||||||||||||||||
| 1211 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1212 | |||||||||||||||||||||||||||||||||||||||||||
| 1213 | =item * B<'remoteaddress'>, hostname or IP address to connect to; | ||||||||||||||||||||||||||||||||||||||||||
| 1214 | |||||||||||||||||||||||||||||||||||||||||||
| 1215 | =item * B<'remoteport'>, the TCP port on the remote host; | ||||||||||||||||||||||||||||||||||||||||||
| 1216 | |||||||||||||||||||||||||||||||||||||||||||
| 1217 | =item * B<'bindaddress'>, a local address to bind from (optional); | ||||||||||||||||||||||||||||||||||||||||||
| 1218 | |||||||||||||||||||||||||||||||||||||||||||
| 1219 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1220 | |||||||||||||||||||||||||||||||||||||||||||
| 1221 | =head2 C<send_output> | ||||||||||||||||||||||||||||||||||||||||||
| 1222 | |||||||||||||||||||||||||||||||||||||||||||
| 1223 | Takes a hashref and one or more connection IDs. | ||||||||||||||||||||||||||||||||||||||||||
| 1224 | |||||||||||||||||||||||||||||||||||||||||||
| 1225 | $ircd->yield( | ||||||||||||||||||||||||||||||||||||||||||
| 1226 | 'send_output', | ||||||||||||||||||||||||||||||||||||||||||
| 1227 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1228 | prefix => 'blah!~blah@blah.blah.blah', | ||||||||||||||||||||||||||||||||||||||||||
| 1229 | command => 'PRIVMSG', | ||||||||||||||||||||||||||||||||||||||||||
| 1230 | params => ['#moo', 'cows go moo, not fish :D'] | ||||||||||||||||||||||||||||||||||||||||||
| 1231 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 1232 | @list_of_connection_ids, | ||||||||||||||||||||||||||||||||||||||||||
| 1233 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 1234 | |||||||||||||||||||||||||||||||||||||||||||
| 1235 | =head2 C<shutdown> | ||||||||||||||||||||||||||||||||||||||||||
| 1236 | |||||||||||||||||||||||||||||||||||||||||||
| 1237 | I<Inherited from L<POE::Component::Syndicator|POE::Component::Syndicator/shutdown>> | ||||||||||||||||||||||||||||||||||||||||||
| 1238 | |||||||||||||||||||||||||||||||||||||||||||
| 1239 | Takes no arguments. Terminates the component. Removes all listeners and | ||||||||||||||||||||||||||||||||||||||||||
| 1240 | connectors. Disconnects all current client and server connections. | ||||||||||||||||||||||||||||||||||||||||||
| 1241 | |||||||||||||||||||||||||||||||||||||||||||
| 1242 | =head1 OUTPUT EVENTS | ||||||||||||||||||||||||||||||||||||||||||
| 1243 | |||||||||||||||||||||||||||||||||||||||||||
| 1244 | These following events are sent to interested sessions. | ||||||||||||||||||||||||||||||||||||||||||
| 1245 | |||||||||||||||||||||||||||||||||||||||||||
| 1246 | =head2 C<ircd_registered> | ||||||||||||||||||||||||||||||||||||||||||
| 1247 | |||||||||||||||||||||||||||||||||||||||||||
| 1248 | I<Inherited from L<POE::Component::Syndicator|POE::Component::Syndicator/syndicator_registered>> | ||||||||||||||||||||||||||||||||||||||||||
| 1249 | |||||||||||||||||||||||||||||||||||||||||||
| 1250 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 1251 | |||||||||||||||||||||||||||||||||||||||||||
| 1252 | =item Emitted: when a session registers with the component; | ||||||||||||||||||||||||||||||||||||||||||
| 1253 | |||||||||||||||||||||||||||||||||||||||||||
| 1254 | =item Target: the registering session; | ||||||||||||||||||||||||||||||||||||||||||
| 1255 | |||||||||||||||||||||||||||||||||||||||||||
| 1256 | =item Args: | ||||||||||||||||||||||||||||||||||||||||||
| 1257 | |||||||||||||||||||||||||||||||||||||||||||
| 1258 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1259 | |||||||||||||||||||||||||||||||||||||||||||
| 1260 | =item * C<ARG0>: the component's object; | ||||||||||||||||||||||||||||||||||||||||||
| 1261 | |||||||||||||||||||||||||||||||||||||||||||
| 1262 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1263 | |||||||||||||||||||||||||||||||||||||||||||
| 1264 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1265 | |||||||||||||||||||||||||||||||||||||||||||
| 1266 | =head2 C<ircd_connection> | ||||||||||||||||||||||||||||||||||||||||||
| 1267 | |||||||||||||||||||||||||||||||||||||||||||
| 1268 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 1269 | |||||||||||||||||||||||||||||||||||||||||||
| 1270 | =item Emitted: when a client connects to one of the component's listeners; | ||||||||||||||||||||||||||||||||||||||||||
| 1271 | |||||||||||||||||||||||||||||||||||||||||||
| 1272 | =item Target: all plugins and registered sessions | ||||||||||||||||||||||||||||||||||||||||||
| 1273 | |||||||||||||||||||||||||||||||||||||||||||
| 1274 | =item Args: | ||||||||||||||||||||||||||||||||||||||||||
| 1275 | |||||||||||||||||||||||||||||||||||||||||||
| 1276 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1277 | |||||||||||||||||||||||||||||||||||||||||||
| 1278 | =item * C<ARG0>: the conn id; | ||||||||||||||||||||||||||||||||||||||||||
| 1279 | |||||||||||||||||||||||||||||||||||||||||||
| 1280 | =item * C<ARG1>: their ip address; | ||||||||||||||||||||||||||||||||||||||||||
| 1281 | |||||||||||||||||||||||||||||||||||||||||||
| 1282 | =item * C<ARG2>: their tcp port; | ||||||||||||||||||||||||||||||||||||||||||
| 1283 | |||||||||||||||||||||||||||||||||||||||||||
| 1284 | =item * C<ARG3>: our ip address; | ||||||||||||||||||||||||||||||||||||||||||
| 1285 | |||||||||||||||||||||||||||||||||||||||||||
| 1286 | =item * C<ARG4>: our socket port; | ||||||||||||||||||||||||||||||||||||||||||
| 1287 | |||||||||||||||||||||||||||||||||||||||||||
| 1288 | =item * C<ARG5>: a boolean indicating whether the client needs to be authed | ||||||||||||||||||||||||||||||||||||||||||
| 1289 | |||||||||||||||||||||||||||||||||||||||||||
| 1290 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1291 | |||||||||||||||||||||||||||||||||||||||||||
| 1292 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1293 | |||||||||||||||||||||||||||||||||||||||||||
| 1294 | =head2 C<ircd_auth_done> | ||||||||||||||||||||||||||||||||||||||||||
| 1295 | |||||||||||||||||||||||||||||||||||||||||||
| 1296 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 1297 | |||||||||||||||||||||||||||||||||||||||||||
| 1298 | =item Emitted: after a client has connected and the component has validated | ||||||||||||||||||||||||||||||||||||||||||
| 1299 | hostname and ident; | ||||||||||||||||||||||||||||||||||||||||||
| 1300 | |||||||||||||||||||||||||||||||||||||||||||
| 1301 | =item Target: Target: all plugins and registered sessions; | ||||||||||||||||||||||||||||||||||||||||||
| 1302 | |||||||||||||||||||||||||||||||||||||||||||
| 1303 | =item Args: | ||||||||||||||||||||||||||||||||||||||||||
| 1304 | |||||||||||||||||||||||||||||||||||||||||||
| 1305 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1306 | |||||||||||||||||||||||||||||||||||||||||||
| 1307 | =item * C<ARG0>, the connection id; | ||||||||||||||||||||||||||||||||||||||||||
| 1308 | |||||||||||||||||||||||||||||||||||||||||||
| 1309 | =item * C<ARG1>, a HASHREF with the following keys: 'ident' and 'hostname'; | ||||||||||||||||||||||||||||||||||||||||||
| 1310 | |||||||||||||||||||||||||||||||||||||||||||
| 1311 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1312 | |||||||||||||||||||||||||||||||||||||||||||
| 1313 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1314 | |||||||||||||||||||||||||||||||||||||||||||
| 1315 | =head2 C<ircd_listener_add> | ||||||||||||||||||||||||||||||||||||||||||
| 1316 | |||||||||||||||||||||||||||||||||||||||||||
| 1317 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 1318 | |||||||||||||||||||||||||||||||||||||||||||
| 1319 | =item Emitted: on a successful L<C<add_listener>|/add_listener> call; | ||||||||||||||||||||||||||||||||||||||||||
| 1320 | |||||||||||||||||||||||||||||||||||||||||||
| 1321 | =item Target: all plugins and registered sessions; | ||||||||||||||||||||||||||||||||||||||||||
| 1322 | |||||||||||||||||||||||||||||||||||||||||||
| 1323 | =item Args: | ||||||||||||||||||||||||||||||||||||||||||
| 1324 | |||||||||||||||||||||||||||||||||||||||||||
| 1325 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1326 | |||||||||||||||||||||||||||||||||||||||||||
| 1327 | =item * C<ARG0>, the listening port; | ||||||||||||||||||||||||||||||||||||||||||
| 1328 | |||||||||||||||||||||||||||||||||||||||||||
| 1329 | =item * C<ARG1>, the listener id; | ||||||||||||||||||||||||||||||||||||||||||
| 1330 | |||||||||||||||||||||||||||||||||||||||||||
| 1331 | =item * C<ARG2>, the listening address; | ||||||||||||||||||||||||||||||||||||||||||
| 1332 | |||||||||||||||||||||||||||||||||||||||||||
| 1333 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1334 | |||||||||||||||||||||||||||||||||||||||||||
| 1335 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1336 | |||||||||||||||||||||||||||||||||||||||||||
| 1337 | =head2 C<ircd_listener_del> | ||||||||||||||||||||||||||||||||||||||||||
| 1338 | |||||||||||||||||||||||||||||||||||||||||||
| 1339 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 1340 | |||||||||||||||||||||||||||||||||||||||||||
| 1341 | =item Emitted: on a successful L<C<del_listener>|/del_listener> call; | ||||||||||||||||||||||||||||||||||||||||||
| 1342 | |||||||||||||||||||||||||||||||||||||||||||
| 1343 | =item Target: all plugins and registered sessions; | ||||||||||||||||||||||||||||||||||||||||||
| 1344 | |||||||||||||||||||||||||||||||||||||||||||
| 1345 | =item Args: | ||||||||||||||||||||||||||||||||||||||||||
| 1346 | |||||||||||||||||||||||||||||||||||||||||||
| 1347 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1348 | |||||||||||||||||||||||||||||||||||||||||||
| 1349 | =item * C<ARG0>, the listening port; | ||||||||||||||||||||||||||||||||||||||||||
| 1350 | |||||||||||||||||||||||||||||||||||||||||||
| 1351 | =item * C<ARG1>, the listener id; | ||||||||||||||||||||||||||||||||||||||||||
| 1352 | |||||||||||||||||||||||||||||||||||||||||||
| 1353 | =item * C<ARG2>, the listener address; | ||||||||||||||||||||||||||||||||||||||||||
| 1354 | |||||||||||||||||||||||||||||||||||||||||||
| 1355 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1356 | |||||||||||||||||||||||||||||||||||||||||||
| 1357 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1358 | |||||||||||||||||||||||||||||||||||||||||||
| 1359 | =head2 C<ircd_listener_failure> | ||||||||||||||||||||||||||||||||||||||||||
| 1360 | |||||||||||||||||||||||||||||||||||||||||||
| 1361 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 1362 | |||||||||||||||||||||||||||||||||||||||||||
| 1363 | =item Emitted: when a listener wheel fails; | ||||||||||||||||||||||||||||||||||||||||||
| 1364 | |||||||||||||||||||||||||||||||||||||||||||
| 1365 | =item Target: all plugins and registered sessions; | ||||||||||||||||||||||||||||||||||||||||||
| 1366 | |||||||||||||||||||||||||||||||||||||||||||
| 1367 | =item Args: | ||||||||||||||||||||||||||||||||||||||||||
| 1368 | |||||||||||||||||||||||||||||||||||||||||||
| 1369 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1370 | |||||||||||||||||||||||||||||||||||||||||||
| 1371 | =item * C<ARG0>, the listener id; | ||||||||||||||||||||||||||||||||||||||||||
| 1372 | |||||||||||||||||||||||||||||||||||||||||||
| 1373 | =item * C<ARG1>, the name of the operation that failed; | ||||||||||||||||||||||||||||||||||||||||||
| 1374 | |||||||||||||||||||||||||||||||||||||||||||
| 1375 | =item * C<ARG2>, numeric value for $!; | ||||||||||||||||||||||||||||||||||||||||||
| 1376 | |||||||||||||||||||||||||||||||||||||||||||
| 1377 | =item * C<ARG3>, string value for $!; | ||||||||||||||||||||||||||||||||||||||||||
| 1378 | |||||||||||||||||||||||||||||||||||||||||||
| 1379 | =item * C<ARG4>, the port it tried to listen on; | ||||||||||||||||||||||||||||||||||||||||||
| 1380 | |||||||||||||||||||||||||||||||||||||||||||
| 1381 | =item * C<ARG5>, the address it tried to listen on; | ||||||||||||||||||||||||||||||||||||||||||
| 1382 | |||||||||||||||||||||||||||||||||||||||||||
| 1383 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1384 | |||||||||||||||||||||||||||||||||||||||||||
| 1385 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1386 | |||||||||||||||||||||||||||||||||||||||||||
| 1387 | =head2 C<ircd_socketerr> | ||||||||||||||||||||||||||||||||||||||||||
| 1388 | |||||||||||||||||||||||||||||||||||||||||||
| 1389 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 1390 | |||||||||||||||||||||||||||||||||||||||||||
| 1391 | =item Emitted: on the failure of an L<C<add_connector>|/add_connector> call | ||||||||||||||||||||||||||||||||||||||||||
| 1392 | |||||||||||||||||||||||||||||||||||||||||||
| 1393 | =item Target: all plugins and registered sessions; | ||||||||||||||||||||||||||||||||||||||||||
| 1394 | |||||||||||||||||||||||||||||||||||||||||||
| 1395 | =item Args: | ||||||||||||||||||||||||||||||||||||||||||
| 1396 | |||||||||||||||||||||||||||||||||||||||||||
| 1397 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1398 | |||||||||||||||||||||||||||||||||||||||||||
| 1399 | =item * C<ARG0>, a HASHREF containing the params that add_connector() was | ||||||||||||||||||||||||||||||||||||||||||
| 1400 | called with; | ||||||||||||||||||||||||||||||||||||||||||
| 1401 | |||||||||||||||||||||||||||||||||||||||||||
| 1402 | =item * C<ARG1>, the name of the operation that failed; | ||||||||||||||||||||||||||||||||||||||||||
| 1403 | |||||||||||||||||||||||||||||||||||||||||||
| 1404 | =item * C<ARG2>, numeric value for $!; | ||||||||||||||||||||||||||||||||||||||||||
| 1405 | |||||||||||||||||||||||||||||||||||||||||||
| 1406 | =item * C<ARG3>, string value for $!; | ||||||||||||||||||||||||||||||||||||||||||
| 1407 | |||||||||||||||||||||||||||||||||||||||||||
| 1408 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1409 | |||||||||||||||||||||||||||||||||||||||||||
| 1410 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1411 | |||||||||||||||||||||||||||||||||||||||||||
| 1412 | =head2 C<ircd_connected> | ||||||||||||||||||||||||||||||||||||||||||
| 1413 | |||||||||||||||||||||||||||||||||||||||||||
| 1414 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 1415 | |||||||||||||||||||||||||||||||||||||||||||
| 1416 | =item Emitted: when the component establishes a connection with a peer; | ||||||||||||||||||||||||||||||||||||||||||
| 1417 | |||||||||||||||||||||||||||||||||||||||||||
| 1418 | =item Target: all plugins and registered sessions; | ||||||||||||||||||||||||||||||||||||||||||
| 1419 | |||||||||||||||||||||||||||||||||||||||||||
| 1420 | =item Args: | ||||||||||||||||||||||||||||||||||||||||||
| 1421 | |||||||||||||||||||||||||||||||||||||||||||
| 1422 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1423 | |||||||||||||||||||||||||||||||||||||||||||
| 1424 | =item * C<ARG0>, the connection id; | ||||||||||||||||||||||||||||||||||||||||||
| 1425 | |||||||||||||||||||||||||||||||||||||||||||
| 1426 | =item * C<ARG1>, their ip address; | ||||||||||||||||||||||||||||||||||||||||||
| 1427 | |||||||||||||||||||||||||||||||||||||||||||
| 1428 | =item * C<ARG2>, their tcp port; | ||||||||||||||||||||||||||||||||||||||||||
| 1429 | |||||||||||||||||||||||||||||||||||||||||||
| 1430 | =item * C<ARG3>, our ip address; | ||||||||||||||||||||||||||||||||||||||||||
| 1431 | |||||||||||||||||||||||||||||||||||||||||||
| 1432 | =item * C<ARG4>, our socket port; | ||||||||||||||||||||||||||||||||||||||||||
| 1433 | |||||||||||||||||||||||||||||||||||||||||||
| 1434 | =item * C<ARG5>, the peer's name; | ||||||||||||||||||||||||||||||||||||||||||
| 1435 | |||||||||||||||||||||||||||||||||||||||||||
| 1436 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1437 | |||||||||||||||||||||||||||||||||||||||||||
| 1438 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1439 | |||||||||||||||||||||||||||||||||||||||||||
| 1440 | =head2 C<ircd_connection_flood> | ||||||||||||||||||||||||||||||||||||||||||
| 1441 | |||||||||||||||||||||||||||||||||||||||||||
| 1442 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 1443 | |||||||||||||||||||||||||||||||||||||||||||
| 1444 | =item Emitted: when a client connection is flooded; | ||||||||||||||||||||||||||||||||||||||||||
| 1445 | |||||||||||||||||||||||||||||||||||||||||||
| 1446 | =item Target: all plugins and registered sessions; | ||||||||||||||||||||||||||||||||||||||||||
| 1447 | |||||||||||||||||||||||||||||||||||||||||||
| 1448 | =item Args: | ||||||||||||||||||||||||||||||||||||||||||
| 1449 | |||||||||||||||||||||||||||||||||||||||||||
| 1450 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1451 | |||||||||||||||||||||||||||||||||||||||||||
| 1452 | =item * C<ARG0>, the connection id; | ||||||||||||||||||||||||||||||||||||||||||
| 1453 | |||||||||||||||||||||||||||||||||||||||||||
| 1454 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1455 | |||||||||||||||||||||||||||||||||||||||||||
| 1456 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1457 | |||||||||||||||||||||||||||||||||||||||||||
| 1458 | =head2 C<ircd_connection_idle> | ||||||||||||||||||||||||||||||||||||||||||
| 1459 | |||||||||||||||||||||||||||||||||||||||||||
| 1460 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 1461 | |||||||||||||||||||||||||||||||||||||||||||
| 1462 | =item Emitted: when a client connection has not sent any data for a set | ||||||||||||||||||||||||||||||||||||||||||
| 1463 | period; | ||||||||||||||||||||||||||||||||||||||||||
| 1464 | |||||||||||||||||||||||||||||||||||||||||||
| 1465 | =item Target: all plugins and registered sessions; | ||||||||||||||||||||||||||||||||||||||||||
| 1466 | |||||||||||||||||||||||||||||||||||||||||||
| 1467 | =item Args: | ||||||||||||||||||||||||||||||||||||||||||
| 1468 | |||||||||||||||||||||||||||||||||||||||||||
| 1469 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1470 | |||||||||||||||||||||||||||||||||||||||||||
| 1471 | =item * C<ARG0>, the connection id; | ||||||||||||||||||||||||||||||||||||||||||
| 1472 | |||||||||||||||||||||||||||||||||||||||||||
| 1473 | =item * C<ARG1>, the number of seconds period we consider as idle; | ||||||||||||||||||||||||||||||||||||||||||
| 1474 | |||||||||||||||||||||||||||||||||||||||||||
| 1475 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1476 | |||||||||||||||||||||||||||||||||||||||||||
| 1477 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1478 | |||||||||||||||||||||||||||||||||||||||||||
| 1479 | =head2 C<ircd_compressed_conn> | ||||||||||||||||||||||||||||||||||||||||||
| 1480 | |||||||||||||||||||||||||||||||||||||||||||
| 1481 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 1482 | |||||||||||||||||||||||||||||||||||||||||||
| 1483 | =item Emitted: when compression has been enabled for a connection | ||||||||||||||||||||||||||||||||||||||||||
| 1484 | |||||||||||||||||||||||||||||||||||||||||||
| 1485 | =item Target: all plugins and registered sessions; | ||||||||||||||||||||||||||||||||||||||||||
| 1486 | |||||||||||||||||||||||||||||||||||||||||||
| 1487 | =item Args: | ||||||||||||||||||||||||||||||||||||||||||
| 1488 | |||||||||||||||||||||||||||||||||||||||||||
| 1489 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1490 | |||||||||||||||||||||||||||||||||||||||||||
| 1491 | =item * C<ARG0>, the connection id; | ||||||||||||||||||||||||||||||||||||||||||
| 1492 | |||||||||||||||||||||||||||||||||||||||||||
| 1493 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1494 | |||||||||||||||||||||||||||||||||||||||||||
| 1495 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1496 | |||||||||||||||||||||||||||||||||||||||||||
| 1497 | =head2 C<ircd_cmd_*> | ||||||||||||||||||||||||||||||||||||||||||
| 1498 | |||||||||||||||||||||||||||||||||||||||||||
| 1499 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 1500 | |||||||||||||||||||||||||||||||||||||||||||
| 1501 | =item Emitted: when a client or peer sends a valid IRC line to us; | ||||||||||||||||||||||||||||||||||||||||||
| 1502 | |||||||||||||||||||||||||||||||||||||||||||
| 1503 | =item Target: all plugins and registered sessions; | ||||||||||||||||||||||||||||||||||||||||||
| 1504 | |||||||||||||||||||||||||||||||||||||||||||
| 1505 | =item Args: | ||||||||||||||||||||||||||||||||||||||||||
| 1506 | |||||||||||||||||||||||||||||||||||||||||||
| 1507 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1508 | |||||||||||||||||||||||||||||||||||||||||||
| 1509 | =item * C<ARG0>, the connection id; | ||||||||||||||||||||||||||||||||||||||||||
| 1510 | |||||||||||||||||||||||||||||||||||||||||||
| 1511 | =item * C<ARG1>, a HASHREF containing the output record from | ||||||||||||||||||||||||||||||||||||||||||
| 1512 | POE::Filter::IRCD: | ||||||||||||||||||||||||||||||||||||||||||
| 1513 | |||||||||||||||||||||||||||||||||||||||||||
| 1514 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1515 | prefix => 'blah!~blah@blah.blah.blah', | ||||||||||||||||||||||||||||||||||||||||||
| 1516 | command => 'PRIVMSG', | ||||||||||||||||||||||||||||||||||||||||||
| 1517 | params => [ '#moo', 'cows go moo, not fish :D' ], | ||||||||||||||||||||||||||||||||||||||||||
| 1518 | raw_line => ':blah!~blah@blah.blah.blah.blah PRIVMSG #moo :cows go moo, not fish :D' | ||||||||||||||||||||||||||||||||||||||||||
| 1519 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1520 | |||||||||||||||||||||||||||||||||||||||||||
| 1521 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1522 | |||||||||||||||||||||||||||||||||||||||||||
| 1523 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1524 | |||||||||||||||||||||||||||||||||||||||||||
| 1525 | =head2 C<ircd_raw_input> | ||||||||||||||||||||||||||||||||||||||||||
| 1526 | |||||||||||||||||||||||||||||||||||||||||||
| 1527 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 1528 | |||||||||||||||||||||||||||||||||||||||||||
| 1529 | =item Emitted: when a line of input is received from a connection | ||||||||||||||||||||||||||||||||||||||||||
| 1530 | |||||||||||||||||||||||||||||||||||||||||||
| 1531 | =item Target: all plugins and registered sessions; | ||||||||||||||||||||||||||||||||||||||||||
| 1532 | |||||||||||||||||||||||||||||||||||||||||||
| 1533 | =item Args: | ||||||||||||||||||||||||||||||||||||||||||
| 1534 | |||||||||||||||||||||||||||||||||||||||||||
| 1535 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1536 | |||||||||||||||||||||||||||||||||||||||||||
| 1537 | =item * C<ARG0>, the connection id; | ||||||||||||||||||||||||||||||||||||||||||
| 1538 | |||||||||||||||||||||||||||||||||||||||||||
| 1539 | =item * C<ARG1>, the raw line of input | ||||||||||||||||||||||||||||||||||||||||||
| 1540 | |||||||||||||||||||||||||||||||||||||||||||
| 1541 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1542 | |||||||||||||||||||||||||||||||||||||||||||
| 1543 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1544 | |||||||||||||||||||||||||||||||||||||||||||
| 1545 | =head2 C<ircd_raw_output> | ||||||||||||||||||||||||||||||||||||||||||
| 1546 | |||||||||||||||||||||||||||||||||||||||||||
| 1547 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 1548 | |||||||||||||||||||||||||||||||||||||||||||
| 1549 | =item Emitted: when a line of output is sent over a connection | ||||||||||||||||||||||||||||||||||||||||||
| 1550 | |||||||||||||||||||||||||||||||||||||||||||
| 1551 | =item Target: all plugins and registered sessions; | ||||||||||||||||||||||||||||||||||||||||||
| 1552 | |||||||||||||||||||||||||||||||||||||||||||
| 1553 | =item Args: | ||||||||||||||||||||||||||||||||||||||||||
| 1554 | |||||||||||||||||||||||||||||||||||||||||||
| 1555 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1556 | |||||||||||||||||||||||||||||||||||||||||||
| 1557 | =item * C<ARG0>, the connection id; | ||||||||||||||||||||||||||||||||||||||||||
| 1558 | |||||||||||||||||||||||||||||||||||||||||||
| 1559 | =item * C<ARG1>, the raw line of output | ||||||||||||||||||||||||||||||||||||||||||
| 1560 | |||||||||||||||||||||||||||||||||||||||||||
| 1561 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1562 | |||||||||||||||||||||||||||||||||||||||||||
| 1563 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1564 | |||||||||||||||||||||||||||||||||||||||||||
| 1565 | =head2 C<ircd_disconnected> | ||||||||||||||||||||||||||||||||||||||||||
| 1566 | |||||||||||||||||||||||||||||||||||||||||||
| 1567 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 1568 | |||||||||||||||||||||||||||||||||||||||||||
| 1569 | =item Emitted: when a client disconnects; | ||||||||||||||||||||||||||||||||||||||||||
| 1570 | |||||||||||||||||||||||||||||||||||||||||||
| 1571 | =item Target: all plugins and registered sessions; | ||||||||||||||||||||||||||||||||||||||||||
| 1572 | |||||||||||||||||||||||||||||||||||||||||||
| 1573 | =item Args: | ||||||||||||||||||||||||||||||||||||||||||
| 1574 | |||||||||||||||||||||||||||||||||||||||||||
| 1575 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1576 | |||||||||||||||||||||||||||||||||||||||||||
| 1577 | =item * C<ARG0>, the connection id; | ||||||||||||||||||||||||||||||||||||||||||
| 1578 | |||||||||||||||||||||||||||||||||||||||||||
| 1579 | =item * C<ARG1>, the error or reason for disconnection; | ||||||||||||||||||||||||||||||||||||||||||
| 1580 | |||||||||||||||||||||||||||||||||||||||||||
| 1581 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1582 | |||||||||||||||||||||||||||||||||||||||||||
| 1583 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1584 | |||||||||||||||||||||||||||||||||||||||||||
| 1585 | =head2 C<ircd_shutdown> | ||||||||||||||||||||||||||||||||||||||||||
| 1586 | |||||||||||||||||||||||||||||||||||||||||||
| 1587 | I<Inherited from L<POE::Component::Syndicator|POE::Component::Syndicator/syndicator_shutdown>> | ||||||||||||||||||||||||||||||||||||||||||
| 1588 | |||||||||||||||||||||||||||||||||||||||||||
| 1589 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 1590 | |||||||||||||||||||||||||||||||||||||||||||
| 1591 | =item Emitted: when the component has been asked to L<C<shutdown>|/shutdown> | ||||||||||||||||||||||||||||||||||||||||||
| 1592 | |||||||||||||||||||||||||||||||||||||||||||
| 1593 | =item Target: all registered sessions; | ||||||||||||||||||||||||||||||||||||||||||
| 1594 | |||||||||||||||||||||||||||||||||||||||||||
| 1595 | =item Args: | ||||||||||||||||||||||||||||||||||||||||||
| 1596 | |||||||||||||||||||||||||||||||||||||||||||
| 1597 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1598 | |||||||||||||||||||||||||||||||||||||||||||
| 1599 | =item * C<ARG0>: the session ID of the requesting component | ||||||||||||||||||||||||||||||||||||||||||
| 1600 | |||||||||||||||||||||||||||||||||||||||||||
| 1601 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1602 | |||||||||||||||||||||||||||||||||||||||||||
| 1603 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1604 | |||||||||||||||||||||||||||||||||||||||||||
| 1605 | =head2 C<ircd_delay_set> | ||||||||||||||||||||||||||||||||||||||||||
| 1606 | |||||||||||||||||||||||||||||||||||||||||||
| 1607 | I<Inherited from L<POE::Component::Syndicator|POE::Component::Syndicator/syndicator_delay_set>> | ||||||||||||||||||||||||||||||||||||||||||
| 1608 | |||||||||||||||||||||||||||||||||||||||||||
| 1609 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 1610 | |||||||||||||||||||||||||||||||||||||||||||
| 1611 | =item Emitted: on a successful addition of a delayed event using the | ||||||||||||||||||||||||||||||||||||||||||
| 1612 | L<C<delay>|/delay> method | ||||||||||||||||||||||||||||||||||||||||||
| 1613 | |||||||||||||||||||||||||||||||||||||||||||
| 1614 | =item Target: all plugins and registered sessions; | ||||||||||||||||||||||||||||||||||||||||||
| 1615 | |||||||||||||||||||||||||||||||||||||||||||
| 1616 | =item Args: | ||||||||||||||||||||||||||||||||||||||||||
| 1617 | |||||||||||||||||||||||||||||||||||||||||||
| 1618 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1619 | |||||||||||||||||||||||||||||||||||||||||||
| 1620 | =item * C<ARG0>: the alarm id which can be used later with | ||||||||||||||||||||||||||||||||||||||||||
| 1621 | L<C<delay_remove>|/delay_remove> | ||||||||||||||||||||||||||||||||||||||||||
| 1622 | |||||||||||||||||||||||||||||||||||||||||||
| 1623 | =item * C<ARG1..$#_>: subsequent arguments are those which were passed to | ||||||||||||||||||||||||||||||||||||||||||
| 1624 | L<C<delay>|/delay> | ||||||||||||||||||||||||||||||||||||||||||
| 1625 | |||||||||||||||||||||||||||||||||||||||||||
| 1626 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1627 | |||||||||||||||||||||||||||||||||||||||||||
| 1628 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1629 | |||||||||||||||||||||||||||||||||||||||||||
| 1630 | =head2 C<ircd_delay_removed> | ||||||||||||||||||||||||||||||||||||||||||
| 1631 | |||||||||||||||||||||||||||||||||||||||||||
| 1632 | I<Inherited from L<POE::Component::Syndicator|POE::Component::Syndicator/syndicator_delay_removed>> | ||||||||||||||||||||||||||||||||||||||||||
| 1633 | |||||||||||||||||||||||||||||||||||||||||||
| 1634 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 1635 | |||||||||||||||||||||||||||||||||||||||||||
| 1636 | =item Emitted: when a delayed command is successfully removed | ||||||||||||||||||||||||||||||||||||||||||
| 1637 | |||||||||||||||||||||||||||||||||||||||||||
| 1638 | =item Target: all plugins and registered sessions; | ||||||||||||||||||||||||||||||||||||||||||
| 1639 | |||||||||||||||||||||||||||||||||||||||||||
| 1640 | =item Args: | ||||||||||||||||||||||||||||||||||||||||||
| 1641 | |||||||||||||||||||||||||||||||||||||||||||
| 1642 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1643 | |||||||||||||||||||||||||||||||||||||||||||
| 1644 | =item * C<ARG0>: the alarm id which was removed | ||||||||||||||||||||||||||||||||||||||||||
| 1645 | |||||||||||||||||||||||||||||||||||||||||||
| 1646 | =item * C<ARG1..$#_>: subsequent arguments are those which were passed to | ||||||||||||||||||||||||||||||||||||||||||
| 1647 | L<C<delay>|/delay> | ||||||||||||||||||||||||||||||||||||||||||
| 1648 | |||||||||||||||||||||||||||||||||||||||||||
| 1649 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1650 | |||||||||||||||||||||||||||||||||||||||||||
| 1651 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1652 | |||||||||||||||||||||||||||||||||||||||||||
| 1653 | =head2 C<ircd_plugin_add> | ||||||||||||||||||||||||||||||||||||||||||
| 1654 | |||||||||||||||||||||||||||||||||||||||||||
| 1655 | I<Inherited from L<Object::Pluggable|Object::Pluggable/_pluggable_event>> | ||||||||||||||||||||||||||||||||||||||||||
| 1656 | |||||||||||||||||||||||||||||||||||||||||||
| 1657 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 1658 | |||||||||||||||||||||||||||||||||||||||||||
| 1659 | =item Emitted: when a new plugin is added to the pipeline | ||||||||||||||||||||||||||||||||||||||||||
| 1660 | |||||||||||||||||||||||||||||||||||||||||||
| 1661 | =item Target: all plugins and registered sessions; | ||||||||||||||||||||||||||||||||||||||||||
| 1662 | |||||||||||||||||||||||||||||||||||||||||||
| 1663 | =item Args: | ||||||||||||||||||||||||||||||||||||||||||
| 1664 | |||||||||||||||||||||||||||||||||||||||||||
| 1665 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1666 | |||||||||||||||||||||||||||||||||||||||||||
| 1667 | =item * C<ARG0>: the plugin alias | ||||||||||||||||||||||||||||||||||||||||||
| 1668 | |||||||||||||||||||||||||||||||||||||||||||
| 1669 | =item * C<ARG1>: the plugin object | ||||||||||||||||||||||||||||||||||||||||||
| 1670 | |||||||||||||||||||||||||||||||||||||||||||
| 1671 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1672 | |||||||||||||||||||||||||||||||||||||||||||
| 1673 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1674 | |||||||||||||||||||||||||||||||||||||||||||
| 1675 | =head2 C<ircd_plugin_del> | ||||||||||||||||||||||||||||||||||||||||||
| 1676 | |||||||||||||||||||||||||||||||||||||||||||
| 1677 | I<Inherited from L<Object::Pluggable|Object::Pluggable/_pluggable_event>> | ||||||||||||||||||||||||||||||||||||||||||
| 1678 | |||||||||||||||||||||||||||||||||||||||||||
| 1679 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 1680 | |||||||||||||||||||||||||||||||||||||||||||
| 1681 | =item Emitted: when a plugin is removed from the pipeline | ||||||||||||||||||||||||||||||||||||||||||
| 1682 | |||||||||||||||||||||||||||||||||||||||||||
| 1683 | =item Target: all plugins and registered sessions; | ||||||||||||||||||||||||||||||||||||||||||
| 1684 | |||||||||||||||||||||||||||||||||||||||||||
| 1685 | =item Args: | ||||||||||||||||||||||||||||||||||||||||||
| 1686 | |||||||||||||||||||||||||||||||||||||||||||
| 1687 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1688 | |||||||||||||||||||||||||||||||||||||||||||
| 1689 | =item * C<ARG0>: the plugin alias | ||||||||||||||||||||||||||||||||||||||||||
| 1690 | |||||||||||||||||||||||||||||||||||||||||||
| 1691 | =item * C<ARG1>: the plugin object | ||||||||||||||||||||||||||||||||||||||||||
| 1692 | |||||||||||||||||||||||||||||||||||||||||||
| 1693 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1694 | |||||||||||||||||||||||||||||||||||||||||||
| 1695 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1696 | |||||||||||||||||||||||||||||||||||||||||||
| 1697 | =head2 C<ircd_plugin_error> | ||||||||||||||||||||||||||||||||||||||||||
| 1698 | |||||||||||||||||||||||||||||||||||||||||||
| 1699 | I<Inherited from L<Object::Pluggable|Object::Pluggable/_pluggable_event>> | ||||||||||||||||||||||||||||||||||||||||||
| 1700 | |||||||||||||||||||||||||||||||||||||||||||
| 1701 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 1702 | |||||||||||||||||||||||||||||||||||||||||||
| 1703 | =item Emitted: when an error occurs while executing a plugin handler | ||||||||||||||||||||||||||||||||||||||||||
| 1704 | |||||||||||||||||||||||||||||||||||||||||||
| 1705 | =item Target: all plugins and registered sessions; | ||||||||||||||||||||||||||||||||||||||||||
| 1706 | |||||||||||||||||||||||||||||||||||||||||||
| 1707 | =item Args: | ||||||||||||||||||||||||||||||||||||||||||
| 1708 | |||||||||||||||||||||||||||||||||||||||||||
| 1709 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1710 | |||||||||||||||||||||||||||||||||||||||||||
| 1711 | =item * C<ARG0>: the error message | ||||||||||||||||||||||||||||||||||||||||||
| 1712 | |||||||||||||||||||||||||||||||||||||||||||
| 1713 | =item * C<ARG1>: the plugin alias | ||||||||||||||||||||||||||||||||||||||||||
| 1714 | |||||||||||||||||||||||||||||||||||||||||||
| 1715 | =item * C<ARG2>: the plugin object | ||||||||||||||||||||||||||||||||||||||||||
| 1716 | |||||||||||||||||||||||||||||||||||||||||||
| 1717 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1718 | |||||||||||||||||||||||||||||||||||||||||||
| 1719 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1720 | |||||||||||||||||||||||||||||||||||||||||||
| 1721 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||||||||
| 1722 | |||||||||||||||||||||||||||||||||||||||||||
| 1723 | Chris 'BinGOs' Williams | ||||||||||||||||||||||||||||||||||||||||||
| 1724 | |||||||||||||||||||||||||||||||||||||||||||
| 1725 | =head1 LICENSE | ||||||||||||||||||||||||||||||||||||||||||
| 1726 | |||||||||||||||||||||||||||||||||||||||||||
| 1727 | Copyright E<copy> Chris Williams | ||||||||||||||||||||||||||||||||||||||||||
| 1728 | |||||||||||||||||||||||||||||||||||||||||||
| 1729 | This module may be used, modified, and distributed under the same terms as | ||||||||||||||||||||||||||||||||||||||||||
| 1730 | Perl itself. Please see the license that came with your Perl distribution | ||||||||||||||||||||||||||||||||||||||||||
| 1731 | for details. | ||||||||||||||||||||||||||||||||||||||||||
| 1732 | |||||||||||||||||||||||||||||||||||||||||||
| 1733 | =head1 SEE ALSO | ||||||||||||||||||||||||||||||||||||||||||
| 1734 | |||||||||||||||||||||||||||||||||||||||||||
| 1735 | L<POE|POE> | ||||||||||||||||||||||||||||||||||||||||||
| 1736 | |||||||||||||||||||||||||||||||||||||||||||
| 1737 | L<POE::Filter::IRCD|POE::Filter::IRCD> | ||||||||||||||||||||||||||||||||||||||||||
| 1738 | |||||||||||||||||||||||||||||||||||||||||||
| 1739 | L<POE::Component::Server::IRC|POE::Component::Server::IRC> | ||||||||||||||||||||||||||||||||||||||||||
| 1740 | |||||||||||||||||||||||||||||||||||||||||||
| 1741 | =cut | ||||||||||||||||||||||||||||||||||||||||||