« blib/lib/POE/Component/Server/IRC/Plugin/OperServ.pm
↑ Summary
blib/lib/POE/Component/Server/IRC/Common.pm »
| 1 | package POE::Component::Server::IRC::Backend; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | 180 | our $AUTHORITY = 'cpan:BINGOS'; | |||||||||||||||||||||||||||||||||||||||||
| 3 | 180 | $POE::Component::Server::IRC::Backend::VERSION = '1.62'; | |||||||||||||||||||||||||||||||||||||||||
| 4 | 180 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | 180 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | 180 | ▶ | use Carp qw(carp croak); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | 180 | ▶ | use List::Util qw(first); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | 180 | use POE qw(Wheel::SocketFactory Wheel::ReadWrite Filter::Stackable | |||||||||||||||||||||||||||||||||||||||||
| 9 | 180 | ▶ | Filter::Line Filter::IRCD Filter::ThruPut); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | 180 | ▶ | use Net::Netmask; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | 180 | ▶ | use Net::CIDR (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 12 | 180 | ▶ | use Net::IP::Minimal qw[ip_is_ipv6]; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 13 | 180 | ▶ | use Socket qw(getnameinfo NI_NUMERICHOST NI_NUMERICSERV AF_INET6); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 14 | 180 | ▶ | use base qw(POE::Component::Syndicator); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||
| 16 | use constant { | ||||||||||||||||||||||||||||||||||||||||||
| 17 | 180 | OBJECT_STATES_HASHREF => { | |||||||||||||||||||||||||||||||||||||||||
| 18 | syndicator_started => '_start', | ||||||||||||||||||||||||||||||||||||||||||
| 19 | add_connector => '_add_connector', | ||||||||||||||||||||||||||||||||||||||||||
| 20 | add_listener => '_add_listener', | ||||||||||||||||||||||||||||||||||||||||||
| 21 | del_listener => '_del_listener', | ||||||||||||||||||||||||||||||||||||||||||
| 22 | send_output => '_send_output', | ||||||||||||||||||||||||||||||||||||||||||
| 23 | shutdown => '_shutdown', | ||||||||||||||||||||||||||||||||||||||||||
| 24 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 25 | OBJECT_STATES_ARRAYREF => [qw( | ||||||||||||||||||||||||||||||||||||||||||
| 26 | _accept_connection | ||||||||||||||||||||||||||||||||||||||||||
| 27 | _accept_failed | ||||||||||||||||||||||||||||||||||||||||||
| 28 | _conn_alarm | ||||||||||||||||||||||||||||||||||||||||||
| 29 | _conn_input | ||||||||||||||||||||||||||||||||||||||||||
| 30 | _conn_error | ||||||||||||||||||||||||||||||||||||||||||
| 31 | _conn_flushed | ||||||||||||||||||||||||||||||||||||||||||
| 32 | _event_dispatcher | ||||||||||||||||||||||||||||||||||||||||||
| 33 | _sock_failed | ||||||||||||||||||||||||||||||||||||||||||
| 34 | _sock_up | ||||||||||||||||||||||||||||||||||||||||||
| 35 | _sock_ssl | ||||||||||||||||||||||||||||||||||||||||||
| 36 | )], | ||||||||||||||||||||||||||||||||||||||||||
| 37 | 180 | ▶ | }; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||
| 39 | sub create { | ||||||||||||||||||||||||||||||||||||||||||
| 40 | 180 | ▶ | my $package = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
create: called CC=17 SCAR=29.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 41 | 180 | ▶ | croak("$package requires an even number of parameters") if @_ & 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 42 | 180 | my %args = @_; | |||||||||||||||||||||||||||||||||||||||||
| 43 | 180 | $args{ lc $_ } = delete $args{$_} for keys %args; | |||||||||||||||||||||||||||||||||||||||||
| 44 | 180 | my $self = bless { }, $package; | |||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||
| 46 | 180 | ▶ | $self->{raw_events} = $args{raw_events} if defined $args{raw_events}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 47 | $self->{prefix} = defined $args{prefix} | ||||||||||||||||||||||||||||||||||||||||||
| 48 | ? $args{prefix} | ||||||||||||||||||||||||||||||||||||||||||
| 49 | 180 | ▶ | : 'ircd_'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 50 | $self->{antiflood} = defined $args{antiflood} | ||||||||||||||||||||||||||||||||||||||||||
| 51 | ? $args{antiflood} | ||||||||||||||||||||||||||||||||||||||||||
| 52 | 180 | ▶ | : 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||
| 54 | $self->{auth} = defined $args{auth} | ||||||||||||||||||||||||||||||||||||||||||
| 55 | ? $args{auth} | ||||||||||||||||||||||||||||||||||||||||||
| 56 | 180 | ▶ | : 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||
| 58 | 180 | ▶ | 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"
| |||||||||||||||||||||||||||||||||||||||||||
| 59 | 9 | eval { | |||||||||||||||||||||||||||||||||||||||||
| 60 | 9 | require POE::Component::SSLify; | |||||||||||||||||||||||||||||||||||||||||
| 61 | 9 | POE::Component::SSLify->import( | |||||||||||||||||||||||||||||||||||||||||
| 62 | qw(SSLify_GetCTX SSLify_Options Server_SSLify Client_SSLify SSLify_ContextCreate) | ||||||||||||||||||||||||||||||||||||||||||
| 63 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 64 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 65 | 9 | chomp $@; | |||||||||||||||||||||||||||||||||||||||||
| 66 | 9 | ▶ | croak("Can't use ssl: $@") if $@; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||
| 68 | 9 | eval { | |||||||||||||||||||||||||||||||||||||||||
| 69 | 9 | SSLify_Options(@{ $args{sslify_options} }); | |||||||||||||||||||||||||||||||||||||||||
| 70 | 9 | my $ctx = SSLify_GetCTX(); | |||||||||||||||||||||||||||||||||||||||||
| 71 | 9 | require Net::SSLeay; | |||||||||||||||||||||||||||||||||||||||||
| 72 | 9 | ▶ | Net::SSLeay::CTX_set_verify( $ctx, 0x01, sub { return 1; } ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 73 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 74 | 9 | chomp $@; | |||||||||||||||||||||||||||||||||||||||||
| 75 | 9 | ▶ | croak("Can't use ssl: $@") if $@; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 76 | 9 | $self->{got_ssl} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||
| 79 | 180 | ▶ | if ($args{states}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 80 | 179 | my $error = $self->_validate_states($args{states}); | |||||||||||||||||||||||||||||||||||||||||
| 81 | 179 | ▶ | croak($error) if defined $error; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||
| 84 | $self->_syndicator_init( | ||||||||||||||||||||||||||||||||||||||||||
| 85 | prefix => $self->{prefix}, | ||||||||||||||||||||||||||||||||||||||||||
| 86 | reg_prefix => 'PCSI_', | ||||||||||||||||||||||||||||||||||||||||||
| 87 | types => [ SERVER => 'IRCD', USER => 'U' ], | ||||||||||||||||||||||||||||||||||||||||||
| 88 | object_states => [ | ||||||||||||||||||||||||||||||||||||||||||
| 89 | $self => OBJECT_STATES_HASHREF, | ||||||||||||||||||||||||||||||||||||||||||
| 90 | $self => OBJECT_STATES_ARRAYREF, | ||||||||||||||||||||||||||||||||||||||||||
| 91 | ($args{states} | ||||||||||||||||||||||||||||||||||||||||||
| 92 | 358 | ▶ | ? map { $self => $_ } @{ $args{states} } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 93 | : () | ||||||||||||||||||||||||||||||||||||||||||
| 94 | ), | ||||||||||||||||||||||||||||||||||||||||||
| 95 | ], | ||||||||||||||||||||||||||||||||||||||||||
| 96 | ($args{plugin_debug} ? (debug => 1) : () ), | ||||||||||||||||||||||||||||||||||||||||||
| 97 | 180 | ▶ | (ref $args{options} eq 'HASH' ? (options => $args{options}) : ()), | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 98 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||
| 100 | 180 | ▶ | if ($self->{auth}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 101 | 1 | require POE::Component::Server::IRC::Plugin::Auth; | |||||||||||||||||||||||||||||||||||||||||
| 102 | $self->plugin_add( | ||||||||||||||||||||||||||||||||||||||||||
| 103 | 'Auth_'.$self->session_id(), | ||||||||||||||||||||||||||||||||||||||||||
| 104 | POE::Component::Server::IRC::Plugin::Auth->new( | ||||||||||||||||||||||||||||||||||||||||||
| 105 | identport => $args{identport}, | ||||||||||||||||||||||||||||||||||||||||||
| 106 | 1 | ), | |||||||||||||||||||||||||||||||||||||||||
| 107 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 108 | } | ||||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||
| 110 | 180 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 111 | } | ||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||
| 113 | sub _validate_states { | ||||||||||||||||||||||||||||||||||||||||||
| 114 | 179 | ▶ | my ($self, $states) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_validate_states: called CC=10 SCAR=25.9
| |||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||
| 116 | 179 | for my $events (@$states) { | |||||||||||||||||||||||||||||||||||||||||
| 117 | 358 | ▶ | if (ref $events eq 'HASH') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 118 | 179 | for my $event (keys %$events) { | |||||||||||||||||||||||||||||||||||||||||
| 119 | 3938 | ▶ | 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","_sock_ssl"];})
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","_sock_ssl"];})
{"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","_sock_ssl"];})
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","_sock_ssl"];})
| |||||||||||||||||||||||||||||||||||||||||||
| 120 | 3938 | ▶ | || first { $event eq $_ } @{ +OBJECT_STATES_ARRAYREF }) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | return "Event $event is reserved by ". __PACKAGE__; | |||||||||||||||||||||||||||||||||||||||||
| 122 | } | ||||||||||||||||||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||||||||||||||||
| 124 | } | ||||||||||||||||||||||||||||||||||||||||||
| 125 | elsif (ref $events eq 'ARRAY') { | ||||||||||||||||||||||||||||||||||||||||||
| 126 | 179 | for my $event (@$events) { | |||||||||||||||||||||||||||||||||||||||||
| 127 | 716 | ▶ | 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","_sock_ssl"];})
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","_sock_ssl"];})
{"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","_sock_ssl"];})
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","_sock_ssl"];})
| |||||||||||||||||||||||||||||||||||||||||||
| 128 | 716 | ▶ | || first { $event eq $_ } @{ +OBJECT_STATES_ARRAYREF }) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | return "Event $event is reserved by ". __PACKAGE__; | |||||||||||||||||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||
| 135 | 179 | return; | |||||||||||||||||||||||||||||||||||||||||
| 136 | } | ||||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||
| 138 | sub _start { | ||||||||||||||||||||||||||||||||||||||||||
| 139 | 180 | ▶ | my ($kernel, $self, $sender) = @_[KERNEL, OBJECT, SENDER]; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_start: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||
| 141 | 180 | $self->{ircd_filter} = POE::Filter::IRCD->new( | |||||||||||||||||||||||||||||||||||||||||
| 142 | colonify => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 143 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 144 | 180 | $self->{line_filter} = POE::Filter::Line->new( | |||||||||||||||||||||||||||||||||||||||||
| 145 | InputRegexp => '\015?\012', | ||||||||||||||||||||||||||||||||||||||||||
| 146 | OutputLiteral => "\015\012", | ||||||||||||||||||||||||||||||||||||||||||
| 147 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 148 | $self->{filter} = POE::Filter::Stackable->new( | ||||||||||||||||||||||||||||||||||||||||||
| 149 | 180 | Filters => [$self->{line_filter}, $self->{ircd_filter}], | |||||||||||||||||||||||||||||||||||||||||
| 150 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||||||||||||
| 152 | 180 | return; | |||||||||||||||||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||
| 155 | sub raw_events { | ||||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | ▶ | my ($self, $value) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
raw_events: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | ▶ | $self->{raw_events} = 1 if $value; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 158 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||
| 161 | sub shutdown { | ||||||||||||||||||||||||||||||||||||||||||
| 162 | 1 | ▶ | my ($self) = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
shutdown: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 163 | 1 | $self->yield('shutdown', @_); | |||||||||||||||||||||||||||||||||||||||||
| 164 | 1 | return; | |||||||||||||||||||||||||||||||||||||||||
| 165 | } | ||||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||
| 167 | sub _shutdown { | ||||||||||||||||||||||||||||||||||||||||||
| 168 | 193 | ▶ | my ($kernel, $self) = @_[KERNEL, OBJECT]; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_shutdown: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||||||||||
| 170 | 193 | $self->{terminating} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 171 | 193 | delete $self->{listeners}; | |||||||||||||||||||||||||||||||||||||||||
| 172 | 193 | delete $self->{connectors}; | |||||||||||||||||||||||||||||||||||||||||
| 173 | 193 | delete $self->{wheels}; | |||||||||||||||||||||||||||||||||||||||||
| 174 | 193 | $self->_syndicator_destroy(); | |||||||||||||||||||||||||||||||||||||||||
| 175 | 193 | return; | |||||||||||||||||||||||||||||||||||||||||
| 176 | } | ||||||||||||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||||||||||
| 178 | sub _accept_failed { | ||||||||||||||||||||||||||||||||||||||||||
| 179 | 0 | ▶ | my ($kernel, $self, $operation, $errnum, $errstr, $listener_id) | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_accept_failed: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 180 | = @_[KERNEL, OBJECT, ARG0..ARG3]; | ||||||||||||||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||||||||||||||
| 182 | 0 | my $port = $self->{listeners}{$listener_id}{port}; | |||||||||||||||||||||||||||||||||||||||||
| 183 | 0 | my $addr = $self->{listeners}{$listener_id}{addr}; | |||||||||||||||||||||||||||||||||||||||||
| 184 | 0 | delete $self->{listeners}{$listener_id}; | |||||||||||||||||||||||||||||||||||||||||
| 185 | 0 | $self->send_event( | |||||||||||||||||||||||||||||||||||||||||
| 186 | "$self->{prefix}listener_failure", | ||||||||||||||||||||||||||||||||||||||||||
| 187 | $listener_id, | ||||||||||||||||||||||||||||||||||||||||||
| 188 | $operation, | ||||||||||||||||||||||||||||||||||||||||||
| 189 | $errnum, | ||||||||||||||||||||||||||||||||||||||||||
| 190 | $errstr, | ||||||||||||||||||||||||||||||||||||||||||
| 191 | $port, | ||||||||||||||||||||||||||||||||||||||||||
| 192 | $addr, | ||||||||||||||||||||||||||||||||||||||||||
| 193 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 194 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 195 | } | ||||||||||||||||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||||||||||||||||
| 197 | sub _accept_connection { | ||||||||||||||||||||||||||||||||||||||||||
| 198 | 517 | ▶ | my ($kernel, $self, $socket, $listener_id) | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_accept_connection: called CC=9 SCAR=22.0
| |||||||||||||||||||||||||||||||||||||||||||
| 199 | = @_[KERNEL, OBJECT, ARG0, ARG3]; | ||||||||||||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||||||||||||
| 201 | 517 | my (undef,$peeraddr,$peerport) = getnameinfo( CORE::getpeername( $socket ), NI_NUMERICHOST | NI_NUMERICSERV ); | |||||||||||||||||||||||||||||||||||||||||
| 202 | 517 | my (undef,$sockaddr,$sockport) = getnameinfo( CORE::getsockname( $socket ), NI_NUMERICHOST | NI_NUMERICSERV ); | |||||||||||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||||||||||||
| 204 | 517 | s!^::ffff:!! for ( $sockaddr, $peeraddr ); | |||||||||||||||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||||||||||||||||
| 206 | 517 | my $listener = $self->{listeners}{$listener_id}; | |||||||||||||||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||||||||||||||||
| 208 | 517 | my $secured = 0; | |||||||||||||||||||||||||||||||||||||||||
| 209 | 517 | my $context = { }; | |||||||||||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||||||||||||
| 211 | 517 | ▶ | if ($self->{got_ssl} && $listener->{usessl}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$self->{"got_ssl"} and $listener->{"usessl"}
MC/DC100%2/2
$self->{"got_ssl"} and $listener->{"usessl"}
$self->{"got_ssl"}
$listener->{"usessl"}
Truth table100%3/3
A and B
A= $self->{"got_ssl"}B= $listener->{"usessl"}
| |||||||||||||||||||||||||||||||||||||||||||
| 212 | 12 | my $cb = $_[SESSION]->callback('_sock_ssl',$context); | |||||||||||||||||||||||||||||||||||||||||
| 213 | 12 | eval { | |||||||||||||||||||||||||||||||||||||||||
| 214 | 12 | $socket = POE::Component::SSLify::Server_SSLify($socket,undef,$cb); | |||||||||||||||||||||||||||||||||||||||||
| 215 | 12 | $secured = 1; | |||||||||||||||||||||||||||||||||||||||||
| 216 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 217 | 12 | chomp $@; | |||||||||||||||||||||||||||||||||||||||||
| 218 | 12 | ▶ | die "Failed to SSLify server socket: $@" if $@; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 219 | } | ||||||||||||||||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||||||||||||||||
| 221 | 517 | my $stats_filter = POE::Filter::ThruPut->new(); | |||||||||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||||||||||
| 223 | my $wheel = POE::Wheel::ReadWrite->new( | ||||||||||||||||||||||||||||||||||||||||||
| 224 | Handle => $socket, | ||||||||||||||||||||||||||||||||||||||||||
| 225 | InputEvent => '_conn_input', | ||||||||||||||||||||||||||||||||||||||||||
| 226 | ErrorEvent => '_conn_error', | ||||||||||||||||||||||||||||||||||||||||||
| 227 | FlushedEvent => '_conn_flushed', | ||||||||||||||||||||||||||||||||||||||||||
| 228 | Filter => POE::Filter::Stackable->new( | ||||||||||||||||||||||||||||||||||||||||||
| 229 | 517 | Filters => [$stats_filter, $self->{filter}], | |||||||||||||||||||||||||||||||||||||||||
| 230 | ), | ||||||||||||||||||||||||||||||||||||||||||
| 231 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||||||||||||
| 233 | 517 | ▶ | if ($wheel) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 234 | 517 | my $wheel_id = $wheel->ID(); | |||||||||||||||||||||||||||||||||||||||||
| 235 | 517 | $context->{wheel_id} = $wheel_id; | |||||||||||||||||||||||||||||||||||||||||
| 236 | my $ref = { | ||||||||||||||||||||||||||||||||||||||||||
| 237 | wheel => $wheel, | ||||||||||||||||||||||||||||||||||||||||||
| 238 | peeraddr => $peeraddr, | ||||||||||||||||||||||||||||||||||||||||||
| 239 | peerport => $peerport, | ||||||||||||||||||||||||||||||||||||||||||
| 240 | flooded => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 241 | sockaddr => $sockaddr, | ||||||||||||||||||||||||||||||||||||||||||
| 242 | sockport => $sockport, | ||||||||||||||||||||||||||||||||||||||||||
| 243 | idle => $listener->{idle}, | ||||||||||||||||||||||||||||||||||||||||||
| 244 | antiflood => $listener->{antiflood}, | ||||||||||||||||||||||||||||||||||||||||||
| 245 | 517 | compress => 0, | |||||||||||||||||||||||||||||||||||||||||
| 246 | secured => $secured, | ||||||||||||||||||||||||||||||||||||||||||
| 247 | stats => $stats_filter, | ||||||||||||||||||||||||||||||||||||||||||
| 248 | _sent => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 249 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||||||||||||||||
| 251 | 517 | ▶ | my $needs_auth = $listener->{auth} && $self->{auth} ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$listener->{"auth"} and $self->{"auth"}
MC/DC50%1/2
$listener->{"auth"} and $self->{"auth"}
$listener->{"auth"}
$self->{"auth"}
Truth table66%2/3
A and B
A= $listener->{"auth"}B= $self->{"auth"}
| |||||||||||||||||||||||||||||||||||||||||||
| 252 | 517 | $self->send_event( | |||||||||||||||||||||||||||||||||||||||||
| 253 | "$self->{prefix}connection", | ||||||||||||||||||||||||||||||||||||||||||
| 254 | $wheel_id, | ||||||||||||||||||||||||||||||||||||||||||
| 255 | $peeraddr, | ||||||||||||||||||||||||||||||||||||||||||
| 256 | $peerport, | ||||||||||||||||||||||||||||||||||||||||||
| 257 | $sockaddr, | ||||||||||||||||||||||||||||||||||||||||||
| 258 | $sockport, | ||||||||||||||||||||||||||||||||||||||||||
| 259 | $needs_auth, | ||||||||||||||||||||||||||||||||||||||||||
| 260 | $secured, | ||||||||||||||||||||||||||||||||||||||||||
| 261 | $stats_filter, | ||||||||||||||||||||||||||||||||||||||||||
| 262 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||||||||||||||||
| 264 | $ref->{alarm} = $kernel->delay_set( | ||||||||||||||||||||||||||||||||||||||||||
| 265 | '_conn_alarm', | ||||||||||||||||||||||||||||||||||||||||||
| 266 | $listener->{idle}, | ||||||||||||||||||||||||||||||||||||||||||
| 267 | 517 | $wheel_id, | |||||||||||||||||||||||||||||||||||||||||
| 268 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 269 | 517 | $self->{wheels}{$wheel_id} = $ref; | |||||||||||||||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||||||||||||||||
| 271 | 517 | ▶ | if ( my $reason = $self->denied( $peeraddr ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 272 | 6 | $ref->{disconnecting} = $reason; | |||||||||||||||||||||||||||||||||||||||||
| 273 | 6 | my $out = { command => 'ERROR', params => [ $reason ] }; | |||||||||||||||||||||||||||||||||||||||||
| 274 | 6 | $self->send_output( $out, $wheel_id ); | |||||||||||||||||||||||||||||||||||||||||
| 275 | } | ||||||||||||||||||||||||||||||||||||||||||
| 276 | } | ||||||||||||||||||||||||||||||||||||||||||
| 277 | 517 | return; | |||||||||||||||||||||||||||||||||||||||||
| 278 | } | ||||||||||||||||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||||||||||||||||
| 280 | sub _sock_ssl { | ||||||||||||||||||||||||||||||||||||||||||
| 281 | 12 | ▶ | my ($kernel,$self,$first,$second) = @_[KERNEL,OBJECT,ARG0,ARG1]; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_sock_ssl: called CC=5 SCAR=16.6
| |||||||||||||||||||||||||||||||||||||||||||
| 282 | 12 | my ($cont) = @$first; | |||||||||||||||||||||||||||||||||||||||||
| 283 | 12 | ▶ | return if !$cont->{wheel_id}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 284 | 12 | my $wheel_id = delete $cont->{wheel_id}; | |||||||||||||||||||||||||||||||||||||||||
| 285 | 12 | ▶ | return if !$self->{wheels}{$wheel_id}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 286 | 12 | my ($sock,$stat,$err) = @$second; | |||||||||||||||||||||||||||||||||||||||||
| 287 | 12 | ▶ | return if !$stat; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 288 | 12 | my $sslinf = _get_ssl_info($sock); | |||||||||||||||||||||||||||||||||||||||||
| 289 | 12 | my $ref = $self->{wheels}{$wheel_id}; | |||||||||||||||||||||||||||||||||||||||||
| 290 | 12 | ▶ | $ref->{sslinf} = $sslinf if $sslinf; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 291 | 12 | return; | |||||||||||||||||||||||||||||||||||||||||
| 292 | } | ||||||||||||||||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||||||||||||||||
| 294 | sub _get_ssl_info { | ||||||||||||||||||||||||||||||||||||||||||
| 295 | 23 | ▶ | my $sock = shift || return; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_get_ssl_info: called CC=9 SCAR=30.7
Condition50%1/2
shift() || (return)
MC/DC0%0/1
shift() || (return)
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||
| 296 | 23 | my $sslinf = eval { | |||||||||||||||||||||||||||||||||||||||||
| 297 | 23 | require Net::SSLeay; | |||||||||||||||||||||||||||||||||||||||||
| 298 | 23 | my $ssl = POE::Component::SSLify::SSLify_GetSSL($sock); | |||||||||||||||||||||||||||||||||||||||||
| 299 | 23 | my $cipher = Net::SSLeay::get_cipher($ssl); | |||||||||||||||||||||||||||||||||||||||||
| 300 | 23 | my $bits = Net::SSLeay::get_cipher_bits($ssl); | |||||||||||||||||||||||||||||||||||||||||
| 301 | 23 | my $version = Net::SSLeay::version($ssl); | |||||||||||||||||||||||||||||||||||||||||
| 302 | 23 | ▶ | my $ver = | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 7 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 303 | $version == 0x0304 ? 'TLSv1_3' : | ||||||||||||||||||||||||||||||||||||||||||
| 304 | $version == 0x0303 ? 'TLSv1_2' : | ||||||||||||||||||||||||||||||||||||||||||
| 305 | $version == 0x0302 ? 'TLSv1_1' : | ||||||||||||||||||||||||||||||||||||||||||
| 306 | $version == 0x0301 ? 'TLSv1' : | ||||||||||||||||||||||||||||||||||||||||||
| 307 | $version == 0x0300 ? 'SSLv3' : | ||||||||||||||||||||||||||||||||||||||||||
| 308 | $version == 0x0002 ? 'SSLv2' : | ||||||||||||||||||||||||||||||||||||||||||
| 309 | $version == 0xfeff ? 'DTLS1' : | ||||||||||||||||||||||||||||||||||||||||||
| 310 | undef; | ||||||||||||||||||||||||||||||||||||||||||
| 311 | 23 | return "$ver-$cipher-$bits"; | |||||||||||||||||||||||||||||||||||||||||
| 312 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 313 | 23 | return $sslinf; | |||||||||||||||||||||||||||||||||||||||||
| 314 | } | ||||||||||||||||||||||||||||||||||||||||||
| 315 | |||||||||||||||||||||||||||||||||||||||||||
| 316 | sub add_listener { | ||||||||||||||||||||||||||||||||||||||||||
| 317 | 170 | ▶ | my ($self) = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_listener: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 318 | 170 | ▶ | croak('add_listener requires an even number of parameters') if @_ & 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 319 | 170 | $self->yield('add_listener', @_); | |||||||||||||||||||||||||||||||||||||||||
| 320 | 170 | return; | |||||||||||||||||||||||||||||||||||||||||
| 321 | } | ||||||||||||||||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||||||||||||||||
| 323 | sub _add_listener { | ||||||||||||||||||||||||||||||||||||||||||
| 324 | 174 | ▶ | my ($kernel, $self) = @_[KERNEL, OBJECT]; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_add_listener: called CC=13 SCAR=26.6
| |||||||||||||||||||||||||||||||||||||||||||
| 325 | 174 | my %args = @_[ARG0..$#_]; | |||||||||||||||||||||||||||||||||||||||||
| 326 | |||||||||||||||||||||||||||||||||||||||||||
| 327 | 174 | $args{ lc($_) } = delete $args{$_} for keys %args; | |||||||||||||||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||||||||||||||||
| 329 | 174 | ▶ | my $bindaddr = $args{bindaddr} || '0.0.0.0'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$args{'bindaddr'} || '0.0.0.0'
MC/DC100%1/1
$args{'bindaddr'} || '0.0.0.0'
$args{'bindaddr'}
Truth table100%2/2
A
A= $args{'bindaddr'}
| |||||||||||||||||||||||||||||||||||||||||||
| 330 | 174 | ▶ | 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'}
| |||||||||||||||||||||||||||||||||||||||||||
| 331 | 174 | ▶ | 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'}
| |||||||||||||||||||||||||||||||||||||||||||
| 332 | 174 | my $auth = 1; | |||||||||||||||||||||||||||||||||||||||||
| 333 | 174 | my $antiflood = 1; | |||||||||||||||||||||||||||||||||||||||||
| 334 | 174 | my $usessl = 0; | |||||||||||||||||||||||||||||||||||||||||
| 335 | 174 | ▶ | $usessl = 1 if $args{usessl}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 336 | 174 | ▶ | $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
| |||||||||||||||||||||||||||||||||||||||||||
| 337 | 174 | ▶ | $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
| |||||||||||||||||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||||||||||||||||
| 339 | my $listener = POE::Wheel::SocketFactory->new( | ||||||||||||||||||||||||||||||||||||||||||
| 340 | BindAddress => $bindaddr, | ||||||||||||||||||||||||||||||||||||||||||
| 341 | BindPort => $bindport, | ||||||||||||||||||||||||||||||||||||||||||
| 342 | SuccessEvent => '_accept_connection', | ||||||||||||||||||||||||||||||||||||||||||
| 343 | FailureEvent => '_accept_failed', | ||||||||||||||||||||||||||||||||||||||||||
| 344 | Reuse => 'on', | ||||||||||||||||||||||||||||||||||||||||||
| 345 | ( ip_is_ipv6( $bindaddr ) ? ( SocketDomain => AF_INET6 ) : () ), | ||||||||||||||||||||||||||||||||||||||||||
| 346 | 174 | ▶ | ($args{listenqueue} ? (ListenQueue => $args{listenqueue}) : ()), | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 347 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 348 | |||||||||||||||||||||||||||||||||||||||||||
| 349 | 174 | my $id = $listener->ID(); | |||||||||||||||||||||||||||||||||||||||||
| 350 | 174 | $self->{listeners}{$id}{wheel} = $listener; | |||||||||||||||||||||||||||||||||||||||||
| 351 | 174 | $self->{listeners}{$id}{port} = $bindport; | |||||||||||||||||||||||||||||||||||||||||
| 352 | 174 | $self->{listeners}{$id}{addr} = $bindaddr; | |||||||||||||||||||||||||||||||||||||||||
| 353 | 174 | $self->{listeners}{$id}{idle} = $idle; | |||||||||||||||||||||||||||||||||||||||||
| 354 | 174 | $self->{listeners}{$id}{auth} = $auth; | |||||||||||||||||||||||||||||||||||||||||
| 355 | 174 | $self->{listeners}{$id}{antiflood} = $antiflood; | |||||||||||||||||||||||||||||||||||||||||
| 356 | 174 | $self->{listeners}{$id}{usessl} = $usessl; | |||||||||||||||||||||||||||||||||||||||||
| 357 | |||||||||||||||||||||||||||||||||||||||||||
| 358 | 174 | my (undef,$addr,$port) = getnameinfo( $listener->getsockname, NI_NUMERICHOST | NI_NUMERICSERV ); | |||||||||||||||||||||||||||||||||||||||||
| 359 | 174 | $addr =~ s!^::ffff:!!; | |||||||||||||||||||||||||||||||||||||||||
| 360 | 174 | ▶ | if ($port) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 361 | 174 | $self->{listeners}{$id}{port} = $port; | |||||||||||||||||||||||||||||||||||||||||
| 362 | $self->send_event( | ||||||||||||||||||||||||||||||||||||||||||
| 363 | 174 | $self->{prefix} . 'listener_add', | |||||||||||||||||||||||||||||||||||||||||
| 364 | $port, | ||||||||||||||||||||||||||||||||||||||||||
| 365 | $id, | ||||||||||||||||||||||||||||||||||||||||||
| 366 | $bindaddr, | ||||||||||||||||||||||||||||||||||||||||||
| 367 | $usessl, | ||||||||||||||||||||||||||||||||||||||||||
| 368 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 369 | } | ||||||||||||||||||||||||||||||||||||||||||
| 370 | 174 | return; | |||||||||||||||||||||||||||||||||||||||||
| 371 | } | ||||||||||||||||||||||||||||||||||||||||||
| 372 | |||||||||||||||||||||||||||||||||||||||||||
| 373 | sub del_listener { | ||||||||||||||||||||||||||||||||||||||||||
| 374 | 10 | ▶ | my ($self) = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
del_listener: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 375 | 10 | ▶ | croak("add_listener requires an even number of parameters") if @_ & 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 376 | 10 | $self->yield('del_listener', @_); | |||||||||||||||||||||||||||||||||||||||||
| 377 | 10 | return; | |||||||||||||||||||||||||||||||||||||||||
| 378 | } | ||||||||||||||||||||||||||||||||||||||||||
| 379 | |||||||||||||||||||||||||||||||||||||||||||
| 380 | sub _del_listener { | ||||||||||||||||||||||||||||||||||||||||||
| 381 | 10 | ▶ | my ($kernel, $self) = @_[KERNEL, OBJECT]; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_del_listener: called CC=6 SCAR=19.2
| |||||||||||||||||||||||||||||||||||||||||||
| 382 | 10 | my %args = @_[ARG0..$#_]; | |||||||||||||||||||||||||||||||||||||||||
| 383 | |||||||||||||||||||||||||||||||||||||||||||
| 384 | 10 | $args{lc $_} = delete $args{$_} for keys %args; | |||||||||||||||||||||||||||||||||||||||||
| 385 | 10 | my $listener_id = delete $args{listener}; | |||||||||||||||||||||||||||||||||||||||||
| 386 | 10 | my $port = delete $args{port}; | |||||||||||||||||||||||||||||||||||||||||
| 387 | |||||||||||||||||||||||||||||||||||||||||||
| 388 | 10 | ▶ | if ($self->_listener_exists($listener_id)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 389 | 0 | my $port = $self->{listeners}{$listener_id}{port}; | |||||||||||||||||||||||||||||||||||||||||
| 390 | 0 | my $addr = $self->{listeners}{$listener_id}{addr}; | |||||||||||||||||||||||||||||||||||||||||
| 391 | 0 | delete $self->{listeners}{$listener_id}; | |||||||||||||||||||||||||||||||||||||||||
| 392 | $self->send_event( | ||||||||||||||||||||||||||||||||||||||||||
| 393 | 0 | $self->{prefix} . 'listener_del', | |||||||||||||||||||||||||||||||||||||||||
| 394 | $port, | ||||||||||||||||||||||||||||||||||||||||||
| 395 | $listener_id, | ||||||||||||||||||||||||||||||||||||||||||
| 396 | $addr, | ||||||||||||||||||||||||||||||||||||||||||
| 397 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 398 | } | ||||||||||||||||||||||||||||||||||||||||||
| 399 | elsif (defined $port) { | ||||||||||||||||||||||||||||||||||||||||||
| 400 | 10 | ▶ | while (my ($id, $listener) = each %{ $self->{listeners } }) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 401 | 10 | ▶ | if ($listener->{port} == $port) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 402 | 10 | my $addr = $listener->{addr}; | |||||||||||||||||||||||||||||||||||||||||
| 403 | 10 | delete $self->{listeners}{$id}; | |||||||||||||||||||||||||||||||||||||||||
| 404 | $self->send_event( | ||||||||||||||||||||||||||||||||||||||||||
| 405 | 10 | $self->{prefix} . 'listener_del', | |||||||||||||||||||||||||||||||||||||||||
| 406 | $port, | ||||||||||||||||||||||||||||||||||||||||||
| 407 | $listener_id, | ||||||||||||||||||||||||||||||||||||||||||
| 408 | $addr, | ||||||||||||||||||||||||||||||||||||||||||
| 409 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 410 | } | ||||||||||||||||||||||||||||||||||||||||||
| 411 | } | ||||||||||||||||||||||||||||||||||||||||||
| 412 | } | ||||||||||||||||||||||||||||||||||||||||||
| 413 | |||||||||||||||||||||||||||||||||||||||||||
| 414 | 10 | return; | |||||||||||||||||||||||||||||||||||||||||
| 415 | } | ||||||||||||||||||||||||||||||||||||||||||
| 416 | |||||||||||||||||||||||||||||||||||||||||||
| 417 | sub _listener_exists { | ||||||||||||||||||||||||||||||||||||||||||
| 418 | 10 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_listener_exists: called CC=3 SCAR=16.5
| |||||||||||||||||||||||||||||||||||||||||||
| 419 | 10 | ▶ | my $listener_id = shift || return; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
shift() || (return)
MC/DC0%0/1
shift() || (return)
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||
| 420 | 0 | ▶ | return 1 if defined $self->{listeners}{$listener_id}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 421 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 422 | } | ||||||||||||||||||||||||||||||||||||||||||
| 423 | |||||||||||||||||||||||||||||||||||||||||||
| 424 | sub add_connector { | ||||||||||||||||||||||||||||||||||||||||||
| 425 | 3 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_connector: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 426 | 3 | ▶ | croak("add_connector requires an even number of parameters") if @_ & 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 427 | 3 | $self->yield('add_connector', @_); | |||||||||||||||||||||||||||||||||||||||||
| 428 | 3 | return; | |||||||||||||||||||||||||||||||||||||||||
| 429 | } | ||||||||||||||||||||||||||||||||||||||||||
| 430 | |||||||||||||||||||||||||||||||||||||||||||
| 431 | sub _add_connector { | ||||||||||||||||||||||||||||||||||||||||||
| 432 | 3 | ▶ | my ($kernel, $self, $sender) = @_[KERNEL, OBJECT, SENDER]; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_add_connector: called CC=8 SCAR=22.4
| |||||||||||||||||||||||||||||||||||||||||||
| 433 | 3 | my %args = @_[ARG0..$#_]; | |||||||||||||||||||||||||||||||||||||||||
| 434 | |||||||||||||||||||||||||||||||||||||||||||
| 435 | 3 | $args{lc $_} = delete $args{$_} for keys %args; | |||||||||||||||||||||||||||||||||||||||||
| 436 | |||||||||||||||||||||||||||||||||||||||||||
| 437 | 3 | my $remoteaddress = $args{remoteaddress}; | |||||||||||||||||||||||||||||||||||||||||
| 438 | 3 | my $remoteport = $args{remoteport}; | |||||||||||||||||||||||||||||||||||||||||
| 439 | |||||||||||||||||||||||||||||||||||||||||||
| 440 | 3 | ▶ | 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
| |||||||||||||||||||||||||||||||||||||||||||
| 441 | |||||||||||||||||||||||||||||||||||||||||||
| 442 | 3 | ▶ | $args{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'}
| |||||||||||||||||||||||||||||||||||||||||||
| 443 | |||||||||||||||||||||||||||||||||||||||||||
| 444 | my $wheel = POE::Wheel::SocketFactory->new( | ||||||||||||||||||||||||||||||||||||||||||
| 445 | SocketProtocol => 'tcp', | ||||||||||||||||||||||||||||||||||||||||||
| 446 | RemoteAddress => $remoteaddress, | ||||||||||||||||||||||||||||||||||||||||||
| 447 | RemotePort => $remoteport, | ||||||||||||||||||||||||||||||||||||||||||
| 448 | SuccessEvent => '_sock_up', | ||||||||||||||||||||||||||||||||||||||||||
| 449 | FailureEvent => '_sock_failed', | ||||||||||||||||||||||||||||||||||||||||||
| 450 | 3 | ▶ | ($args{bindaddress} ? (BindAddress => $args{bindaddress}) : ()), | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 451 | (ip_is_ipv6($remoteaddress) ? (SocketDomain => AF_INET6) : () ), | ||||||||||||||||||||||||||||||||||||||||||
| 452 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 453 | |||||||||||||||||||||||||||||||||||||||||||
| 454 | 3 | ▶ | if ($wheel) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 455 | 3 | $args{wheel} = $wheel; | |||||||||||||||||||||||||||||||||||||||||
| 456 | 3 | $self->{connectors}{$wheel->ID()} = \%args; | |||||||||||||||||||||||||||||||||||||||||
| 457 | } | ||||||||||||||||||||||||||||||||||||||||||
| 458 | 3 | return; | |||||||||||||||||||||||||||||||||||||||||
| 459 | } | ||||||||||||||||||||||||||||||||||||||||||
| 460 | |||||||||||||||||||||||||||||||||||||||||||
| 461 | sub _sock_failed { | ||||||||||||||||||||||||||||||||||||||||||
| 462 | 0 | ▶ | my ($kernel, $self, $op, $errno, $errstr, $connector_id) | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_sock_failed: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 463 | = @_[KERNEL, OBJECT, ARG0..ARG3]; | ||||||||||||||||||||||||||||||||||||||||||
| 464 | |||||||||||||||||||||||||||||||||||||||||||
| 465 | 0 | my $ref = delete $self->{connectors}{$connector_id}; | |||||||||||||||||||||||||||||||||||||||||
| 466 | 0 | delete $ref->{wheel}; | |||||||||||||||||||||||||||||||||||||||||
| 467 | 0 | $self->send_event("$self->{prefix}socketerr", $ref, $op, $errno, $errstr); | |||||||||||||||||||||||||||||||||||||||||
| 468 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 469 | } | ||||||||||||||||||||||||||||||||||||||||||
| 470 | |||||||||||||||||||||||||||||||||||||||||||
| 471 | sub _sock_up { | ||||||||||||||||||||||||||||||||||||||||||
| 472 | 3 | ▶ | my ($kernel, $self, $socket, $connector_id) | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_sock_up: called CC=6 SCAR=18.0
| |||||||||||||||||||||||||||||||||||||||||||
| 473 | = @_[KERNEL, OBJECT, ARG0, ARG3]; | ||||||||||||||||||||||||||||||||||||||||||
| 474 | |||||||||||||||||||||||||||||||||||||||||||
| 475 | 3 | my (undef,$peeraddr,$peerport) = getnameinfo( CORE::getpeername( $socket ), NI_NUMERICHOST | NI_NUMERICSERV ); | |||||||||||||||||||||||||||||||||||||||||
| 476 | 3 | my (undef,$sockaddr,$sockport) = getnameinfo( CORE::getsockname( $socket ), NI_NUMERICHOST | NI_NUMERICSERV ); | |||||||||||||||||||||||||||||||||||||||||
| 477 | |||||||||||||||||||||||||||||||||||||||||||
| 478 | 3 | s!^::ffff:!! for ( $sockaddr, $peeraddr ); | |||||||||||||||||||||||||||||||||||||||||
| 479 | |||||||||||||||||||||||||||||||||||||||||||
| 480 | 3 | my $cntr = delete $self->{connectors}{$connector_id}; | |||||||||||||||||||||||||||||||||||||||||
| 481 | 3 | ▶ | if ($self->{got_ssl} && $cntr->{usessl}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$self->{"got_ssl"} and $cntr->{"usessl"}
MC/DC50%1/2
$self->{"got_ssl"} and $cntr->{"usessl"}
$self->{"got_ssl"}
$cntr->{"usessl"}
Truth table66%2/3
A and B
A= $self->{"got_ssl"}B= $cntr->{"usessl"}
| |||||||||||||||||||||||||||||||||||||||||||
| 482 | 1 | eval { | |||||||||||||||||||||||||||||||||||||||||
| 483 | 1 | my $ctx = SSLify_ContextCreate( @{ $self->{sslify_options} } ); | |||||||||||||||||||||||||||||||||||||||||
| 484 | 1 | $socket = POE::Component::SSLify::Client_SSLify($socket,undef,undef,$ctx); | |||||||||||||||||||||||||||||||||||||||||
| 485 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 486 | 1 | chomp $@; | |||||||||||||||||||||||||||||||||||||||||
| 487 | 1 | ▶ | die "Failed to SSLify client socket: $@" if $@; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 488 | } | ||||||||||||||||||||||||||||||||||||||||||
| 489 | |||||||||||||||||||||||||||||||||||||||||||
| 490 | 3 | my $stats_filter = POE::Filter::ThruPut->new(); | |||||||||||||||||||||||||||||||||||||||||
| 491 | |||||||||||||||||||||||||||||||||||||||||||
| 492 | my $wheel = POE::Wheel::ReadWrite->new( | ||||||||||||||||||||||||||||||||||||||||||
| 493 | Handle => $socket, | ||||||||||||||||||||||||||||||||||||||||||
| 494 | InputEvent => '_conn_input', | ||||||||||||||||||||||||||||||||||||||||||
| 495 | ErrorEvent => '_conn_error', | ||||||||||||||||||||||||||||||||||||||||||
| 496 | FlushedEvent => '_conn_flushed', | ||||||||||||||||||||||||||||||||||||||||||
| 497 | Filter => POE::Filter::Stackable->new( | ||||||||||||||||||||||||||||||||||||||||||
| 498 | 3 | Filters => [$stats_filter, $self->{filter}], | |||||||||||||||||||||||||||||||||||||||||
| 499 | ), | ||||||||||||||||||||||||||||||||||||||||||
| 500 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 501 | |||||||||||||||||||||||||||||||||||||||||||
| 502 | 3 | ▶ | return if !$wheel; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 503 | 3 | my $wheel_id = $wheel->ID(); | |||||||||||||||||||||||||||||||||||||||||
| 504 | my $ref = { | ||||||||||||||||||||||||||||||||||||||||||
| 505 | wheel => $wheel, | ||||||||||||||||||||||||||||||||||||||||||
| 506 | peeraddr => $peeraddr, | ||||||||||||||||||||||||||||||||||||||||||
| 507 | peerport => $peerport, | ||||||||||||||||||||||||||||||||||||||||||
| 508 | sockaddr => $sockaddr, | ||||||||||||||||||||||||||||||||||||||||||
| 509 | sockport => $sockport, | ||||||||||||||||||||||||||||||||||||||||||
| 510 | idle => $cntr->{idle}, | ||||||||||||||||||||||||||||||||||||||||||
| 511 | 3 | antiflood => 0, | |||||||||||||||||||||||||||||||||||||||||
| 512 | compress => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 513 | stats => $stats_filter, | ||||||||||||||||||||||||||||||||||||||||||
| 514 | _sent => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 515 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 516 | |||||||||||||||||||||||||||||||||||||||||||
| 517 | 3 | $self->{wheels}{$wheel_id} = $ref; | |||||||||||||||||||||||||||||||||||||||||
| 518 | $self->send_event( | ||||||||||||||||||||||||||||||||||||||||||
| 519 | "$self->{prefix}connected", | ||||||||||||||||||||||||||||||||||||||||||
| 520 | $wheel_id, | ||||||||||||||||||||||||||||||||||||||||||
| 521 | $peeraddr, | ||||||||||||||||||||||||||||||||||||||||||
| 522 | $peerport, | ||||||||||||||||||||||||||||||||||||||||||
| 523 | $sockaddr, | ||||||||||||||||||||||||||||||||||||||||||
| 524 | $sockport, | ||||||||||||||||||||||||||||||||||||||||||
| 525 | $cntr->{name}, | ||||||||||||||||||||||||||||||||||||||||||
| 526 | 3 | $stats_filter, | |||||||||||||||||||||||||||||||||||||||||
| 527 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 528 | 3 | return; | |||||||||||||||||||||||||||||||||||||||||
| 529 | } | ||||||||||||||||||||||||||||||||||||||||||
| 530 | |||||||||||||||||||||||||||||||||||||||||||
| 531 | sub _anti_flood { | ||||||||||||||||||||||||||||||||||||||||||
| 532 | 0 | ▶ | my ($self, $wheel_id, $input) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_anti_flood: not called CC=8 SCAR=42.8
| |||||||||||||||||||||||||||||||||||||||||||
| 533 | 0 | my $current_time = time(); | |||||||||||||||||||||||||||||||||||||||||
| 534 | |||||||||||||||||||||||||||||||||||||||||||
| 535 | 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
| |||||||||||||||||||||||||||||||||||||||||||
| 536 | |||||||||||||||||||||||||||||||||||||||||||
| 537 | SWITCH: { | ||||||||||||||||||||||||||||||||||||||||||
| 538 | 0 | ▶ | if ($self->{wheels}->{ $wheel_id }->{flooded}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 539 | 0 | last SWITCH; | |||||||||||||||||||||||||||||||||||||||||
| 540 | } | ||||||||||||||||||||||||||||||||||||||||||
| 541 | 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
| |||||||||||||||||||||||||||||||||||||||||||
| 542 | || $self->{wheels}{$wheel_id}{timer} < $current_time) { | ||||||||||||||||||||||||||||||||||||||||||
| 543 | |||||||||||||||||||||||||||||||||||||||||||
| 544 | 0 | $self->{wheels}{$wheel_id}{timer} = $current_time; | |||||||||||||||||||||||||||||||||||||||||
| 545 | 0 | my $event = "$self->{prefix}cmd_" . lc $input->{command}; | |||||||||||||||||||||||||||||||||||||||||
| 546 | 0 | $self->send_event($event, $wheel_id, $input); | |||||||||||||||||||||||||||||||||||||||||
| 547 | 0 | last SWITCH; | |||||||||||||||||||||||||||||||||||||||||
| 548 | } | ||||||||||||||||||||||||||||||||||||||||||
| 549 | 0 | ▶ | if ($self->{wheels}{$wheel_id}{timer} <= $current_time + 10) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 550 | 0 | $self->{wheels}{$wheel_id}{timer} += 1; | |||||||||||||||||||||||||||||||||||||||||
| 551 | 0 | push @{ $self->{wheels}{$wheel_id}{msq} }, $input; | |||||||||||||||||||||||||||||||||||||||||
| 552 | 0 | push @{ $self->{wheels}{$wheel_id}{alarm_ids} }, | |||||||||||||||||||||||||||||||||||||||||
| 553 | $poe_kernel->alarm_set( | ||||||||||||||||||||||||||||||||||||||||||
| 554 | '_event_dispatcher', | ||||||||||||||||||||||||||||||||||||||||||
| 555 | $self->{wheels}{$wheel_id}{timer}, | ||||||||||||||||||||||||||||||||||||||||||
| 556 | 0 | $wheel_id | |||||||||||||||||||||||||||||||||||||||||
| 557 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 558 | 0 | last SWITCH; | |||||||||||||||||||||||||||||||||||||||||
| 559 | } | ||||||||||||||||||||||||||||||||||||||||||
| 560 | |||||||||||||||||||||||||||||||||||||||||||
| 561 | 0 | $self->{wheels}{$wheel_id}{flooded} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 562 | 0 | $self->send_event("$self->{prefix}connection_flood", $wheel_id); | |||||||||||||||||||||||||||||||||||||||||
| 563 | } | ||||||||||||||||||||||||||||||||||||||||||
| 564 | |||||||||||||||||||||||||||||||||||||||||||
| 565 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 566 | } | ||||||||||||||||||||||||||||||||||||||||||
| 567 | |||||||||||||||||||||||||||||||||||||||||||
| 568 | sub _conn_error { | ||||||||||||||||||||||||||||||||||||||||||
| 569 | 237 | ▶ | my ($self, $errstr, $wheel_id) = @_[OBJECT, ARG2, ARG3]; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_conn_error: called CC=3 SCAR=11.3
| |||||||||||||||||||||||||||||||||||||||||||
| 570 | 237 | ▶ | return if !$self->connection_exists($wheel_id); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 571 | $self->_disconnected( | ||||||||||||||||||||||||||||||||||||||||||
| 572 | $wheel_id, | ||||||||||||||||||||||||||||||||||||||||||
| 573 | $errstr || $self->{wheels}{$wheel_id}{disconnecting} | ||||||||||||||||||||||||||||||||||||||||||
| 574 | 237 | ▶ | ); | ||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$errstr || $self->{'wheels'}{$wheel_id}{'disconnecting'}
MC/DC50%1/2
$errstr || $self->{'wheels'}{$wheel_id}{'disconnecting'}
$errstr
$self->{'wheels'}{$wheel_id}{'disconnecting'}
Truth table66%2/3
A || B
A= $errstrB= $self->{'wheels'}{$wheel_id}{'disconnecting'}
| |||||||||||||||||||||||||||||||||||||||||||
| 575 | 237 | return; | |||||||||||||||||||||||||||||||||||||||||
| 576 | } | ||||||||||||||||||||||||||||||||||||||||||
| 577 | |||||||||||||||||||||||||||||||||||||||||||
| 578 | sub _conn_alarm { | ||||||||||||||||||||||||||||||||||||||||||
| 579 | 0 | ▶ | my ($kernel, $self, $wheel_id) = @_[KERNEL, OBJECT, ARG0]; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_conn_alarm: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 580 | 0 | ▶ | return if !$self->connection_exists($wheel_id); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 581 | 0 | my $conn = $self->{wheels}{$wheel_id}; | |||||||||||||||||||||||||||||||||||||||||
| 582 | |||||||||||||||||||||||||||||||||||||||||||
| 583 | $self->send_event( | ||||||||||||||||||||||||||||||||||||||||||
| 584 | "$self->{prefix}connection_idle", | ||||||||||||||||||||||||||||||||||||||||||
| 585 | $wheel_id, | ||||||||||||||||||||||||||||||||||||||||||
| 586 | $conn->{idle}, | ||||||||||||||||||||||||||||||||||||||||||
| 587 | 0 | ); | |||||||||||||||||||||||||||||||||||||||||
| 588 | $conn->{alarm} = $kernel->delay_set( | ||||||||||||||||||||||||||||||||||||||||||
| 589 | '_conn_alarm', | ||||||||||||||||||||||||||||||||||||||||||
| 590 | $conn->{idle}, | ||||||||||||||||||||||||||||||||||||||||||
| 591 | 0 | $wheel_id, | |||||||||||||||||||||||||||||||||||||||||
| 592 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 593 | |||||||||||||||||||||||||||||||||||||||||||
| 594 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 595 | } | ||||||||||||||||||||||||||||||||||||||||||
| 596 | |||||||||||||||||||||||||||||||||||||||||||
| 597 | sub _conn_flushed { | ||||||||||||||||||||||||||||||||||||||||||
| 598 | 2748 | ▶ | my ($kernel, $self, $wheel_id) = @_[KERNEL, OBJECT, ARG0]; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_conn_flushed: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||
| 599 | 2748 | ▶ | return if !$self->connection_exists($wheel_id); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 600 | |||||||||||||||||||||||||||||||||||||||||||
| 601 | { | ||||||||||||||||||||||||||||||||||||||||||
| 602 | 2748 | my $sent = $self->{wheels}{$wheel_id}{stats}->send(); | |||||||||||||||||||||||||||||||||||||||||
| 603 | 2748 | my $tally = $sent - $self->{wheels}{$wheel_id}{_sent}; | |||||||||||||||||||||||||||||||||||||||||
| 604 | 2748 | $self->{wheels}{$wheel_id}{_sent} = $sent; | |||||||||||||||||||||||||||||||||||||||||
| 605 | 2748 | $self->{_globalstats}{sent} += $tally; | |||||||||||||||||||||||||||||||||||||||||
| 606 | } | ||||||||||||||||||||||||||||||||||||||||||
| 607 | |||||||||||||||||||||||||||||||||||||||||||
| 608 | 2748 | ▶ | if ($self->{wheels}{$wheel_id}{disconnecting}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 609 | $self->_disconnected( | ||||||||||||||||||||||||||||||||||||||||||
| 610 | $wheel_id, | ||||||||||||||||||||||||||||||||||||||||||
| 611 | $self->{wheels}{$wheel_id}{disconnecting}, | ||||||||||||||||||||||||||||||||||||||||||
| 612 | 242 | ); | |||||||||||||||||||||||||||||||||||||||||
| 613 | 242 | return; | |||||||||||||||||||||||||||||||||||||||||
| 614 | } | ||||||||||||||||||||||||||||||||||||||||||
| 615 | |||||||||||||||||||||||||||||||||||||||||||
| 616 | 2506 | ▶ | if ($self->{wheels}{$wheel_id}{compress_pending}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 617 | 1 | delete $self->{wheels}{$wheel_id}{compress_pending}; | |||||||||||||||||||||||||||||||||||||||||
| 618 | 1 | $self->{wheels}{$wheel_id}{wheel}->get_input_filter()->unshift( | |||||||||||||||||||||||||||||||||||||||||
| 619 | POE::Filter::Zlib::Stream->new(), | ||||||||||||||||||||||||||||||||||||||||||
| 620 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 621 | 1 | $self->send_event("$self->{prefix}compressed_conn", $wheel_id); | |||||||||||||||||||||||||||||||||||||||||
| 622 | 1 | return; | |||||||||||||||||||||||||||||||||||||||||
| 623 | } | ||||||||||||||||||||||||||||||||||||||||||
| 624 | 2505 | return; | |||||||||||||||||||||||||||||||||||||||||
| 625 | } | ||||||||||||||||||||||||||||||||||||||||||
| 626 | |||||||||||||||||||||||||||||||||||||||||||
| 627 | sub _conn_input { | ||||||||||||||||||||||||||||||||||||||||||
| 628 | 3890 | ▶ | my ($kernel, $self, $input, $wheel_id) = @_[KERNEL, OBJECT, ARG0, ARG1]; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_conn_input: called CC=4 SCAR=14.1
| |||||||||||||||||||||||||||||||||||||||||||
| 629 | 3890 | my $conn = $self->{wheels}{$wheel_id}; | |||||||||||||||||||||||||||||||||||||||||
| 630 | |||||||||||||||||||||||||||||||||||||||||||
| 631 | # We aren't interested if they are disconnecting | ||||||||||||||||||||||||||||||||||||||||||
| 632 | 3890 | ▶ | return if $conn->{disconnecting}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 633 | |||||||||||||||||||||||||||||||||||||||||||
| 634 | { | ||||||||||||||||||||||||||||||||||||||||||
| 635 | 3889 | require bytes; | |||||||||||||||||||||||||||||||||||||||||
| 636 | 3889 | $self->{_globalstats}{recv} += bytes::length($input->{raw_line}) + 2; | |||||||||||||||||||||||||||||||||||||||||
| 637 | } | ||||||||||||||||||||||||||||||||||||||||||
| 638 | |||||||||||||||||||||||||||||||||||||||||||
| 639 | 3889 | ▶ | if ($self->{raw_events}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 640 | $self->send_event( | ||||||||||||||||||||||||||||||||||||||||||
| 641 | "$self->{prefix}raw_input", | ||||||||||||||||||||||||||||||||||||||||||
| 642 | $wheel_id, | ||||||||||||||||||||||||||||||||||||||||||
| 643 | $input->{raw_line}, | ||||||||||||||||||||||||||||||||||||||||||
| 644 | 0 | ); | |||||||||||||||||||||||||||||||||||||||||
| 645 | } | ||||||||||||||||||||||||||||||||||||||||||
| 646 | 3889 | $conn->{msgs}{recv}++; | |||||||||||||||||||||||||||||||||||||||||
| 647 | 3889 | $conn->{seen} = time(); | |||||||||||||||||||||||||||||||||||||||||
| 648 | 3889 | $kernel->delay_adjust($conn->{alarm}, $conn->{idle}); | |||||||||||||||||||||||||||||||||||||||||
| 649 | |||||||||||||||||||||||||||||||||||||||||||
| 650 | # TODO: Antiflood code | ||||||||||||||||||||||||||||||||||||||||||
| 651 | 3889 | ▶ | if ($self->antiflood($wheel_id)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 652 | 0 | $self->_anti_flood($wheel_id, $input); | |||||||||||||||||||||||||||||||||||||||||
| 653 | } | ||||||||||||||||||||||||||||||||||||||||||
| 654 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 655 | 3889 | my $event = "$self->{prefix}cmd_" . lc $input->{command}; | |||||||||||||||||||||||||||||||||||||||||
| 656 | 3889 | $self->send_event($event, $wheel_id, $input); | |||||||||||||||||||||||||||||||||||||||||
| 657 | } | ||||||||||||||||||||||||||||||||||||||||||
| 658 | 3889 | return; | |||||||||||||||||||||||||||||||||||||||||
| 659 | } | ||||||||||||||||||||||||||||||||||||||||||
| 660 | |||||||||||||||||||||||||||||||||||||||||||
| 661 | sub _event_dispatcher { | ||||||||||||||||||||||||||||||||||||||||||
| 662 | 0 | ▶ | my ($kernel, $self, $wheel_id) = @_[KERNEL, OBJECT, ARG0]; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_event_dispatcher: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||
| 663 | |||||||||||||||||||||||||||||||||||||||||||
| 664 | 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"}
| |||||||||||||||||||||||||||||||||||||||||||
| 665 | || $self->{wheels}{$wheel_id}{flooded}) { | ||||||||||||||||||||||||||||||||||||||||||
| 666 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 667 | } | ||||||||||||||||||||||||||||||||||||||||||
| 668 | |||||||||||||||||||||||||||||||||||||||||||
| 669 | 0 | shift @{ $self->{wheels}{$wheel_id}{alarm_ids} }; | |||||||||||||||||||||||||||||||||||||||||
| 670 | 0 | my $input = shift @{ $self->{wheels}{$wheel_id}{msq} }; | |||||||||||||||||||||||||||||||||||||||||
| 671 | |||||||||||||||||||||||||||||||||||||||||||
| 672 | 0 | ▶ | if ($input) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 673 | 0 | my $event = "$self->{prefix}cmd_" . lc $input->{command}; | |||||||||||||||||||||||||||||||||||||||||
| 674 | 0 | $self->send_event($event, $wheel_id, $input); | |||||||||||||||||||||||||||||||||||||||||
| 675 | } | ||||||||||||||||||||||||||||||||||||||||||
| 676 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 677 | } | ||||||||||||||||||||||||||||||||||||||||||
| 678 | |||||||||||||||||||||||||||||||||||||||||||
| 679 | sub send_output { | ||||||||||||||||||||||||||||||||||||||||||
| 680 | 12458 | ▶ | my ($self, $output) = splice @_, 0, 2; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
send_output: called CC=5 SCAR=17.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 681 | |||||||||||||||||||||||||||||||||||||||||||
| 682 | 12458 | ▶ | if ($output && ref $output eq 'HASH') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$output and ref $output eq "HASH"
MC/DC50%1/2
$output and ref $output eq "HASH"
$output
ref $output eq "HASH"
Truth table66%2/3
A and B
A= $outputB= ref $output eq "HASH"
| |||||||||||||||||||||||||||||||||||||||||||
| 683 | 12232 | for my $id (grep { $self->connection_exists($_) } @_) { | |||||||||||||||||||||||||||||||||||||||||
| 684 | 8976 | ▶ | if ($self->{raw_events}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 685 | 0 | my $out = $self->{filter}->put([$output])->[0]; | |||||||||||||||||||||||||||||||||||||||||
| 686 | 0 | $out =~ s/\015\012$//; | |||||||||||||||||||||||||||||||||||||||||
| 687 | 0 | $self->send_event("$self->{prefix}raw_output", $id, $out); | |||||||||||||||||||||||||||||||||||||||||
| 688 | } | ||||||||||||||||||||||||||||||||||||||||||
| 689 | 8976 | $self->{wheels}{$id}{msgs}{sent}++; | |||||||||||||||||||||||||||||||||||||||||
| 690 | 8976 | $self->{wheels}{$id}{wheel}->put($output); | |||||||||||||||||||||||||||||||||||||||||
| 691 | } | ||||||||||||||||||||||||||||||||||||||||||
| 692 | } | ||||||||||||||||||||||||||||||||||||||||||
| 693 | |||||||||||||||||||||||||||||||||||||||||||
| 694 | 12458 | return; | |||||||||||||||||||||||||||||||||||||||||
| 695 | } | ||||||||||||||||||||||||||||||||||||||||||
| 696 | |||||||||||||||||||||||||||||||||||||||||||
| 697 | sub _send_output { | ||||||||||||||||||||||||||||||||||||||||||
| 698 | 0 | ▶ | $_[OBJECT]->send_output(@_[ARG0..$#_]); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_send_output: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 699 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 700 | } | ||||||||||||||||||||||||||||||||||||||||||
| 701 | |||||||||||||||||||||||||||||||||||||||||||
| 702 | sub antiflood { | ||||||||||||||||||||||||||||||||||||||||||
| 703 | 4422 | ▶ | my ($self, $wheel_id, $value) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
antiflood: called CC=7 SCAR=35.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 704 | |||||||||||||||||||||||||||||||||||||||||||
| 705 | 4422 | ▶ | return if !$self->connection_exists($wheel_id); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 706 | 4422 | ▶ | return 0 if !$self->{antiflood}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 707 | 0 | ▶ | return $self->{wheels}{$wheel_id}{antiflood} if !defined $value; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 708 | |||||||||||||||||||||||||||||||||||||||||||
| 709 | 0 | ▶ | if (!$value) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 710 | # Flush pending messages from that wheel | ||||||||||||||||||||||||||||||||||||||||||
| 711 | 0 | ▶ | while (my $alarm_id = shift @{ $self->{wheels}{$wheel_id}{alarm_ids} }) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 712 | 0 | $poe_kernel->alarm_remove($alarm_id); | |||||||||||||||||||||||||||||||||||||||||
| 713 | 0 | my $input = shift @{ $self->{wheels}{$wheel_id}{msq} }; | |||||||||||||||||||||||||||||||||||||||||
| 714 | |||||||||||||||||||||||||||||||||||||||||||
| 715 | 0 | ▶ | if ($input) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 716 | 0 | my $event = "$self->{prefix}cmd_" . lc $input->{command}; | |||||||||||||||||||||||||||||||||||||||||
| 717 | 0 | $self->send_event($event, $wheel_id, $input); | |||||||||||||||||||||||||||||||||||||||||
| 718 | } | ||||||||||||||||||||||||||||||||||||||||||
| 719 | } | ||||||||||||||||||||||||||||||||||||||||||
| 720 | } | ||||||||||||||||||||||||||||||||||||||||||
| 721 | |||||||||||||||||||||||||||||||||||||||||||
| 722 | 0 | $self->{wheels}{$wheel_id}{antiflood} = $value; | |||||||||||||||||||||||||||||||||||||||||
| 723 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 724 | } | ||||||||||||||||||||||||||||||||||||||||||
| 725 | |||||||||||||||||||||||||||||||||||||||||||
| 726 | sub compressed_link { | ||||||||||||||||||||||||||||||||||||||||||
| 727 | 2 | ▶ | my ($self, $wheel_id, $value, $cntr) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
compressed_link: called CC=7 SCAR=20.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 728 | 2 | ▶ | return if !$self->connection_exists($wheel_id); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 729 | 2 | ▶ | return $self->{wheels}{$wheel_id}{compress} if !defined $value; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 730 | |||||||||||||||||||||||||||||||||||||||||||
| 731 | 2 | ▶ | if ($value) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 732 | 2 | ▶ | if (!$self->{got_zlib}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 733 | 2 | eval { | |||||||||||||||||||||||||||||||||||||||||
| 734 | 2 | require POE::Filter::Zlib::Stream; | |||||||||||||||||||||||||||||||||||||||||
| 735 | 2 | $self->{got_zlib} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 736 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 737 | 2 | chomp $@; | |||||||||||||||||||||||||||||||||||||||||
| 738 | 2 | ▶ | croak($@) if !$self->{got_zlib}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 739 | } | ||||||||||||||||||||||||||||||||||||||||||
| 740 | 2 | ▶ | if ($cntr) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 741 | 1 | $self->{wheels}{$wheel_id}{wheel}->get_input_filter()->unshift( | |||||||||||||||||||||||||||||||||||||||||
| 742 | POE::Filter::Zlib::Stream->new() | ||||||||||||||||||||||||||||||||||||||||||
| 743 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 744 | 1 | $self->send_event( | |||||||||||||||||||||||||||||||||||||||||
| 745 | "$self->{prefix}compressed_conn", | ||||||||||||||||||||||||||||||||||||||||||
| 746 | $wheel_id, | ||||||||||||||||||||||||||||||||||||||||||
| 747 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 748 | } | ||||||||||||||||||||||||||||||||||||||||||
| 749 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 750 | 1 | $self->{wheels}{$wheel_id}{compress_pending} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 751 | } | ||||||||||||||||||||||||||||||||||||||||||
| 752 | } | ||||||||||||||||||||||||||||||||||||||||||
| 753 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 754 | 0 | $self->{wheels}{$wheel_id}{wheel}->get_input_filter()->shift(); | |||||||||||||||||||||||||||||||||||||||||
| 755 | } | ||||||||||||||||||||||||||||||||||||||||||
| 756 | |||||||||||||||||||||||||||||||||||||||||||
| 757 | 2 | $self->{wheels}{$wheel_id}{compress} = $value; | |||||||||||||||||||||||||||||||||||||||||
| 758 | 2 | return; | |||||||||||||||||||||||||||||||||||||||||
| 759 | } | ||||||||||||||||||||||||||||||||||||||||||
| 760 | |||||||||||||||||||||||||||||||||||||||||||
| 761 | sub disconnect { | ||||||||||||||||||||||||||||||||||||||||||
| 762 | 236 | ▶ | my ($self, $wheel_id, $string) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
disconnect: called CC=4 SCAR=15.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 763 | 236 | ▶ | 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)
| |||||||||||||||||||||||||||||||||||||||||||
| 764 | 236 | ▶ | $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
| |||||||||||||||||||||||||||||||||||||||||||
| 765 | 236 | return; | |||||||||||||||||||||||||||||||||||||||||
| 766 | } | ||||||||||||||||||||||||||||||||||||||||||
| 767 | |||||||||||||||||||||||||||||||||||||||||||
| 768 | sub _disconnected { | ||||||||||||||||||||||||||||||||||||||||||
| 769 | 479 | ▶ | my ($self, $wheel_id, $errstr) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_disconnected: called CC=6 SCAR=19.4
| |||||||||||||||||||||||||||||||||||||||||||
| 770 | 479 | ▶ | 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)
| |||||||||||||||||||||||||||||||||||||||||||
| 771 | |||||||||||||||||||||||||||||||||||||||||||
| 772 | 479 | my $conn = delete $self->{wheels}{$wheel_id}; | |||||||||||||||||||||||||||||||||||||||||
| 773 | 479 | for my $alarm_id ($conn->{alarm}, @{ $conn->{alarm_ids} }) { | |||||||||||||||||||||||||||||||||||||||||
| 774 | 479 | $poe_kernel->alarm_remove($_); | |||||||||||||||||||||||||||||||||||||||||
| 775 | } | ||||||||||||||||||||||||||||||||||||||||||
| 776 | $self->send_event( | ||||||||||||||||||||||||||||||||||||||||||
| 777 | 479 | ▶ | "$self->{prefix}disconnected", | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$errstr || 'Remote host closed the connection'
MC/DC100%1/1
$errstr || 'Remote host closed the connection'
$errstr
Truth table100%2/2
A
A= $errstr
| |||||||||||||||||||||||||||||||||||||||||||
| 778 | $wheel_id, | ||||||||||||||||||||||||||||||||||||||||||
| 779 | $errstr || 'Remote host closed the connection', | ||||||||||||||||||||||||||||||||||||||||||
| 780 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 781 | |||||||||||||||||||||||||||||||||||||||||||
| 782 | 479 | ▶ | if ( $^O =~ /(cygwin|MSWin)/ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 783 | 0 | $conn->{wheel}->shutdown_input(); | |||||||||||||||||||||||||||||||||||||||||
| 784 | 0 | $conn->{wheel}->shutdown_output(); | |||||||||||||||||||||||||||||||||||||||||
| 785 | } | ||||||||||||||||||||||||||||||||||||||||||
| 786 | |||||||||||||||||||||||||||||||||||||||||||
| 787 | 479 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 788 | } | ||||||||||||||||||||||||||||||||||||||||||
| 789 | |||||||||||||||||||||||||||||||||||||||||||
| 790 | sub connection_info { | ||||||||||||||||||||||||||||||||||||||||||
| 791 | 0 | ▶ | my ($self, $wheel_id) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
connection_info: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 792 | 0 | ▶ | return if !$self->connection_exists($wheel_id); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 793 | return map { | ||||||||||||||||||||||||||||||||||||||||||
| 794 | 0 | $self->{wheels}{$wheel_id}{$_} | |||||||||||||||||||||||||||||||||||||||||
| 795 | } qw(peeraddr peerport sockaddr sockport); | ||||||||||||||||||||||||||||||||||||||||||
| 796 | } | ||||||||||||||||||||||||||||||||||||||||||
| 797 | |||||||||||||||||||||||||||||||||||||||||||
| 798 | sub connection_exists { | ||||||||||||||||||||||||||||||||||||||||||
| 799 | 17180 | ▶ | my ($self, $wheel_id) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
connection_exists: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 800 | 17180 | ▶ | 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}
| |||||||||||||||||||||||||||||||||||||||||||
| 801 | 17102 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 802 | } | ||||||||||||||||||||||||||||||||||||||||||
| 803 | |||||||||||||||||||||||||||||||||||||||||||
| 804 | sub connection_secured { | ||||||||||||||||||||||||||||||||||||||||||
| 805 | 476 | ▶ | my ($self, $wheel_id) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
connection_secured: called CC=6 SCAR=18.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 806 | 476 | ▶ | return if !$wheel_id || !defined $self->{wheels}{$wheel_id}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$wheel_id and defined $self->{"wheels"}{$wheel_id}
MC/DC0%0/2
$wheel_id and defined $self->{"wheels"}{$wheel_id}
$wheel_id
defined $self->{"wheels"}{$wheel_id}
Truth table33%1/3
A and B
A= $wheel_idB= defined $self->{"wheels"}{$wheel_id}
| |||||||||||||||||||||||||||||||||||||||||||
| 807 | 476 | ▶ | return if !$self->{wheels}{$wheel_id}{secured}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 808 | 11 | my $sslinfo = $self->{wheels}{$wheel_id}{sslinfo}; | |||||||||||||||||||||||||||||||||||||||||
| 809 | 11 | ▶ | if (!$sslinfo) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 810 | 11 | my $sock = $self->{wheels}{$wheel_id}{wheel}->get_input_handle(); | |||||||||||||||||||||||||||||||||||||||||
| 811 | 11 | $sslinfo = _get_ssl_info($sock); | |||||||||||||||||||||||||||||||||||||||||
| 812 | 11 | ▶ | $self->{wheels}{$wheel_id}{sslinfo} = $sslinfo | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 813 | if $sslinfo; | ||||||||||||||||||||||||||||||||||||||||||
| 814 | } | ||||||||||||||||||||||||||||||||||||||||||
| 815 | 11 | return $sslinfo; | |||||||||||||||||||||||||||||||||||||||||
| 816 | } | ||||||||||||||||||||||||||||||||||||||||||
| 817 | |||||||||||||||||||||||||||||||||||||||||||
| 818 | sub connection_certfp { | ||||||||||||||||||||||||||||||||||||||||||
| 819 | 9 | ▶ | my ($self, $wheel_id) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
connection_certfp: called CC=5 SCAR=17.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 820 | 9 | ▶ | return if !$wheel_id || !defined $self->{wheels}{$wheel_id}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$wheel_id and defined $self->{"wheels"}{$wheel_id}
MC/DC0%0/2
$wheel_id and defined $self->{"wheels"}{$wheel_id}
$wheel_id
defined $self->{"wheels"}{$wheel_id}
Truth table33%1/3
A and B
A= $wheel_idB= defined $self->{"wheels"}{$wheel_id}
| |||||||||||||||||||||||||||||||||||||||||||
| 821 | 9 | ▶ | return if !$self->{wheels}{$wheel_id}{secured}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 822 | 9 | my $sock = $self->{wheels}{$wheel_id}{wheel}->get_input_handle(); | |||||||||||||||||||||||||||||||||||||||||
| 823 | 9 | my $fp = eval { | |||||||||||||||||||||||||||||||||||||||||
| 824 | 9 | my $ssl = POE::Component::SSLify::SSLify_GetSSL($sock); | |||||||||||||||||||||||||||||||||||||||||
| 825 | 9 | my $x509 = Net::SSLeay::get_peer_certificate($ssl); | |||||||||||||||||||||||||||||||||||||||||
| 826 | 9 | return Net::SSLeay::X509_get_fingerprint($x509,'sha256'); | |||||||||||||||||||||||||||||||||||||||||
| 827 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 828 | 9 | ▶ | $fp =~ s!:!!g if $fp; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 829 | 9 | return $fp; | |||||||||||||||||||||||||||||||||||||||||
| 830 | } | ||||||||||||||||||||||||||||||||||||||||||
| 831 | |||||||||||||||||||||||||||||||||||||||||||
| 832 | sub connection_stats { | ||||||||||||||||||||||||||||||||||||||||||
| 833 | 0 | ▶ | my ($self, $wheel_id) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
connection_stats: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 834 | 0 | ▶ | return if !$wheel_id || !defined $self->{wheels}{$wheel_id}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$wheel_id and defined $self->{"wheels"}{$wheel_id}
MC/DC0%0/2
$wheel_id and defined $self->{"wheels"}{$wheel_id}
$wheel_id
defined $self->{"wheels"}{$wheel_id}
Truth table0%0/3
A and B
A= $wheel_idB= defined $self->{"wheels"}{$wheel_id}
| |||||||||||||||||||||||||||||||||||||||||||
| 835 | 0 | return $self->{wheels}{$wheel_id}{stats}->stats(); | |||||||||||||||||||||||||||||||||||||||||
| 836 | } | ||||||||||||||||||||||||||||||||||||||||||
| 837 | |||||||||||||||||||||||||||||||||||||||||||
| 838 | sub connection_msgs { | ||||||||||||||||||||||||||||||||||||||||||
| 839 | 2 | ▶ | my ($self, $wheel_id) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
connection_msgs: called CC=3 SCAR=12.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 840 | 2 | ▶ | return if !$wheel_id || !defined $self->{wheels}{$wheel_id}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$wheel_id and defined $self->{"wheels"}{$wheel_id}
MC/DC0%0/2
$wheel_id and defined $self->{"wheels"}{$wheel_id}
$wheel_id
defined $self->{"wheels"}{$wheel_id}
Truth table33%1/3
A and B
A= $wheel_idB= defined $self->{"wheels"}{$wheel_id}
| |||||||||||||||||||||||||||||||||||||||||||
| 841 | 2 | return [ map { $self->{wheels}{$wheel_id}{msgs}{$_} } qw[sent recv] ]; | |||||||||||||||||||||||||||||||||||||||||
| 842 | } | ||||||||||||||||||||||||||||||||||||||||||
| 843 | |||||||||||||||||||||||||||||||||||||||||||
| 844 | sub _conn_flooded { | ||||||||||||||||||||||||||||||||||||||||||
| 845 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_conn_flooded: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||
| 846 | 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()
| |||||||||||||||||||||||||||||||||||||||||||
| 847 | 0 | ▶ | return if !$self->connection_exists($conn_id); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 848 | 0 | return $self->{wheels}{$conn_id}{flooded}; | |||||||||||||||||||||||||||||||||||||||||
| 849 | } | ||||||||||||||||||||||||||||||||||||||||||
| 850 | |||||||||||||||||||||||||||||||||||||||||||
| 851 | sub add_denial { | ||||||||||||||||||||||||||||||||||||||||||
| 852 | 6 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_denial: called CC=5 SCAR=17.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 853 | 6 | ▶ | my $netmask = shift || return; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
shift() || (return)
MC/DC0%0/1
shift() || (return)
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||
| 854 | 6 | ▶ | my $reason = shift || 'Denied'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
shift() || 'Denied'
MC/DC0%0/1
shift() || 'Denied'
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||
| 855 | |||||||||||||||||||||||||||||||||||||||||||
| 856 | 6 | ▶ | if ( ! eval { $netmask->isa('Net::Netmask') } ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 857 | 6 | $netmask = Net::CIDR::cidrvalidate( $netmask ); | |||||||||||||||||||||||||||||||||||||||||
| 858 | } | ||||||||||||||||||||||||||||||||||||||||||
| 859 | |||||||||||||||||||||||||||||||||||||||||||
| 860 | 6 | ▶ | if ( !$netmask ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 861 | 0 | carp("Failed to validate netmask"); | |||||||||||||||||||||||||||||||||||||||||
| 862 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 863 | } | ||||||||||||||||||||||||||||||||||||||||||
| 864 | |||||||||||||||||||||||||||||||||||||||||||
| 865 | 6 | $self->{denials}{$netmask} = { | |||||||||||||||||||||||||||||||||||||||||
| 866 | blk => $netmask, | ||||||||||||||||||||||||||||||||||||||||||
| 867 | reason => $reason, | ||||||||||||||||||||||||||||||||||||||||||
| 868 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 869 | 6 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 870 | } | ||||||||||||||||||||||||||||||||||||||||||
| 871 | |||||||||||||||||||||||||||||||||||||||||||
| 872 | sub del_denial { | ||||||||||||||||||||||||||||||||||||||||||
| 873 | 5 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
del_denial: called CC=3 SCAR=11.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 874 | 5 | ▶ | my $netmask = shift || return; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
shift() || (return)
MC/DC0%0/1
shift() || (return)
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||
| 875 | 5 | ▶ | return if !$self->{denials}{$netmask}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 876 | 5 | delete $self->{denials}{$netmask}; | |||||||||||||||||||||||||||||||||||||||||
| 877 | 5 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 878 | } | ||||||||||||||||||||||||||||||||||||||||||
| 879 | |||||||||||||||||||||||||||||||||||||||||||
| 880 | sub add_exemption { | ||||||||||||||||||||||||||||||||||||||||||
| 881 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_exemption: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 882 | 0 | ▶ | my $netmask = shift || return; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
shift() || (return)
MC/DC0%0/1
shift() || (return)
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||
| 883 | |||||||||||||||||||||||||||||||||||||||||||
| 884 | 0 | ▶ | if ( !$netmask->isa('Net::Netmask') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 885 | 0 | $netmask = Net::CIDR::cidrvalidate( $netmask ); | |||||||||||||||||||||||||||||||||||||||||
| 886 | } | ||||||||||||||||||||||||||||||||||||||||||
| 887 | |||||||||||||||||||||||||||||||||||||||||||
| 888 | 0 | ▶ | if ( !$netmask ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 889 | 0 | carp("Failed to validate netmask"); | |||||||||||||||||||||||||||||||||||||||||
| 890 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 891 | } | ||||||||||||||||||||||||||||||||||||||||||
| 892 | |||||||||||||||||||||||||||||||||||||||||||
| 893 | 0 | ▶ | if (!$self->{exemptions}{$netmask}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 894 | 0 | $self->{exemptions}{$netmask} = $netmask; | |||||||||||||||||||||||||||||||||||||||||
| 895 | } | ||||||||||||||||||||||||||||||||||||||||||
| 896 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 897 | } | ||||||||||||||||||||||||||||||||||||||||||
| 898 | |||||||||||||||||||||||||||||||||||||||||||
| 899 | sub del_exemption { | ||||||||||||||||||||||||||||||||||||||||||
| 900 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
del_exemption: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 901 | 0 | ▶ | my $netmask = shift || return; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
shift() || (return)
MC/DC0%0/1
shift() || (return)
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||
| 902 | 0 | ▶ | return if !$self->{exemptions}{$netmask}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 903 | 0 | delete $self->{exemptions}{$netmask}; | |||||||||||||||||||||||||||||||||||||||||
| 904 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 905 | } | ||||||||||||||||||||||||||||||||||||||||||
| 906 | |||||||||||||||||||||||||||||||||||||||||||
| 907 | sub denied { | ||||||||||||||||||||||||||||||||||||||||||
| 908 | 529 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
denied: called CC=7 SCAR=21.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 909 | 529 | ▶ | my $ipaddr = shift || return; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
shift() || (return)
MC/DC0%0/1
shift() || (return)
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||
| 910 | 529 | ▶ | return if $self->exempted($ipaddr); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 911 | |||||||||||||||||||||||||||||||||||||||||||
| 912 | 529 | for my $mask (keys %{ $self->{denials} }) { | |||||||||||||||||||||||||||||||||||||||||
| 913 | 11 | ▶ | if ( eval { $self->{denials}{$mask}{blk}->isa('Net::Netmask') } && $self->{denials}{$mask}{blk}->match($ipaddr)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%1/3
eval {
do {
$self->{"denials"}{$mask}{"blk"}->isa("Net::Netmask")
}
} and $self->{"denials"}{$mask}{"blk"}->match($ipaddr)
MC/DC0%0/2
eval {
do {
$self->{"denials"}{$mask}{"blk"}->isa("Net::Netmask")
}
} and $self->{"denials"}{$mask}{"blk"}->match($ipaddr)
eval {
do {
$self->{"denials"}{$mask}{"blk"}->isa("Net::Netmask")
}
}
$self->{"denials"}{$mask}{"blk"}->match($ipaddr)
Truth table33%1/3
A and B
A= eval {
do {
$self->{"denials"}{$mask}{"blk"}->isa("Net::Netmask")
}
}B= $self->{"denials"}{$mask}{"blk"}->match($ipaddr)
| |||||||||||||||||||||||||||||||||||||||||||
| 914 | 0 | return $self->{denials}{$mask}{reason}; | |||||||||||||||||||||||||||||||||||||||||
| 915 | } | ||||||||||||||||||||||||||||||||||||||||||
| 916 | elsif ( Net::CIDR::cidrlookup( $ipaddr, $self->{denials}{$mask}{blk} ) ) { | ||||||||||||||||||||||||||||||||||||||||||
| 917 | 11 | return $self->{denials}{$mask}{reason}; | |||||||||||||||||||||||||||||||||||||||||
| 918 | } | ||||||||||||||||||||||||||||||||||||||||||
| 919 | } | ||||||||||||||||||||||||||||||||||||||||||
| 920 | |||||||||||||||||||||||||||||||||||||||||||
| 921 | 518 | return; | |||||||||||||||||||||||||||||||||||||||||
| 922 | } | ||||||||||||||||||||||||||||||||||||||||||
| 923 | |||||||||||||||||||||||||||||||||||||||||||
| 924 | sub exempted { | ||||||||||||||||||||||||||||||||||||||||||
| 925 | 529 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
exempted: called CC=6 SCAR=26.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 926 | 529 | ▶ | my $ipaddr = shift || return; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
shift() || (return)
MC/DC0%0/1
shift() || (return)
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||
| 927 | 529 | for my $mask (keys %{ $self->{exemptions} }) { | |||||||||||||||||||||||||||||||||||||||||
| 928 | 0 | ▶ | return 1 if $self->{exemptions}{$mask}->isa('Net::Netmask') && $self->{exemptions}{$mask}->match($ipaddr); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->{"exemptions"}{$mask}->isa("Net::Netmask") and $self->{"exemptions"}{$mask}->match($ipaddr)
MC/DC0%0/2
$self->{"exemptions"}{$mask}->isa("Net::Netmask") and $self->{"exemptions"}{$mask}->match($ipaddr)
$self->{"exemptions"}{$mask}->isa("Net::Netmask")
$self->{"exemptions"}{$mask}->match($ipaddr)
Truth table0%0/3
A and B
A= $self->{"exemptions"}{$mask}->isa("Net::Netmask")B= $self->{"exemptions"}{$mask}->match($ipaddr)
| |||||||||||||||||||||||||||||||||||||||||||
| 929 | 0 | ▶ | return 1 if Net::CIDR::cidrlookup( $ipaddr, $self->{exemptions}{$mask} ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 930 | } | ||||||||||||||||||||||||||||||||||||||||||
| 931 | 529 | return; | |||||||||||||||||||||||||||||||||||||||||
| 932 | } | ||||||||||||||||||||||||||||||||||||||||||
| 933 | |||||||||||||||||||||||||||||||||||||||||||
| 934 | 180 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 935 | |||||||||||||||||||||||||||||||||||||||||||
| 936 | =encoding utf8 | ||||||||||||||||||||||||||||||||||||||||||
| 937 | |||||||||||||||||||||||||||||||||||||||||||
| 938 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||
| 939 | |||||||||||||||||||||||||||||||||||||||||||
| 940 | POE::Component::Server::IRC::Backend - A POE component class that provides network connection abstraction for POE::Component::Server::IRC | ||||||||||||||||||||||||||||||||||||||||||
| 941 | |||||||||||||||||||||||||||||||||||||||||||
| 942 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||
| 943 | |||||||||||||||||||||||||||||||||||||||||||
| 944 | package MyIRCD; | ||||||||||||||||||||||||||||||||||||||||||
| 945 | |||||||||||||||||||||||||||||||||||||||||||
| 946 | use strict; | ||||||||||||||||||||||||||||||||||||||||||
| 947 | use warnings; | ||||||||||||||||||||||||||||||||||||||||||
| 948 | use base 'POE::Component::Server::IRC::Backend'; | ||||||||||||||||||||||||||||||||||||||||||
| 949 | |||||||||||||||||||||||||||||||||||||||||||
| 950 | sub spawn { | ||||||||||||||||||||||||||||||||||||||||||
| 951 | my ($package, %args) = @_; | ||||||||||||||||||||||||||||||||||||||||||
| 952 | |||||||||||||||||||||||||||||||||||||||||||
| 953 | my $self = $package->create(prefix => 'ircd_', @_); | ||||||||||||||||||||||||||||||||||||||||||
| 954 | |||||||||||||||||||||||||||||||||||||||||||
| 955 | # process %args ... | ||||||||||||||||||||||||||||||||||||||||||
| 956 | |||||||||||||||||||||||||||||||||||||||||||
| 957 | return $self; | ||||||||||||||||||||||||||||||||||||||||||
| 958 | } | ||||||||||||||||||||||||||||||||||||||||||
| 959 | |||||||||||||||||||||||||||||||||||||||||||
| 960 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||
| 961 | |||||||||||||||||||||||||||||||||||||||||||
| 962 | POE::Component::Server::IRC::Backend - A POE component class that provides | ||||||||||||||||||||||||||||||||||||||||||
| 963 | network connection abstraction for | ||||||||||||||||||||||||||||||||||||||||||
| 964 | L<POE::Component::Server::IRC|POE::Component::Server::IRC>. It uses a | ||||||||||||||||||||||||||||||||||||||||||
| 965 | plugin system. See | ||||||||||||||||||||||||||||||||||||||||||
| 966 | L<POE::Component::Server::IRC::Plugin|POE::Component::Server::IRC::Plugin> | ||||||||||||||||||||||||||||||||||||||||||
| 967 | for details. | ||||||||||||||||||||||||||||||||||||||||||
| 968 | |||||||||||||||||||||||||||||||||||||||||||
| 969 | =head1 CONSTRUCTOR | ||||||||||||||||||||||||||||||||||||||||||
| 970 | |||||||||||||||||||||||||||||||||||||||||||
| 971 | =head2 C<create> | ||||||||||||||||||||||||||||||||||||||||||
| 972 | |||||||||||||||||||||||||||||||||||||||||||
| 973 | Returns an object. Accepts the following parameters, all are optional: | ||||||||||||||||||||||||||||||||||||||||||
| 974 | |||||||||||||||||||||||||||||||||||||||||||
| 975 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 976 | |||||||||||||||||||||||||||||||||||||||||||
| 977 | =item * B<'alias'>, a POE::Kernel alias to set; | ||||||||||||||||||||||||||||||||||||||||||
| 978 | |||||||||||||||||||||||||||||||||||||||||||
| 979 | =item * B<'auth'>, set to a false value to globally disable IRC | ||||||||||||||||||||||||||||||||||||||||||
| 980 | authentication, default is auth is enabled; | ||||||||||||||||||||||||||||||||||||||||||
| 981 | |||||||||||||||||||||||||||||||||||||||||||
| 982 | =item * B<'antiflood'>, set to a false value to globally disable flood | ||||||||||||||||||||||||||||||||||||||||||
| 983 | protection, default is true; | ||||||||||||||||||||||||||||||||||||||||||
| 984 | |||||||||||||||||||||||||||||||||||||||||||
| 985 | =item * B<'prefix'>, this is the prefix that is used to generate event | ||||||||||||||||||||||||||||||||||||||||||
| 986 | names that the component produces. The default is 'ircd_'. | ||||||||||||||||||||||||||||||||||||||||||
| 987 | |||||||||||||||||||||||||||||||||||||||||||
| 988 | =item * B<'states'>, an array reference of extra objects states for the IRC | ||||||||||||||||||||||||||||||||||||||||||
| 989 | daemon's POE sessions. The elements can be array references of states | ||||||||||||||||||||||||||||||||||||||||||
| 990 | as well as hash references of state => handler pairs. | ||||||||||||||||||||||||||||||||||||||||||
| 991 | |||||||||||||||||||||||||||||||||||||||||||
| 992 | =item * B<'plugin_debug'>, set to a true value to print plugin debug info. | ||||||||||||||||||||||||||||||||||||||||||
| 993 | Default is false. | ||||||||||||||||||||||||||||||||||||||||||
| 994 | |||||||||||||||||||||||||||||||||||||||||||
| 995 | =item * B<'options'>, a hashref of options to L<POE::Session|POE::Session> | ||||||||||||||||||||||||||||||||||||||||||
| 996 | |||||||||||||||||||||||||||||||||||||||||||
| 997 | =item * B<'raw_events'>, whether to send L<raw|/ircd_raw_input> events. | ||||||||||||||||||||||||||||||||||||||||||
| 998 | False by default. Can be enabled later with L<C<raw_events>|/raw_events>; | ||||||||||||||||||||||||||||||||||||||||||
| 999 | |||||||||||||||||||||||||||||||||||||||||||
| 1000 | =item * B<'sslify_options'>, an array reference of items that are passed | ||||||||||||||||||||||||||||||||||||||||||
| 1001 | to L<POE::Component::SSLify> C<SSLify_Options>. Used to supply x509 certificate | ||||||||||||||||||||||||||||||||||||||||||
| 1002 | and key; | ||||||||||||||||||||||||||||||||||||||||||
| 1003 | |||||||||||||||||||||||||||||||||||||||||||
| 1004 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1005 | |||||||||||||||||||||||||||||||||||||||||||
| 1006 | If the component is created from within another session, that session will | ||||||||||||||||||||||||||||||||||||||||||
| 1007 | be automagcially registered with the component to receive events and get | ||||||||||||||||||||||||||||||||||||||||||
| 1008 | an 'ircd_backend_registered' event. | ||||||||||||||||||||||||||||||||||||||||||
| 1009 | |||||||||||||||||||||||||||||||||||||||||||
| 1010 | =head1 METHODS | ||||||||||||||||||||||||||||||||||||||||||
| 1011 | |||||||||||||||||||||||||||||||||||||||||||
| 1012 | =head2 General | ||||||||||||||||||||||||||||||||||||||||||
| 1013 | |||||||||||||||||||||||||||||||||||||||||||
| 1014 | =head3 C<shutdown> | ||||||||||||||||||||||||||||||||||||||||||
| 1015 | |||||||||||||||||||||||||||||||||||||||||||
| 1016 | Takes no arguments. Terminates the component. Removes all listeners and | ||||||||||||||||||||||||||||||||||||||||||
| 1017 | connectors. Disconnects all current client and server connections. This | ||||||||||||||||||||||||||||||||||||||||||
| 1018 | is a shorthand for C<< $ircd->yield('shutdown') >>. | ||||||||||||||||||||||||||||||||||||||||||
| 1019 | |||||||||||||||||||||||||||||||||||||||||||
| 1020 | =head3 C<session_id> | ||||||||||||||||||||||||||||||||||||||||||
| 1021 | |||||||||||||||||||||||||||||||||||||||||||
| 1022 | I<Inherited from L<POE::Component::Syndicator|POE::Component::Syndicator/session_id>> | ||||||||||||||||||||||||||||||||||||||||||
| 1023 | |||||||||||||||||||||||||||||||||||||||||||
| 1024 | Takes no arguments. Returns the ID of the component's session. Ideal for | ||||||||||||||||||||||||||||||||||||||||||
| 1025 | posting events to the component. | ||||||||||||||||||||||||||||||||||||||||||
| 1026 | |||||||||||||||||||||||||||||||||||||||||||
| 1027 | =head3 C<session_alias> | ||||||||||||||||||||||||||||||||||||||||||
| 1028 | |||||||||||||||||||||||||||||||||||||||||||
| 1029 | I<Inherited from L<POE::Component::Syndicator|POE::Component::Syndicator/session_alias>> | ||||||||||||||||||||||||||||||||||||||||||
| 1030 | |||||||||||||||||||||||||||||||||||||||||||
| 1031 | Takes no arguments. Returns the session alias that has been set through | ||||||||||||||||||||||||||||||||||||||||||
| 1032 | L<C<create>|/create>'s B<'alias'> argument. | ||||||||||||||||||||||||||||||||||||||||||
| 1033 | |||||||||||||||||||||||||||||||||||||||||||
| 1034 | =head3 C<yield> | ||||||||||||||||||||||||||||||||||||||||||
| 1035 | |||||||||||||||||||||||||||||||||||||||||||
| 1036 | I<Inherited from L<POE::Component::Syndicator|POE::Component::Syndicator/yield>> | ||||||||||||||||||||||||||||||||||||||||||
| 1037 | |||||||||||||||||||||||||||||||||||||||||||
| 1038 | This method provides an alternative object based means of posting events | ||||||||||||||||||||||||||||||||||||||||||
| 1039 | to the component. First argument is the event to post, following arguments | ||||||||||||||||||||||||||||||||||||||||||
| 1040 | are sent as arguments to the resultant post. | ||||||||||||||||||||||||||||||||||||||||||
| 1041 | |||||||||||||||||||||||||||||||||||||||||||
| 1042 | =head3 C<call> | ||||||||||||||||||||||||||||||||||||||||||
| 1043 | |||||||||||||||||||||||||||||||||||||||||||
| 1044 | I<Inherited from L<POE::Component::Syndicator|POE::Component::Syndicator/call>> | ||||||||||||||||||||||||||||||||||||||||||
| 1045 | |||||||||||||||||||||||||||||||||||||||||||
| 1046 | This method provides an alternative object based means of calling events | ||||||||||||||||||||||||||||||||||||||||||
| 1047 | to the component. First argument is the event to call, following arguments | ||||||||||||||||||||||||||||||||||||||||||
| 1048 | are sent as arguments to the resultant call. | ||||||||||||||||||||||||||||||||||||||||||
| 1049 | |||||||||||||||||||||||||||||||||||||||||||
| 1050 | =head3 C<delay> | ||||||||||||||||||||||||||||||||||||||||||
| 1051 | |||||||||||||||||||||||||||||||||||||||||||
| 1052 | I<Inherited from L<POE::Component::Syndicator|POE::Component::Syndicator/delay>> | ||||||||||||||||||||||||||||||||||||||||||
| 1053 | |||||||||||||||||||||||||||||||||||||||||||
| 1054 | This method provides a way of posting delayed events to the component. The | ||||||||||||||||||||||||||||||||||||||||||
| 1055 | first argument is an arrayref consisting of the delayed command to post and | ||||||||||||||||||||||||||||||||||||||||||
| 1056 | any command arguments. The second argument is the time in seconds that one | ||||||||||||||||||||||||||||||||||||||||||
| 1057 | wishes to delay the command being posted. | ||||||||||||||||||||||||||||||||||||||||||
| 1058 | |||||||||||||||||||||||||||||||||||||||||||
| 1059 | Returns an alarm ID that can be used with L<C<delay_remove>|/delay_remove> | ||||||||||||||||||||||||||||||||||||||||||
| 1060 | to cancel the delayed event. This will be undefined if something went | ||||||||||||||||||||||||||||||||||||||||||
| 1061 | wrong. | ||||||||||||||||||||||||||||||||||||||||||
| 1062 | |||||||||||||||||||||||||||||||||||||||||||
| 1063 | =head3 C<delay_remove> | ||||||||||||||||||||||||||||||||||||||||||
| 1064 | |||||||||||||||||||||||||||||||||||||||||||
| 1065 | I<Inherited from L<POE::Component::Syndicator|POE::Component::Syndicator/delay_remove>> | ||||||||||||||||||||||||||||||||||||||||||
| 1066 | |||||||||||||||||||||||||||||||||||||||||||
| 1067 | This method removes a previously scheduled delayed event from the | ||||||||||||||||||||||||||||||||||||||||||
| 1068 | component. Takes one argument, the C<alarm_id> that was returned by a | ||||||||||||||||||||||||||||||||||||||||||
| 1069 | L<C<delay>|/delay> method call. | ||||||||||||||||||||||||||||||||||||||||||
| 1070 | |||||||||||||||||||||||||||||||||||||||||||
| 1071 | Returns an arrayref that was originally requested to be delayed. | ||||||||||||||||||||||||||||||||||||||||||
| 1072 | |||||||||||||||||||||||||||||||||||||||||||
| 1073 | =head3 C<send_event> | ||||||||||||||||||||||||||||||||||||||||||
| 1074 | |||||||||||||||||||||||||||||||||||||||||||
| 1075 | I<Inherited from L<POE::Component::Syndicator|POE::Component::Syndicator/send_event>> | ||||||||||||||||||||||||||||||||||||||||||
| 1076 | |||||||||||||||||||||||||||||||||||||||||||
| 1077 | Sends an event through the component's event handling system. These will | ||||||||||||||||||||||||||||||||||||||||||
| 1078 | get processed by plugins then by registered sessions. First argument is | ||||||||||||||||||||||||||||||||||||||||||
| 1079 | the event name, followed by any parameters for that event. | ||||||||||||||||||||||||||||||||||||||||||
| 1080 | |||||||||||||||||||||||||||||||||||||||||||
| 1081 | =head3 C<send_event_next> | ||||||||||||||||||||||||||||||||||||||||||
| 1082 | |||||||||||||||||||||||||||||||||||||||||||
| 1083 | I<Inherited from L<POE::Component::Syndicator|POE::Component::Syndicator/send_event_next>> | ||||||||||||||||||||||||||||||||||||||||||
| 1084 | |||||||||||||||||||||||||||||||||||||||||||
| 1085 | This sends an event right after the one that's currently being processed. | ||||||||||||||||||||||||||||||||||||||||||
| 1086 | Useful if you want to generate some event which is directly related to | ||||||||||||||||||||||||||||||||||||||||||
| 1087 | another event so you want them to appear together. This method can only be | ||||||||||||||||||||||||||||||||||||||||||
| 1088 | called when POE::Component::IRC is processing an event, e.g. from one of | ||||||||||||||||||||||||||||||||||||||||||
| 1089 | your event handlers. Takes the same arguments as | ||||||||||||||||||||||||||||||||||||||||||
| 1090 | L<C<send_event>|/send_event>. | ||||||||||||||||||||||||||||||||||||||||||
| 1091 | |||||||||||||||||||||||||||||||||||||||||||
| 1092 | =head3 C<send_event_now> | ||||||||||||||||||||||||||||||||||||||||||
| 1093 | |||||||||||||||||||||||||||||||||||||||||||
| 1094 | I<Inherited from L<POE::Component::Syndicator|POE::Component::Syndicator/send_event_now>> | ||||||||||||||||||||||||||||||||||||||||||
| 1095 | |||||||||||||||||||||||||||||||||||||||||||
| 1096 | This will send an event to be processed immediately. This means that if an | ||||||||||||||||||||||||||||||||||||||||||
| 1097 | event is currently being processed and there are plugins or sessions which | ||||||||||||||||||||||||||||||||||||||||||
| 1098 | will receive it after you do, then an event sent with C<send_event_now> | ||||||||||||||||||||||||||||||||||||||||||
| 1099 | will be received by those plugins/sessions I<before> the current event. | ||||||||||||||||||||||||||||||||||||||||||
| 1100 | Takes the same arguments as L<C<send_event>|/send_event>. | ||||||||||||||||||||||||||||||||||||||||||
| 1101 | |||||||||||||||||||||||||||||||||||||||||||
| 1102 | =head3 C<raw_events> | ||||||||||||||||||||||||||||||||||||||||||
| 1103 | |||||||||||||||||||||||||||||||||||||||||||
| 1104 | If called with a true value, raw events (L<C<ircd_raw_input>|/ircd_raw_input> | ||||||||||||||||||||||||||||||||||||||||||
| 1105 | and L<C<ircd_raw_output>|/ircd_raw_output>) will be enabled. | ||||||||||||||||||||||||||||||||||||||||||
| 1106 | |||||||||||||||||||||||||||||||||||||||||||
| 1107 | =head2 Connections | ||||||||||||||||||||||||||||||||||||||||||
| 1108 | |||||||||||||||||||||||||||||||||||||||||||
| 1109 | =head3 C<antiflood> | ||||||||||||||||||||||||||||||||||||||||||
| 1110 | |||||||||||||||||||||||||||||||||||||||||||
| 1111 | Takes two arguments, a connection id and true/false value. If value is | ||||||||||||||||||||||||||||||||||||||||||
| 1112 | specified antiflood protection is enabled or disabled accordingly for the | ||||||||||||||||||||||||||||||||||||||||||
| 1113 | specified connection. If a value is not specified the current status of | ||||||||||||||||||||||||||||||||||||||||||
| 1114 | antiflood protection is returned. Returns undef on error. | ||||||||||||||||||||||||||||||||||||||||||
| 1115 | |||||||||||||||||||||||||||||||||||||||||||
| 1116 | =head3 C<compressed_link> | ||||||||||||||||||||||||||||||||||||||||||
| 1117 | |||||||||||||||||||||||||||||||||||||||||||
| 1118 | Takes two arguments, a connection id and true/false value. If a value is | ||||||||||||||||||||||||||||||||||||||||||
| 1119 | specified, compression will be enabled or disabled accordingly for the | ||||||||||||||||||||||||||||||||||||||||||
| 1120 | specified connection. If a value is not specified the current status of | ||||||||||||||||||||||||||||||||||||||||||
| 1121 | compression is returned. Returns undef on error. | ||||||||||||||||||||||||||||||||||||||||||
| 1122 | |||||||||||||||||||||||||||||||||||||||||||
| 1123 | =head3 C<disconnect> | ||||||||||||||||||||||||||||||||||||||||||
| 1124 | |||||||||||||||||||||||||||||||||||||||||||
| 1125 | Requires on argument, the connection id you wish to disconnect. The | ||||||||||||||||||||||||||||||||||||||||||
| 1126 | component will terminate the connection the next time that the wheel input | ||||||||||||||||||||||||||||||||||||||||||
| 1127 | is flushed, so you may send some sort of error message to the client on | ||||||||||||||||||||||||||||||||||||||||||
| 1128 | that connection. Returns true on success, undef on error. | ||||||||||||||||||||||||||||||||||||||||||
| 1129 | |||||||||||||||||||||||||||||||||||||||||||
| 1130 | =head3 C<connection_exists> | ||||||||||||||||||||||||||||||||||||||||||
| 1131 | |||||||||||||||||||||||||||||||||||||||||||
| 1132 | Requires one argument, a connection id. Returns true value if the connection | ||||||||||||||||||||||||||||||||||||||||||
| 1133 | exists, false otherwise. | ||||||||||||||||||||||||||||||||||||||||||
| 1134 | |||||||||||||||||||||||||||||||||||||||||||
| 1135 | =head3 C<connection_info> | ||||||||||||||||||||||||||||||||||||||||||
| 1136 | |||||||||||||||||||||||||||||||||||||||||||
| 1137 | Takes one argument, a connection_id. Returns a list consisting of: the IP | ||||||||||||||||||||||||||||||||||||||||||
| 1138 | address of the peer; the port on the peer; our socket address; our socket | ||||||||||||||||||||||||||||||||||||||||||
| 1139 | port. Returns undef on error. | ||||||||||||||||||||||||||||||||||||||||||
| 1140 | |||||||||||||||||||||||||||||||||||||||||||
| 1141 | my ($peeraddr, $peerport, $sockaddr, $sockport) = $ircd->connection_info($conn_id); | ||||||||||||||||||||||||||||||||||||||||||
| 1142 | |||||||||||||||||||||||||||||||||||||||||||
| 1143 | =head3 C<add_denial> | ||||||||||||||||||||||||||||||||||||||||||
| 1144 | |||||||||||||||||||||||||||||||||||||||||||
| 1145 | Takes one mandatory argument and one optional. The first mandatory | ||||||||||||||||||||||||||||||||||||||||||
| 1146 | argument is an address or CIDR as understood by L<Net::CIDR>::cidrvalidate that will be used to | ||||||||||||||||||||||||||||||||||||||||||
| 1147 | check connecting IP addresses against. The second optional argument is a | ||||||||||||||||||||||||||||||||||||||||||
| 1148 | reason string for the denial. | ||||||||||||||||||||||||||||||||||||||||||
| 1149 | |||||||||||||||||||||||||||||||||||||||||||
| 1150 | =head3 C<del_denial> | ||||||||||||||||||||||||||||||||||||||||||
| 1151 | |||||||||||||||||||||||||||||||||||||||||||
| 1152 | Takes one mandatory argument, an address or CIDR as understood by L<Net::CIDR>::cidrvalidate to | ||||||||||||||||||||||||||||||||||||||||||
| 1153 | remove from the current denial list. | ||||||||||||||||||||||||||||||||||||||||||
| 1154 | |||||||||||||||||||||||||||||||||||||||||||
| 1155 | =head3 C<denied> | ||||||||||||||||||||||||||||||||||||||||||
| 1156 | |||||||||||||||||||||||||||||||||||||||||||
| 1157 | Takes one argument, an IP address. Returns true or false depending on | ||||||||||||||||||||||||||||||||||||||||||
| 1158 | whether that IP is denied or not. | ||||||||||||||||||||||||||||||||||||||||||
| 1159 | |||||||||||||||||||||||||||||||||||||||||||
| 1160 | =head3 C<add_exemption> | ||||||||||||||||||||||||||||||||||||||||||
| 1161 | |||||||||||||||||||||||||||||||||||||||||||
| 1162 | Takes one mandatory argument, an address or CIDR as understood by L<Net::CIDR>::cidrvalidate that | ||||||||||||||||||||||||||||||||||||||||||
| 1163 | will be checked against connecting IP addresses for exemption from denials. | ||||||||||||||||||||||||||||||||||||||||||
| 1164 | |||||||||||||||||||||||||||||||||||||||||||
| 1165 | =head3 C<del_exemption> | ||||||||||||||||||||||||||||||||||||||||||
| 1166 | |||||||||||||||||||||||||||||||||||||||||||
| 1167 | Takes one mandatory argument, an address or CIDR as understood by L<Net::CIDR>::cidrvalidate to | ||||||||||||||||||||||||||||||||||||||||||
| 1168 | remove from the current exemption list. | ||||||||||||||||||||||||||||||||||||||||||
| 1169 | |||||||||||||||||||||||||||||||||||||||||||
| 1170 | =head3 C<exempted> | ||||||||||||||||||||||||||||||||||||||||||
| 1171 | |||||||||||||||||||||||||||||||||||||||||||
| 1172 | Takes one argument, an IP address. Returns true or false depending on | ||||||||||||||||||||||||||||||||||||||||||
| 1173 | whether that IP is exempt from denial or not. | ||||||||||||||||||||||||||||||||||||||||||
| 1174 | |||||||||||||||||||||||||||||||||||||||||||
| 1175 | =head2 Plugins | ||||||||||||||||||||||||||||||||||||||||||
| 1176 | |||||||||||||||||||||||||||||||||||||||||||
| 1177 | =head3 C<pipeline> | ||||||||||||||||||||||||||||||||||||||||||
| 1178 | |||||||||||||||||||||||||||||||||||||||||||
| 1179 | I<Inherited from L<Object::Pluggable|Object::Pluggable/pipeline>> | ||||||||||||||||||||||||||||||||||||||||||
| 1180 | |||||||||||||||||||||||||||||||||||||||||||
| 1181 | Returns the L<Object::Pluggable::Pipeline|Object::Pluggable::Pipeline> | ||||||||||||||||||||||||||||||||||||||||||
| 1182 | object. | ||||||||||||||||||||||||||||||||||||||||||
| 1183 | |||||||||||||||||||||||||||||||||||||||||||
| 1184 | =head3 C<plugin_add> | ||||||||||||||||||||||||||||||||||||||||||
| 1185 | |||||||||||||||||||||||||||||||||||||||||||
| 1186 | I<Inherited from L<Object::Pluggable|Object::Pluggable/plugin_add>> | ||||||||||||||||||||||||||||||||||||||||||
| 1187 | |||||||||||||||||||||||||||||||||||||||||||
| 1188 | Accepts two arguments: | ||||||||||||||||||||||||||||||||||||||||||
| 1189 | |||||||||||||||||||||||||||||||||||||||||||
| 1190 | The alias for the plugin | ||||||||||||||||||||||||||||||||||||||||||
| 1191 | The actual plugin object | ||||||||||||||||||||||||||||||||||||||||||
| 1192 | Any number of extra arguments | ||||||||||||||||||||||||||||||||||||||||||
| 1193 | |||||||||||||||||||||||||||||||||||||||||||
| 1194 | The alias is there for the user to refer to it, as it is possible to have | ||||||||||||||||||||||||||||||||||||||||||
| 1195 | multiple plugins of the same kind active in one Object::Pluggable object. | ||||||||||||||||||||||||||||||||||||||||||
| 1196 | |||||||||||||||||||||||||||||||||||||||||||
| 1197 | This method goes through the pipeline's C<push()> method, which will call | ||||||||||||||||||||||||||||||||||||||||||
| 1198 | C<< $plugin->plugin_register($pluggable, @args) >>. | ||||||||||||||||||||||||||||||||||||||||||
| 1199 | |||||||||||||||||||||||||||||||||||||||||||
| 1200 | Returns the number of plugins now in the pipeline if plugin was | ||||||||||||||||||||||||||||||||||||||||||
| 1201 | initialized, C<undef>/an empty list if not. | ||||||||||||||||||||||||||||||||||||||||||
| 1202 | |||||||||||||||||||||||||||||||||||||||||||
| 1203 | =head3 C<plugin_del> | ||||||||||||||||||||||||||||||||||||||||||
| 1204 | |||||||||||||||||||||||||||||||||||||||||||
| 1205 | I<Inherited from L<Object::Pluggable|Object::Pluggable/plugin_del>> | ||||||||||||||||||||||||||||||||||||||||||
| 1206 | |||||||||||||||||||||||||||||||||||||||||||
| 1207 | Accepts the following arguments: | ||||||||||||||||||||||||||||||||||||||||||
| 1208 | |||||||||||||||||||||||||||||||||||||||||||
| 1209 | The alias for the plugin or the plugin object itself | ||||||||||||||||||||||||||||||||||||||||||
| 1210 | Any number of extra arguments | ||||||||||||||||||||||||||||||||||||||||||
| 1211 | |||||||||||||||||||||||||||||||||||||||||||
| 1212 | This method goes through the pipeline's C<remove()> method, which will call | ||||||||||||||||||||||||||||||||||||||||||
| 1213 | C<< $plugin->plugin_unregister($pluggable, @args) >>. | ||||||||||||||||||||||||||||||||||||||||||
| 1214 | |||||||||||||||||||||||||||||||||||||||||||
| 1215 | Returns the plugin object if the plugin was removed, C<undef>/an empty list | ||||||||||||||||||||||||||||||||||||||||||
| 1216 | if not. | ||||||||||||||||||||||||||||||||||||||||||
| 1217 | |||||||||||||||||||||||||||||||||||||||||||
| 1218 | =head3 C<plugin_get> | ||||||||||||||||||||||||||||||||||||||||||
| 1219 | |||||||||||||||||||||||||||||||||||||||||||
| 1220 | I<Inherited from L<Object::Pluggable|Object::Pluggable/plugin_get>> | ||||||||||||||||||||||||||||||||||||||||||
| 1221 | |||||||||||||||||||||||||||||||||||||||||||
| 1222 | Accepts the following arguments: | ||||||||||||||||||||||||||||||||||||||||||
| 1223 | |||||||||||||||||||||||||||||||||||||||||||
| 1224 | The alias for the plugin | ||||||||||||||||||||||||||||||||||||||||||
| 1225 | |||||||||||||||||||||||||||||||||||||||||||
| 1226 | This method goes through the pipeline's C<get()> method. | ||||||||||||||||||||||||||||||||||||||||||
| 1227 | |||||||||||||||||||||||||||||||||||||||||||
| 1228 | Returns the plugin object if it was found, C<undef>/an empty list if not. | ||||||||||||||||||||||||||||||||||||||||||
| 1229 | |||||||||||||||||||||||||||||||||||||||||||
| 1230 | =head3 C<plugin_list> | ||||||||||||||||||||||||||||||||||||||||||
| 1231 | |||||||||||||||||||||||||||||||||||||||||||
| 1232 | I<Inherited from L<Object::Pluggable|Object::Pluggable/plugin_list>> | ||||||||||||||||||||||||||||||||||||||||||
| 1233 | |||||||||||||||||||||||||||||||||||||||||||
| 1234 | Takes no arguments. | ||||||||||||||||||||||||||||||||||||||||||
| 1235 | |||||||||||||||||||||||||||||||||||||||||||
| 1236 | Returns a hashref of plugin objects, keyed on alias, or an empty list if | ||||||||||||||||||||||||||||||||||||||||||
| 1237 | there are no plugins loaded. | ||||||||||||||||||||||||||||||||||||||||||
| 1238 | |||||||||||||||||||||||||||||||||||||||||||
| 1239 | =head3 C<plugin_order> | ||||||||||||||||||||||||||||||||||||||||||
| 1240 | |||||||||||||||||||||||||||||||||||||||||||
| 1241 | I<Inherited from L<Object::Pluggable|Object::Pluggable/plugin_order>> | ||||||||||||||||||||||||||||||||||||||||||
| 1242 | |||||||||||||||||||||||||||||||||||||||||||
| 1243 | Takes no arguments. | ||||||||||||||||||||||||||||||||||||||||||
| 1244 | |||||||||||||||||||||||||||||||||||||||||||
| 1245 | Returns an arrayref of plugin objects, in the order which they are | ||||||||||||||||||||||||||||||||||||||||||
| 1246 | encountered in the pipeline. | ||||||||||||||||||||||||||||||||||||||||||
| 1247 | |||||||||||||||||||||||||||||||||||||||||||
| 1248 | =head3 C<plugin_register> | ||||||||||||||||||||||||||||||||||||||||||
| 1249 | |||||||||||||||||||||||||||||||||||||||||||
| 1250 | I<Inherited from L<Object::Pluggable|Object::Pluggable/plugin_register>> | ||||||||||||||||||||||||||||||||||||||||||
| 1251 | |||||||||||||||||||||||||||||||||||||||||||
| 1252 | Accepts the following arguments: | ||||||||||||||||||||||||||||||||||||||||||
| 1253 | |||||||||||||||||||||||||||||||||||||||||||
| 1254 | The plugin object | ||||||||||||||||||||||||||||||||||||||||||
| 1255 | The type of the hook (the hook types are specified with _pluggable_init()'s 'types') | ||||||||||||||||||||||||||||||||||||||||||
| 1256 | The event name[s] to watch | ||||||||||||||||||||||||||||||||||||||||||
| 1257 | |||||||||||||||||||||||||||||||||||||||||||
| 1258 | The event names can be as many as possible, or an arrayref. They correspond | ||||||||||||||||||||||||||||||||||||||||||
| 1259 | to the prefixed events and naturally, arbitrary events too. | ||||||||||||||||||||||||||||||||||||||||||
| 1260 | |||||||||||||||||||||||||||||||||||||||||||
| 1261 | You do not need to supply events with the prefix in front of them, just the | ||||||||||||||||||||||||||||||||||||||||||
| 1262 | names. | ||||||||||||||||||||||||||||||||||||||||||
| 1263 | |||||||||||||||||||||||||||||||||||||||||||
| 1264 | It is possible to register for all events by specifying 'all' as an event. | ||||||||||||||||||||||||||||||||||||||||||
| 1265 | |||||||||||||||||||||||||||||||||||||||||||
| 1266 | Returns 1 if everything checked out fine, C<undef>/an empty list if | ||||||||||||||||||||||||||||||||||||||||||
| 1267 | something is seriously wrong. | ||||||||||||||||||||||||||||||||||||||||||
| 1268 | |||||||||||||||||||||||||||||||||||||||||||
| 1269 | =head3 C<plugin_unregister> | ||||||||||||||||||||||||||||||||||||||||||
| 1270 | |||||||||||||||||||||||||||||||||||||||||||
| 1271 | I<Inherited from L<Object::Pluggable|Object::Pluggable/plugin_unregister>> | ||||||||||||||||||||||||||||||||||||||||||
| 1272 | |||||||||||||||||||||||||||||||||||||||||||
| 1273 | Accepts the following arguments: | ||||||||||||||||||||||||||||||||||||||||||
| 1274 | |||||||||||||||||||||||||||||||||||||||||||
| 1275 | The plugin object | ||||||||||||||||||||||||||||||||||||||||||
| 1276 | The type of the hook (the hook types are specified with _pluggable_init()'s 'types') | ||||||||||||||||||||||||||||||||||||||||||
| 1277 | The event name[s] to unwatch | ||||||||||||||||||||||||||||||||||||||||||
| 1278 | |||||||||||||||||||||||||||||||||||||||||||
| 1279 | The event names can be as many as possible, or an arrayref. They correspond | ||||||||||||||||||||||||||||||||||||||||||
| 1280 | to the prefixed events and naturally, arbitrary events too. | ||||||||||||||||||||||||||||||||||||||||||
| 1281 | |||||||||||||||||||||||||||||||||||||||||||
| 1282 | You do not need to supply events with the prefix in front of them, just the | ||||||||||||||||||||||||||||||||||||||||||
| 1283 | names. | ||||||||||||||||||||||||||||||||||||||||||
| 1284 | |||||||||||||||||||||||||||||||||||||||||||
| 1285 | It is possible to register for all events by specifying 'all' as an event. | ||||||||||||||||||||||||||||||||||||||||||
| 1286 | |||||||||||||||||||||||||||||||||||||||||||
| 1287 | Returns 1 if all the event name[s] was unregistered, undef if some was not | ||||||||||||||||||||||||||||||||||||||||||
| 1288 | found. | ||||||||||||||||||||||||||||||||||||||||||
| 1289 | |||||||||||||||||||||||||||||||||||||||||||
| 1290 | =head1 INPUT EVENTS | ||||||||||||||||||||||||||||||||||||||||||
| 1291 | |||||||||||||||||||||||||||||||||||||||||||
| 1292 | These are POE events that the component will accept: | ||||||||||||||||||||||||||||||||||||||||||
| 1293 | |||||||||||||||||||||||||||||||||||||||||||
| 1294 | =head2 C<register> | ||||||||||||||||||||||||||||||||||||||||||
| 1295 | |||||||||||||||||||||||||||||||||||||||||||
| 1296 | I<Inherited from L<POE::Component::Syndicator|POE::Component::Syndicator/register>> | ||||||||||||||||||||||||||||||||||||||||||
| 1297 | |||||||||||||||||||||||||||||||||||||||||||
| 1298 | Takes N arguments: a list of event names that your session wants to listen | ||||||||||||||||||||||||||||||||||||||||||
| 1299 | for, minus the C<irc_> prefix. | ||||||||||||||||||||||||||||||||||||||||||
| 1300 | |||||||||||||||||||||||||||||||||||||||||||
| 1301 | $ircd->yield('register', qw(connected disconnected)); | ||||||||||||||||||||||||||||||||||||||||||
| 1302 | |||||||||||||||||||||||||||||||||||||||||||
| 1303 | The special argument 'all' will register your session for all events. | ||||||||||||||||||||||||||||||||||||||||||
| 1304 | Registering will generate an L<C<ircd_registered>|/ircd_registered> | ||||||||||||||||||||||||||||||||||||||||||
| 1305 | event that your session can trap. | ||||||||||||||||||||||||||||||||||||||||||
| 1306 | |||||||||||||||||||||||||||||||||||||||||||
| 1307 | =head2 C<unregister> | ||||||||||||||||||||||||||||||||||||||||||
| 1308 | |||||||||||||||||||||||||||||||||||||||||||
| 1309 | I<Inherited from L<POE::Component::Syndicator|POE::Component::Syndicator/unregister>> | ||||||||||||||||||||||||||||||||||||||||||
| 1310 | |||||||||||||||||||||||||||||||||||||||||||
| 1311 | Takes N arguments: a list of event names which you I<don't> want to | ||||||||||||||||||||||||||||||||||||||||||
| 1312 | receive. If you've previously done a L<C<register>|/register> | ||||||||||||||||||||||||||||||||||||||||||
| 1313 | for a particular event which you no longer care about, this event will | ||||||||||||||||||||||||||||||||||||||||||
| 1314 | tell the component to stop sending them to you. (If you haven't, it just | ||||||||||||||||||||||||||||||||||||||||||
| 1315 | ignores you. No big deal.) | ||||||||||||||||||||||||||||||||||||||||||
| 1316 | |||||||||||||||||||||||||||||||||||||||||||
| 1317 | If you have registered with 'all', attempting to unregister individual | ||||||||||||||||||||||||||||||||||||||||||
| 1318 | events such as 'connected', etc. will not work. This is a 'feature'. | ||||||||||||||||||||||||||||||||||||||||||
| 1319 | |||||||||||||||||||||||||||||||||||||||||||
| 1320 | =head2 C<add_listener> | ||||||||||||||||||||||||||||||||||||||||||
| 1321 | |||||||||||||||||||||||||||||||||||||||||||
| 1322 | Takes a number of arguments. Adds a new listener. | ||||||||||||||||||||||||||||||||||||||||||
| 1323 | |||||||||||||||||||||||||||||||||||||||||||
| 1324 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1325 | |||||||||||||||||||||||||||||||||||||||||||
| 1326 | =item * B<'port'>, the TCP port to listen on. Default is a random port; | ||||||||||||||||||||||||||||||||||||||||||
| 1327 | |||||||||||||||||||||||||||||||||||||||||||
| 1328 | =item * B<'auth'>, enable or disable auth sub-system for this listener. | ||||||||||||||||||||||||||||||||||||||||||
| 1329 | Enabled by default; | ||||||||||||||||||||||||||||||||||||||||||
| 1330 | |||||||||||||||||||||||||||||||||||||||||||
| 1331 | =item * B<'bindaddr'>, specify a local address to bind the listener to; | ||||||||||||||||||||||||||||||||||||||||||
| 1332 | |||||||||||||||||||||||||||||||||||||||||||
| 1333 | =item * B<'listenqueue'>, change the SocketFactory's ListenQueue; | ||||||||||||||||||||||||||||||||||||||||||
| 1334 | |||||||||||||||||||||||||||||||||||||||||||
| 1335 | =item * B<'usessl'>, whether the listener should use SSL. Default is | ||||||||||||||||||||||||||||||||||||||||||
| 1336 | false; | ||||||||||||||||||||||||||||||||||||||||||
| 1337 | |||||||||||||||||||||||||||||||||||||||||||
| 1338 | =item * B<'antiflood'>, whether the listener should use flood protection. | ||||||||||||||||||||||||||||||||||||||||||
| 1339 | Defaults is true; | ||||||||||||||||||||||||||||||||||||||||||
| 1340 | |||||||||||||||||||||||||||||||||||||||||||
| 1341 | =item * B<'idle'>, the time, in seconds, after which a connection will be | ||||||||||||||||||||||||||||||||||||||||||
| 1342 | considered idle. Defaults is 180. | ||||||||||||||||||||||||||||||||||||||||||
| 1343 | |||||||||||||||||||||||||||||||||||||||||||
| 1344 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1345 | |||||||||||||||||||||||||||||||||||||||||||
| 1346 | =head2 C<del_listener> | ||||||||||||||||||||||||||||||||||||||||||
| 1347 | |||||||||||||||||||||||||||||||||||||||||||
| 1348 | Takes one of the following arguments: | ||||||||||||||||||||||||||||||||||||||||||
| 1349 | |||||||||||||||||||||||||||||||||||||||||||
| 1350 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1351 | |||||||||||||||||||||||||||||||||||||||||||
| 1352 | =item * B<'listener'>, a previously returned listener ID; | ||||||||||||||||||||||||||||||||||||||||||
| 1353 | |||||||||||||||||||||||||||||||||||||||||||
| 1354 | =item * B<'port'>, a listening port; | ||||||||||||||||||||||||||||||||||||||||||
| 1355 | |||||||||||||||||||||||||||||||||||||||||||
| 1356 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1357 | |||||||||||||||||||||||||||||||||||||||||||
| 1358 | The listener will be deleted. Note: any connected clients on that port | ||||||||||||||||||||||||||||||||||||||||||
| 1359 | will not be disconnected. | ||||||||||||||||||||||||||||||||||||||||||
| 1360 | |||||||||||||||||||||||||||||||||||||||||||
| 1361 | =head2 C<add_connector> | ||||||||||||||||||||||||||||||||||||||||||
| 1362 | |||||||||||||||||||||||||||||||||||||||||||
| 1363 | Takes two mandatory arguments, B<'remoteaddress'> and B<'remoteport'>. | ||||||||||||||||||||||||||||||||||||||||||
| 1364 | Opens a TCP connection to specified address and port. | ||||||||||||||||||||||||||||||||||||||||||
| 1365 | |||||||||||||||||||||||||||||||||||||||||||
| 1366 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1367 | |||||||||||||||||||||||||||||||||||||||||||
| 1368 | =item * B<'remoteaddress'>, hostname or IP address to connect to; | ||||||||||||||||||||||||||||||||||||||||||
| 1369 | |||||||||||||||||||||||||||||||||||||||||||
| 1370 | =item * B<'remoteport'>, the TCP port on the remote host; | ||||||||||||||||||||||||||||||||||||||||||
| 1371 | |||||||||||||||||||||||||||||||||||||||||||
| 1372 | =item * B<'bindaddress'>, a local address to bind from (optional); | ||||||||||||||||||||||||||||||||||||||||||
| 1373 | |||||||||||||||||||||||||||||||||||||||||||
| 1374 | =item * B<'idle'>, the time, in seconds, after which a connection will be | ||||||||||||||||||||||||||||||||||||||||||
| 1375 | considered idle. Defaults is 180; | ||||||||||||||||||||||||||||||||||||||||||
| 1376 | |||||||||||||||||||||||||||||||||||||||||||
| 1377 | =item * B<'usessl'>, whether the connection should use SSL. Default is | ||||||||||||||||||||||||||||||||||||||||||
| 1378 | false; | ||||||||||||||||||||||||||||||||||||||||||
| 1379 | |||||||||||||||||||||||||||||||||||||||||||
| 1380 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1381 | |||||||||||||||||||||||||||||||||||||||||||
| 1382 | =head2 C<send_output> | ||||||||||||||||||||||||||||||||||||||||||
| 1383 | |||||||||||||||||||||||||||||||||||||||||||
| 1384 | Takes a hashref and one or more connection IDs. | ||||||||||||||||||||||||||||||||||||||||||
| 1385 | |||||||||||||||||||||||||||||||||||||||||||
| 1386 | $ircd->yield( | ||||||||||||||||||||||||||||||||||||||||||
| 1387 | 'send_output', | ||||||||||||||||||||||||||||||||||||||||||
| 1388 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1389 | prefix => 'blah!~blah@blah.blah.blah', | ||||||||||||||||||||||||||||||||||||||||||
| 1390 | command => 'PRIVMSG', | ||||||||||||||||||||||||||||||||||||||||||
| 1391 | params => ['#moo', 'cows go moo, not fish :D'] | ||||||||||||||||||||||||||||||||||||||||||
| 1392 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 1393 | @list_of_connection_ids, | ||||||||||||||||||||||||||||||||||||||||||
| 1394 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 1395 | |||||||||||||||||||||||||||||||||||||||||||
| 1396 | =head2 C<shutdown> | ||||||||||||||||||||||||||||||||||||||||||
| 1397 | |||||||||||||||||||||||||||||||||||||||||||
| 1398 | I<Inherited from L<POE::Component::Syndicator|POE::Component::Syndicator/shutdown>> | ||||||||||||||||||||||||||||||||||||||||||
| 1399 | |||||||||||||||||||||||||||||||||||||||||||
| 1400 | Takes no arguments. Terminates the component. Removes all listeners and | ||||||||||||||||||||||||||||||||||||||||||
| 1401 | connectors. Disconnects all current client and server connections. | ||||||||||||||||||||||||||||||||||||||||||
| 1402 | |||||||||||||||||||||||||||||||||||||||||||
| 1403 | =head1 OUTPUT EVENTS | ||||||||||||||||||||||||||||||||||||||||||
| 1404 | |||||||||||||||||||||||||||||||||||||||||||
| 1405 | These following events are sent to interested sessions. | ||||||||||||||||||||||||||||||||||||||||||
| 1406 | |||||||||||||||||||||||||||||||||||||||||||
| 1407 | =head2 C<ircd_registered> | ||||||||||||||||||||||||||||||||||||||||||
| 1408 | |||||||||||||||||||||||||||||||||||||||||||
| 1409 | I<Inherited from L<POE::Component::Syndicator|POE::Component::Syndicator/syndicator_registered>> | ||||||||||||||||||||||||||||||||||||||||||
| 1410 | |||||||||||||||||||||||||||||||||||||||||||
| 1411 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 1412 | |||||||||||||||||||||||||||||||||||||||||||
| 1413 | =item Emitted: when a session registers with the component; | ||||||||||||||||||||||||||||||||||||||||||
| 1414 | |||||||||||||||||||||||||||||||||||||||||||
| 1415 | =item Target: the registering session; | ||||||||||||||||||||||||||||||||||||||||||
| 1416 | |||||||||||||||||||||||||||||||||||||||||||
| 1417 | =item Args: | ||||||||||||||||||||||||||||||||||||||||||
| 1418 | |||||||||||||||||||||||||||||||||||||||||||
| 1419 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1420 | |||||||||||||||||||||||||||||||||||||||||||
| 1421 | =item * C<ARG0>: the component's object; | ||||||||||||||||||||||||||||||||||||||||||
| 1422 | |||||||||||||||||||||||||||||||||||||||||||
| 1423 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1424 | |||||||||||||||||||||||||||||||||||||||||||
| 1425 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1426 | |||||||||||||||||||||||||||||||||||||||||||
| 1427 | =head2 C<ircd_connection> | ||||||||||||||||||||||||||||||||||||||||||
| 1428 | |||||||||||||||||||||||||||||||||||||||||||
| 1429 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 1430 | |||||||||||||||||||||||||||||||||||||||||||
| 1431 | =item Emitted: when a client connects to one of the component's listeners; | ||||||||||||||||||||||||||||||||||||||||||
| 1432 | |||||||||||||||||||||||||||||||||||||||||||
| 1433 | =item Target: all plugins and registered sessions | ||||||||||||||||||||||||||||||||||||||||||
| 1434 | |||||||||||||||||||||||||||||||||||||||||||
| 1435 | =item Args: | ||||||||||||||||||||||||||||||||||||||||||
| 1436 | |||||||||||||||||||||||||||||||||||||||||||
| 1437 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1438 | |||||||||||||||||||||||||||||||||||||||||||
| 1439 | =item * C<ARG0>: the conn id; | ||||||||||||||||||||||||||||||||||||||||||
| 1440 | |||||||||||||||||||||||||||||||||||||||||||
| 1441 | =item * C<ARG1>: their ip address; | ||||||||||||||||||||||||||||||||||||||||||
| 1442 | |||||||||||||||||||||||||||||||||||||||||||
| 1443 | =item * C<ARG2>: their tcp port; | ||||||||||||||||||||||||||||||||||||||||||
| 1444 | |||||||||||||||||||||||||||||||||||||||||||
| 1445 | =item * C<ARG3>: our ip address; | ||||||||||||||||||||||||||||||||||||||||||
| 1446 | |||||||||||||||||||||||||||||||||||||||||||
| 1447 | =item * C<ARG4>: our socket port; | ||||||||||||||||||||||||||||||||||||||||||
| 1448 | |||||||||||||||||||||||||||||||||||||||||||
| 1449 | =item * C<ARG5>: a boolean indicating whether the client needs to be authed | ||||||||||||||||||||||||||||||||||||||||||
| 1450 | |||||||||||||||||||||||||||||||||||||||||||
| 1451 | =item * C<ARG6>: a boolean indicating whether the client is securely connected | ||||||||||||||||||||||||||||||||||||||||||
| 1452 | |||||||||||||||||||||||||||||||||||||||||||
| 1453 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1454 | |||||||||||||||||||||||||||||||||||||||||||
| 1455 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1456 | |||||||||||||||||||||||||||||||||||||||||||
| 1457 | =head2 C<ircd_auth_done> | ||||||||||||||||||||||||||||||||||||||||||
| 1458 | |||||||||||||||||||||||||||||||||||||||||||
| 1459 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 1460 | |||||||||||||||||||||||||||||||||||||||||||
| 1461 | =item Emitted: after a client has connected and the component has validated | ||||||||||||||||||||||||||||||||||||||||||
| 1462 | hostname and ident; | ||||||||||||||||||||||||||||||||||||||||||
| 1463 | |||||||||||||||||||||||||||||||||||||||||||
| 1464 | =item Target: Target: all plugins and registered sessions; | ||||||||||||||||||||||||||||||||||||||||||
| 1465 | |||||||||||||||||||||||||||||||||||||||||||
| 1466 | =item Args: | ||||||||||||||||||||||||||||||||||||||||||
| 1467 | |||||||||||||||||||||||||||||||||||||||||||
| 1468 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1469 | |||||||||||||||||||||||||||||||||||||||||||
| 1470 | =item * C<ARG0>, the connection id; | ||||||||||||||||||||||||||||||||||||||||||
| 1471 | |||||||||||||||||||||||||||||||||||||||||||
| 1472 | =item * C<ARG1>, a HASHREF with the following keys: 'ident' and 'hostname'; | ||||||||||||||||||||||||||||||||||||||||||
| 1473 | |||||||||||||||||||||||||||||||||||||||||||
| 1474 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1475 | |||||||||||||||||||||||||||||||||||||||||||
| 1476 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1477 | |||||||||||||||||||||||||||||||||||||||||||
| 1478 | =head2 C<ircd_listener_add> | ||||||||||||||||||||||||||||||||||||||||||
| 1479 | |||||||||||||||||||||||||||||||||||||||||||
| 1480 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 1481 | |||||||||||||||||||||||||||||||||||||||||||
| 1482 | =item Emitted: on a successful L<C<add_listener>|/add_listener> call; | ||||||||||||||||||||||||||||||||||||||||||
| 1483 | |||||||||||||||||||||||||||||||||||||||||||
| 1484 | =item Target: all plugins and registered sessions; | ||||||||||||||||||||||||||||||||||||||||||
| 1485 | |||||||||||||||||||||||||||||||||||||||||||
| 1486 | =item Args: | ||||||||||||||||||||||||||||||||||||||||||
| 1487 | |||||||||||||||||||||||||||||||||||||||||||
| 1488 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1489 | |||||||||||||||||||||||||||||||||||||||||||
| 1490 | =item * C<ARG0>, the listening port; | ||||||||||||||||||||||||||||||||||||||||||
| 1491 | |||||||||||||||||||||||||||||||||||||||||||
| 1492 | =item * C<ARG1>, the listener id; | ||||||||||||||||||||||||||||||||||||||||||
| 1493 | |||||||||||||||||||||||||||||||||||||||||||
| 1494 | =item * C<ARG2>, the listening address; | ||||||||||||||||||||||||||||||||||||||||||
| 1495 | |||||||||||||||||||||||||||||||||||||||||||
| 1496 | =item * C<ARG3>, whether SSL is in use; | ||||||||||||||||||||||||||||||||||||||||||
| 1497 | |||||||||||||||||||||||||||||||||||||||||||
| 1498 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1499 | |||||||||||||||||||||||||||||||||||||||||||
| 1500 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1501 | |||||||||||||||||||||||||||||||||||||||||||
| 1502 | =head2 C<ircd_listener_del> | ||||||||||||||||||||||||||||||||||||||||||
| 1503 | |||||||||||||||||||||||||||||||||||||||||||
| 1504 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 1505 | |||||||||||||||||||||||||||||||||||||||||||
| 1506 | =item Emitted: on a successful L<C<del_listener>|/del_listener> call; | ||||||||||||||||||||||||||||||||||||||||||
| 1507 | |||||||||||||||||||||||||||||||||||||||||||
| 1508 | =item Target: all plugins and registered sessions; | ||||||||||||||||||||||||||||||||||||||||||
| 1509 | |||||||||||||||||||||||||||||||||||||||||||
| 1510 | =item Args: | ||||||||||||||||||||||||||||||||||||||||||
| 1511 | |||||||||||||||||||||||||||||||||||||||||||
| 1512 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1513 | |||||||||||||||||||||||||||||||||||||||||||
| 1514 | =item * C<ARG0>, the listening port; | ||||||||||||||||||||||||||||||||||||||||||
| 1515 | |||||||||||||||||||||||||||||||||||||||||||
| 1516 | =item * C<ARG1>, the listener id; | ||||||||||||||||||||||||||||||||||||||||||
| 1517 | |||||||||||||||||||||||||||||||||||||||||||
| 1518 | =item * C<ARG2>, the listener address; | ||||||||||||||||||||||||||||||||||||||||||
| 1519 | |||||||||||||||||||||||||||||||||||||||||||
| 1520 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1521 | |||||||||||||||||||||||||||||||||||||||||||
| 1522 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1523 | |||||||||||||||||||||||||||||||||||||||||||
| 1524 | =head2 C<ircd_listener_failure> | ||||||||||||||||||||||||||||||||||||||||||
| 1525 | |||||||||||||||||||||||||||||||||||||||||||
| 1526 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 1527 | |||||||||||||||||||||||||||||||||||||||||||
| 1528 | =item Emitted: when a listener wheel fails; | ||||||||||||||||||||||||||||||||||||||||||
| 1529 | |||||||||||||||||||||||||||||||||||||||||||
| 1530 | =item Target: all plugins and registered sessions; | ||||||||||||||||||||||||||||||||||||||||||
| 1531 | |||||||||||||||||||||||||||||||||||||||||||
| 1532 | =item Args: | ||||||||||||||||||||||||||||||||||||||||||
| 1533 | |||||||||||||||||||||||||||||||||||||||||||
| 1534 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1535 | |||||||||||||||||||||||||||||||||||||||||||
| 1536 | =item * C<ARG0>, the listener id; | ||||||||||||||||||||||||||||||||||||||||||
| 1537 | |||||||||||||||||||||||||||||||||||||||||||
| 1538 | =item * C<ARG1>, the name of the operation that failed; | ||||||||||||||||||||||||||||||||||||||||||
| 1539 | |||||||||||||||||||||||||||||||||||||||||||
| 1540 | =item * C<ARG2>, numeric value for $!; | ||||||||||||||||||||||||||||||||||||||||||
| 1541 | |||||||||||||||||||||||||||||||||||||||||||
| 1542 | =item * C<ARG3>, string value for $!; | ||||||||||||||||||||||||||||||||||||||||||
| 1543 | |||||||||||||||||||||||||||||||||||||||||||
| 1544 | =item * C<ARG4>, the port it tried to listen on; | ||||||||||||||||||||||||||||||||||||||||||
| 1545 | |||||||||||||||||||||||||||||||||||||||||||
| 1546 | =item * C<ARG5>, the address it tried to listen on; | ||||||||||||||||||||||||||||||||||||||||||
| 1547 | |||||||||||||||||||||||||||||||||||||||||||
| 1548 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1549 | |||||||||||||||||||||||||||||||||||||||||||
| 1550 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1551 | |||||||||||||||||||||||||||||||||||||||||||
| 1552 | =head2 C<ircd_socketerr> | ||||||||||||||||||||||||||||||||||||||||||
| 1553 | |||||||||||||||||||||||||||||||||||||||||||
| 1554 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 1555 | |||||||||||||||||||||||||||||||||||||||||||
| 1556 | =item Emitted: on the failure of an L<C<add_connector>|/add_connector> call | ||||||||||||||||||||||||||||||||||||||||||
| 1557 | |||||||||||||||||||||||||||||||||||||||||||
| 1558 | =item Target: all plugins and registered sessions; | ||||||||||||||||||||||||||||||||||||||||||
| 1559 | |||||||||||||||||||||||||||||||||||||||||||
| 1560 | =item Args: | ||||||||||||||||||||||||||||||||||||||||||
| 1561 | |||||||||||||||||||||||||||||||||||||||||||
| 1562 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1563 | |||||||||||||||||||||||||||||||||||||||||||
| 1564 | =item * C<ARG0>, a HASHREF containing the params that add_connector() was | ||||||||||||||||||||||||||||||||||||||||||
| 1565 | called with; | ||||||||||||||||||||||||||||||||||||||||||
| 1566 | |||||||||||||||||||||||||||||||||||||||||||
| 1567 | =item * C<ARG1>, the name of the operation that failed; | ||||||||||||||||||||||||||||||||||||||||||
| 1568 | |||||||||||||||||||||||||||||||||||||||||||
| 1569 | =item * C<ARG2>, numeric value for $!; | ||||||||||||||||||||||||||||||||||||||||||
| 1570 | |||||||||||||||||||||||||||||||||||||||||||
| 1571 | =item * C<ARG3>, string value for $!; | ||||||||||||||||||||||||||||||||||||||||||
| 1572 | |||||||||||||||||||||||||||||||||||||||||||
| 1573 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1574 | |||||||||||||||||||||||||||||||||||||||||||
| 1575 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1576 | |||||||||||||||||||||||||||||||||||||||||||
| 1577 | =head2 C<ircd_connected> | ||||||||||||||||||||||||||||||||||||||||||
| 1578 | |||||||||||||||||||||||||||||||||||||||||||
| 1579 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 1580 | |||||||||||||||||||||||||||||||||||||||||||
| 1581 | =item Emitted: when the component establishes a connection with a peer; | ||||||||||||||||||||||||||||||||||||||||||
| 1582 | |||||||||||||||||||||||||||||||||||||||||||
| 1583 | =item Target: all plugins and registered sessions; | ||||||||||||||||||||||||||||||||||||||||||
| 1584 | |||||||||||||||||||||||||||||||||||||||||||
| 1585 | =item Args: | ||||||||||||||||||||||||||||||||||||||||||
| 1586 | |||||||||||||||||||||||||||||||||||||||||||
| 1587 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1588 | |||||||||||||||||||||||||||||||||||||||||||
| 1589 | =item * C<ARG0>, the connection id; | ||||||||||||||||||||||||||||||||||||||||||
| 1590 | |||||||||||||||||||||||||||||||||||||||||||
| 1591 | =item * C<ARG1>, their ip address; | ||||||||||||||||||||||||||||||||||||||||||
| 1592 | |||||||||||||||||||||||||||||||||||||||||||
| 1593 | =item * C<ARG2>, their tcp port; | ||||||||||||||||||||||||||||||||||||||||||
| 1594 | |||||||||||||||||||||||||||||||||||||||||||
| 1595 | =item * C<ARG3>, our ip address; | ||||||||||||||||||||||||||||||||||||||||||
| 1596 | |||||||||||||||||||||||||||||||||||||||||||
| 1597 | =item * C<ARG4>, our socket port; | ||||||||||||||||||||||||||||||||||||||||||
| 1598 | |||||||||||||||||||||||||||||||||||||||||||
| 1599 | =item * C<ARG5>, the peer's name; | ||||||||||||||||||||||||||||||||||||||||||
| 1600 | |||||||||||||||||||||||||||||||||||||||||||
| 1601 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1602 | |||||||||||||||||||||||||||||||||||||||||||
| 1603 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1604 | |||||||||||||||||||||||||||||||||||||||||||
| 1605 | =head2 C<ircd_connection_flood> | ||||||||||||||||||||||||||||||||||||||||||
| 1606 | |||||||||||||||||||||||||||||||||||||||||||
| 1607 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 1608 | |||||||||||||||||||||||||||||||||||||||||||
| 1609 | =item Emitted: when a client connection is flooded; | ||||||||||||||||||||||||||||||||||||||||||
| 1610 | |||||||||||||||||||||||||||||||||||||||||||
| 1611 | =item Target: all plugins and registered sessions; | ||||||||||||||||||||||||||||||||||||||||||
| 1612 | |||||||||||||||||||||||||||||||||||||||||||
| 1613 | =item Args: | ||||||||||||||||||||||||||||||||||||||||||
| 1614 | |||||||||||||||||||||||||||||||||||||||||||
| 1615 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1616 | |||||||||||||||||||||||||||||||||||||||||||
| 1617 | =item * C<ARG0>, the connection id; | ||||||||||||||||||||||||||||||||||||||||||
| 1618 | |||||||||||||||||||||||||||||||||||||||||||
| 1619 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1620 | |||||||||||||||||||||||||||||||||||||||||||
| 1621 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1622 | |||||||||||||||||||||||||||||||||||||||||||
| 1623 | =head2 C<ircd_connection_idle> | ||||||||||||||||||||||||||||||||||||||||||
| 1624 | |||||||||||||||||||||||||||||||||||||||||||
| 1625 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 1626 | |||||||||||||||||||||||||||||||||||||||||||
| 1627 | =item Emitted: when a client connection has not sent any data for a set | ||||||||||||||||||||||||||||||||||||||||||
| 1628 | period; | ||||||||||||||||||||||||||||||||||||||||||
| 1629 | |||||||||||||||||||||||||||||||||||||||||||
| 1630 | =item Target: all plugins and registered sessions; | ||||||||||||||||||||||||||||||||||||||||||
| 1631 | |||||||||||||||||||||||||||||||||||||||||||
| 1632 | =item Args: | ||||||||||||||||||||||||||||||||||||||||||
| 1633 | |||||||||||||||||||||||||||||||||||||||||||
| 1634 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1635 | |||||||||||||||||||||||||||||||||||||||||||
| 1636 | =item * C<ARG0>, the connection id; | ||||||||||||||||||||||||||||||||||||||||||
| 1637 | |||||||||||||||||||||||||||||||||||||||||||
| 1638 | =item * C<ARG1>, the number of seconds period we consider as idle; | ||||||||||||||||||||||||||||||||||||||||||
| 1639 | |||||||||||||||||||||||||||||||||||||||||||
| 1640 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1641 | |||||||||||||||||||||||||||||||||||||||||||
| 1642 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1643 | |||||||||||||||||||||||||||||||||||||||||||
| 1644 | =head2 C<ircd_compressed_conn> | ||||||||||||||||||||||||||||||||||||||||||
| 1645 | |||||||||||||||||||||||||||||||||||||||||||
| 1646 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 1647 | |||||||||||||||||||||||||||||||||||||||||||
| 1648 | =item Emitted: when compression has been enabled for a connection | ||||||||||||||||||||||||||||||||||||||||||
| 1649 | |||||||||||||||||||||||||||||||||||||||||||
| 1650 | =item Target: all plugins and registered sessions; | ||||||||||||||||||||||||||||||||||||||||||
| 1651 | |||||||||||||||||||||||||||||||||||||||||||
| 1652 | =item Args: | ||||||||||||||||||||||||||||||||||||||||||
| 1653 | |||||||||||||||||||||||||||||||||||||||||||
| 1654 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1655 | |||||||||||||||||||||||||||||||||||||||||||
| 1656 | =item * C<ARG0>, the connection id; | ||||||||||||||||||||||||||||||||||||||||||
| 1657 | |||||||||||||||||||||||||||||||||||||||||||
| 1658 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1659 | |||||||||||||||||||||||||||||||||||||||||||
| 1660 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1661 | |||||||||||||||||||||||||||||||||||||||||||
| 1662 | =head2 C<ircd_cmd_*> | ||||||||||||||||||||||||||||||||||||||||||
| 1663 | |||||||||||||||||||||||||||||||||||||||||||
| 1664 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 1665 | |||||||||||||||||||||||||||||||||||||||||||
| 1666 | =item Emitted: when a client or peer sends a valid IRC line to us; | ||||||||||||||||||||||||||||||||||||||||||
| 1667 | |||||||||||||||||||||||||||||||||||||||||||
| 1668 | =item Target: all plugins and registered sessions; | ||||||||||||||||||||||||||||||||||||||||||
| 1669 | |||||||||||||||||||||||||||||||||||||||||||
| 1670 | =item Args: | ||||||||||||||||||||||||||||||||||||||||||
| 1671 | |||||||||||||||||||||||||||||||||||||||||||
| 1672 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1673 | |||||||||||||||||||||||||||||||||||||||||||
| 1674 | =item * C<ARG0>, the connection id; | ||||||||||||||||||||||||||||||||||||||||||
| 1675 | |||||||||||||||||||||||||||||||||||||||||||
| 1676 | =item * C<ARG1>, a HASHREF containing the output record from | ||||||||||||||||||||||||||||||||||||||||||
| 1677 | POE::Filter::IRCD: | ||||||||||||||||||||||||||||||||||||||||||
| 1678 | |||||||||||||||||||||||||||||||||||||||||||
| 1679 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1680 | prefix => 'blah!~blah@blah.blah.blah', | ||||||||||||||||||||||||||||||||||||||||||
| 1681 | command => 'PRIVMSG', | ||||||||||||||||||||||||||||||||||||||||||
| 1682 | params => [ '#moo', 'cows go moo, not fish :D' ], | ||||||||||||||||||||||||||||||||||||||||||
| 1683 | raw_line => ':blah!~blah@blah.blah.blah.blah PRIVMSG #moo :cows go moo, not fish :D' | ||||||||||||||||||||||||||||||||||||||||||
| 1684 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1685 | |||||||||||||||||||||||||||||||||||||||||||
| 1686 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1687 | |||||||||||||||||||||||||||||||||||||||||||
| 1688 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1689 | |||||||||||||||||||||||||||||||||||||||||||
| 1690 | =head2 C<ircd_raw_input> | ||||||||||||||||||||||||||||||||||||||||||
| 1691 | |||||||||||||||||||||||||||||||||||||||||||
| 1692 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 1693 | |||||||||||||||||||||||||||||||||||||||||||
| 1694 | =item Emitted: when a line of input is received from a connection | ||||||||||||||||||||||||||||||||||||||||||
| 1695 | |||||||||||||||||||||||||||||||||||||||||||
| 1696 | =item Target: all plugins and registered sessions; | ||||||||||||||||||||||||||||||||||||||||||
| 1697 | |||||||||||||||||||||||||||||||||||||||||||
| 1698 | =item Args: | ||||||||||||||||||||||||||||||||||||||||||
| 1699 | |||||||||||||||||||||||||||||||||||||||||||
| 1700 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1701 | |||||||||||||||||||||||||||||||||||||||||||
| 1702 | =item * C<ARG0>, the connection id; | ||||||||||||||||||||||||||||||||||||||||||
| 1703 | |||||||||||||||||||||||||||||||||||||||||||
| 1704 | =item * C<ARG1>, the raw line of input | ||||||||||||||||||||||||||||||||||||||||||
| 1705 | |||||||||||||||||||||||||||||||||||||||||||
| 1706 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1707 | |||||||||||||||||||||||||||||||||||||||||||
| 1708 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1709 | |||||||||||||||||||||||||||||||||||||||||||
| 1710 | =head2 C<ircd_raw_output> | ||||||||||||||||||||||||||||||||||||||||||
| 1711 | |||||||||||||||||||||||||||||||||||||||||||
| 1712 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 1713 | |||||||||||||||||||||||||||||||||||||||||||
| 1714 | =item Emitted: when a line of output is sent over a connection | ||||||||||||||||||||||||||||||||||||||||||
| 1715 | |||||||||||||||||||||||||||||||||||||||||||
| 1716 | =item Target: all plugins and registered sessions; | ||||||||||||||||||||||||||||||||||||||||||
| 1717 | |||||||||||||||||||||||||||||||||||||||||||
| 1718 | =item Args: | ||||||||||||||||||||||||||||||||||||||||||
| 1719 | |||||||||||||||||||||||||||||||||||||||||||
| 1720 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1721 | |||||||||||||||||||||||||||||||||||||||||||
| 1722 | =item * C<ARG0>, the connection id; | ||||||||||||||||||||||||||||||||||||||||||
| 1723 | |||||||||||||||||||||||||||||||||||||||||||
| 1724 | =item * C<ARG1>, the raw line of output | ||||||||||||||||||||||||||||||||||||||||||
| 1725 | |||||||||||||||||||||||||||||||||||||||||||
| 1726 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1727 | |||||||||||||||||||||||||||||||||||||||||||
| 1728 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1729 | |||||||||||||||||||||||||||||||||||||||||||
| 1730 | =head2 C<ircd_disconnected> | ||||||||||||||||||||||||||||||||||||||||||
| 1731 | |||||||||||||||||||||||||||||||||||||||||||
| 1732 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 1733 | |||||||||||||||||||||||||||||||||||||||||||
| 1734 | =item Emitted: when a client disconnects; | ||||||||||||||||||||||||||||||||||||||||||
| 1735 | |||||||||||||||||||||||||||||||||||||||||||
| 1736 | =item Target: all plugins and registered sessions; | ||||||||||||||||||||||||||||||||||||||||||
| 1737 | |||||||||||||||||||||||||||||||||||||||||||
| 1738 | =item Args: | ||||||||||||||||||||||||||||||||||||||||||
| 1739 | |||||||||||||||||||||||||||||||||||||||||||
| 1740 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1741 | |||||||||||||||||||||||||||||||||||||||||||
| 1742 | =item * C<ARG0>, the connection id; | ||||||||||||||||||||||||||||||||||||||||||
| 1743 | |||||||||||||||||||||||||||||||||||||||||||
| 1744 | =item * C<ARG1>, the error or reason for disconnection; | ||||||||||||||||||||||||||||||||||||||||||
| 1745 | |||||||||||||||||||||||||||||||||||||||||||
| 1746 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1747 | |||||||||||||||||||||||||||||||||||||||||||
| 1748 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1749 | |||||||||||||||||||||||||||||||||||||||||||
| 1750 | =head2 C<ircd_shutdown> | ||||||||||||||||||||||||||||||||||||||||||
| 1751 | |||||||||||||||||||||||||||||||||||||||||||
| 1752 | I<Inherited from L<POE::Component::Syndicator|POE::Component::Syndicator/syndicator_shutdown>> | ||||||||||||||||||||||||||||||||||||||||||
| 1753 | |||||||||||||||||||||||||||||||||||||||||||
| 1754 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 1755 | |||||||||||||||||||||||||||||||||||||||||||
| 1756 | =item Emitted: when the component has been asked to L<C<shutdown>|/shutdown> | ||||||||||||||||||||||||||||||||||||||||||
| 1757 | |||||||||||||||||||||||||||||||||||||||||||
| 1758 | =item Target: all registered sessions; | ||||||||||||||||||||||||||||||||||||||||||
| 1759 | |||||||||||||||||||||||||||||||||||||||||||
| 1760 | =item Args: | ||||||||||||||||||||||||||||||||||||||||||
| 1761 | |||||||||||||||||||||||||||||||||||||||||||
| 1762 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1763 | |||||||||||||||||||||||||||||||||||||||||||
| 1764 | =item * C<ARG0>: the session ID of the requesting component | ||||||||||||||||||||||||||||||||||||||||||
| 1765 | |||||||||||||||||||||||||||||||||||||||||||
| 1766 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1767 | |||||||||||||||||||||||||||||||||||||||||||
| 1768 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1769 | |||||||||||||||||||||||||||||||||||||||||||
| 1770 | =head2 C<ircd_delay_set> | ||||||||||||||||||||||||||||||||||||||||||
| 1771 | |||||||||||||||||||||||||||||||||||||||||||
| 1772 | I<Inherited from L<POE::Component::Syndicator|POE::Component::Syndicator/syndicator_delay_set>> | ||||||||||||||||||||||||||||||||||||||||||
| 1773 | |||||||||||||||||||||||||||||||||||||||||||
| 1774 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 1775 | |||||||||||||||||||||||||||||||||||||||||||
| 1776 | =item Emitted: on a successful addition of a delayed event using the | ||||||||||||||||||||||||||||||||||||||||||
| 1777 | L<C<delay>|/delay> method | ||||||||||||||||||||||||||||||||||||||||||
| 1778 | |||||||||||||||||||||||||||||||||||||||||||
| 1779 | =item Target: all plugins and registered sessions; | ||||||||||||||||||||||||||||||||||||||||||
| 1780 | |||||||||||||||||||||||||||||||||||||||||||
| 1781 | =item Args: | ||||||||||||||||||||||||||||||||||||||||||
| 1782 | |||||||||||||||||||||||||||||||||||||||||||
| 1783 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1784 | |||||||||||||||||||||||||||||||||||||||||||
| 1785 | =item * C<ARG0>: the alarm id which can be used later with | ||||||||||||||||||||||||||||||||||||||||||
| 1786 | L<C<delay_remove>|/delay_remove> | ||||||||||||||||||||||||||||||||||||||||||
| 1787 | |||||||||||||||||||||||||||||||||||||||||||
| 1788 | =item * C<ARG1..$#_>: subsequent arguments are those which were passed to | ||||||||||||||||||||||||||||||||||||||||||
| 1789 | L<C<delay>|/delay> | ||||||||||||||||||||||||||||||||||||||||||
| 1790 | |||||||||||||||||||||||||||||||||||||||||||
| 1791 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1792 | |||||||||||||||||||||||||||||||||||||||||||
| 1793 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1794 | |||||||||||||||||||||||||||||||||||||||||||
| 1795 | =head2 C<ircd_delay_removed> | ||||||||||||||||||||||||||||||||||||||||||
| 1796 | |||||||||||||||||||||||||||||||||||||||||||
| 1797 | I<Inherited from L<POE::Component::Syndicator|POE::Component::Syndicator/syndicator_delay_removed>> | ||||||||||||||||||||||||||||||||||||||||||
| 1798 | |||||||||||||||||||||||||||||||||||||||||||
| 1799 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 1800 | |||||||||||||||||||||||||||||||||||||||||||
| 1801 | =item Emitted: when a delayed command is successfully removed | ||||||||||||||||||||||||||||||||||||||||||
| 1802 | |||||||||||||||||||||||||||||||||||||||||||
| 1803 | =item Target: all plugins and registered sessions; | ||||||||||||||||||||||||||||||||||||||||||
| 1804 | |||||||||||||||||||||||||||||||||||||||||||
| 1805 | =item Args: | ||||||||||||||||||||||||||||||||||||||||||
| 1806 | |||||||||||||||||||||||||||||||||||||||||||
| 1807 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1808 | |||||||||||||||||||||||||||||||||||||||||||
| 1809 | =item * C<ARG0>: the alarm id which was removed | ||||||||||||||||||||||||||||||||||||||||||
| 1810 | |||||||||||||||||||||||||||||||||||||||||||
| 1811 | =item * C<ARG1..$#_>: subsequent arguments are those which were passed to | ||||||||||||||||||||||||||||||||||||||||||
| 1812 | L<C<delay>|/delay> | ||||||||||||||||||||||||||||||||||||||||||
| 1813 | |||||||||||||||||||||||||||||||||||||||||||
| 1814 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1815 | |||||||||||||||||||||||||||||||||||||||||||
| 1816 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1817 | |||||||||||||||||||||||||||||||||||||||||||
| 1818 | =head2 C<ircd_plugin_add> | ||||||||||||||||||||||||||||||||||||||||||
| 1819 | |||||||||||||||||||||||||||||||||||||||||||
| 1820 | I<Inherited from L<Object::Pluggable|Object::Pluggable/_pluggable_event>> | ||||||||||||||||||||||||||||||||||||||||||
| 1821 | |||||||||||||||||||||||||||||||||||||||||||
| 1822 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 1823 | |||||||||||||||||||||||||||||||||||||||||||
| 1824 | =item Emitted: when a new plugin is added to the pipeline | ||||||||||||||||||||||||||||||||||||||||||
| 1825 | |||||||||||||||||||||||||||||||||||||||||||
| 1826 | =item Target: all plugins and registered sessions; | ||||||||||||||||||||||||||||||||||||||||||
| 1827 | |||||||||||||||||||||||||||||||||||||||||||
| 1828 | =item Args: | ||||||||||||||||||||||||||||||||||||||||||
| 1829 | |||||||||||||||||||||||||||||||||||||||||||
| 1830 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1831 | |||||||||||||||||||||||||||||||||||||||||||
| 1832 | =item * C<ARG0>: the plugin alias | ||||||||||||||||||||||||||||||||||||||||||
| 1833 | |||||||||||||||||||||||||||||||||||||||||||
| 1834 | =item * C<ARG1>: the plugin object | ||||||||||||||||||||||||||||||||||||||||||
| 1835 | |||||||||||||||||||||||||||||||||||||||||||
| 1836 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1837 | |||||||||||||||||||||||||||||||||||||||||||
| 1838 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1839 | |||||||||||||||||||||||||||||||||||||||||||
| 1840 | =head2 C<ircd_plugin_del> | ||||||||||||||||||||||||||||||||||||||||||
| 1841 | |||||||||||||||||||||||||||||||||||||||||||
| 1842 | I<Inherited from L<Object::Pluggable|Object::Pluggable/_pluggable_event>> | ||||||||||||||||||||||||||||||||||||||||||
| 1843 | |||||||||||||||||||||||||||||||||||||||||||
| 1844 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 1845 | |||||||||||||||||||||||||||||||||||||||||||
| 1846 | =item Emitted: when a plugin is removed from the pipeline | ||||||||||||||||||||||||||||||||||||||||||
| 1847 | |||||||||||||||||||||||||||||||||||||||||||
| 1848 | =item Target: all plugins and registered sessions; | ||||||||||||||||||||||||||||||||||||||||||
| 1849 | |||||||||||||||||||||||||||||||||||||||||||
| 1850 | =item Args: | ||||||||||||||||||||||||||||||||||||||||||
| 1851 | |||||||||||||||||||||||||||||||||||||||||||
| 1852 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1853 | |||||||||||||||||||||||||||||||||||||||||||
| 1854 | =item * C<ARG0>: the plugin alias | ||||||||||||||||||||||||||||||||||||||||||
| 1855 | |||||||||||||||||||||||||||||||||||||||||||
| 1856 | =item * C<ARG1>: the plugin object | ||||||||||||||||||||||||||||||||||||||||||
| 1857 | |||||||||||||||||||||||||||||||||||||||||||
| 1858 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1859 | |||||||||||||||||||||||||||||||||||||||||||
| 1860 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1861 | |||||||||||||||||||||||||||||||||||||||||||
| 1862 | =head2 C<ircd_plugin_error> | ||||||||||||||||||||||||||||||||||||||||||
| 1863 | |||||||||||||||||||||||||||||||||||||||||||
| 1864 | I<Inherited from L<Object::Pluggable|Object::Pluggable/_pluggable_event>> | ||||||||||||||||||||||||||||||||||||||||||
| 1865 | |||||||||||||||||||||||||||||||||||||||||||
| 1866 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 1867 | |||||||||||||||||||||||||||||||||||||||||||
| 1868 | =item Emitted: when an error occurs while executing a plugin handler | ||||||||||||||||||||||||||||||||||||||||||
| 1869 | |||||||||||||||||||||||||||||||||||||||||||
| 1870 | =item Target: all plugins and registered sessions; | ||||||||||||||||||||||||||||||||||||||||||
| 1871 | |||||||||||||||||||||||||||||||||||||||||||
| 1872 | =item Args: | ||||||||||||||||||||||||||||||||||||||||||
| 1873 | |||||||||||||||||||||||||||||||||||||||||||
| 1874 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1875 | |||||||||||||||||||||||||||||||||||||||||||
| 1876 | =item * C<ARG0>: the error message | ||||||||||||||||||||||||||||||||||||||||||
| 1877 | |||||||||||||||||||||||||||||||||||||||||||
| 1878 | =item * C<ARG1>: the plugin alias | ||||||||||||||||||||||||||||||||||||||||||
| 1879 | |||||||||||||||||||||||||||||||||||||||||||
| 1880 | =item * C<ARG2>: the plugin object | ||||||||||||||||||||||||||||||||||||||||||
| 1881 | |||||||||||||||||||||||||||||||||||||||||||
| 1882 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1883 | |||||||||||||||||||||||||||||||||||||||||||
| 1884 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1885 | |||||||||||||||||||||||||||||||||||||||||||
| 1886 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||||||||
| 1887 | |||||||||||||||||||||||||||||||||||||||||||
| 1888 | Chris 'BinGOs' Williams | ||||||||||||||||||||||||||||||||||||||||||
| 1889 | |||||||||||||||||||||||||||||||||||||||||||
| 1890 | =head1 LICENSE | ||||||||||||||||||||||||||||||||||||||||||
| 1891 | |||||||||||||||||||||||||||||||||||||||||||
| 1892 | Copyright E<copy> Chris Williams | ||||||||||||||||||||||||||||||||||||||||||
| 1893 | |||||||||||||||||||||||||||||||||||||||||||
| 1894 | This module may be used, modified, and distributed under the same terms as | ||||||||||||||||||||||||||||||||||||||||||
| 1895 | Perl itself. Please see the license that came with your Perl distribution | ||||||||||||||||||||||||||||||||||||||||||
| 1896 | for details. | ||||||||||||||||||||||||||||||||||||||||||
| 1897 | |||||||||||||||||||||||||||||||||||||||||||
| 1898 | =head1 SEE ALSO | ||||||||||||||||||||||||||||||||||||||||||
| 1899 | |||||||||||||||||||||||||||||||||||||||||||
| 1900 | L<POE|POE> | ||||||||||||||||||||||||||||||||||||||||||
| 1901 | |||||||||||||||||||||||||||||||||||||||||||
| 1902 | L<POE::Filter::IRCD|POE::Filter::IRCD> | ||||||||||||||||||||||||||||||||||||||||||
| 1903 | |||||||||||||||||||||||||||||||||||||||||||
| 1904 | L<POE::Component::Server::IRC|POE::Component::Server::IRC> | ||||||||||||||||||||||||||||||||||||||||||
| 1905 | |||||||||||||||||||||||||||||||||||||||||||
| 1906 | =cut | ||||||||||||||||||||||||||||||||||||||||||