« 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 | 181 | $POE::Component::Server::IRC::Backend::VERSION = '1.66'; | |||||||||||||||||||||||||||||||||||||||||
| 3 | 181 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 181 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | 181 | ▶ | use Carp qw(carp croak); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | 181 | ▶ | use List::Util qw(first); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | 181 | ▶ | use POE qw(Wheel::SocketFactory Wheel::ReadWrite Filter::Stackable | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | 181 | Filter::Line Filter::IRCD Filter::ThruPut); | |||||||||||||||||||||||||||||||||||||||||
| 9 | 181 | ▶ | use Net::Netmask; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | 181 | ▶ | use Net::CIDR (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | 181 | ▶ | use Net::IP::Minimal qw[ip_is_ipv6]; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 12 | 181 | ▶ | use Socket qw(getnameinfo NI_NUMERICHOST NI_NUMERICSERV AF_INET6); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 13 | 181 | ▶ | use base qw(POE::Component::Syndicator); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||
| 15 | 181 | ▶ | use constant { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 16 | 181 | OBJECT_STATES_HASHREF => { | |||||||||||||||||||||||||||||||||||||||||
| 17 | syndicator_started => '_start', | ||||||||||||||||||||||||||||||||||||||||||
| 18 | add_connector => '_add_connector', | ||||||||||||||||||||||||||||||||||||||||||
| 19 | add_listener => '_add_listener', | ||||||||||||||||||||||||||||||||||||||||||
| 20 | del_listener => '_del_listener', | ||||||||||||||||||||||||||||||||||||||||||
| 21 | send_output => '_send_output', | ||||||||||||||||||||||||||||||||||||||||||
| 22 | shutdown => '_shutdown', | ||||||||||||||||||||||||||||||||||||||||||
| 23 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 24 | OBJECT_STATES_ARRAYREF => [qw( | ||||||||||||||||||||||||||||||||||||||||||
| 25 | _accept_connection | ||||||||||||||||||||||||||||||||||||||||||
| 26 | _accept_failed | ||||||||||||||||||||||||||||||||||||||||||
| 27 | _conn_alarm | ||||||||||||||||||||||||||||||||||||||||||
| 28 | _conn_input | ||||||||||||||||||||||||||||||||||||||||||
| 29 | _conn_error | ||||||||||||||||||||||||||||||||||||||||||
| 30 | _conn_flushed | ||||||||||||||||||||||||||||||||||||||||||
| 31 | _event_dispatcher | ||||||||||||||||||||||||||||||||||||||||||
| 32 | _sock_failed | ||||||||||||||||||||||||||||||||||||||||||
| 33 | _sock_up | ||||||||||||||||||||||||||||||||||||||||||
| 34 | _sock_ssl | ||||||||||||||||||||||||||||||||||||||||||
| 35 | )], | ||||||||||||||||||||||||||||||||||||||||||
| 36 | 181 | }; | |||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||
| 38 | 181 | ▶ | sub create { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
create: called CC=17 SCAR=29.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 39 | 181 | my $package = shift; | |||||||||||||||||||||||||||||||||||||||||
| 40 | 181 | ▶ | croak("$package requires an even number of parameters") if @_ & 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 41 | 181 | my %args = @_; | |||||||||||||||||||||||||||||||||||||||||
| 42 | 181 | $args{ lc $_ } = delete $args{$_} for keys %args; | |||||||||||||||||||||||||||||||||||||||||
| 43 | 181 | my $self = bless { }, $package; | |||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||
| 45 | 181 | ▶ | $self->{raw_events} = $args{raw_events} if defined $args{raw_events}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 46 | $self->{prefix} = defined $args{prefix} | ||||||||||||||||||||||||||||||||||||||||||
| 47 | ? $args{prefix} | ||||||||||||||||||||||||||||||||||||||||||
| 48 | 181 | ▶ | : 'ircd_'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 49 | $self->{antiflood} = defined $args{antiflood} | ||||||||||||||||||||||||||||||||||||||||||
| 50 | ? $args{antiflood} | ||||||||||||||||||||||||||||||||||||||||||
| 51 | 181 | ▶ | : 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||
| 53 | $self->{auth} = defined $args{auth} | ||||||||||||||||||||||||||||||||||||||||||
| 54 | ? $args{auth} | ||||||||||||||||||||||||||||||||||||||||||
| 55 | 181 | ▶ | : 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||
| 57 | 181 | ▶ | 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"
| |||||||||||||||||||||||||||||||||||||||||||
| 58 | 9 | eval { | |||||||||||||||||||||||||||||||||||||||||
| 59 | 9 | require POE::Component::SSLify; | |||||||||||||||||||||||||||||||||||||||||
| 60 | 9 | POE::Component::SSLify->import( | |||||||||||||||||||||||||||||||||||||||||
| 61 | qw(SSLify_GetCTX SSLify_Options Server_SSLify Client_SSLify SSLify_ContextCreate) | ||||||||||||||||||||||||||||||||||||||||||
| 62 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 63 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 64 | 9 | chomp $@; | |||||||||||||||||||||||||||||||||||||||||
| 65 | 9 | ▶ | croak("Can't use ssl: $@") if $@; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||
| 67 | 9 | eval { | |||||||||||||||||||||||||||||||||||||||||
| 68 | 9 | SSLify_Options(@{ $args{sslify_options} }); | |||||||||||||||||||||||||||||||||||||||||
| 69 | 9 | my $ctx = SSLify_GetCTX(); | |||||||||||||||||||||||||||||||||||||||||
| 70 | 9 | require Net::SSLeay; | |||||||||||||||||||||||||||||||||||||||||
| 71 | 9 | ▶ | Net::SSLeay::CTX_set_verify( $ctx, 0x01, sub { return 1; } ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 72 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 73 | 9 | chomp $@; | |||||||||||||||||||||||||||||||||||||||||
| 74 | 9 | ▶ | croak("Can't use ssl: $@") if $@; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 75 | 9 | $self->{got_ssl} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||
| 78 | 181 | ▶ | if ($args{states}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 79 | 180 | my $error = $self->_validate_states($args{states}); | |||||||||||||||||||||||||||||||||||||||||
| 80 | 180 | ▶ | croak($error) if defined $error; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||
| 83 | $self->_syndicator_init( | ||||||||||||||||||||||||||||||||||||||||||
| 84 | prefix => $self->{prefix}, | ||||||||||||||||||||||||||||||||||||||||||
| 85 | reg_prefix => 'PCSI_', | ||||||||||||||||||||||||||||||||||||||||||
| 86 | types => [ SERVER => 'IRCD', USER => 'U' ], | ||||||||||||||||||||||||||||||||||||||||||
| 87 | object_states => [ | ||||||||||||||||||||||||||||||||||||||||||
| 88 | $self => OBJECT_STATES_HASHREF, | ||||||||||||||||||||||||||||||||||||||||||
| 89 | $self => OBJECT_STATES_ARRAYREF, | ||||||||||||||||||||||||||||||||||||||||||
| 90 | ($args{states} | ||||||||||||||||||||||||||||||||||||||||||
| 91 | 360 | ▶ | ? map { $self => $_ } @{ $args{states} } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 92 | : () | ||||||||||||||||||||||||||||||||||||||||||
| 93 | ), | ||||||||||||||||||||||||||||||||||||||||||
| 94 | ], | ||||||||||||||||||||||||||||||||||||||||||
| 95 | ($args{plugin_debug} ? (debug => 1) : () ), | ||||||||||||||||||||||||||||||||||||||||||
| 96 | 181 | ▶ | (ref $args{options} eq 'HASH' ? (options => $args{options}) : ()), | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 97 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||||||||
| 99 | 181 | ▶ | if ($self->{auth}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 100 | 1 | require POE::Component::Server::IRC::Plugin::Auth; | |||||||||||||||||||||||||||||||||||||||||
| 101 | $self->plugin_add( | ||||||||||||||||||||||||||||||||||||||||||
| 102 | 'Auth_'.$self->session_id(), | ||||||||||||||||||||||||||||||||||||||||||
| 103 | POE::Component::Server::IRC::Plugin::Auth->new( | ||||||||||||||||||||||||||||||||||||||||||
| 104 | identport => $args{identport}, | ||||||||||||||||||||||||||||||||||||||||||
| 105 | 1 | ), | |||||||||||||||||||||||||||||||||||||||||
| 106 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||
| 109 | 181 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 110 | } | ||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||
| 112 | 180 | ▶ | sub _validate_states { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_validate_states: called CC=10 SCAR=25.9
| |||||||||||||||||||||||||||||||||||||||||||
| 113 | 180 | my ($self, $states) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||
| 115 | 180 | for my $events (@$states) { | |||||||||||||||||||||||||||||||||||||||||
| 116 | 360 | ▶ | if (ref $events eq 'HASH') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 117 | 180 | for my $event (keys %$events) { | |||||||||||||||||||||||||||||||||||||||||
| 118 | 3960 | ▶ | 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"];})
| |||||||||||||||||||||||||||||||||||||||||||
| 119 | 3960 | ▶ | || first { $event eq $_ } @{ +OBJECT_STATES_ARRAYREF }) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | return "Event $event is reserved by ". __PACKAGE__; | |||||||||||||||||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||||||||||||||||
| 122 | } | ||||||||||||||||||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||||||||||||||||
| 124 | elsif (ref $events eq 'ARRAY') { | ||||||||||||||||||||||||||||||||||||||||||
| 125 | 180 | for my $event (@$events) { | |||||||||||||||||||||||||||||||||||||||||
| 126 | 720 | ▶ | 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"];})
| |||||||||||||||||||||||||||||||||||||||||||
| 127 | 720 | ▶ | || first { $event eq $_ } @{ +OBJECT_STATES_ARRAYREF }) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 128 | 0 | return "Event $event is reserved by ". __PACKAGE__; | |||||||||||||||||||||||||||||||||||||||||
| 129 | } | ||||||||||||||||||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||||||||||||
| 134 | 180 | return; | |||||||||||||||||||||||||||||||||||||||||
| 135 | } | ||||||||||||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||||||||||||
| 137 | 181 | ▶ | sub _start { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_start: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 138 | 181 | my ($kernel, $self, $sender) = @_[KERNEL, OBJECT, SENDER]; | |||||||||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||||||||||
| 140 | 181 | $self->{ircd_filter} = POE::Filter::IRCD->new( | |||||||||||||||||||||||||||||||||||||||||
| 141 | colonify => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 142 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 143 | 181 | $self->{line_filter} = POE::Filter::Line->new( | |||||||||||||||||||||||||||||||||||||||||
| 144 | InputRegexp => '\015?\012', | ||||||||||||||||||||||||||||||||||||||||||
| 145 | OutputLiteral => "\015\012", | ||||||||||||||||||||||||||||||||||||||||||
| 146 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 147 | $self->{filter} = POE::Filter::Stackable->new( | ||||||||||||||||||||||||||||||||||||||||||
| 148 | 181 | Filters => [$self->{line_filter}, $self->{ircd_filter}], | |||||||||||||||||||||||||||||||||||||||||
| 149 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||||||||||
| 151 | 181 | return; | |||||||||||||||||||||||||||||||||||||||||
| 152 | } | ||||||||||||||||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||||||||||||||||
| 154 | 0 | ▶ | sub raw_events { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
raw_events: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 155 | 0 | my ($self, $value) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | ▶ | $self->{raw_events} = 1 if $value; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||||||||||||
| 160 | 1 | ▶ | sub shutdown { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
shutdown: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 161 | 1 | my ($self) = shift; | |||||||||||||||||||||||||||||||||||||||||
| 162 | 1 | $self->yield('shutdown', @_); | |||||||||||||||||||||||||||||||||||||||||
| 163 | 1 | return; | |||||||||||||||||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||||||||||
| 166 | 194 | ▶ | sub _shutdown { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_shutdown: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 167 | 194 | my ($kernel, $self) = @_[KERNEL, OBJECT]; | |||||||||||||||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||||||||||||||||
| 169 | 194 | $self->{terminating} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 170 | 194 | delete $self->{listeners}; | |||||||||||||||||||||||||||||||||||||||||
| 171 | 194 | delete $self->{connectors}; | |||||||||||||||||||||||||||||||||||||||||
| 172 | 194 | delete $self->{wheels}; | |||||||||||||||||||||||||||||||||||||||||
| 173 | 194 | $self->_syndicator_destroy(); | |||||||||||||||||||||||||||||||||||||||||
| 174 | 194 | return; | |||||||||||||||||||||||||||||||||||||||||
| 175 | } | ||||||||||||||||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | ▶ | sub _accept_failed { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_accept_failed: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 178 | 0 | my ($kernel, $self, $operation, $errnum, $errstr, $listener_id) | |||||||||||||||||||||||||||||||||||||||||
| 179 | = @_[KERNEL, OBJECT, ARG0..ARG3]; | ||||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||
| 181 | 0 | my $port = $self->{listeners}{$listener_id}{port}; | |||||||||||||||||||||||||||||||||||||||||
| 182 | 0 | my $addr = $self->{listeners}{$listener_id}{addr}; | |||||||||||||||||||||||||||||||||||||||||
| 183 | 0 | delete $self->{listeners}{$listener_id}; | |||||||||||||||||||||||||||||||||||||||||
| 184 | 0 | $self->send_event( | |||||||||||||||||||||||||||||||||||||||||
| 185 | "$self->{prefix}listener_failure", | ||||||||||||||||||||||||||||||||||||||||||
| 186 | $listener_id, | ||||||||||||||||||||||||||||||||||||||||||
| 187 | $operation, | ||||||||||||||||||||||||||||||||||||||||||
| 188 | $errnum, | ||||||||||||||||||||||||||||||||||||||||||
| 189 | $errstr, | ||||||||||||||||||||||||||||||||||||||||||
| 190 | $port, | ||||||||||||||||||||||||||||||||||||||||||
| 191 | $addr, | ||||||||||||||||||||||||||||||||||||||||||
| 192 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 193 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 194 | } | ||||||||||||||||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||||||||||||||||
| 196 | 520 | ▶ | sub _accept_connection { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_accept_connection: called CC=9 SCAR=22.0
| |||||||||||||||||||||||||||||||||||||||||||
| 197 | 520 | my ($kernel, $self, $socket, $listener_id) | |||||||||||||||||||||||||||||||||||||||||
| 198 | = @_[KERNEL, OBJECT, ARG0, ARG3]; | ||||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||
| 200 | 520 | my (undef,$peeraddr,$peerport) = getnameinfo( CORE::getpeername( $socket ), NI_NUMERICHOST | NI_NUMERICSERV ); | |||||||||||||||||||||||||||||||||||||||||
| 201 | 520 | my (undef,$sockaddr,$sockport) = getnameinfo( CORE::getsockname( $socket ), NI_NUMERICHOST | NI_NUMERICSERV ); | |||||||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||||||||
| 203 | 520 | s!^::ffff:!! for ( $sockaddr, $peeraddr ); | |||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||
| 205 | 520 | my $listener = $self->{listeners}{$listener_id}; | |||||||||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||||||||||
| 207 | 520 | my $secured = 0; | |||||||||||||||||||||||||||||||||||||||||
| 208 | 520 | my $context = { }; | |||||||||||||||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||||||||||||||||
| 210 | 520 | ▶ | 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"}
| |||||||||||||||||||||||||||||||||||||||||||
| 211 | 12 | my $cb = $_[SESSION]->callback('_sock_ssl',$context); | |||||||||||||||||||||||||||||||||||||||||
| 212 | 12 | eval { | |||||||||||||||||||||||||||||||||||||||||
| 213 | 12 | $socket = POE::Component::SSLify::Server_SSLify($socket,undef,$cb); | |||||||||||||||||||||||||||||||||||||||||
| 214 | 12 | $secured = 1; | |||||||||||||||||||||||||||||||||||||||||
| 215 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 216 | 12 | chomp $@; | |||||||||||||||||||||||||||||||||||||||||
| 217 | 12 | ▶ | die "Failed to SSLify server socket: $@" if $@; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 218 | } | ||||||||||||||||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||||||||||||||||
| 220 | 520 | my $stats_filter = POE::Filter::ThruPut->new(); | |||||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||||||
| 222 | my $wheel = POE::Wheel::ReadWrite->new( | ||||||||||||||||||||||||||||||||||||||||||
| 223 | Handle => $socket, | ||||||||||||||||||||||||||||||||||||||||||
| 224 | InputEvent => '_conn_input', | ||||||||||||||||||||||||||||||||||||||||||
| 225 | ErrorEvent => '_conn_error', | ||||||||||||||||||||||||||||||||||||||||||
| 226 | FlushedEvent => '_conn_flushed', | ||||||||||||||||||||||||||||||||||||||||||
| 227 | Filter => POE::Filter::Stackable->new( | ||||||||||||||||||||||||||||||||||||||||||
| 228 | 520 | Filters => [$stats_filter, $self->{filter}], | |||||||||||||||||||||||||||||||||||||||||
| 229 | ), | ||||||||||||||||||||||||||||||||||||||||||
| 230 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||||||||||||||||
| 232 | 520 | ▶ | if ($wheel) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 233 | 520 | my $wheel_id = $wheel->ID(); | |||||||||||||||||||||||||||||||||||||||||
| 234 | 520 | $context->{wheel_id} = $wheel_id; | |||||||||||||||||||||||||||||||||||||||||
| 235 | my $ref = { | ||||||||||||||||||||||||||||||||||||||||||
| 236 | wheel => $wheel, | ||||||||||||||||||||||||||||||||||||||||||
| 237 | peeraddr => $peeraddr, | ||||||||||||||||||||||||||||||||||||||||||
| 238 | peerport => $peerport, | ||||||||||||||||||||||||||||||||||||||||||
| 239 | flooded => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 240 | sockaddr => $sockaddr, | ||||||||||||||||||||||||||||||||||||||||||
| 241 | sockport => $sockport, | ||||||||||||||||||||||||||||||||||||||||||
| 242 | idle => $listener->{idle}, | ||||||||||||||||||||||||||||||||||||||||||
| 243 | antiflood => $listener->{antiflood}, | ||||||||||||||||||||||||||||||||||||||||||
| 244 | 520 | compress => 0, | |||||||||||||||||||||||||||||||||||||||||
| 245 | secured => $secured, | ||||||||||||||||||||||||||||||||||||||||||
| 246 | stats => $stats_filter, | ||||||||||||||||||||||||||||||||||||||||||
| 247 | _sent => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 248 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||||||||||||||||
| 250 | 520 | ▶ | 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"}
| |||||||||||||||||||||||||||||||||||||||||||
| 251 | 520 | $self->send_event( | |||||||||||||||||||||||||||||||||||||||||
| 252 | "$self->{prefix}connection", | ||||||||||||||||||||||||||||||||||||||||||
| 253 | $wheel_id, | ||||||||||||||||||||||||||||||||||||||||||
| 254 | $peeraddr, | ||||||||||||||||||||||||||||||||||||||||||
| 255 | $peerport, | ||||||||||||||||||||||||||||||||||||||||||
| 256 | $sockaddr, | ||||||||||||||||||||||||||||||||||||||||||
| 257 | $sockport, | ||||||||||||||||||||||||||||||||||||||||||
| 258 | $needs_auth, | ||||||||||||||||||||||||||||||||||||||||||
| 259 | $secured, | ||||||||||||||||||||||||||||||||||||||||||
| 260 | $stats_filter, | ||||||||||||||||||||||||||||||||||||||||||
| 261 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||||||||||||||||
| 263 | $ref->{alarm} = $kernel->delay_set( | ||||||||||||||||||||||||||||||||||||||||||
| 264 | '_conn_alarm', | ||||||||||||||||||||||||||||||||||||||||||
| 265 | $listener->{idle}, | ||||||||||||||||||||||||||||||||||||||||||
| 266 | 520 | $wheel_id, | |||||||||||||||||||||||||||||||||||||||||
| 267 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 268 | 520 | $self->{wheels}{$wheel_id} = $ref; | |||||||||||||||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||||||||||||||||
| 270 | 520 | ▶ | if ( my $reason = $self->denied( $peeraddr ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 271 | 6 | $ref->{disconnecting} = $reason; | |||||||||||||||||||||||||||||||||||||||||
| 272 | 6 | my $out = { command => 'ERROR', params => [ $reason ] }; | |||||||||||||||||||||||||||||||||||||||||
| 273 | 6 | $self->send_output( $out, $wheel_id ); | |||||||||||||||||||||||||||||||||||||||||
| 274 | } | ||||||||||||||||||||||||||||||||||||||||||
| 275 | } | ||||||||||||||||||||||||||||||||||||||||||
| 276 | 520 | return; | |||||||||||||||||||||||||||||||||||||||||
| 277 | } | ||||||||||||||||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||||||||||||||||
| 279 | 12 | ▶ | sub _sock_ssl { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_sock_ssl: called CC=5 SCAR=16.6
| |||||||||||||||||||||||||||||||||||||||||||
| 280 | 12 | my ($kernel,$self,$first,$second) = @_[KERNEL,OBJECT,ARG0,ARG1]; | |||||||||||||||||||||||||||||||||||||||||
| 281 | 12 | my ($cont) = @$first; | |||||||||||||||||||||||||||||||||||||||||
| 282 | 12 | ▶ | return if !$cont->{wheel_id}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 283 | 12 | my $wheel_id = delete $cont->{wheel_id}; | |||||||||||||||||||||||||||||||||||||||||
| 284 | 12 | ▶ | return if !$self->{wheels}{$wheel_id}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 285 | 12 | my ($sock,$stat,$err) = @$second; | |||||||||||||||||||||||||||||||||||||||||
| 286 | 12 | ▶ | return if !$stat; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 287 | 12 | my $sslinf = _get_ssl_info($sock); | |||||||||||||||||||||||||||||||||||||||||
| 288 | 12 | my $ref = $self->{wheels}{$wheel_id}; | |||||||||||||||||||||||||||||||||||||||||
| 289 | 12 | ▶ | $ref->{sslinf} = $sslinf if $sslinf; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 290 | 12 | return; | |||||||||||||||||||||||||||||||||||||||||
| 291 | } | ||||||||||||||||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||||||||||||||||
| 293 | 23 | ▶ | sub _get_ssl_info { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_get_ssl_info: called CC=9 SCAR=30.7
| |||||||||||||||||||||||||||||||||||||||||||
| 294 | 23 | ▶ | my $sock = shift || return; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
shift() || (return)
MC/DC0%0/1
shift() || (return)
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||
| 295 | 23 | my $sslinf = eval { | |||||||||||||||||||||||||||||||||||||||||
| 296 | 23 | require Net::SSLeay; | |||||||||||||||||||||||||||||||||||||||||
| 297 | 23 | my $ssl = POE::Component::SSLify::SSLify_GetSSL($sock); | |||||||||||||||||||||||||||||||||||||||||
| 298 | 23 | my $cipher = Net::SSLeay::get_cipher($ssl); | |||||||||||||||||||||||||||||||||||||||||
| 299 | 23 | my $bits = Net::SSLeay::get_cipher_bits($ssl); | |||||||||||||||||||||||||||||||||||||||||
| 300 | 23 | my $version = Net::SSLeay::version($ssl); | |||||||||||||||||||||||||||||||||||||||||
| 301 | 23 | ▶ | my $ver = | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 7 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 302 | $version == 0x0304 ? 'TLSv1_3' : | ||||||||||||||||||||||||||||||||||||||||||
| 303 | $version == 0x0303 ? 'TLSv1_2' : | ||||||||||||||||||||||||||||||||||||||||||
| 304 | $version == 0x0302 ? 'TLSv1_1' : | ||||||||||||||||||||||||||||||||||||||||||
| 305 | $version == 0x0301 ? 'TLSv1' : | ||||||||||||||||||||||||||||||||||||||||||
| 306 | $version == 0x0300 ? 'SSLv3' : | ||||||||||||||||||||||||||||||||||||||||||
| 307 | $version == 0x0002 ? 'SSLv2' : | ||||||||||||||||||||||||||||||||||||||||||
| 308 | $version == 0xfeff ? 'DTLS1' : | ||||||||||||||||||||||||||||||||||||||||||
| 309 | undef; | ||||||||||||||||||||||||||||||||||||||||||
| 310 | 23 | return "$ver-$cipher-$bits"; | |||||||||||||||||||||||||||||||||||||||||
| 311 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 312 | 23 | return $sslinf; | |||||||||||||||||||||||||||||||||||||||||
| 313 | } | ||||||||||||||||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||||||||||||||||
| 315 | 171 | ▶ | sub add_listener { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_listener: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 316 | 171 | my ($self) = shift; | |||||||||||||||||||||||||||||||||||||||||
| 317 | 171 | ▶ | croak('add_listener requires an even number of parameters') if @_ & 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 318 | 171 | $self->yield('add_listener', @_); | |||||||||||||||||||||||||||||||||||||||||
| 319 | 171 | return; | |||||||||||||||||||||||||||||||||||||||||
| 320 | } | ||||||||||||||||||||||||||||||||||||||||||
| 321 | |||||||||||||||||||||||||||||||||||||||||||
| 322 | 175 | ▶ | sub _add_listener { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_add_listener: called CC=13 SCAR=26.6
| |||||||||||||||||||||||||||||||||||||||||||
| 323 | 175 | my ($kernel, $self) = @_[KERNEL, OBJECT]; | |||||||||||||||||||||||||||||||||||||||||
| 324 | 175 | my %args = @_[ARG0..$#_]; | |||||||||||||||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||||||||||||||||
| 326 | 175 | $args{ lc($_) } = delete $args{$_} for keys %args; | |||||||||||||||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||||||||||||||||
| 328 | 175 | ▶ | 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'}
| |||||||||||||||||||||||||||||||||||||||||||
| 329 | 175 | ▶ | 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'}
| |||||||||||||||||||||||||||||||||||||||||||
| 330 | 175 | ▶ | 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'}
| |||||||||||||||||||||||||||||||||||||||||||
| 331 | 175 | my $auth = 1; | |||||||||||||||||||||||||||||||||||||||||
| 332 | 175 | my $antiflood = 1; | |||||||||||||||||||||||||||||||||||||||||
| 333 | 175 | my $usessl = 0; | |||||||||||||||||||||||||||||||||||||||||
| 334 | 175 | ▶ | $usessl = 1 if $args{usessl}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 335 | 175 | ▶ | $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
| |||||||||||||||||||||||||||||||||||||||||||
| 336 | 175 | ▶ | $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
| |||||||||||||||||||||||||||||||||||||||||||
| 337 | |||||||||||||||||||||||||||||||||||||||||||
| 338 | my $listener = POE::Wheel::SocketFactory->new( | ||||||||||||||||||||||||||||||||||||||||||
| 339 | BindAddress => $bindaddr, | ||||||||||||||||||||||||||||||||||||||||||
| 340 | BindPort => $bindport, | ||||||||||||||||||||||||||||||||||||||||||
| 341 | SuccessEvent => '_accept_connection', | ||||||||||||||||||||||||||||||||||||||||||
| 342 | FailureEvent => '_accept_failed', | ||||||||||||||||||||||||||||||||||||||||||
| 343 | Reuse => 'on', | ||||||||||||||||||||||||||||||||||||||||||
| 344 | ( ip_is_ipv6( $bindaddr ) ? ( SocketDomain => AF_INET6 ) : () ), | ||||||||||||||||||||||||||||||||||||||||||
| 345 | 175 | ▶ | ($args{listenqueue} ? (ListenQueue => $args{listenqueue}) : ()), | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 346 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||||||||||||||||
| 348 | 175 | my $id = $listener->ID(); | |||||||||||||||||||||||||||||||||||||||||
| 349 | 175 | $self->{listeners}{$id}{wheel} = $listener; | |||||||||||||||||||||||||||||||||||||||||
| 350 | 175 | $self->{listeners}{$id}{port} = $bindport; | |||||||||||||||||||||||||||||||||||||||||
| 351 | 175 | $self->{listeners}{$id}{addr} = $bindaddr; | |||||||||||||||||||||||||||||||||||||||||
| 352 | 175 | $self->{listeners}{$id}{idle} = $idle; | |||||||||||||||||||||||||||||||||||||||||
| 353 | 175 | $self->{listeners}{$id}{auth} = $auth; | |||||||||||||||||||||||||||||||||||||||||
| 354 | 175 | $self->{listeners}{$id}{antiflood} = $antiflood; | |||||||||||||||||||||||||||||||||||||||||
| 355 | 175 | $self->{listeners}{$id}{usessl} = $usessl; | |||||||||||||||||||||||||||||||||||||||||
| 356 | |||||||||||||||||||||||||||||||||||||||||||
| 357 | 175 | my (undef,$addr,$port) = getnameinfo( $listener->getsockname, NI_NUMERICHOST | NI_NUMERICSERV ); | |||||||||||||||||||||||||||||||||||||||||
| 358 | 175 | $addr =~ s!^::ffff:!!; | |||||||||||||||||||||||||||||||||||||||||
| 359 | 175 | ▶ | if ($port) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 360 | 175 | $self->{listeners}{$id}{port} = $port; | |||||||||||||||||||||||||||||||||||||||||
| 361 | $self->send_event( | ||||||||||||||||||||||||||||||||||||||||||
| 362 | 175 | $self->{prefix} . 'listener_add', | |||||||||||||||||||||||||||||||||||||||||
| 363 | $port, | ||||||||||||||||||||||||||||||||||||||||||
| 364 | $id, | ||||||||||||||||||||||||||||||||||||||||||
| 365 | $bindaddr, | ||||||||||||||||||||||||||||||||||||||||||
| 366 | $usessl, | ||||||||||||||||||||||||||||||||||||||||||
| 367 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 368 | } | ||||||||||||||||||||||||||||||||||||||||||
| 369 | 175 | return; | |||||||||||||||||||||||||||||||||||||||||
| 370 | } | ||||||||||||||||||||||||||||||||||||||||||
| 371 | |||||||||||||||||||||||||||||||||||||||||||
| 372 | 10 | ▶ | sub del_listener { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
del_listener: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 373 | 10 | my ($self) = shift; | |||||||||||||||||||||||||||||||||||||||||
| 374 | 10 | ▶ | croak("add_listener requires an even number of parameters") if @_ & 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 375 | 10 | $self->yield('del_listener', @_); | |||||||||||||||||||||||||||||||||||||||||
| 376 | 10 | return; | |||||||||||||||||||||||||||||||||||||||||
| 377 | } | ||||||||||||||||||||||||||||||||||||||||||
| 378 | |||||||||||||||||||||||||||||||||||||||||||
| 379 | 10 | ▶ | sub _del_listener { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_del_listener: called CC=6 SCAR=19.2
| |||||||||||||||||||||||||||||||||||||||||||
| 380 | 10 | my ($kernel, $self) = @_[KERNEL, OBJECT]; | |||||||||||||||||||||||||||||||||||||||||
| 381 | 10 | my %args = @_[ARG0..$#_]; | |||||||||||||||||||||||||||||||||||||||||
| 382 | |||||||||||||||||||||||||||||||||||||||||||
| 383 | 10 | $args{lc $_} = delete $args{$_} for keys %args; | |||||||||||||||||||||||||||||||||||||||||
| 384 | 10 | my $listener_id = delete $args{listener}; | |||||||||||||||||||||||||||||||||||||||||
| 385 | 10 | my $port = delete $args{port}; | |||||||||||||||||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||||||||||||||||||
| 387 | 10 | ▶ | if ($self->_listener_exists($listener_id)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 388 | 0 | my $port = $self->{listeners}{$listener_id}{port}; | |||||||||||||||||||||||||||||||||||||||||
| 389 | 0 | my $addr = $self->{listeners}{$listener_id}{addr}; | |||||||||||||||||||||||||||||||||||||||||
| 390 | 0 | delete $self->{listeners}{$listener_id}; | |||||||||||||||||||||||||||||||||||||||||
| 391 | $self->send_event( | ||||||||||||||||||||||||||||||||||||||||||
| 392 | 0 | $self->{prefix} . 'listener_del', | |||||||||||||||||||||||||||||||||||||||||
| 393 | $port, | ||||||||||||||||||||||||||||||||||||||||||
| 394 | $listener_id, | ||||||||||||||||||||||||||||||||||||||||||
| 395 | $addr, | ||||||||||||||||||||||||||||||||||||||||||
| 396 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 397 | } | ||||||||||||||||||||||||||||||||||||||||||
| 398 | elsif (defined $port) { | ||||||||||||||||||||||||||||||||||||||||||
| 399 | 10 | ▶ | while (my ($id, $listener) = each %{ $self->{listeners } }) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 400 | 10 | ▶ | if ($listener->{port} == $port) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 401 | 10 | my $addr = $listener->{addr}; | |||||||||||||||||||||||||||||||||||||||||
| 402 | 10 | delete $self->{listeners}{$id}; | |||||||||||||||||||||||||||||||||||||||||
| 403 | $self->send_event( | ||||||||||||||||||||||||||||||||||||||||||
| 404 | 10 | $self->{prefix} . 'listener_del', | |||||||||||||||||||||||||||||||||||||||||
| 405 | $port, | ||||||||||||||||||||||||||||||||||||||||||
| 406 | $listener_id, | ||||||||||||||||||||||||||||||||||||||||||
| 407 | $addr, | ||||||||||||||||||||||||||||||||||||||||||
| 408 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 409 | } | ||||||||||||||||||||||||||||||||||||||||||
| 410 | } | ||||||||||||||||||||||||||||||||||||||||||
| 411 | } | ||||||||||||||||||||||||||||||||||||||||||
| 412 | |||||||||||||||||||||||||||||||||||||||||||
| 413 | 10 | return; | |||||||||||||||||||||||||||||||||||||||||
| 414 | } | ||||||||||||||||||||||||||||||||||||||||||
| 415 | |||||||||||||||||||||||||||||||||||||||||||
| 416 | 10 | ▶ | sub _listener_exists { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_listener_exists: called CC=3 SCAR=16.5
| |||||||||||||||||||||||||||||||||||||||||||
| 417 | 10 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 418 | 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()
| |||||||||||||||||||||||||||||||||||||||||||
| 419 | 0 | ▶ | return 1 if defined $self->{listeners}{$listener_id}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 420 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 421 | } | ||||||||||||||||||||||||||||||||||||||||||
| 422 | |||||||||||||||||||||||||||||||||||||||||||
| 423 | 3 | ▶ | sub add_connector { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_connector: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 424 | 3 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 425 | 3 | ▶ | croak("add_connector requires an even number of parameters") if @_ & 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 426 | 3 | $self->yield('add_connector', @_); | |||||||||||||||||||||||||||||||||||||||||
| 427 | 3 | return; | |||||||||||||||||||||||||||||||||||||||||
| 428 | } | ||||||||||||||||||||||||||||||||||||||||||
| 429 | |||||||||||||||||||||||||||||||||||||||||||
| 430 | 3 | ▶ | sub _add_connector { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_add_connector: called CC=8 SCAR=22.4
| |||||||||||||||||||||||||||||||||||||||||||
| 431 | 3 | my ($kernel, $self, $sender) = @_[KERNEL, OBJECT, SENDER]; | |||||||||||||||||||||||||||||||||||||||||
| 432 | 3 | my %args = @_[ARG0..$#_]; | |||||||||||||||||||||||||||||||||||||||||
| 433 | |||||||||||||||||||||||||||||||||||||||||||
| 434 | 3 | $args{lc $_} = delete $args{$_} for keys %args; | |||||||||||||||||||||||||||||||||||||||||
| 435 | |||||||||||||||||||||||||||||||||||||||||||
| 436 | 3 | my $remoteaddress = $args{remoteaddress}; | |||||||||||||||||||||||||||||||||||||||||
| 437 | 3 | my $remoteport = $args{remoteport}; | |||||||||||||||||||||||||||||||||||||||||
| 438 | |||||||||||||||||||||||||||||||||||||||||||
| 439 | 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
| |||||||||||||||||||||||||||||||||||||||||||
| 440 | |||||||||||||||||||||||||||||||||||||||||||
| 441 | 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'}
| |||||||||||||||||||||||||||||||||||||||||||
| 442 | |||||||||||||||||||||||||||||||||||||||||||
| 443 | my $wheel = POE::Wheel::SocketFactory->new( | ||||||||||||||||||||||||||||||||||||||||||
| 444 | SocketProtocol => 'tcp', | ||||||||||||||||||||||||||||||||||||||||||
| 445 | RemoteAddress => $remoteaddress, | ||||||||||||||||||||||||||||||||||||||||||
| 446 | RemotePort => $remoteport, | ||||||||||||||||||||||||||||||||||||||||||
| 447 | SuccessEvent => '_sock_up', | ||||||||||||||||||||||||||||||||||||||||||
| 448 | FailureEvent => '_sock_failed', | ||||||||||||||||||||||||||||||||||||||||||
| 449 | 3 | ▶ | ($args{bindaddress} ? (BindAddress => $args{bindaddress}) : ()), | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 450 | (ip_is_ipv6($remoteaddress) ? (SocketDomain => AF_INET6) : () ), | ||||||||||||||||||||||||||||||||||||||||||
| 451 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 452 | |||||||||||||||||||||||||||||||||||||||||||
| 453 | 3 | ▶ | if ($wheel) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 454 | 3 | $args{wheel} = $wheel; | |||||||||||||||||||||||||||||||||||||||||
| 455 | 3 | $self->{connectors}{$wheel->ID()} = \%args; | |||||||||||||||||||||||||||||||||||||||||
| 456 | } | ||||||||||||||||||||||||||||||||||||||||||
| 457 | 3 | return; | |||||||||||||||||||||||||||||||||||||||||
| 458 | } | ||||||||||||||||||||||||||||||||||||||||||
| 459 | |||||||||||||||||||||||||||||||||||||||||||
| 460 | 0 | ▶ | sub _sock_failed { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_sock_failed: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 461 | 0 | my ($kernel, $self, $op, $errno, $errstr, $connector_id) | |||||||||||||||||||||||||||||||||||||||||
| 462 | = @_[KERNEL, OBJECT, ARG0..ARG3]; | ||||||||||||||||||||||||||||||||||||||||||
| 463 | |||||||||||||||||||||||||||||||||||||||||||
| 464 | 0 | my $ref = delete $self->{connectors}{$connector_id}; | |||||||||||||||||||||||||||||||||||||||||
| 465 | 0 | delete $ref->{wheel}; | |||||||||||||||||||||||||||||||||||||||||
| 466 | 0 | $self->send_event("$self->{prefix}socketerr", $ref, $op, $errno, $errstr); | |||||||||||||||||||||||||||||||||||||||||
| 467 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 468 | } | ||||||||||||||||||||||||||||||||||||||||||
| 469 | |||||||||||||||||||||||||||||||||||||||||||
| 470 | 3 | ▶ | sub _sock_up { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_sock_up: called CC=6 SCAR=18.0
| |||||||||||||||||||||||||||||||||||||||||||
| 471 | 3 | my ($kernel, $self, $socket, $connector_id) | |||||||||||||||||||||||||||||||||||||||||
| 472 | = @_[KERNEL, OBJECT, ARG0, ARG3]; | ||||||||||||||||||||||||||||||||||||||||||
| 473 | |||||||||||||||||||||||||||||||||||||||||||
| 474 | 3 | my (undef,$peeraddr,$peerport) = getnameinfo( CORE::getpeername( $socket ), NI_NUMERICHOST | NI_NUMERICSERV ); | |||||||||||||||||||||||||||||||||||||||||
| 475 | 3 | my (undef,$sockaddr,$sockport) = getnameinfo( CORE::getsockname( $socket ), NI_NUMERICHOST | NI_NUMERICSERV ); | |||||||||||||||||||||||||||||||||||||||||
| 476 | |||||||||||||||||||||||||||||||||||||||||||
| 477 | 3 | s!^::ffff:!! for ( $sockaddr, $peeraddr ); | |||||||||||||||||||||||||||||||||||||||||
| 478 | |||||||||||||||||||||||||||||||||||||||||||
| 479 | 3 | my $cntr = delete $self->{connectors}{$connector_id}; | |||||||||||||||||||||||||||||||||||||||||
| 480 | 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"}
| |||||||||||||||||||||||||||||||||||||||||||
| 481 | 1 | eval { | |||||||||||||||||||||||||||||||||||||||||
| 482 | 1 | my $ctx = SSLify_ContextCreate( @{ $self->{sslify_options} } ); | |||||||||||||||||||||||||||||||||||||||||
| 483 | 1 | $socket = POE::Component::SSLify::Client_SSLify($socket,undef,undef,$ctx); | |||||||||||||||||||||||||||||||||||||||||
| 484 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 485 | 1 | chomp $@; | |||||||||||||||||||||||||||||||||||||||||
| 486 | 1 | ▶ | die "Failed to SSLify client socket: $@" if $@; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 487 | } | ||||||||||||||||||||||||||||||||||||||||||
| 488 | |||||||||||||||||||||||||||||||||||||||||||
| 489 | 3 | my $stats_filter = POE::Filter::ThruPut->new(); | |||||||||||||||||||||||||||||||||||||||||
| 490 | |||||||||||||||||||||||||||||||||||||||||||
| 491 | my $wheel = POE::Wheel::ReadWrite->new( | ||||||||||||||||||||||||||||||||||||||||||
| 492 | Handle => $socket, | ||||||||||||||||||||||||||||||||||||||||||
| 493 | InputEvent => '_conn_input', | ||||||||||||||||||||||||||||||||||||||||||
| 494 | ErrorEvent => '_conn_error', | ||||||||||||||||||||||||||||||||||||||||||
| 495 | FlushedEvent => '_conn_flushed', | ||||||||||||||||||||||||||||||||||||||||||
| 496 | Filter => POE::Filter::Stackable->new( | ||||||||||||||||||||||||||||||||||||||||||
| 497 | 3 | Filters => [$stats_filter, $self->{filter}], | |||||||||||||||||||||||||||||||||||||||||
| 498 | ), | ||||||||||||||||||||||||||||||||||||||||||
| 499 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 500 | |||||||||||||||||||||||||||||||||||||||||||
| 501 | 3 | ▶ | return if !$wheel; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 502 | 3 | my $wheel_id = $wheel->ID(); | |||||||||||||||||||||||||||||||||||||||||
| 503 | my $ref = { | ||||||||||||||||||||||||||||||||||||||||||
| 504 | wheel => $wheel, | ||||||||||||||||||||||||||||||||||||||||||
| 505 | peeraddr => $peeraddr, | ||||||||||||||||||||||||||||||||||||||||||
| 506 | peerport => $peerport, | ||||||||||||||||||||||||||||||||||||||||||
| 507 | sockaddr => $sockaddr, | ||||||||||||||||||||||||||||||||||||||||||
| 508 | sockport => $sockport, | ||||||||||||||||||||||||||||||||||||||||||
| 509 | idle => $cntr->{idle}, | ||||||||||||||||||||||||||||||||||||||||||
| 510 | 3 | antiflood => 0, | |||||||||||||||||||||||||||||||||||||||||
| 511 | compress => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 512 | stats => $stats_filter, | ||||||||||||||||||||||||||||||||||||||||||
| 513 | _sent => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 514 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 515 | |||||||||||||||||||||||||||||||||||||||||||
| 516 | 3 | $self->{wheels}{$wheel_id} = $ref; | |||||||||||||||||||||||||||||||||||||||||
| 517 | $self->send_event( | ||||||||||||||||||||||||||||||||||||||||||
| 518 | "$self->{prefix}connected", | ||||||||||||||||||||||||||||||||||||||||||
| 519 | $wheel_id, | ||||||||||||||||||||||||||||||||||||||||||
| 520 | $peeraddr, | ||||||||||||||||||||||||||||||||||||||||||
| 521 | $peerport, | ||||||||||||||||||||||||||||||||||||||||||
| 522 | $sockaddr, | ||||||||||||||||||||||||||||||||||||||||||
| 523 | $sockport, | ||||||||||||||||||||||||||||||||||||||||||
| 524 | $cntr->{name}, | ||||||||||||||||||||||||||||||||||||||||||
| 525 | 3 | $stats_filter, | |||||||||||||||||||||||||||||||||||||||||
| 526 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 527 | 3 | return; | |||||||||||||||||||||||||||||||||||||||||
| 528 | } | ||||||||||||||||||||||||||||||||||||||||||
| 529 | |||||||||||||||||||||||||||||||||||||||||||
| 530 | 0 | ▶ | sub _anti_flood { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_anti_flood: not called CC=8 SCAR=42.8
| |||||||||||||||||||||||||||||||||||||||||||
| 531 | 0 | my ($self, $wheel_id, $input) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 532 | 0 | my $current_time = time(); | |||||||||||||||||||||||||||||||||||||||||
| 533 | |||||||||||||||||||||||||||||||||||||||||||
| 534 | 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
| |||||||||||||||||||||||||||||||||||||||||||
| 535 | |||||||||||||||||||||||||||||||||||||||||||
| 536 | SWITCH: { | ||||||||||||||||||||||||||||||||||||||||||
| 537 | 0 | ▶ | if ($self->{wheels}->{ $wheel_id }->{flooded}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 538 | 0 | last SWITCH; | |||||||||||||||||||||||||||||||||||||||||
| 539 | } | ||||||||||||||||||||||||||||||||||||||||||
| 540 | 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
| |||||||||||||||||||||||||||||||||||||||||||
| 541 | || $self->{wheels}{$wheel_id}{timer} < $current_time) { | ||||||||||||||||||||||||||||||||||||||||||
| 542 | |||||||||||||||||||||||||||||||||||||||||||
| 543 | 0 | $self->{wheels}{$wheel_id}{timer} = $current_time; | |||||||||||||||||||||||||||||||||||||||||
| 544 | 0 | my $event = "$self->{prefix}cmd_" . lc $input->{command}; | |||||||||||||||||||||||||||||||||||||||||
| 545 | 0 | $self->send_event($event, $wheel_id, $input); | |||||||||||||||||||||||||||||||||||||||||
| 546 | 0 | last SWITCH; | |||||||||||||||||||||||||||||||||||||||||
| 547 | } | ||||||||||||||||||||||||||||||||||||||||||
| 548 | 0 | ▶ | if ($self->{wheels}{$wheel_id}{timer} <= $current_time + 10) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 549 | 0 | $self->{wheels}{$wheel_id}{timer} += 1; | |||||||||||||||||||||||||||||||||||||||||
| 550 | 0 | push @{ $self->{wheels}{$wheel_id}{msq} }, $input; | |||||||||||||||||||||||||||||||||||||||||
| 551 | 0 | push @{ $self->{wheels}{$wheel_id}{alarm_ids} }, | |||||||||||||||||||||||||||||||||||||||||
| 552 | $poe_kernel->alarm_set( | ||||||||||||||||||||||||||||||||||||||||||
| 553 | '_event_dispatcher', | ||||||||||||||||||||||||||||||||||||||||||
| 554 | $self->{wheels}{$wheel_id}{timer}, | ||||||||||||||||||||||||||||||||||||||||||
| 555 | 0 | $wheel_id | |||||||||||||||||||||||||||||||||||||||||
| 556 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 557 | 0 | last SWITCH; | |||||||||||||||||||||||||||||||||||||||||
| 558 | } | ||||||||||||||||||||||||||||||||||||||||||
| 559 | |||||||||||||||||||||||||||||||||||||||||||
| 560 | 0 | $self->{wheels}{$wheel_id}{flooded} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 561 | 0 | $self->send_event("$self->{prefix}connection_flood", $wheel_id); | |||||||||||||||||||||||||||||||||||||||||
| 562 | } | ||||||||||||||||||||||||||||||||||||||||||
| 563 | |||||||||||||||||||||||||||||||||||||||||||
| 564 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 565 | } | ||||||||||||||||||||||||||||||||||||||||||
| 566 | |||||||||||||||||||||||||||||||||||||||||||
| 567 | 239 | ▶ | sub _conn_error { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_conn_error: called CC=3 SCAR=11.3
| |||||||||||||||||||||||||||||||||||||||||||
| 568 | 239 | my ($self, $errstr, $wheel_id) = @_[OBJECT, ARG2, ARG3]; | |||||||||||||||||||||||||||||||||||||||||
| 569 | 239 | ▶ | return if !$self->connection_exists($wheel_id); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 570 | $self->_disconnected( | ||||||||||||||||||||||||||||||||||||||||||
| 571 | $wheel_id, | ||||||||||||||||||||||||||||||||||||||||||
| 572 | $errstr || $self->{wheels}{$wheel_id}{disconnecting} | ||||||||||||||||||||||||||||||||||||||||||
| 573 | 239 | ▶ | ); | ||||||||||||||||||||||||||||||||||||||||
|
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'}
| |||||||||||||||||||||||||||||||||||||||||||
| 574 | 239 | return; | |||||||||||||||||||||||||||||||||||||||||
| 575 | } | ||||||||||||||||||||||||||||||||||||||||||
| 576 | |||||||||||||||||||||||||||||||||||||||||||
| 577 | 0 | ▶ | sub _conn_alarm { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_conn_alarm: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 578 | 0 | my ($kernel, $self, $wheel_id) = @_[KERNEL, OBJECT, ARG0]; | |||||||||||||||||||||||||||||||||||||||||
| 579 | 0 | ▶ | return if !$self->connection_exists($wheel_id); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 580 | 0 | my $conn = $self->{wheels}{$wheel_id}; | |||||||||||||||||||||||||||||||||||||||||
| 581 | |||||||||||||||||||||||||||||||||||||||||||
| 582 | $self->send_event( | ||||||||||||||||||||||||||||||||||||||||||
| 583 | "$self->{prefix}connection_idle", | ||||||||||||||||||||||||||||||||||||||||||
| 584 | $wheel_id, | ||||||||||||||||||||||||||||||||||||||||||
| 585 | $conn->{idle}, | ||||||||||||||||||||||||||||||||||||||||||
| 586 | 0 | ); | |||||||||||||||||||||||||||||||||||||||||
| 587 | $conn->{alarm} = $kernel->delay_set( | ||||||||||||||||||||||||||||||||||||||||||
| 588 | '_conn_alarm', | ||||||||||||||||||||||||||||||||||||||||||
| 589 | $conn->{idle}, | ||||||||||||||||||||||||||||||||||||||||||
| 590 | 0 | $wheel_id, | |||||||||||||||||||||||||||||||||||||||||
| 591 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 592 | |||||||||||||||||||||||||||||||||||||||||||
| 593 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 594 | } | ||||||||||||||||||||||||||||||||||||||||||
| 595 | |||||||||||||||||||||||||||||||||||||||||||
| 596 | 2764 | ▶ | sub _conn_flushed { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_conn_flushed: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||
| 597 | 2764 | my ($kernel, $self, $wheel_id) = @_[KERNEL, OBJECT, ARG0]; | |||||||||||||||||||||||||||||||||||||||||
| 598 | 2764 | ▶ | return if !$self->connection_exists($wheel_id); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 599 | |||||||||||||||||||||||||||||||||||||||||||
| 600 | { | ||||||||||||||||||||||||||||||||||||||||||
| 601 | 2764 | my $sent = $self->{wheels}{$wheel_id}{stats}->send(); | |||||||||||||||||||||||||||||||||||||||||
| 602 | 2764 | my $tally = $sent - $self->{wheels}{$wheel_id}{_sent}; | |||||||||||||||||||||||||||||||||||||||||
| 603 | 2764 | $self->{wheels}{$wheel_id}{_sent} = $sent; | |||||||||||||||||||||||||||||||||||||||||
| 604 | 2764 | $self->{_globalstats}{sent} += $tally; | |||||||||||||||||||||||||||||||||||||||||
| 605 | } | ||||||||||||||||||||||||||||||||||||||||||
| 606 | |||||||||||||||||||||||||||||||||||||||||||
| 607 | 2764 | ▶ | if ($self->{wheels}{$wheel_id}{disconnecting}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 608 | $self->_disconnected( | ||||||||||||||||||||||||||||||||||||||||||
| 609 | $wheel_id, | ||||||||||||||||||||||||||||||||||||||||||
| 610 | $self->{wheels}{$wheel_id}{disconnecting}, | ||||||||||||||||||||||||||||||||||||||||||
| 611 | 243 | ); | |||||||||||||||||||||||||||||||||||||||||
| 612 | 243 | return; | |||||||||||||||||||||||||||||||||||||||||
| 613 | } | ||||||||||||||||||||||||||||||||||||||||||
| 614 | |||||||||||||||||||||||||||||||||||||||||||
| 615 | 2521 | ▶ | if ($self->{wheels}{$wheel_id}{compress_pending}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 616 | 1 | delete $self->{wheels}{$wheel_id}{compress_pending}; | |||||||||||||||||||||||||||||||||||||||||
| 617 | 1 | $self->{wheels}{$wheel_id}{wheel}->get_input_filter()->unshift( | |||||||||||||||||||||||||||||||||||||||||
| 618 | POE::Filter::Zlib::Stream->new(), | ||||||||||||||||||||||||||||||||||||||||||
| 619 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 620 | 1 | $self->send_event("$self->{prefix}compressed_conn", $wheel_id); | |||||||||||||||||||||||||||||||||||||||||
| 621 | 1 | return; | |||||||||||||||||||||||||||||||||||||||||
| 622 | } | ||||||||||||||||||||||||||||||||||||||||||
| 623 | 2520 | return; | |||||||||||||||||||||||||||||||||||||||||
| 624 | } | ||||||||||||||||||||||||||||||||||||||||||
| 625 | |||||||||||||||||||||||||||||||||||||||||||
| 626 | 3909 | ▶ | sub _conn_input { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_conn_input: called CC=4 SCAR=14.1
| |||||||||||||||||||||||||||||||||||||||||||
| 627 | 3909 | my ($kernel, $self, $input, $wheel_id) = @_[KERNEL, OBJECT, ARG0, ARG1]; | |||||||||||||||||||||||||||||||||||||||||
| 628 | 3909 | my $conn = $self->{wheels}{$wheel_id}; | |||||||||||||||||||||||||||||||||||||||||
| 629 | |||||||||||||||||||||||||||||||||||||||||||
| 630 | # We aren't interested if they are disconnecting | ||||||||||||||||||||||||||||||||||||||||||
| 631 | 3909 | ▶ | return if $conn->{disconnecting}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 632 | |||||||||||||||||||||||||||||||||||||||||||
| 633 | { | ||||||||||||||||||||||||||||||||||||||||||
| 634 | 3908 | require bytes; | |||||||||||||||||||||||||||||||||||||||||
| 635 | 3908 | $self->{_globalstats}{recv} += bytes::length($input->{raw_line}) + 2; | |||||||||||||||||||||||||||||||||||||||||
| 636 | } | ||||||||||||||||||||||||||||||||||||||||||
| 637 | |||||||||||||||||||||||||||||||||||||||||||
| 638 | 3908 | ▶ | if ($self->{raw_events}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 639 | $self->send_event( | ||||||||||||||||||||||||||||||||||||||||||
| 640 | "$self->{prefix}raw_input", | ||||||||||||||||||||||||||||||||||||||||||
| 641 | $wheel_id, | ||||||||||||||||||||||||||||||||||||||||||
| 642 | $input->{raw_line}, | ||||||||||||||||||||||||||||||||||||||||||
| 643 | 0 | ); | |||||||||||||||||||||||||||||||||||||||||
| 644 | } | ||||||||||||||||||||||||||||||||||||||||||
| 645 | 3908 | $conn->{msgs}{recv}++; | |||||||||||||||||||||||||||||||||||||||||
| 646 | 3908 | $conn->{seen} = time(); | |||||||||||||||||||||||||||||||||||||||||
| 647 | 3908 | $kernel->delay_adjust($conn->{alarm}, $conn->{idle}); | |||||||||||||||||||||||||||||||||||||||||
| 648 | |||||||||||||||||||||||||||||||||||||||||||
| 649 | # TODO: Antiflood code | ||||||||||||||||||||||||||||||||||||||||||
| 650 | 3908 | ▶ | if ($self->antiflood($wheel_id)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 651 | 0 | $self->_anti_flood($wheel_id, $input); | |||||||||||||||||||||||||||||||||||||||||
| 652 | } | ||||||||||||||||||||||||||||||||||||||||||
| 653 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 654 | 3908 | my $event = "$self->{prefix}cmd_" . lc $input->{command}; | |||||||||||||||||||||||||||||||||||||||||
| 655 | 3908 | $self->send_event($event, $wheel_id, $input); | |||||||||||||||||||||||||||||||||||||||||
| 656 | } | ||||||||||||||||||||||||||||||||||||||||||
| 657 | 3908 | return; | |||||||||||||||||||||||||||||||||||||||||
| 658 | } | ||||||||||||||||||||||||||||||||||||||||||
| 659 | |||||||||||||||||||||||||||||||||||||||||||
| 660 | 0 | ▶ | sub _event_dispatcher { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_event_dispatcher: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||
| 661 | 0 | my ($kernel, $self, $wheel_id) = @_[KERNEL, OBJECT, ARG0]; | |||||||||||||||||||||||||||||||||||||||||
| 662 | |||||||||||||||||||||||||||||||||||||||||||
| 663 | 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"}
| |||||||||||||||||||||||||||||||||||||||||||
| 664 | || $self->{wheels}{$wheel_id}{flooded}) { | ||||||||||||||||||||||||||||||||||||||||||
| 665 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 666 | } | ||||||||||||||||||||||||||||||||||||||||||
| 667 | |||||||||||||||||||||||||||||||||||||||||||
| 668 | 0 | shift @{ $self->{wheels}{$wheel_id}{alarm_ids} }; | |||||||||||||||||||||||||||||||||||||||||
| 669 | 0 | my $input = shift @{ $self->{wheels}{$wheel_id}{msq} }; | |||||||||||||||||||||||||||||||||||||||||
| 670 | |||||||||||||||||||||||||||||||||||||||||||
| 671 | 0 | ▶ | if ($input) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 672 | 0 | my $event = "$self->{prefix}cmd_" . lc $input->{command}; | |||||||||||||||||||||||||||||||||||||||||
| 673 | 0 | $self->send_event($event, $wheel_id, $input); | |||||||||||||||||||||||||||||||||||||||||
| 674 | } | ||||||||||||||||||||||||||||||||||||||||||
| 675 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 676 | } | ||||||||||||||||||||||||||||||||||||||||||
| 677 | |||||||||||||||||||||||||||||||||||||||||||
| 678 | 12567 | ▶ | sub send_output { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
send_output: called CC=5 SCAR=17.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 679 | 12567 | my ($self, $output) = splice @_, 0, 2; | |||||||||||||||||||||||||||||||||||||||||
| 680 | |||||||||||||||||||||||||||||||||||||||||||
| 681 | 12567 | ▶ | 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"
| |||||||||||||||||||||||||||||||||||||||||||
| 682 | 12340 | for my $id (grep { $self->connection_exists($_) } @_) { | |||||||||||||||||||||||||||||||||||||||||
| 683 | 9039 | ▶ | if ($self->{raw_events}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 684 | 0 | my $out = $self->{filter}->put([$output])->[0]; | |||||||||||||||||||||||||||||||||||||||||
| 685 | 0 | $out =~ s/\015\012$//; | |||||||||||||||||||||||||||||||||||||||||
| 686 | 0 | $self->send_event("$self->{prefix}raw_output", $id, $out); | |||||||||||||||||||||||||||||||||||||||||
| 687 | } | ||||||||||||||||||||||||||||||||||||||||||
| 688 | 9039 | $self->{wheels}{$id}{msgs}{sent}++; | |||||||||||||||||||||||||||||||||||||||||
| 689 | 9039 | $self->{wheels}{$id}{wheel}->put($output); | |||||||||||||||||||||||||||||||||||||||||
| 690 | } | ||||||||||||||||||||||||||||||||||||||||||
| 691 | } | ||||||||||||||||||||||||||||||||||||||||||
| 692 | |||||||||||||||||||||||||||||||||||||||||||
| 693 | 12567 | return; | |||||||||||||||||||||||||||||||||||||||||
| 694 | } | ||||||||||||||||||||||||||||||||||||||||||
| 695 | |||||||||||||||||||||||||||||||||||||||||||
| 696 | 0 | ▶ | sub _send_output { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_send_output: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 697 | 0 | $_[OBJECT]->send_output(@_[ARG0..$#_]); | |||||||||||||||||||||||||||||||||||||||||
| 698 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 699 | } | ||||||||||||||||||||||||||||||||||||||||||
| 700 | |||||||||||||||||||||||||||||||||||||||||||
| 701 | 4446 | ▶ | sub antiflood { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
antiflood: called CC=7 SCAR=35.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 702 | 4446 | my ($self, $wheel_id, $value) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 703 | |||||||||||||||||||||||||||||||||||||||||||
| 704 | 4446 | ▶ | return if !$self->connection_exists($wheel_id); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 705 | 4446 | ▶ | return 0 if !$self->{antiflood}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 706 | 0 | ▶ | return $self->{wheels}{$wheel_id}{antiflood} if !defined $value; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 707 | |||||||||||||||||||||||||||||||||||||||||||
| 708 | 0 | ▶ | if (!$value) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 709 | # Flush pending messages from that wheel | ||||||||||||||||||||||||||||||||||||||||||
| 710 | 0 | ▶ | while (my $alarm_id = shift @{ $self->{wheels}{$wheel_id}{alarm_ids} }) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 711 | 0 | $poe_kernel->alarm_remove($alarm_id); | |||||||||||||||||||||||||||||||||||||||||
| 712 | 0 | my $input = shift @{ $self->{wheels}{$wheel_id}{msq} }; | |||||||||||||||||||||||||||||||||||||||||
| 713 | |||||||||||||||||||||||||||||||||||||||||||
| 714 | 0 | ▶ | if ($input) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 715 | 0 | my $event = "$self->{prefix}cmd_" . lc $input->{command}; | |||||||||||||||||||||||||||||||||||||||||
| 716 | 0 | $self->send_event($event, $wheel_id, $input); | |||||||||||||||||||||||||||||||||||||||||
| 717 | } | ||||||||||||||||||||||||||||||||||||||||||
| 718 | } | ||||||||||||||||||||||||||||||||||||||||||
| 719 | } | ||||||||||||||||||||||||||||||||||||||||||
| 720 | |||||||||||||||||||||||||||||||||||||||||||
| 721 | 0 | $self->{wheels}{$wheel_id}{antiflood} = $value; | |||||||||||||||||||||||||||||||||||||||||
| 722 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 723 | } | ||||||||||||||||||||||||||||||||||||||||||
| 724 | |||||||||||||||||||||||||||||||||||||||||||
| 725 | 2 | ▶ | sub compressed_link { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
compressed_link: called CC=7 SCAR=20.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 726 | 2 | my ($self, $wheel_id, $value, $cntr) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 727 | 2 | ▶ | return if !$self->connection_exists($wheel_id); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 728 | 2 | ▶ | return $self->{wheels}{$wheel_id}{compress} if !defined $value; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 729 | |||||||||||||||||||||||||||||||||||||||||||
| 730 | 2 | ▶ | if ($value) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 731 | 2 | ▶ | if (!$self->{got_zlib}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 732 | 2 | eval { | |||||||||||||||||||||||||||||||||||||||||
| 733 | 2 | require POE::Filter::Zlib::Stream; | |||||||||||||||||||||||||||||||||||||||||
| 734 | 2 | $self->{got_zlib} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 735 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 736 | 2 | chomp $@; | |||||||||||||||||||||||||||||||||||||||||
| 737 | 2 | ▶ | croak($@) if !$self->{got_zlib}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 738 | } | ||||||||||||||||||||||||||||||||||||||||||
| 739 | 2 | ▶ | if ($cntr) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 740 | 1 | $self->{wheels}{$wheel_id}{wheel}->get_input_filter()->unshift( | |||||||||||||||||||||||||||||||||||||||||
| 741 | POE::Filter::Zlib::Stream->new() | ||||||||||||||||||||||||||||||||||||||||||
| 742 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 743 | 1 | $self->send_event( | |||||||||||||||||||||||||||||||||||||||||
| 744 | "$self->{prefix}compressed_conn", | ||||||||||||||||||||||||||||||||||||||||||
| 745 | $wheel_id, | ||||||||||||||||||||||||||||||||||||||||||
| 746 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 747 | } | ||||||||||||||||||||||||||||||||||||||||||
| 748 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 749 | 1 | $self->{wheels}{$wheel_id}{compress_pending} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 750 | } | ||||||||||||||||||||||||||||||||||||||||||
| 751 | } | ||||||||||||||||||||||||||||||||||||||||||
| 752 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 753 | 0 | $self->{wheels}{$wheel_id}{wheel}->get_input_filter()->shift(); | |||||||||||||||||||||||||||||||||||||||||
| 754 | } | ||||||||||||||||||||||||||||||||||||||||||
| 755 | |||||||||||||||||||||||||||||||||||||||||||
| 756 | 2 | $self->{wheels}{$wheel_id}{compress} = $value; | |||||||||||||||||||||||||||||||||||||||||
| 757 | 2 | return; | |||||||||||||||||||||||||||||||||||||||||
| 758 | } | ||||||||||||||||||||||||||||||||||||||||||
| 759 | |||||||||||||||||||||||||||||||||||||||||||
| 760 | 237 | ▶ | sub disconnect { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
disconnect: called CC=4 SCAR=15.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 761 | 237 | my ($self, $wheel_id, $string) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 762 | 237 | ▶ | 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)
| |||||||||||||||||||||||||||||||||||||||||||
| 763 | 237 | ▶ | $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
| |||||||||||||||||||||||||||||||||||||||||||
| 764 | 237 | return; | |||||||||||||||||||||||||||||||||||||||||
| 765 | } | ||||||||||||||||||||||||||||||||||||||||||
| 766 | |||||||||||||||||||||||||||||||||||||||||||
| 767 | 482 | ▶ | sub _disconnected { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_disconnected: called CC=6 SCAR=19.4
| |||||||||||||||||||||||||||||||||||||||||||
| 768 | 482 | my ($self, $wheel_id, $errstr) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 769 | 482 | ▶ | 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)
| |||||||||||||||||||||||||||||||||||||||||||
| 770 | |||||||||||||||||||||||||||||||||||||||||||
| 771 | 482 | my $conn = delete $self->{wheels}{$wheel_id}; | |||||||||||||||||||||||||||||||||||||||||
| 772 | 482 | for my $alarm_id ($conn->{alarm}, @{ $conn->{alarm_ids} }) { | |||||||||||||||||||||||||||||||||||||||||
| 773 | 482 | $poe_kernel->alarm_remove($_); | |||||||||||||||||||||||||||||||||||||||||
| 774 | } | ||||||||||||||||||||||||||||||||||||||||||
| 775 | $self->send_event( | ||||||||||||||||||||||||||||||||||||||||||
| 776 | 482 | ▶ | "$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
| |||||||||||||||||||||||||||||||||||||||||||
| 777 | $wheel_id, | ||||||||||||||||||||||||||||||||||||||||||
| 778 | $errstr || 'Remote host closed the connection', | ||||||||||||||||||||||||||||||||||||||||||
| 779 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 780 | |||||||||||||||||||||||||||||||||||||||||||
| 781 | 482 | ▶ | if ( $^O =~ /(cygwin|MSWin)/ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 782 | 0 | $conn->{wheel}->shutdown_input(); | |||||||||||||||||||||||||||||||||||||||||
| 783 | 0 | $conn->{wheel}->shutdown_output(); | |||||||||||||||||||||||||||||||||||||||||
| 784 | } | ||||||||||||||||||||||||||||||||||||||||||
| 785 | |||||||||||||||||||||||||||||||||||||||||||
| 786 | 482 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 787 | } | ||||||||||||||||||||||||||||||||||||||||||
| 788 | |||||||||||||||||||||||||||||||||||||||||||
| 789 | 0 | ▶ | sub connection_info { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
connection_info: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 790 | 0 | my ($self, $wheel_id) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 791 | 0 | ▶ | return if !$self->connection_exists($wheel_id); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 792 | return map { | ||||||||||||||||||||||||||||||||||||||||||
| 793 | 0 | $self->{wheels}{$wheel_id}{$_} | |||||||||||||||||||||||||||||||||||||||||
| 794 | } qw(peeraddr peerport sockaddr sockport); | ||||||||||||||||||||||||||||||||||||||||||
| 795 | } | ||||||||||||||||||||||||||||||||||||||||||
| 796 | |||||||||||||||||||||||||||||||||||||||||||
| 797 | 17289 | ▶ | sub connection_exists { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
connection_exists: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 798 | 17289 | my ($self, $wheel_id) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 799 | 17289 | ▶ | 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}
| |||||||||||||||||||||||||||||||||||||||||||
| 800 | 17211 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 801 | } | ||||||||||||||||||||||||||||||||||||||||||
| 802 | |||||||||||||||||||||||||||||||||||||||||||
| 803 | 479 | ▶ | sub connection_secured { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
connection_secured: called CC=6 SCAR=18.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 804 | 479 | my ($self, $wheel_id) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 805 | 479 | ▶ | 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}
| |||||||||||||||||||||||||||||||||||||||||||
| 806 | 479 | ▶ | return if !$self->{wheels}{$wheel_id}{secured}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 807 | 11 | my $sslinfo = $self->{wheels}{$wheel_id}{sslinfo}; | |||||||||||||||||||||||||||||||||||||||||
| 808 | 11 | ▶ | if (!$sslinfo) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 809 | 11 | my $sock = $self->{wheels}{$wheel_id}{wheel}->get_input_handle(); | |||||||||||||||||||||||||||||||||||||||||
| 810 | 11 | $sslinfo = _get_ssl_info($sock); | |||||||||||||||||||||||||||||||||||||||||
| 811 | 11 | ▶ | $self->{wheels}{$wheel_id}{sslinfo} = $sslinfo | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 812 | if $sslinfo; | ||||||||||||||||||||||||||||||||||||||||||
| 813 | } | ||||||||||||||||||||||||||||||||||||||||||
| 814 | 11 | return $sslinfo; | |||||||||||||||||||||||||||||||||||||||||
| 815 | } | ||||||||||||||||||||||||||||||||||||||||||
| 816 | |||||||||||||||||||||||||||||||||||||||||||
| 817 | 9 | ▶ | sub connection_certfp { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
connection_certfp: called CC=5 SCAR=17.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 818 | 9 | my ($self, $wheel_id) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 819 | 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}
| |||||||||||||||||||||||||||||||||||||||||||
| 820 | 9 | ▶ | return if !$self->{wheels}{$wheel_id}{secured}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 821 | 9 | my $sock = $self->{wheels}{$wheel_id}{wheel}->get_input_handle(); | |||||||||||||||||||||||||||||||||||||||||
| 822 | 9 | my $fp = eval { | |||||||||||||||||||||||||||||||||||||||||
| 823 | 9 | my $ssl = POE::Component::SSLify::SSLify_GetSSL($sock); | |||||||||||||||||||||||||||||||||||||||||
| 824 | 9 | my $x509 = Net::SSLeay::get_peer_certificate($ssl); | |||||||||||||||||||||||||||||||||||||||||
| 825 | 9 | return Net::SSLeay::X509_get_fingerprint($x509,'sha256'); | |||||||||||||||||||||||||||||||||||||||||
| 826 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 827 | 9 | ▶ | $fp =~ s!:!!g if $fp; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 828 | 9 | return $fp; | |||||||||||||||||||||||||||||||||||||||||
| 829 | } | ||||||||||||||||||||||||||||||||||||||||||
| 830 | |||||||||||||||||||||||||||||||||||||||||||
| 831 | 0 | ▶ | sub connection_stats { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
connection_stats: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 832 | 0 | my ($self, $wheel_id) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 833 | 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}
| |||||||||||||||||||||||||||||||||||||||||||
| 834 | 0 | return $self->{wheels}{$wheel_id}{stats}->stats(); | |||||||||||||||||||||||||||||||||||||||||
| 835 | } | ||||||||||||||||||||||||||||||||||||||||||
| 836 | |||||||||||||||||||||||||||||||||||||||||||
| 837 | 2 | ▶ | sub connection_msgs { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
connection_msgs: called CC=3 SCAR=12.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 838 | 2 | my ($self, $wheel_id) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 839 | 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}
| |||||||||||||||||||||||||||||||||||||||||||
| 840 | 2 | return [ map { $self->{wheels}{$wheel_id}{msgs}{$_} } qw[sent recv] ]; | |||||||||||||||||||||||||||||||||||||||||
| 841 | } | ||||||||||||||||||||||||||||||||||||||||||
| 842 | |||||||||||||||||||||||||||||||||||||||||||
| 843 | 0 | ▶ | sub _conn_flooded { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_conn_flooded: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||
| 844 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 845 | 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()
| |||||||||||||||||||||||||||||||||||||||||||
| 846 | 0 | ▶ | return if !$self->connection_exists($conn_id); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 847 | 0 | return $self->{wheels}{$conn_id}{flooded}; | |||||||||||||||||||||||||||||||||||||||||
| 848 | } | ||||||||||||||||||||||||||||||||||||||||||
| 849 | |||||||||||||||||||||||||||||||||||||||||||
| 850 | 6 | ▶ | sub add_denial { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_denial: called CC=5 SCAR=17.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 851 | 6 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 852 | 6 | ▶ | my $netmask = shift || return; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
shift() || (return)
MC/DC0%0/1
shift() || (return)
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||
| 853 | 6 | ▶ | my $reason = shift || 'Denied'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
shift() || 'Denied'
MC/DC0%0/1
shift() || 'Denied'
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||
| 854 | |||||||||||||||||||||||||||||||||||||||||||
| 855 | 6 | ▶ | if ( ! eval { $netmask->isa('Net::Netmask') } ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 856 | 6 | $netmask = Net::CIDR::cidrvalidate( $netmask ); | |||||||||||||||||||||||||||||||||||||||||
| 857 | } | ||||||||||||||||||||||||||||||||||||||||||
| 858 | |||||||||||||||||||||||||||||||||||||||||||
| 859 | 6 | ▶ | if ( !$netmask ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 860 | 0 | carp("Failed to validate netmask"); | |||||||||||||||||||||||||||||||||||||||||
| 861 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 862 | } | ||||||||||||||||||||||||||||||||||||||||||
| 863 | |||||||||||||||||||||||||||||||||||||||||||
| 864 | 6 | $self->{denials}{$netmask} = { | |||||||||||||||||||||||||||||||||||||||||
| 865 | blk => $netmask, | ||||||||||||||||||||||||||||||||||||||||||
| 866 | reason => $reason, | ||||||||||||||||||||||||||||||||||||||||||
| 867 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 868 | 6 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 869 | } | ||||||||||||||||||||||||||||||||||||||||||
| 870 | |||||||||||||||||||||||||||||||||||||||||||
| 871 | 5 | ▶ | sub del_denial { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
del_denial: called CC=3 SCAR=11.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 872 | 5 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 873 | 5 | ▶ | my $netmask = shift || return; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
shift() || (return)
MC/DC0%0/1
shift() || (return)
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||
| 874 | 5 | ▶ | return if !$self->{denials}{$netmask}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 875 | 5 | delete $self->{denials}{$netmask}; | |||||||||||||||||||||||||||||||||||||||||
| 876 | 5 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 877 | } | ||||||||||||||||||||||||||||||||||||||||||
| 878 | |||||||||||||||||||||||||||||||||||||||||||
| 879 | 0 | ▶ | sub add_exemption { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_exemption: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 880 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 881 | 0 | ▶ | my $netmask = shift || return; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
shift() || (return)
MC/DC0%0/1
shift() || (return)
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||
| 882 | |||||||||||||||||||||||||||||||||||||||||||
| 883 | 0 | ▶ | if ( !$netmask->isa('Net::Netmask') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 884 | 0 | $netmask = Net::CIDR::cidrvalidate( $netmask ); | |||||||||||||||||||||||||||||||||||||||||
| 885 | } | ||||||||||||||||||||||||||||||||||||||||||
| 886 | |||||||||||||||||||||||||||||||||||||||||||
| 887 | 0 | ▶ | if ( !$netmask ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 888 | 0 | carp("Failed to validate netmask"); | |||||||||||||||||||||||||||||||||||||||||
| 889 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 890 | } | ||||||||||||||||||||||||||||||||||||||||||
| 891 | |||||||||||||||||||||||||||||||||||||||||||
| 892 | 0 | ▶ | if (!$self->{exemptions}{$netmask}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 893 | 0 | $self->{exemptions}{$netmask} = $netmask; | |||||||||||||||||||||||||||||||||||||||||
| 894 | } | ||||||||||||||||||||||||||||||||||||||||||
| 895 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 896 | } | ||||||||||||||||||||||||||||||||||||||||||
| 897 | |||||||||||||||||||||||||||||||||||||||||||
| 898 | 0 | ▶ | sub del_exemption { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
del_exemption: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 899 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 900 | 0 | ▶ | my $netmask = shift || return; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
shift() || (return)
MC/DC0%0/1
shift() || (return)
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||
| 901 | 0 | ▶ | return if !$self->{exemptions}{$netmask}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 902 | 0 | delete $self->{exemptions}{$netmask}; | |||||||||||||||||||||||||||||||||||||||||
| 903 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 904 | } | ||||||||||||||||||||||||||||||||||||||||||
| 905 | |||||||||||||||||||||||||||||||||||||||||||
| 906 | 532 | ▶ | sub denied { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
denied: called CC=7 SCAR=21.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 907 | 532 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 908 | 532 | ▶ | my $ipaddr = shift || return; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
shift() || (return)
MC/DC0%0/1
shift() || (return)
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||
| 909 | 532 | ▶ | return if $self->exempted($ipaddr); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 910 | |||||||||||||||||||||||||||||||||||||||||||
| 911 | 532 | for my $mask (keys %{ $self->{denials} }) { | |||||||||||||||||||||||||||||||||||||||||
| 912 | 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)
| |||||||||||||||||||||||||||||||||||||||||||
| 913 | 0 | return $self->{denials}{$mask}{reason}; | |||||||||||||||||||||||||||||||||||||||||
| 914 | } | ||||||||||||||||||||||||||||||||||||||||||
| 915 | elsif ( Net::CIDR::cidrlookup( $ipaddr, $self->{denials}{$mask}{blk} ) ) { | ||||||||||||||||||||||||||||||||||||||||||
| 916 | 11 | return $self->{denials}{$mask}{reason}; | |||||||||||||||||||||||||||||||||||||||||
| 917 | } | ||||||||||||||||||||||||||||||||||||||||||
| 918 | } | ||||||||||||||||||||||||||||||||||||||||||
| 919 | |||||||||||||||||||||||||||||||||||||||||||
| 920 | 521 | return; | |||||||||||||||||||||||||||||||||||||||||
| 921 | } | ||||||||||||||||||||||||||||||||||||||||||
| 922 | |||||||||||||||||||||||||||||||||||||||||||
| 923 | 532 | ▶ | sub exempted { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
exempted: called CC=6 SCAR=26.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 924 | 532 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 925 | 532 | ▶ | my $ipaddr = shift || return; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
shift() || (return)
MC/DC0%0/1
shift() || (return)
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||
| 926 | 532 | for my $mask (keys %{ $self->{exemptions} }) { | |||||||||||||||||||||||||||||||||||||||||
| 927 | 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)
| |||||||||||||||||||||||||||||||||||||||||||
| 928 | 0 | ▶ | return 1 if Net::CIDR::cidrlookup( $ipaddr, $self->{exemptions}{$mask} ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 929 | } | ||||||||||||||||||||||||||||||||||||||||||
| 930 | 532 | return; | |||||||||||||||||||||||||||||||||||||||||
| 931 | } | ||||||||||||||||||||||||||||||||||||||||||
| 932 | |||||||||||||||||||||||||||||||||||||||||||
| 933 | 181 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 934 | |||||||||||||||||||||||||||||||||||||||||||
| 935 | =encoding utf8 | ||||||||||||||||||||||||||||||||||||||||||
| 936 | |||||||||||||||||||||||||||||||||||||||||||
| 937 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||
| 938 | |||||||||||||||||||||||||||||||||||||||||||
| 939 | POE::Component::Server::IRC::Backend - A POE component class that provides network connection abstraction for POE::Component::Server::IRC | ||||||||||||||||||||||||||||||||||||||||||
| 940 | |||||||||||||||||||||||||||||||||||||||||||
| 941 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||
| 942 | |||||||||||||||||||||||||||||||||||||||||||
| 943 | package MyIRCD; | ||||||||||||||||||||||||||||||||||||||||||
| 944 | |||||||||||||||||||||||||||||||||||||||||||
| 945 | use strict; | ||||||||||||||||||||||||||||||||||||||||||
| 946 | use warnings; | ||||||||||||||||||||||||||||||||||||||||||
| 947 | use base 'POE::Component::Server::IRC::Backend'; | ||||||||||||||||||||||||||||||||||||||||||
| 948 | |||||||||||||||||||||||||||||||||||||||||||
| 949 | sub spawn { | ||||||||||||||||||||||||||||||||||||||||||
| 950 | my ($package, %args) = @_; | ||||||||||||||||||||||||||||||||||||||||||
| 951 | |||||||||||||||||||||||||||||||||||||||||||
| 952 | my $self = $package->create(prefix => 'ircd_', @_); | ||||||||||||||||||||||||||||||||||||||||||
| 953 | |||||||||||||||||||||||||||||||||||||||||||
| 954 | # process %args ... | ||||||||||||||||||||||||||||||||||||||||||
| 955 | |||||||||||||||||||||||||||||||||||||||||||
| 956 | return $self; | ||||||||||||||||||||||||||||||||||||||||||
| 957 | } | ||||||||||||||||||||||||||||||||||||||||||
| 958 | |||||||||||||||||||||||||||||||||||||||||||
| 959 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||
| 960 | |||||||||||||||||||||||||||||||||||||||||||
| 961 | POE::Component::Server::IRC::Backend - A POE component class that provides | ||||||||||||||||||||||||||||||||||||||||||
| 962 | network connection abstraction for | ||||||||||||||||||||||||||||||||||||||||||
| 963 | L<POE::Component::Server::IRC|POE::Component::Server::IRC>. It uses a | ||||||||||||||||||||||||||||||||||||||||||
| 964 | plugin system. See | ||||||||||||||||||||||||||||||||||||||||||
| 965 | L<POE::Component::Server::IRC::Plugin|POE::Component::Server::IRC::Plugin> | ||||||||||||||||||||||||||||||||||||||||||
| 966 | for details. | ||||||||||||||||||||||||||||||||||||||||||
| 967 | |||||||||||||||||||||||||||||||||||||||||||
| 968 | =head1 CONSTRUCTOR | ||||||||||||||||||||||||||||||||||||||||||
| 969 | |||||||||||||||||||||||||||||||||||||||||||
| 970 | =head2 C<create> | ||||||||||||||||||||||||||||||||||||||||||
| 971 | |||||||||||||||||||||||||||||||||||||||||||
| 972 | Returns an object. Accepts the following parameters, all are optional: | ||||||||||||||||||||||||||||||||||||||||||
| 973 | |||||||||||||||||||||||||||||||||||||||||||
| 974 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 975 | |||||||||||||||||||||||||||||||||||||||||||
| 976 | =item * B<'alias'>, a POE::Kernel alias to set; | ||||||||||||||||||||||||||||||||||||||||||
| 977 | |||||||||||||||||||||||||||||||||||||||||||
| 978 | =item * B<'auth'>, set to a false value to globally disable IRC | ||||||||||||||||||||||||||||||||||||||||||
| 979 | authentication, default is auth is enabled; | ||||||||||||||||||||||||||||||||||||||||||
| 980 | |||||||||||||||||||||||||||||||||||||||||||
| 981 | =item * B<'antiflood'>, set to a false value to globally disable flood | ||||||||||||||||||||||||||||||||||||||||||
| 982 | protection, default is true; | ||||||||||||||||||||||||||||||||||||||||||
| 983 | |||||||||||||||||||||||||||||||||||||||||||
| 984 | =item * B<'prefix'>, this is the prefix that is used to generate event | ||||||||||||||||||||||||||||||||||||||||||
| 985 | names that the component produces. The default is 'ircd_'. | ||||||||||||||||||||||||||||||||||||||||||
| 986 | |||||||||||||||||||||||||||||||||||||||||||
| 987 | =item * B<'states'>, an array reference of extra objects states for the IRC | ||||||||||||||||||||||||||||||||||||||||||
| 988 | daemon's POE sessions. The elements can be array references of states | ||||||||||||||||||||||||||||||||||||||||||
| 989 | as well as hash references of state => handler pairs. | ||||||||||||||||||||||||||||||||||||||||||
| 990 | |||||||||||||||||||||||||||||||||||||||||||
| 991 | =item * B<'plugin_debug'>, set to a true value to print plugin debug info. | ||||||||||||||||||||||||||||||||||||||||||
| 992 | Default is false. | ||||||||||||||||||||||||||||||||||||||||||
| 993 | |||||||||||||||||||||||||||||||||||||||||||
| 994 | =item * B<'options'>, a hashref of options to L<POE::Session|POE::Session> | ||||||||||||||||||||||||||||||||||||||||||
| 995 | |||||||||||||||||||||||||||||||||||||||||||
| 996 | =item * B<'raw_events'>, whether to send L<raw|/ircd_raw_input> events. | ||||||||||||||||||||||||||||||||||||||||||
| 997 | False by default. Can be enabled later with L<C<raw_events>|/raw_events>; | ||||||||||||||||||||||||||||||||||||||||||
| 998 | |||||||||||||||||||||||||||||||||||||||||||
| 999 | =item * B<'sslify_options'>, an array reference of items that are passed | ||||||||||||||||||||||||||||||||||||||||||
| 1000 | to L<POE::Component::SSLify> C<SSLify_Options>. Used to supply x509 certificate | ||||||||||||||||||||||||||||||||||||||||||
| 1001 | and key; | ||||||||||||||||||||||||||||||||||||||||||
| 1002 | |||||||||||||||||||||||||||||||||||||||||||
| 1003 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1004 | |||||||||||||||||||||||||||||||||||||||||||
| 1005 | If the component is created from within another session, that session will | ||||||||||||||||||||||||||||||||||||||||||
| 1006 | be automagcially registered with the component to receive events and get | ||||||||||||||||||||||||||||||||||||||||||
| 1007 | an 'ircd_backend_registered' event. | ||||||||||||||||||||||||||||||||||||||||||
| 1008 | |||||||||||||||||||||||||||||||||||||||||||
| 1009 | =head1 METHODS | ||||||||||||||||||||||||||||||||||||||||||
| 1010 | |||||||||||||||||||||||||||||||||||||||||||
| 1011 | =head2 General | ||||||||||||||||||||||||||||||||||||||||||
| 1012 | |||||||||||||||||||||||||||||||||||||||||||
| 1013 | =head3 C<shutdown> | ||||||||||||||||||||||||||||||||||||||||||
| 1014 | |||||||||||||||||||||||||||||||||||||||||||
| 1015 | Takes no arguments. Terminates the component. Removes all listeners and | ||||||||||||||||||||||||||||||||||||||||||
| 1016 | connectors. Disconnects all current client and server connections. This | ||||||||||||||||||||||||||||||||||||||||||
| 1017 | is a shorthand for C<< $ircd->yield('shutdown') >>. | ||||||||||||||||||||||||||||||||||||||||||
| 1018 | |||||||||||||||||||||||||||||||||||||||||||
| 1019 | =head3 C<session_id> | ||||||||||||||||||||||||||||||||||||||||||
| 1020 | |||||||||||||||||||||||||||||||||||||||||||
| 1021 | I<Inherited from L<POE::Component::Syndicator|POE::Component::Syndicator/session_id>> | ||||||||||||||||||||||||||||||||||||||||||
| 1022 | |||||||||||||||||||||||||||||||||||||||||||
| 1023 | Takes no arguments. Returns the ID of the component's session. Ideal for | ||||||||||||||||||||||||||||||||||||||||||
| 1024 | posting events to the component. | ||||||||||||||||||||||||||||||||||||||||||
| 1025 | |||||||||||||||||||||||||||||||||||||||||||
| 1026 | =head3 C<session_alias> | ||||||||||||||||||||||||||||||||||||||||||
| 1027 | |||||||||||||||||||||||||||||||||||||||||||
| 1028 | I<Inherited from L<POE::Component::Syndicator|POE::Component::Syndicator/session_alias>> | ||||||||||||||||||||||||||||||||||||||||||
| 1029 | |||||||||||||||||||||||||||||||||||||||||||
| 1030 | Takes no arguments. Returns the session alias that has been set through | ||||||||||||||||||||||||||||||||||||||||||
| 1031 | L<C<create>|/create>'s B<'alias'> argument. | ||||||||||||||||||||||||||||||||||||||||||
| 1032 | |||||||||||||||||||||||||||||||||||||||||||
| 1033 | =head3 C<yield> | ||||||||||||||||||||||||||||||||||||||||||
| 1034 | |||||||||||||||||||||||||||||||||||||||||||
| 1035 | I<Inherited from L<POE::Component::Syndicator|POE::Component::Syndicator/yield>> | ||||||||||||||||||||||||||||||||||||||||||
| 1036 | |||||||||||||||||||||||||||||||||||||||||||
| 1037 | This method provides an alternative object based means of posting events | ||||||||||||||||||||||||||||||||||||||||||
| 1038 | to the component. First argument is the event to post, following arguments | ||||||||||||||||||||||||||||||||||||||||||
| 1039 | are sent as arguments to the resultant post. | ||||||||||||||||||||||||||||||||||||||||||
| 1040 | |||||||||||||||||||||||||||||||||||||||||||
| 1041 | =head3 C<call> | ||||||||||||||||||||||||||||||||||||||||||
| 1042 | |||||||||||||||||||||||||||||||||||||||||||
| 1043 | I<Inherited from L<POE::Component::Syndicator|POE::Component::Syndicator/call>> | ||||||||||||||||||||||||||||||||||||||||||
| 1044 | |||||||||||||||||||||||||||||||||||||||||||
| 1045 | This method provides an alternative object based means of calling events | ||||||||||||||||||||||||||||||||||||||||||
| 1046 | to the component. First argument is the event to call, following arguments | ||||||||||||||||||||||||||||||||||||||||||
| 1047 | are sent as arguments to the resultant call. | ||||||||||||||||||||||||||||||||||||||||||
| 1048 | |||||||||||||||||||||||||||||||||||||||||||
| 1049 | =head3 C<delay> | ||||||||||||||||||||||||||||||||||||||||||
| 1050 | |||||||||||||||||||||||||||||||||||||||||||
| 1051 | I<Inherited from L<POE::Component::Syndicator|POE::Component::Syndicator/delay>> | ||||||||||||||||||||||||||||||||||||||||||
| 1052 | |||||||||||||||||||||||||||||||||||||||||||
| 1053 | This method provides a way of posting delayed events to the component. The | ||||||||||||||||||||||||||||||||||||||||||
| 1054 | first argument is an arrayref consisting of the delayed command to post and | ||||||||||||||||||||||||||||||||||||||||||
| 1055 | any command arguments. The second argument is the time in seconds that one | ||||||||||||||||||||||||||||||||||||||||||
| 1056 | wishes to delay the command being posted. | ||||||||||||||||||||||||||||||||||||||||||
| 1057 | |||||||||||||||||||||||||||||||||||||||||||
| 1058 | Returns an alarm ID that can be used with L<C<delay_remove>|/delay_remove> | ||||||||||||||||||||||||||||||||||||||||||
| 1059 | to cancel the delayed event. This will be undefined if something went | ||||||||||||||||||||||||||||||||||||||||||
| 1060 | wrong. | ||||||||||||||||||||||||||||||||||||||||||
| 1061 | |||||||||||||||||||||||||||||||||||||||||||
| 1062 | =head3 C<delay_remove> | ||||||||||||||||||||||||||||||||||||||||||
| 1063 | |||||||||||||||||||||||||||||||||||||||||||
| 1064 | I<Inherited from L<POE::Component::Syndicator|POE::Component::Syndicator/delay_remove>> | ||||||||||||||||||||||||||||||||||||||||||
| 1065 | |||||||||||||||||||||||||||||||||||||||||||
| 1066 | This method removes a previously scheduled delayed event from the | ||||||||||||||||||||||||||||||||||||||||||
| 1067 | component. Takes one argument, the C<alarm_id> that was returned by a | ||||||||||||||||||||||||||||||||||||||||||
| 1068 | L<C<delay>|/delay> method call. | ||||||||||||||||||||||||||||||||||||||||||
| 1069 | |||||||||||||||||||||||||||||||||||||||||||
| 1070 | Returns an arrayref that was originally requested to be delayed. | ||||||||||||||||||||||||||||||||||||||||||
| 1071 | |||||||||||||||||||||||||||||||||||||||||||
| 1072 | =head3 C<send_event> | ||||||||||||||||||||||||||||||||||||||||||
| 1073 | |||||||||||||||||||||||||||||||||||||||||||
| 1074 | I<Inherited from L<POE::Component::Syndicator|POE::Component::Syndicator/send_event>> | ||||||||||||||||||||||||||||||||||||||||||
| 1075 | |||||||||||||||||||||||||||||||||||||||||||
| 1076 | Sends an event through the component's event handling system. These will | ||||||||||||||||||||||||||||||||||||||||||
| 1077 | get processed by plugins then by registered sessions. First argument is | ||||||||||||||||||||||||||||||||||||||||||
| 1078 | the event name, followed by any parameters for that event. | ||||||||||||||||||||||||||||||||||||||||||
| 1079 | |||||||||||||||||||||||||||||||||||||||||||
| 1080 | =head3 C<send_event_next> | ||||||||||||||||||||||||||||||||||||||||||
| 1081 | |||||||||||||||||||||||||||||||||||||||||||
| 1082 | I<Inherited from L<POE::Component::Syndicator|POE::Component::Syndicator/send_event_next>> | ||||||||||||||||||||||||||||||||||||||||||
| 1083 | |||||||||||||||||||||||||||||||||||||||||||
| 1084 | This sends an event right after the one that's currently being processed. | ||||||||||||||||||||||||||||||||||||||||||
| 1085 | Useful if you want to generate some event which is directly related to | ||||||||||||||||||||||||||||||||||||||||||
| 1086 | another event so you want them to appear together. This method can only be | ||||||||||||||||||||||||||||||||||||||||||
| 1087 | called when POE::Component::IRC is processing an event, e.g. from one of | ||||||||||||||||||||||||||||||||||||||||||
| 1088 | your event handlers. Takes the same arguments as | ||||||||||||||||||||||||||||||||||||||||||
| 1089 | L<C<send_event>|/send_event>. | ||||||||||||||||||||||||||||||||||||||||||
| 1090 | |||||||||||||||||||||||||||||||||||||||||||
| 1091 | =head3 C<send_event_now> | ||||||||||||||||||||||||||||||||||||||||||
| 1092 | |||||||||||||||||||||||||||||||||||||||||||
| 1093 | I<Inherited from L<POE::Component::Syndicator|POE::Component::Syndicator/send_event_now>> | ||||||||||||||||||||||||||||||||||||||||||
| 1094 | |||||||||||||||||||||||||||||||||||||||||||
| 1095 | This will send an event to be processed immediately. This means that if an | ||||||||||||||||||||||||||||||||||||||||||
| 1096 | event is currently being processed and there are plugins or sessions which | ||||||||||||||||||||||||||||||||||||||||||
| 1097 | will receive it after you do, then an event sent with C<send_event_now> | ||||||||||||||||||||||||||||||||||||||||||
| 1098 | will be received by those plugins/sessions I<before> the current event. | ||||||||||||||||||||||||||||||||||||||||||
| 1099 | Takes the same arguments as L<C<send_event>|/send_event>. | ||||||||||||||||||||||||||||||||||||||||||
| 1100 | |||||||||||||||||||||||||||||||||||||||||||
| 1101 | =head3 C<raw_events> | ||||||||||||||||||||||||||||||||||||||||||
| 1102 | |||||||||||||||||||||||||||||||||||||||||||
| 1103 | If called with a true value, raw events (L<C<ircd_raw_input>|/ircd_raw_input> | ||||||||||||||||||||||||||||||||||||||||||
| 1104 | and L<C<ircd_raw_output>|/ircd_raw_output>) will be enabled. | ||||||||||||||||||||||||||||||||||||||||||
| 1105 | |||||||||||||||||||||||||||||||||||||||||||
| 1106 | =head2 Connections | ||||||||||||||||||||||||||||||||||||||||||
| 1107 | |||||||||||||||||||||||||||||||||||||||||||
| 1108 | =head3 C<antiflood> | ||||||||||||||||||||||||||||||||||||||||||
| 1109 | |||||||||||||||||||||||||||||||||||||||||||
| 1110 | Takes two arguments, a connection id and true/false value. If value is | ||||||||||||||||||||||||||||||||||||||||||
| 1111 | specified antiflood protection is enabled or disabled accordingly for the | ||||||||||||||||||||||||||||||||||||||||||
| 1112 | specified connection. If a value is not specified the current status of | ||||||||||||||||||||||||||||||||||||||||||
| 1113 | antiflood protection is returned. Returns undef on error. | ||||||||||||||||||||||||||||||||||||||||||
| 1114 | |||||||||||||||||||||||||||||||||||||||||||
| 1115 | =head3 C<compressed_link> | ||||||||||||||||||||||||||||||||||||||||||
| 1116 | |||||||||||||||||||||||||||||||||||||||||||
| 1117 | Takes two arguments, a connection id and true/false value. If a value is | ||||||||||||||||||||||||||||||||||||||||||
| 1118 | specified, compression will be enabled or disabled accordingly for the | ||||||||||||||||||||||||||||||||||||||||||
| 1119 | specified connection. If a value is not specified the current status of | ||||||||||||||||||||||||||||||||||||||||||
| 1120 | compression is returned. Returns undef on error. | ||||||||||||||||||||||||||||||||||||||||||
| 1121 | |||||||||||||||||||||||||||||||||||||||||||
| 1122 | =head3 C<disconnect> | ||||||||||||||||||||||||||||||||||||||||||
| 1123 | |||||||||||||||||||||||||||||||||||||||||||
| 1124 | Requires on argument, the connection id you wish to disconnect. The | ||||||||||||||||||||||||||||||||||||||||||
| 1125 | component will terminate the connection the next time that the wheel input | ||||||||||||||||||||||||||||||||||||||||||
| 1126 | is flushed, so you may send some sort of error message to the client on | ||||||||||||||||||||||||||||||||||||||||||
| 1127 | that connection. Returns true on success, undef on error. | ||||||||||||||||||||||||||||||||||||||||||
| 1128 | |||||||||||||||||||||||||||||||||||||||||||
| 1129 | =head3 C<connection_exists> | ||||||||||||||||||||||||||||||||||||||||||
| 1130 | |||||||||||||||||||||||||||||||||||||||||||
| 1131 | Requires one argument, a connection id. Returns true value if the connection | ||||||||||||||||||||||||||||||||||||||||||
| 1132 | exists, false otherwise. | ||||||||||||||||||||||||||||||||||||||||||
| 1133 | |||||||||||||||||||||||||||||||||||||||||||
| 1134 | =head3 C<connection_info> | ||||||||||||||||||||||||||||||||||||||||||
| 1135 | |||||||||||||||||||||||||||||||||||||||||||
| 1136 | Takes one argument, a connection_id. Returns a list consisting of: the IP | ||||||||||||||||||||||||||||||||||||||||||
| 1137 | address of the peer; the port on the peer; our socket address; our socket | ||||||||||||||||||||||||||||||||||||||||||
| 1138 | port. Returns undef on error. | ||||||||||||||||||||||||||||||||||||||||||
| 1139 | |||||||||||||||||||||||||||||||||||||||||||
| 1140 | my ($peeraddr, $peerport, $sockaddr, $sockport) = $ircd->connection_info($conn_id); | ||||||||||||||||||||||||||||||||||||||||||
| 1141 | |||||||||||||||||||||||||||||||||||||||||||
| 1142 | =head3 C<add_denial> | ||||||||||||||||||||||||||||||||||||||||||
| 1143 | |||||||||||||||||||||||||||||||||||||||||||
| 1144 | Takes one mandatory argument and one optional. The first mandatory | ||||||||||||||||||||||||||||||||||||||||||
| 1145 | argument is an address or CIDR as understood by L<Net::CIDR>::cidrvalidate that will be used to | ||||||||||||||||||||||||||||||||||||||||||
| 1146 | check connecting IP addresses against. The second optional argument is a | ||||||||||||||||||||||||||||||||||||||||||
| 1147 | reason string for the denial. | ||||||||||||||||||||||||||||||||||||||||||
| 1148 | |||||||||||||||||||||||||||||||||||||||||||
| 1149 | =head3 C<del_denial> | ||||||||||||||||||||||||||||||||||||||||||
| 1150 | |||||||||||||||||||||||||||||||||||||||||||
| 1151 | Takes one mandatory argument, an address or CIDR as understood by L<Net::CIDR>::cidrvalidate to | ||||||||||||||||||||||||||||||||||||||||||
| 1152 | remove from the current denial list. | ||||||||||||||||||||||||||||||||||||||||||
| 1153 | |||||||||||||||||||||||||||||||||||||||||||
| 1154 | =head3 C<denied> | ||||||||||||||||||||||||||||||||||||||||||
| 1155 | |||||||||||||||||||||||||||||||||||||||||||
| 1156 | Takes one argument, an IP address. Returns true or false depending on | ||||||||||||||||||||||||||||||||||||||||||
| 1157 | whether that IP is denied or not. | ||||||||||||||||||||||||||||||||||||||||||
| 1158 | |||||||||||||||||||||||||||||||||||||||||||
| 1159 | =head3 C<add_exemption> | ||||||||||||||||||||||||||||||||||||||||||
| 1160 | |||||||||||||||||||||||||||||||||||||||||||
| 1161 | Takes one mandatory argument, an address or CIDR as understood by L<Net::CIDR>::cidrvalidate that | ||||||||||||||||||||||||||||||||||||||||||
| 1162 | will be checked against connecting IP addresses for exemption from denials. | ||||||||||||||||||||||||||||||||||||||||||
| 1163 | |||||||||||||||||||||||||||||||||||||||||||
| 1164 | =head3 C<del_exemption> | ||||||||||||||||||||||||||||||||||||||||||
| 1165 | |||||||||||||||||||||||||||||||||||||||||||
| 1166 | Takes one mandatory argument, an address or CIDR as understood by L<Net::CIDR>::cidrvalidate to | ||||||||||||||||||||||||||||||||||||||||||
| 1167 | remove from the current exemption list. | ||||||||||||||||||||||||||||||||||||||||||
| 1168 | |||||||||||||||||||||||||||||||||||||||||||
| 1169 | =head3 C<exempted> | ||||||||||||||||||||||||||||||||||||||||||
| 1170 | |||||||||||||||||||||||||||||||||||||||||||
| 1171 | Takes one argument, an IP address. Returns true or false depending on | ||||||||||||||||||||||||||||||||||||||||||
| 1172 | whether that IP is exempt from denial or not. | ||||||||||||||||||||||||||||||||||||||||||
| 1173 | |||||||||||||||||||||||||||||||||||||||||||
| 1174 | =head2 Plugins | ||||||||||||||||||||||||||||||||||||||||||
| 1175 | |||||||||||||||||||||||||||||||||||||||||||
| 1176 | =head3 C<pipeline> | ||||||||||||||||||||||||||||||||||||||||||
| 1177 | |||||||||||||||||||||||||||||||||||||||||||
| 1178 | I<Inherited from L<Object::Pluggable|Object::Pluggable/pipeline>> | ||||||||||||||||||||||||||||||||||||||||||
| 1179 | |||||||||||||||||||||||||||||||||||||||||||
| 1180 | Returns the L<Object::Pluggable::Pipeline|Object::Pluggable::Pipeline> | ||||||||||||||||||||||||||||||||||||||||||
| 1181 | object. | ||||||||||||||||||||||||||||||||||||||||||
| 1182 | |||||||||||||||||||||||||||||||||||||||||||
| 1183 | =head3 C<plugin_add> | ||||||||||||||||||||||||||||||||||||||||||
| 1184 | |||||||||||||||||||||||||||||||||||||||||||
| 1185 | I<Inherited from L<Object::Pluggable|Object::Pluggable/plugin_add>> | ||||||||||||||||||||||||||||||||||||||||||
| 1186 | |||||||||||||||||||||||||||||||||||||||||||
| 1187 | Accepts two arguments: | ||||||||||||||||||||||||||||||||||||||||||
| 1188 | |||||||||||||||||||||||||||||||||||||||||||
| 1189 | The alias for the plugin | ||||||||||||||||||||||||||||||||||||||||||
| 1190 | The actual plugin object | ||||||||||||||||||||||||||||||||||||||||||
| 1191 | Any number of extra arguments | ||||||||||||||||||||||||||||||||||||||||||
| 1192 | |||||||||||||||||||||||||||||||||||||||||||
| 1193 | The alias is there for the user to refer to it, as it is possible to have | ||||||||||||||||||||||||||||||||||||||||||
| 1194 | multiple plugins of the same kind active in one Object::Pluggable object. | ||||||||||||||||||||||||||||||||||||||||||
| 1195 | |||||||||||||||||||||||||||||||||||||||||||
| 1196 | This method goes through the pipeline's C<push()> method, which will call | ||||||||||||||||||||||||||||||||||||||||||
| 1197 | C<< $plugin->plugin_register($pluggable, @args) >>. | ||||||||||||||||||||||||||||||||||||||||||
| 1198 | |||||||||||||||||||||||||||||||||||||||||||
| 1199 | Returns the number of plugins now in the pipeline if plugin was | ||||||||||||||||||||||||||||||||||||||||||
| 1200 | initialized, C<undef>/an empty list if not. | ||||||||||||||||||||||||||||||||||||||||||
| 1201 | |||||||||||||||||||||||||||||||||||||||||||
| 1202 | =head3 C<plugin_del> | ||||||||||||||||||||||||||||||||||||||||||
| 1203 | |||||||||||||||||||||||||||||||||||||||||||
| 1204 | I<Inherited from L<Object::Pluggable|Object::Pluggable/plugin_del>> | ||||||||||||||||||||||||||||||||||||||||||
| 1205 | |||||||||||||||||||||||||||||||||||||||||||
| 1206 | Accepts the following arguments: | ||||||||||||||||||||||||||||||||||||||||||
| 1207 | |||||||||||||||||||||||||||||||||||||||||||
| 1208 | The alias for the plugin or the plugin object itself | ||||||||||||||||||||||||||||||||||||||||||
| 1209 | Any number of extra arguments | ||||||||||||||||||||||||||||||||||||||||||
| 1210 | |||||||||||||||||||||||||||||||||||||||||||
| 1211 | This method goes through the pipeline's C<remove()> method, which will call | ||||||||||||||||||||||||||||||||||||||||||
| 1212 | C<< $plugin->plugin_unregister($pluggable, @args) >>. | ||||||||||||||||||||||||||||||||||||||||||
| 1213 | |||||||||||||||||||||||||||||||||||||||||||
| 1214 | Returns the plugin object if the plugin was removed, C<undef>/an empty list | ||||||||||||||||||||||||||||||||||||||||||
| 1215 | if not. | ||||||||||||||||||||||||||||||||||||||||||
| 1216 | |||||||||||||||||||||||||||||||||||||||||||
| 1217 | =head3 C<plugin_get> | ||||||||||||||||||||||||||||||||||||||||||
| 1218 | |||||||||||||||||||||||||||||||||||||||||||
| 1219 | I<Inherited from L<Object::Pluggable|Object::Pluggable/plugin_get>> | ||||||||||||||||||||||||||||||||||||||||||
| 1220 | |||||||||||||||||||||||||||||||||||||||||||
| 1221 | Accepts the following arguments: | ||||||||||||||||||||||||||||||||||||||||||
| 1222 | |||||||||||||||||||||||||||||||||||||||||||
| 1223 | The alias for the plugin | ||||||||||||||||||||||||||||||||||||||||||
| 1224 | |||||||||||||||||||||||||||||||||||||||||||
| 1225 | This method goes through the pipeline's C<get()> method. | ||||||||||||||||||||||||||||||||||||||||||
| 1226 | |||||||||||||||||||||||||||||||||||||||||||
| 1227 | Returns the plugin object if it was found, C<undef>/an empty list if not. | ||||||||||||||||||||||||||||||||||||||||||
| 1228 | |||||||||||||||||||||||||||||||||||||||||||
| 1229 | =head3 C<plugin_list> | ||||||||||||||||||||||||||||||||||||||||||
| 1230 | |||||||||||||||||||||||||||||||||||||||||||
| 1231 | I<Inherited from L<Object::Pluggable|Object::Pluggable/plugin_list>> | ||||||||||||||||||||||||||||||||||||||||||
| 1232 | |||||||||||||||||||||||||||||||||||||||||||
| 1233 | Takes no arguments. | ||||||||||||||||||||||||||||||||||||||||||
| 1234 | |||||||||||||||||||||||||||||||||||||||||||
| 1235 | Returns a hashref of plugin objects, keyed on alias, or an empty list if | ||||||||||||||||||||||||||||||||||||||||||
| 1236 | there are no plugins loaded. | ||||||||||||||||||||||||||||||||||||||||||
| 1237 | |||||||||||||||||||||||||||||||||||||||||||
| 1238 | =head3 C<plugin_order> | ||||||||||||||||||||||||||||||||||||||||||
| 1239 | |||||||||||||||||||||||||||||||||||||||||||
| 1240 | I<Inherited from L<Object::Pluggable|Object::Pluggable/plugin_order>> | ||||||||||||||||||||||||||||||||||||||||||
| 1241 | |||||||||||||||||||||||||||||||||||||||||||
| 1242 | Takes no arguments. | ||||||||||||||||||||||||||||||||||||||||||
| 1243 | |||||||||||||||||||||||||||||||||||||||||||
| 1244 | Returns an arrayref of plugin objects, in the order which they are | ||||||||||||||||||||||||||||||||||||||||||
| 1245 | encountered in the pipeline. | ||||||||||||||||||||||||||||||||||||||||||
| 1246 | |||||||||||||||||||||||||||||||||||||||||||
| 1247 | =head3 C<plugin_register> | ||||||||||||||||||||||||||||||||||||||||||
| 1248 | |||||||||||||||||||||||||||||||||||||||||||
| 1249 | I<Inherited from L<Object::Pluggable|Object::Pluggable/plugin_register>> | ||||||||||||||||||||||||||||||||||||||||||
| 1250 | |||||||||||||||||||||||||||||||||||||||||||
| 1251 | Accepts the following arguments: | ||||||||||||||||||||||||||||||||||||||||||
| 1252 | |||||||||||||||||||||||||||||||||||||||||||
| 1253 | The plugin object | ||||||||||||||||||||||||||||||||||||||||||
| 1254 | The type of the hook (the hook types are specified with _pluggable_init()'s 'types') | ||||||||||||||||||||||||||||||||||||||||||
| 1255 | The event name[s] to watch | ||||||||||||||||||||||||||||||||||||||||||
| 1256 | |||||||||||||||||||||||||||||||||||||||||||
| 1257 | The event names can be as many as possible, or an arrayref. They correspond | ||||||||||||||||||||||||||||||||||||||||||
| 1258 | to the prefixed events and naturally, arbitrary events too. | ||||||||||||||||||||||||||||||||||||||||||
| 1259 | |||||||||||||||||||||||||||||||||||||||||||
| 1260 | You do not need to supply events with the prefix in front of them, just the | ||||||||||||||||||||||||||||||||||||||||||
| 1261 | names. | ||||||||||||||||||||||||||||||||||||||||||
| 1262 | |||||||||||||||||||||||||||||||||||||||||||
| 1263 | It is possible to register for all events by specifying 'all' as an event. | ||||||||||||||||||||||||||||||||||||||||||
| 1264 | |||||||||||||||||||||||||||||||||||||||||||
| 1265 | Returns 1 if everything checked out fine, C<undef>/an empty list if | ||||||||||||||||||||||||||||||||||||||||||
| 1266 | something is seriously wrong. | ||||||||||||||||||||||||||||||||||||||||||
| 1267 | |||||||||||||||||||||||||||||||||||||||||||
| 1268 | =head3 C<plugin_unregister> | ||||||||||||||||||||||||||||||||||||||||||
| 1269 | |||||||||||||||||||||||||||||||||||||||||||
| 1270 | I<Inherited from L<Object::Pluggable|Object::Pluggable/plugin_unregister>> | ||||||||||||||||||||||||||||||||||||||||||
| 1271 | |||||||||||||||||||||||||||||||||||||||||||
| 1272 | Accepts the following arguments: | ||||||||||||||||||||||||||||||||||||||||||
| 1273 | |||||||||||||||||||||||||||||||||||||||||||
| 1274 | The plugin object | ||||||||||||||||||||||||||||||||||||||||||
| 1275 | The type of the hook (the hook types are specified with _pluggable_init()'s 'types') | ||||||||||||||||||||||||||||||||||||||||||
| 1276 | The event name[s] to unwatch | ||||||||||||||||||||||||||||||||||||||||||
| 1277 | |||||||||||||||||||||||||||||||||||||||||||
| 1278 | The event names can be as many as possible, or an arrayref. They correspond | ||||||||||||||||||||||||||||||||||||||||||
| 1279 | to the prefixed events and naturally, arbitrary events too. | ||||||||||||||||||||||||||||||||||||||||||
| 1280 | |||||||||||||||||||||||||||||||||||||||||||
| 1281 | You do not need to supply events with the prefix in front of them, just the | ||||||||||||||||||||||||||||||||||||||||||
| 1282 | names. | ||||||||||||||||||||||||||||||||||||||||||
| 1283 | |||||||||||||||||||||||||||||||||||||||||||
| 1284 | It is possible to register for all events by specifying 'all' as an event. | ||||||||||||||||||||||||||||||||||||||||||
| 1285 | |||||||||||||||||||||||||||||||||||||||||||
| 1286 | Returns 1 if all the event name[s] was unregistered, undef if some was not | ||||||||||||||||||||||||||||||||||||||||||
| 1287 | found. | ||||||||||||||||||||||||||||||||||||||||||
| 1288 | |||||||||||||||||||||||||||||||||||||||||||
| 1289 | =head1 INPUT EVENTS | ||||||||||||||||||||||||||||||||||||||||||
| 1290 | |||||||||||||||||||||||||||||||||||||||||||
| 1291 | These are POE events that the component will accept: | ||||||||||||||||||||||||||||||||||||||||||
| 1292 | |||||||||||||||||||||||||||||||||||||||||||
| 1293 | =head2 C<register> | ||||||||||||||||||||||||||||||||||||||||||
| 1294 | |||||||||||||||||||||||||||||||||||||||||||
| 1295 | I<Inherited from L<POE::Component::Syndicator|POE::Component::Syndicator/register>> | ||||||||||||||||||||||||||||||||||||||||||
| 1296 | |||||||||||||||||||||||||||||||||||||||||||
| 1297 | Takes N arguments: a list of event names that your session wants to listen | ||||||||||||||||||||||||||||||||||||||||||
| 1298 | for, minus the C<irc_> prefix. | ||||||||||||||||||||||||||||||||||||||||||
| 1299 | |||||||||||||||||||||||||||||||||||||||||||
| 1300 | $ircd->yield('register', qw(connected disconnected)); | ||||||||||||||||||||||||||||||||||||||||||
| 1301 | |||||||||||||||||||||||||||||||||||||||||||
| 1302 | The special argument 'all' will register your session for all events. | ||||||||||||||||||||||||||||||||||||||||||
| 1303 | Registering will generate an L<C<ircd_registered>|/ircd_registered> | ||||||||||||||||||||||||||||||||||||||||||
| 1304 | event that your session can trap. | ||||||||||||||||||||||||||||||||||||||||||
| 1305 | |||||||||||||||||||||||||||||||||||||||||||
| 1306 | =head2 C<unregister> | ||||||||||||||||||||||||||||||||||||||||||
| 1307 | |||||||||||||||||||||||||||||||||||||||||||
| 1308 | I<Inherited from L<POE::Component::Syndicator|POE::Component::Syndicator/unregister>> | ||||||||||||||||||||||||||||||||||||||||||
| 1309 | |||||||||||||||||||||||||||||||||||||||||||
| 1310 | Takes N arguments: a list of event names which you I<don't> want to | ||||||||||||||||||||||||||||||||||||||||||
| 1311 | receive. If you've previously done a L<C<register>|/register> | ||||||||||||||||||||||||||||||||||||||||||
| 1312 | for a particular event which you no longer care about, this event will | ||||||||||||||||||||||||||||||||||||||||||
| 1313 | tell the component to stop sending them to you. (If you haven't, it just | ||||||||||||||||||||||||||||||||||||||||||
| 1314 | ignores you. No big deal.) | ||||||||||||||||||||||||||||||||||||||||||
| 1315 | |||||||||||||||||||||||||||||||||||||||||||
| 1316 | If you have registered with 'all', attempting to unregister individual | ||||||||||||||||||||||||||||||||||||||||||
| 1317 | events such as 'connected', etc. will not work. This is a 'feature'. | ||||||||||||||||||||||||||||||||||||||||||
| 1318 | |||||||||||||||||||||||||||||||||||||||||||
| 1319 | =head2 C<add_listener> | ||||||||||||||||||||||||||||||||||||||||||
| 1320 | |||||||||||||||||||||||||||||||||||||||||||
| 1321 | Takes a number of arguments. Adds a new listener. | ||||||||||||||||||||||||||||||||||||||||||
| 1322 | |||||||||||||||||||||||||||||||||||||||||||
| 1323 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1324 | |||||||||||||||||||||||||||||||||||||||||||
| 1325 | =item * B<'port'>, the TCP port to listen on. Default is a random port; | ||||||||||||||||||||||||||||||||||||||||||
| 1326 | |||||||||||||||||||||||||||||||||||||||||||
| 1327 | =item * B<'auth'>, enable or disable auth sub-system for this listener. | ||||||||||||||||||||||||||||||||||||||||||
| 1328 | Enabled by default; | ||||||||||||||||||||||||||||||||||||||||||
| 1329 | |||||||||||||||||||||||||||||||||||||||||||
| 1330 | =item * B<'bindaddr'>, specify a local address to bind the listener to; | ||||||||||||||||||||||||||||||||||||||||||
| 1331 | |||||||||||||||||||||||||||||||||||||||||||
| 1332 | =item * B<'listenqueue'>, change the SocketFactory's ListenQueue; | ||||||||||||||||||||||||||||||||||||||||||
| 1333 | |||||||||||||||||||||||||||||||||||||||||||
| 1334 | =item * B<'usessl'>, whether the listener should use SSL. Default is | ||||||||||||||||||||||||||||||||||||||||||
| 1335 | false; | ||||||||||||||||||||||||||||||||||||||||||
| 1336 | |||||||||||||||||||||||||||||||||||||||||||
| 1337 | =item * B<'antiflood'>, whether the listener should use flood protection. | ||||||||||||||||||||||||||||||||||||||||||
| 1338 | Defaults is true; | ||||||||||||||||||||||||||||||||||||||||||
| 1339 | |||||||||||||||||||||||||||||||||||||||||||
| 1340 | =item * B<'idle'>, the time, in seconds, after which a connection will be | ||||||||||||||||||||||||||||||||||||||||||
| 1341 | considered idle. Defaults is 180. | ||||||||||||||||||||||||||||||||||||||||||
| 1342 | |||||||||||||||||||||||||||||||||||||||||||
| 1343 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1344 | |||||||||||||||||||||||||||||||||||||||||||
| 1345 | =head2 C<del_listener> | ||||||||||||||||||||||||||||||||||||||||||
| 1346 | |||||||||||||||||||||||||||||||||||||||||||
| 1347 | Takes one of the following arguments: | ||||||||||||||||||||||||||||||||||||||||||
| 1348 | |||||||||||||||||||||||||||||||||||||||||||
| 1349 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1350 | |||||||||||||||||||||||||||||||||||||||||||
| 1351 | =item * B<'listener'>, a previously returned listener ID; | ||||||||||||||||||||||||||||||||||||||||||
| 1352 | |||||||||||||||||||||||||||||||||||||||||||
| 1353 | =item * B<'port'>, a listening port; | ||||||||||||||||||||||||||||||||||||||||||
| 1354 | |||||||||||||||||||||||||||||||||||||||||||
| 1355 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1356 | |||||||||||||||||||||||||||||||||||||||||||
| 1357 | The listener will be deleted. Note: any connected clients on that port | ||||||||||||||||||||||||||||||||||||||||||
| 1358 | will not be disconnected. | ||||||||||||||||||||||||||||||||||||||||||
| 1359 | |||||||||||||||||||||||||||||||||||||||||||
| 1360 | =head2 C<add_connector> | ||||||||||||||||||||||||||||||||||||||||||
| 1361 | |||||||||||||||||||||||||||||||||||||||||||
| 1362 | Takes two mandatory arguments, B<'remoteaddress'> and B<'remoteport'>. | ||||||||||||||||||||||||||||||||||||||||||
| 1363 | Opens a TCP connection to specified address and port. | ||||||||||||||||||||||||||||||||||||||||||
| 1364 | |||||||||||||||||||||||||||||||||||||||||||
| 1365 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1366 | |||||||||||||||||||||||||||||||||||||||||||
| 1367 | =item * B<'remoteaddress'>, hostname or IP address to connect to; | ||||||||||||||||||||||||||||||||||||||||||
| 1368 | |||||||||||||||||||||||||||||||||||||||||||
| 1369 | =item * B<'remoteport'>, the TCP port on the remote host; | ||||||||||||||||||||||||||||||||||||||||||
| 1370 | |||||||||||||||||||||||||||||||||||||||||||
| 1371 | =item * B<'bindaddress'>, a local address to bind from (optional); | ||||||||||||||||||||||||||||||||||||||||||
| 1372 | |||||||||||||||||||||||||||||||||||||||||||
| 1373 | =item * B<'idle'>, the time, in seconds, after which a connection will be | ||||||||||||||||||||||||||||||||||||||||||
| 1374 | considered idle. Defaults is 180; | ||||||||||||||||||||||||||||||||||||||||||
| 1375 | |||||||||||||||||||||||||||||||||||||||||||
| 1376 | =item * B<'usessl'>, whether the connection should use SSL. Default is | ||||||||||||||||||||||||||||||||||||||||||
| 1377 | false; | ||||||||||||||||||||||||||||||||||||||||||
| 1378 | |||||||||||||||||||||||||||||||||||||||||||
| 1379 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1380 | |||||||||||||||||||||||||||||||||||||||||||
| 1381 | =head2 C<send_output> | ||||||||||||||||||||||||||||||||||||||||||
| 1382 | |||||||||||||||||||||||||||||||||||||||||||
| 1383 | Takes a hashref and one or more connection IDs. | ||||||||||||||||||||||||||||||||||||||||||
| 1384 | |||||||||||||||||||||||||||||||||||||||||||
| 1385 | $ircd->yield( | ||||||||||||||||||||||||||||||||||||||||||
| 1386 | 'send_output', | ||||||||||||||||||||||||||||||||||||||||||
| 1387 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1388 | prefix => 'blah!~blah@blah.blah.blah', | ||||||||||||||||||||||||||||||||||||||||||
| 1389 | command => 'PRIVMSG', | ||||||||||||||||||||||||||||||||||||||||||
| 1390 | params => ['#moo', 'cows go moo, not fish :D'] | ||||||||||||||||||||||||||||||||||||||||||
| 1391 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 1392 | @list_of_connection_ids, | ||||||||||||||||||||||||||||||||||||||||||
| 1393 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 1394 | |||||||||||||||||||||||||||||||||||||||||||
| 1395 | =head2 C<shutdown> | ||||||||||||||||||||||||||||||||||||||||||
| 1396 | |||||||||||||||||||||||||||||||||||||||||||
| 1397 | I<Inherited from L<POE::Component::Syndicator|POE::Component::Syndicator/shutdown>> | ||||||||||||||||||||||||||||||||||||||||||
| 1398 | |||||||||||||||||||||||||||||||||||||||||||
| 1399 | Takes no arguments. Terminates the component. Removes all listeners and | ||||||||||||||||||||||||||||||||||||||||||
| 1400 | connectors. Disconnects all current client and server connections. | ||||||||||||||||||||||||||||||||||||||||||
| 1401 | |||||||||||||||||||||||||||||||||||||||||||
| 1402 | =head1 OUTPUT EVENTS | ||||||||||||||||||||||||||||||||||||||||||
| 1403 | |||||||||||||||||||||||||||||||||||||||||||
| 1404 | These following events are sent to interested sessions. | ||||||||||||||||||||||||||||||||||||||||||
| 1405 | |||||||||||||||||||||||||||||||||||||||||||
| 1406 | =head2 C<ircd_registered> | ||||||||||||||||||||||||||||||||||||||||||
| 1407 | |||||||||||||||||||||||||||||||||||||||||||
| 1408 | I<Inherited from L<POE::Component::Syndicator|POE::Component::Syndicator/syndicator_registered>> | ||||||||||||||||||||||||||||||||||||||||||
| 1409 | |||||||||||||||||||||||||||||||||||||||||||
| 1410 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 1411 | |||||||||||||||||||||||||||||||||||||||||||
| 1412 | =item Emitted: when a session registers with the component; | ||||||||||||||||||||||||||||||||||||||||||
| 1413 | |||||||||||||||||||||||||||||||||||||||||||
| 1414 | =item Target: the registering session; | ||||||||||||||||||||||||||||||||||||||||||
| 1415 | |||||||||||||||||||||||||||||||||||||||||||
| 1416 | =item Args: | ||||||||||||||||||||||||||||||||||||||||||
| 1417 | |||||||||||||||||||||||||||||||||||||||||||
| 1418 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1419 | |||||||||||||||||||||||||||||||||||||||||||
| 1420 | =item * C<ARG0>: the component's object; | ||||||||||||||||||||||||||||||||||||||||||
| 1421 | |||||||||||||||||||||||||||||||||||||||||||
| 1422 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1423 | |||||||||||||||||||||||||||||||||||||||||||
| 1424 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1425 | |||||||||||||||||||||||||||||||||||||||||||
| 1426 | =head2 C<ircd_connection> | ||||||||||||||||||||||||||||||||||||||||||
| 1427 | |||||||||||||||||||||||||||||||||||||||||||
| 1428 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 1429 | |||||||||||||||||||||||||||||||||||||||||||
| 1430 | =item Emitted: when a client connects to one of the component's listeners; | ||||||||||||||||||||||||||||||||||||||||||
| 1431 | |||||||||||||||||||||||||||||||||||||||||||
| 1432 | =item Target: all plugins and registered sessions | ||||||||||||||||||||||||||||||||||||||||||
| 1433 | |||||||||||||||||||||||||||||||||||||||||||
| 1434 | =item Args: | ||||||||||||||||||||||||||||||||||||||||||
| 1435 | |||||||||||||||||||||||||||||||||||||||||||
| 1436 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1437 | |||||||||||||||||||||||||||||||||||||||||||
| 1438 | =item * C<ARG0>: the conn id; | ||||||||||||||||||||||||||||||||||||||||||
| 1439 | |||||||||||||||||||||||||||||||||||||||||||
| 1440 | =item * C<ARG1>: their ip address; | ||||||||||||||||||||||||||||||||||||||||||
| 1441 | |||||||||||||||||||||||||||||||||||||||||||
| 1442 | =item * C<ARG2>: their tcp port; | ||||||||||||||||||||||||||||||||||||||||||
| 1443 | |||||||||||||||||||||||||||||||||||||||||||
| 1444 | =item * C<ARG3>: our ip address; | ||||||||||||||||||||||||||||||||||||||||||
| 1445 | |||||||||||||||||||||||||||||||||||||||||||
| 1446 | =item * C<ARG4>: our socket port; | ||||||||||||||||||||||||||||||||||||||||||
| 1447 | |||||||||||||||||||||||||||||||||||||||||||
| 1448 | =item * C<ARG5>: a boolean indicating whether the client needs to be authed | ||||||||||||||||||||||||||||||||||||||||||
| 1449 | |||||||||||||||||||||||||||||||||||||||||||
| 1450 | =item * C<ARG6>: a boolean indicating whether the client is securely connected | ||||||||||||||||||||||||||||||||||||||||||
| 1451 | |||||||||||||||||||||||||||||||||||||||||||
| 1452 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1453 | |||||||||||||||||||||||||||||||||||||||||||
| 1454 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1455 | |||||||||||||||||||||||||||||||||||||||||||
| 1456 | =head2 C<ircd_auth_done> | ||||||||||||||||||||||||||||||||||||||||||
| 1457 | |||||||||||||||||||||||||||||||||||||||||||
| 1458 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 1459 | |||||||||||||||||||||||||||||||||||||||||||
| 1460 | =item Emitted: after a client has connected and the component has validated | ||||||||||||||||||||||||||||||||||||||||||
| 1461 | hostname and ident; | ||||||||||||||||||||||||||||||||||||||||||
| 1462 | |||||||||||||||||||||||||||||||||||||||||||
| 1463 | =item Target: Target: all plugins and registered sessions; | ||||||||||||||||||||||||||||||||||||||||||
| 1464 | |||||||||||||||||||||||||||||||||||||||||||
| 1465 | =item Args: | ||||||||||||||||||||||||||||||||||||||||||
| 1466 | |||||||||||||||||||||||||||||||||||||||||||
| 1467 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1468 | |||||||||||||||||||||||||||||||||||||||||||
| 1469 | =item * C<ARG0>, the connection id; | ||||||||||||||||||||||||||||||||||||||||||
| 1470 | |||||||||||||||||||||||||||||||||||||||||||
| 1471 | =item * C<ARG1>, a HASHREF with the following keys: 'ident' and 'hostname'; | ||||||||||||||||||||||||||||||||||||||||||
| 1472 | |||||||||||||||||||||||||||||||||||||||||||
| 1473 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1474 | |||||||||||||||||||||||||||||||||||||||||||
| 1475 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1476 | |||||||||||||||||||||||||||||||||||||||||||
| 1477 | =head2 C<ircd_listener_add> | ||||||||||||||||||||||||||||||||||||||||||
| 1478 | |||||||||||||||||||||||||||||||||||||||||||
| 1479 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 1480 | |||||||||||||||||||||||||||||||||||||||||||
| 1481 | =item Emitted: on a successful L<C<add_listener>|/add_listener> call; | ||||||||||||||||||||||||||||||||||||||||||
| 1482 | |||||||||||||||||||||||||||||||||||||||||||
| 1483 | =item Target: all plugins and registered sessions; | ||||||||||||||||||||||||||||||||||||||||||
| 1484 | |||||||||||||||||||||||||||||||||||||||||||
| 1485 | =item Args: | ||||||||||||||||||||||||||||||||||||||||||
| 1486 | |||||||||||||||||||||||||||||||||||||||||||
| 1487 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1488 | |||||||||||||||||||||||||||||||||||||||||||
| 1489 | =item * C<ARG0>, the listening port; | ||||||||||||||||||||||||||||||||||||||||||
| 1490 | |||||||||||||||||||||||||||||||||||||||||||
| 1491 | =item * C<ARG1>, the listener id; | ||||||||||||||||||||||||||||||||||||||||||
| 1492 | |||||||||||||||||||||||||||||||||||||||||||
| 1493 | =item * C<ARG2>, the listening address; | ||||||||||||||||||||||||||||||||||||||||||
| 1494 | |||||||||||||||||||||||||||||||||||||||||||
| 1495 | =item * C<ARG3>, whether SSL is in use; | ||||||||||||||||||||||||||||||||||||||||||
| 1496 | |||||||||||||||||||||||||||||||||||||||||||
| 1497 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1498 | |||||||||||||||||||||||||||||||||||||||||||
| 1499 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1500 | |||||||||||||||||||||||||||||||||||||||||||
| 1501 | =head2 C<ircd_listener_del> | ||||||||||||||||||||||||||||||||||||||||||
| 1502 | |||||||||||||||||||||||||||||||||||||||||||
| 1503 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 1504 | |||||||||||||||||||||||||||||||||||||||||||
| 1505 | =item Emitted: on a successful L<C<del_listener>|/del_listener> call; | ||||||||||||||||||||||||||||||||||||||||||
| 1506 | |||||||||||||||||||||||||||||||||||||||||||
| 1507 | =item Target: all plugins and registered sessions; | ||||||||||||||||||||||||||||||||||||||||||
| 1508 | |||||||||||||||||||||||||||||||||||||||||||
| 1509 | =item Args: | ||||||||||||||||||||||||||||||||||||||||||
| 1510 | |||||||||||||||||||||||||||||||||||||||||||
| 1511 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1512 | |||||||||||||||||||||||||||||||||||||||||||
| 1513 | =item * C<ARG0>, the listening port; | ||||||||||||||||||||||||||||||||||||||||||
| 1514 | |||||||||||||||||||||||||||||||||||||||||||
| 1515 | =item * C<ARG1>, the listener id; | ||||||||||||||||||||||||||||||||||||||||||
| 1516 | |||||||||||||||||||||||||||||||||||||||||||
| 1517 | =item * C<ARG2>, the listener address; | ||||||||||||||||||||||||||||||||||||||||||
| 1518 | |||||||||||||||||||||||||||||||||||||||||||
| 1519 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1520 | |||||||||||||||||||||||||||||||||||||||||||
| 1521 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1522 | |||||||||||||||||||||||||||||||||||||||||||
| 1523 | =head2 C<ircd_listener_failure> | ||||||||||||||||||||||||||||||||||||||||||
| 1524 | |||||||||||||||||||||||||||||||||||||||||||
| 1525 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 1526 | |||||||||||||||||||||||||||||||||||||||||||
| 1527 | =item Emitted: when a listener wheel fails; | ||||||||||||||||||||||||||||||||||||||||||
| 1528 | |||||||||||||||||||||||||||||||||||||||||||
| 1529 | =item Target: all plugins and registered sessions; | ||||||||||||||||||||||||||||||||||||||||||
| 1530 | |||||||||||||||||||||||||||||||||||||||||||
| 1531 | =item Args: | ||||||||||||||||||||||||||||||||||||||||||
| 1532 | |||||||||||||||||||||||||||||||||||||||||||
| 1533 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1534 | |||||||||||||||||||||||||||||||||||||||||||
| 1535 | =item * C<ARG0>, the listener id; | ||||||||||||||||||||||||||||||||||||||||||
| 1536 | |||||||||||||||||||||||||||||||||||||||||||
| 1537 | =item * C<ARG1>, the name of the operation that failed; | ||||||||||||||||||||||||||||||||||||||||||
| 1538 | |||||||||||||||||||||||||||||||||||||||||||
| 1539 | =item * C<ARG2>, numeric value for $!; | ||||||||||||||||||||||||||||||||||||||||||
| 1540 | |||||||||||||||||||||||||||||||||||||||||||
| 1541 | =item * C<ARG3>, string value for $!; | ||||||||||||||||||||||||||||||||||||||||||
| 1542 | |||||||||||||||||||||||||||||||||||||||||||
| 1543 | =item * C<ARG4>, the port it tried to listen on; | ||||||||||||||||||||||||||||||||||||||||||
| 1544 | |||||||||||||||||||||||||||||||||||||||||||
| 1545 | =item * C<ARG5>, the address it tried to listen on; | ||||||||||||||||||||||||||||||||||||||||||
| 1546 | |||||||||||||||||||||||||||||||||||||||||||
| 1547 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1548 | |||||||||||||||||||||||||||||||||||||||||||
| 1549 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1550 | |||||||||||||||||||||||||||||||||||||||||||
| 1551 | =head2 C<ircd_socketerr> | ||||||||||||||||||||||||||||||||||||||||||
| 1552 | |||||||||||||||||||||||||||||||||||||||||||
| 1553 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 1554 | |||||||||||||||||||||||||||||||||||||||||||
| 1555 | =item Emitted: on the failure of an L<C<add_connector>|/add_connector> call | ||||||||||||||||||||||||||||||||||||||||||
| 1556 | |||||||||||||||||||||||||||||||||||||||||||
| 1557 | =item Target: all plugins and registered sessions; | ||||||||||||||||||||||||||||||||||||||||||
| 1558 | |||||||||||||||||||||||||||||||||||||||||||
| 1559 | =item Args: | ||||||||||||||||||||||||||||||||||||||||||
| 1560 | |||||||||||||||||||||||||||||||||||||||||||
| 1561 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1562 | |||||||||||||||||||||||||||||||||||||||||||
| 1563 | =item * C<ARG0>, a HASHREF containing the params that add_connector() was | ||||||||||||||||||||||||||||||||||||||||||
| 1564 | called with; | ||||||||||||||||||||||||||||||||||||||||||
| 1565 | |||||||||||||||||||||||||||||||||||||||||||
| 1566 | =item * C<ARG1>, the name of the operation that failed; | ||||||||||||||||||||||||||||||||||||||||||
| 1567 | |||||||||||||||||||||||||||||||||||||||||||
| 1568 | =item * C<ARG2>, numeric value for $!; | ||||||||||||||||||||||||||||||||||||||||||
| 1569 | |||||||||||||||||||||||||||||||||||||||||||
| 1570 | =item * C<ARG3>, string value for $!; | ||||||||||||||||||||||||||||||||||||||||||
| 1571 | |||||||||||||||||||||||||||||||||||||||||||
| 1572 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1573 | |||||||||||||||||||||||||||||||||||||||||||
| 1574 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1575 | |||||||||||||||||||||||||||||||||||||||||||
| 1576 | =head2 C<ircd_connected> | ||||||||||||||||||||||||||||||||||||||||||
| 1577 | |||||||||||||||||||||||||||||||||||||||||||
| 1578 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 1579 | |||||||||||||||||||||||||||||||||||||||||||
| 1580 | =item Emitted: when the component establishes a connection with a peer; | ||||||||||||||||||||||||||||||||||||||||||
| 1581 | |||||||||||||||||||||||||||||||||||||||||||
| 1582 | =item Target: all plugins and registered sessions; | ||||||||||||||||||||||||||||||||||||||||||
| 1583 | |||||||||||||||||||||||||||||||||||||||||||
| 1584 | =item Args: | ||||||||||||||||||||||||||||||||||||||||||
| 1585 | |||||||||||||||||||||||||||||||||||||||||||
| 1586 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1587 | |||||||||||||||||||||||||||||||||||||||||||
| 1588 | =item * C<ARG0>, the connection id; | ||||||||||||||||||||||||||||||||||||||||||
| 1589 | |||||||||||||||||||||||||||||||||||||||||||
| 1590 | =item * C<ARG1>, their ip address; | ||||||||||||||||||||||||||||||||||||||||||
| 1591 | |||||||||||||||||||||||||||||||||||||||||||
| 1592 | =item * C<ARG2>, their tcp port; | ||||||||||||||||||||||||||||||||||||||||||
| 1593 | |||||||||||||||||||||||||||||||||||||||||||
| 1594 | =item * C<ARG3>, our ip address; | ||||||||||||||||||||||||||||||||||||||||||
| 1595 | |||||||||||||||||||||||||||||||||||||||||||
| 1596 | =item * C<ARG4>, our socket port; | ||||||||||||||||||||||||||||||||||||||||||
| 1597 | |||||||||||||||||||||||||||||||||||||||||||
| 1598 | =item * C<ARG5>, the peer's name; | ||||||||||||||||||||||||||||||||||||||||||
| 1599 | |||||||||||||||||||||||||||||||||||||||||||
| 1600 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1601 | |||||||||||||||||||||||||||||||||||||||||||
| 1602 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1603 | |||||||||||||||||||||||||||||||||||||||||||
| 1604 | =head2 C<ircd_connection_flood> | ||||||||||||||||||||||||||||||||||||||||||
| 1605 | |||||||||||||||||||||||||||||||||||||||||||
| 1606 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 1607 | |||||||||||||||||||||||||||||||||||||||||||
| 1608 | =item Emitted: when a client connection is flooded; | ||||||||||||||||||||||||||||||||||||||||||
| 1609 | |||||||||||||||||||||||||||||||||||||||||||
| 1610 | =item Target: all plugins and registered sessions; | ||||||||||||||||||||||||||||||||||||||||||
| 1611 | |||||||||||||||||||||||||||||||||||||||||||
| 1612 | =item Args: | ||||||||||||||||||||||||||||||||||||||||||
| 1613 | |||||||||||||||||||||||||||||||||||||||||||
| 1614 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1615 | |||||||||||||||||||||||||||||||||||||||||||
| 1616 | =item * C<ARG0>, the connection id; | ||||||||||||||||||||||||||||||||||||||||||
| 1617 | |||||||||||||||||||||||||||||||||||||||||||
| 1618 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1619 | |||||||||||||||||||||||||||||||||||||||||||
| 1620 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1621 | |||||||||||||||||||||||||||||||||||||||||||
| 1622 | =head2 C<ircd_connection_idle> | ||||||||||||||||||||||||||||||||||||||||||
| 1623 | |||||||||||||||||||||||||||||||||||||||||||
| 1624 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 1625 | |||||||||||||||||||||||||||||||||||||||||||
| 1626 | =item Emitted: when a client connection has not sent any data for a set | ||||||||||||||||||||||||||||||||||||||||||
| 1627 | period; | ||||||||||||||||||||||||||||||||||||||||||
| 1628 | |||||||||||||||||||||||||||||||||||||||||||
| 1629 | =item Target: all plugins and registered sessions; | ||||||||||||||||||||||||||||||||||||||||||
| 1630 | |||||||||||||||||||||||||||||||||||||||||||
| 1631 | =item Args: | ||||||||||||||||||||||||||||||||||||||||||
| 1632 | |||||||||||||||||||||||||||||||||||||||||||
| 1633 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1634 | |||||||||||||||||||||||||||||||||||||||||||
| 1635 | =item * C<ARG0>, the connection id; | ||||||||||||||||||||||||||||||||||||||||||
| 1636 | |||||||||||||||||||||||||||||||||||||||||||
| 1637 | =item * C<ARG1>, the number of seconds period we consider as idle; | ||||||||||||||||||||||||||||||||||||||||||
| 1638 | |||||||||||||||||||||||||||||||||||||||||||
| 1639 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1640 | |||||||||||||||||||||||||||||||||||||||||||
| 1641 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1642 | |||||||||||||||||||||||||||||||||||||||||||
| 1643 | =head2 C<ircd_compressed_conn> | ||||||||||||||||||||||||||||||||||||||||||
| 1644 | |||||||||||||||||||||||||||||||||||||||||||
| 1645 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 1646 | |||||||||||||||||||||||||||||||||||||||||||
| 1647 | =item Emitted: when compression has been enabled for a connection | ||||||||||||||||||||||||||||||||||||||||||
| 1648 | |||||||||||||||||||||||||||||||||||||||||||
| 1649 | =item Target: all plugins and registered sessions; | ||||||||||||||||||||||||||||||||||||||||||
| 1650 | |||||||||||||||||||||||||||||||||||||||||||
| 1651 | =item Args: | ||||||||||||||||||||||||||||||||||||||||||
| 1652 | |||||||||||||||||||||||||||||||||||||||||||
| 1653 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1654 | |||||||||||||||||||||||||||||||||||||||||||
| 1655 | =item * C<ARG0>, the connection id; | ||||||||||||||||||||||||||||||||||||||||||
| 1656 | |||||||||||||||||||||||||||||||||||||||||||
| 1657 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1658 | |||||||||||||||||||||||||||||||||||||||||||
| 1659 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1660 | |||||||||||||||||||||||||||||||||||||||||||
| 1661 | =head2 C<ircd_cmd_*> | ||||||||||||||||||||||||||||||||||||||||||
| 1662 | |||||||||||||||||||||||||||||||||||||||||||
| 1663 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 1664 | |||||||||||||||||||||||||||||||||||||||||||
| 1665 | =item Emitted: when a client or peer sends a valid IRC line to us; | ||||||||||||||||||||||||||||||||||||||||||
| 1666 | |||||||||||||||||||||||||||||||||||||||||||
| 1667 | =item Target: all plugins and registered sessions; | ||||||||||||||||||||||||||||||||||||||||||
| 1668 | |||||||||||||||||||||||||||||||||||||||||||
| 1669 | =item Args: | ||||||||||||||||||||||||||||||||||||||||||
| 1670 | |||||||||||||||||||||||||||||||||||||||||||
| 1671 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1672 | |||||||||||||||||||||||||||||||||||||||||||
| 1673 | =item * C<ARG0>, the connection id; | ||||||||||||||||||||||||||||||||||||||||||
| 1674 | |||||||||||||||||||||||||||||||||||||||||||
| 1675 | =item * C<ARG1>, a HASHREF containing the output record from | ||||||||||||||||||||||||||||||||||||||||||
| 1676 | POE::Filter::IRCD: | ||||||||||||||||||||||||||||||||||||||||||
| 1677 | |||||||||||||||||||||||||||||||||||||||||||
| 1678 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1679 | prefix => 'blah!~blah@blah.blah.blah', | ||||||||||||||||||||||||||||||||||||||||||
| 1680 | command => 'PRIVMSG', | ||||||||||||||||||||||||||||||||||||||||||
| 1681 | params => [ '#moo', 'cows go moo, not fish :D' ], | ||||||||||||||||||||||||||||||||||||||||||
| 1682 | raw_line => ':blah!~blah@blah.blah.blah.blah PRIVMSG #moo :cows go moo, not fish :D' | ||||||||||||||||||||||||||||||||||||||||||
| 1683 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1684 | |||||||||||||||||||||||||||||||||||||||||||
| 1685 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1686 | |||||||||||||||||||||||||||||||||||||||||||
| 1687 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1688 | |||||||||||||||||||||||||||||||||||||||||||
| 1689 | =head2 C<ircd_raw_input> | ||||||||||||||||||||||||||||||||||||||||||
| 1690 | |||||||||||||||||||||||||||||||||||||||||||
| 1691 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 1692 | |||||||||||||||||||||||||||||||||||||||||||
| 1693 | =item Emitted: when a line of input is received from a connection | ||||||||||||||||||||||||||||||||||||||||||
| 1694 | |||||||||||||||||||||||||||||||||||||||||||
| 1695 | =item Target: all plugins and registered sessions; | ||||||||||||||||||||||||||||||||||||||||||
| 1696 | |||||||||||||||||||||||||||||||||||||||||||
| 1697 | =item Args: | ||||||||||||||||||||||||||||||||||||||||||
| 1698 | |||||||||||||||||||||||||||||||||||||||||||
| 1699 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1700 | |||||||||||||||||||||||||||||||||||||||||||
| 1701 | =item * C<ARG0>, the connection id; | ||||||||||||||||||||||||||||||||||||||||||
| 1702 | |||||||||||||||||||||||||||||||||||||||||||
| 1703 | =item * C<ARG1>, the raw line of input | ||||||||||||||||||||||||||||||||||||||||||
| 1704 | |||||||||||||||||||||||||||||||||||||||||||
| 1705 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1706 | |||||||||||||||||||||||||||||||||||||||||||
| 1707 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1708 | |||||||||||||||||||||||||||||||||||||||||||
| 1709 | =head2 C<ircd_raw_output> | ||||||||||||||||||||||||||||||||||||||||||
| 1710 | |||||||||||||||||||||||||||||||||||||||||||
| 1711 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 1712 | |||||||||||||||||||||||||||||||||||||||||||
| 1713 | =item Emitted: when a line of output is sent over a connection | ||||||||||||||||||||||||||||||||||||||||||
| 1714 | |||||||||||||||||||||||||||||||||||||||||||
| 1715 | =item Target: all plugins and registered sessions; | ||||||||||||||||||||||||||||||||||||||||||
| 1716 | |||||||||||||||||||||||||||||||||||||||||||
| 1717 | =item Args: | ||||||||||||||||||||||||||||||||||||||||||
| 1718 | |||||||||||||||||||||||||||||||||||||||||||
| 1719 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1720 | |||||||||||||||||||||||||||||||||||||||||||
| 1721 | =item * C<ARG0>, the connection id; | ||||||||||||||||||||||||||||||||||||||||||
| 1722 | |||||||||||||||||||||||||||||||||||||||||||
| 1723 | =item * C<ARG1>, the raw line of output | ||||||||||||||||||||||||||||||||||||||||||
| 1724 | |||||||||||||||||||||||||||||||||||||||||||
| 1725 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1726 | |||||||||||||||||||||||||||||||||||||||||||
| 1727 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1728 | |||||||||||||||||||||||||||||||||||||||||||
| 1729 | =head2 C<ircd_disconnected> | ||||||||||||||||||||||||||||||||||||||||||
| 1730 | |||||||||||||||||||||||||||||||||||||||||||
| 1731 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 1732 | |||||||||||||||||||||||||||||||||||||||||||
| 1733 | =item Emitted: when a client disconnects; | ||||||||||||||||||||||||||||||||||||||||||
| 1734 | |||||||||||||||||||||||||||||||||||||||||||
| 1735 | =item Target: all plugins and registered sessions; | ||||||||||||||||||||||||||||||||||||||||||
| 1736 | |||||||||||||||||||||||||||||||||||||||||||
| 1737 | =item Args: | ||||||||||||||||||||||||||||||||||||||||||
| 1738 | |||||||||||||||||||||||||||||||||||||||||||
| 1739 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1740 | |||||||||||||||||||||||||||||||||||||||||||
| 1741 | =item * C<ARG0>, the connection id; | ||||||||||||||||||||||||||||||||||||||||||
| 1742 | |||||||||||||||||||||||||||||||||||||||||||
| 1743 | =item * C<ARG1>, the error or reason for disconnection; | ||||||||||||||||||||||||||||||||||||||||||
| 1744 | |||||||||||||||||||||||||||||||||||||||||||
| 1745 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1746 | |||||||||||||||||||||||||||||||||||||||||||
| 1747 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1748 | |||||||||||||||||||||||||||||||||||||||||||
| 1749 | =head2 C<ircd_shutdown> | ||||||||||||||||||||||||||||||||||||||||||
| 1750 | |||||||||||||||||||||||||||||||||||||||||||
| 1751 | I<Inherited from L<POE::Component::Syndicator|POE::Component::Syndicator/syndicator_shutdown>> | ||||||||||||||||||||||||||||||||||||||||||
| 1752 | |||||||||||||||||||||||||||||||||||||||||||
| 1753 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 1754 | |||||||||||||||||||||||||||||||||||||||||||
| 1755 | =item Emitted: when the component has been asked to L<C<shutdown>|/shutdown> | ||||||||||||||||||||||||||||||||||||||||||
| 1756 | |||||||||||||||||||||||||||||||||||||||||||
| 1757 | =item Target: all registered sessions; | ||||||||||||||||||||||||||||||||||||||||||
| 1758 | |||||||||||||||||||||||||||||||||||||||||||
| 1759 | =item Args: | ||||||||||||||||||||||||||||||||||||||||||
| 1760 | |||||||||||||||||||||||||||||||||||||||||||
| 1761 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1762 | |||||||||||||||||||||||||||||||||||||||||||
| 1763 | =item * C<ARG0>: the session ID of the requesting component | ||||||||||||||||||||||||||||||||||||||||||
| 1764 | |||||||||||||||||||||||||||||||||||||||||||
| 1765 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1766 | |||||||||||||||||||||||||||||||||||||||||||
| 1767 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1768 | |||||||||||||||||||||||||||||||||||||||||||
| 1769 | =head2 C<ircd_delay_set> | ||||||||||||||||||||||||||||||||||||||||||
| 1770 | |||||||||||||||||||||||||||||||||||||||||||
| 1771 | I<Inherited from L<POE::Component::Syndicator|POE::Component::Syndicator/syndicator_delay_set>> | ||||||||||||||||||||||||||||||||||||||||||
| 1772 | |||||||||||||||||||||||||||||||||||||||||||
| 1773 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 1774 | |||||||||||||||||||||||||||||||||||||||||||
| 1775 | =item Emitted: on a successful addition of a delayed event using the | ||||||||||||||||||||||||||||||||||||||||||
| 1776 | L<C<delay>|/delay> method | ||||||||||||||||||||||||||||||||||||||||||
| 1777 | |||||||||||||||||||||||||||||||||||||||||||
| 1778 | =item Target: all plugins and registered sessions; | ||||||||||||||||||||||||||||||||||||||||||
| 1779 | |||||||||||||||||||||||||||||||||||||||||||
| 1780 | =item Args: | ||||||||||||||||||||||||||||||||||||||||||
| 1781 | |||||||||||||||||||||||||||||||||||||||||||
| 1782 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1783 | |||||||||||||||||||||||||||||||||||||||||||
| 1784 | =item * C<ARG0>: the alarm id which can be used later with | ||||||||||||||||||||||||||||||||||||||||||
| 1785 | L<C<delay_remove>|/delay_remove> | ||||||||||||||||||||||||||||||||||||||||||
| 1786 | |||||||||||||||||||||||||||||||||||||||||||
| 1787 | =item * C<ARG1..$#_>: subsequent arguments are those which were passed to | ||||||||||||||||||||||||||||||||||||||||||
| 1788 | L<C<delay>|/delay> | ||||||||||||||||||||||||||||||||||||||||||
| 1789 | |||||||||||||||||||||||||||||||||||||||||||
| 1790 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1791 | |||||||||||||||||||||||||||||||||||||||||||
| 1792 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1793 | |||||||||||||||||||||||||||||||||||||||||||
| 1794 | =head2 C<ircd_delay_removed> | ||||||||||||||||||||||||||||||||||||||||||
| 1795 | |||||||||||||||||||||||||||||||||||||||||||
| 1796 | I<Inherited from L<POE::Component::Syndicator|POE::Component::Syndicator/syndicator_delay_removed>> | ||||||||||||||||||||||||||||||||||||||||||
| 1797 | |||||||||||||||||||||||||||||||||||||||||||
| 1798 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 1799 | |||||||||||||||||||||||||||||||||||||||||||
| 1800 | =item Emitted: when a delayed command is successfully removed | ||||||||||||||||||||||||||||||||||||||||||
| 1801 | |||||||||||||||||||||||||||||||||||||||||||
| 1802 | =item Target: all plugins and registered sessions; | ||||||||||||||||||||||||||||||||||||||||||
| 1803 | |||||||||||||||||||||||||||||||||||||||||||
| 1804 | =item Args: | ||||||||||||||||||||||||||||||||||||||||||
| 1805 | |||||||||||||||||||||||||||||||||||||||||||
| 1806 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1807 | |||||||||||||||||||||||||||||||||||||||||||
| 1808 | =item * C<ARG0>: the alarm id which was removed | ||||||||||||||||||||||||||||||||||||||||||
| 1809 | |||||||||||||||||||||||||||||||||||||||||||
| 1810 | =item * C<ARG1..$#_>: subsequent arguments are those which were passed to | ||||||||||||||||||||||||||||||||||||||||||
| 1811 | L<C<delay>|/delay> | ||||||||||||||||||||||||||||||||||||||||||
| 1812 | |||||||||||||||||||||||||||||||||||||||||||
| 1813 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1814 | |||||||||||||||||||||||||||||||||||||||||||
| 1815 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1816 | |||||||||||||||||||||||||||||||||||||||||||
| 1817 | =head2 C<ircd_plugin_add> | ||||||||||||||||||||||||||||||||||||||||||
| 1818 | |||||||||||||||||||||||||||||||||||||||||||
| 1819 | I<Inherited from L<Object::Pluggable|Object::Pluggable/_pluggable_event>> | ||||||||||||||||||||||||||||||||||||||||||
| 1820 | |||||||||||||||||||||||||||||||||||||||||||
| 1821 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 1822 | |||||||||||||||||||||||||||||||||||||||||||
| 1823 | =item Emitted: when a new plugin is added to the pipeline | ||||||||||||||||||||||||||||||||||||||||||
| 1824 | |||||||||||||||||||||||||||||||||||||||||||
| 1825 | =item Target: all plugins and registered sessions; | ||||||||||||||||||||||||||||||||||||||||||
| 1826 | |||||||||||||||||||||||||||||||||||||||||||
| 1827 | =item Args: | ||||||||||||||||||||||||||||||||||||||||||
| 1828 | |||||||||||||||||||||||||||||||||||||||||||
| 1829 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1830 | |||||||||||||||||||||||||||||||||||||||||||
| 1831 | =item * C<ARG0>: the plugin alias | ||||||||||||||||||||||||||||||||||||||||||
| 1832 | |||||||||||||||||||||||||||||||||||||||||||
| 1833 | =item * C<ARG1>: the plugin object | ||||||||||||||||||||||||||||||||||||||||||
| 1834 | |||||||||||||||||||||||||||||||||||||||||||
| 1835 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1836 | |||||||||||||||||||||||||||||||||||||||||||
| 1837 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1838 | |||||||||||||||||||||||||||||||||||||||||||
| 1839 | =head2 C<ircd_plugin_del> | ||||||||||||||||||||||||||||||||||||||||||
| 1840 | |||||||||||||||||||||||||||||||||||||||||||
| 1841 | I<Inherited from L<Object::Pluggable|Object::Pluggable/_pluggable_event>> | ||||||||||||||||||||||||||||||||||||||||||
| 1842 | |||||||||||||||||||||||||||||||||||||||||||
| 1843 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 1844 | |||||||||||||||||||||||||||||||||||||||||||
| 1845 | =item Emitted: when a plugin is removed from the pipeline | ||||||||||||||||||||||||||||||||||||||||||
| 1846 | |||||||||||||||||||||||||||||||||||||||||||
| 1847 | =item Target: all plugins and registered sessions; | ||||||||||||||||||||||||||||||||||||||||||
| 1848 | |||||||||||||||||||||||||||||||||||||||||||
| 1849 | =item Args: | ||||||||||||||||||||||||||||||||||||||||||
| 1850 | |||||||||||||||||||||||||||||||||||||||||||
| 1851 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1852 | |||||||||||||||||||||||||||||||||||||||||||
| 1853 | =item * C<ARG0>: the plugin alias | ||||||||||||||||||||||||||||||||||||||||||
| 1854 | |||||||||||||||||||||||||||||||||||||||||||
| 1855 | =item * C<ARG1>: the plugin object | ||||||||||||||||||||||||||||||||||||||||||
| 1856 | |||||||||||||||||||||||||||||||||||||||||||
| 1857 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1858 | |||||||||||||||||||||||||||||||||||||||||||
| 1859 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1860 | |||||||||||||||||||||||||||||||||||||||||||
| 1861 | =head2 C<ircd_plugin_error> | ||||||||||||||||||||||||||||||||||||||||||
| 1862 | |||||||||||||||||||||||||||||||||||||||||||
| 1863 | I<Inherited from L<Object::Pluggable|Object::Pluggable/_pluggable_event>> | ||||||||||||||||||||||||||||||||||||||||||
| 1864 | |||||||||||||||||||||||||||||||||||||||||||
| 1865 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 1866 | |||||||||||||||||||||||||||||||||||||||||||
| 1867 | =item Emitted: when an error occurs while executing a plugin handler | ||||||||||||||||||||||||||||||||||||||||||
| 1868 | |||||||||||||||||||||||||||||||||||||||||||
| 1869 | =item Target: all plugins and registered sessions; | ||||||||||||||||||||||||||||||||||||||||||
| 1870 | |||||||||||||||||||||||||||||||||||||||||||
| 1871 | =item Args: | ||||||||||||||||||||||||||||||||||||||||||
| 1872 | |||||||||||||||||||||||||||||||||||||||||||
| 1873 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1874 | |||||||||||||||||||||||||||||||||||||||||||
| 1875 | =item * C<ARG0>: the error message | ||||||||||||||||||||||||||||||||||||||||||
| 1876 | |||||||||||||||||||||||||||||||||||||||||||
| 1877 | =item * C<ARG1>: the plugin alias | ||||||||||||||||||||||||||||||||||||||||||
| 1878 | |||||||||||||||||||||||||||||||||||||||||||
| 1879 | =item * C<ARG2>: the plugin object | ||||||||||||||||||||||||||||||||||||||||||
| 1880 | |||||||||||||||||||||||||||||||||||||||||||
| 1881 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1882 | |||||||||||||||||||||||||||||||||||||||||||
| 1883 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1884 | |||||||||||||||||||||||||||||||||||||||||||
| 1885 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||||||||
| 1886 | |||||||||||||||||||||||||||||||||||||||||||
| 1887 | Chris 'BinGOs' Williams | ||||||||||||||||||||||||||||||||||||||||||
| 1888 | |||||||||||||||||||||||||||||||||||||||||||
| 1889 | =head1 LICENSE | ||||||||||||||||||||||||||||||||||||||||||
| 1890 | |||||||||||||||||||||||||||||||||||||||||||
| 1891 | Copyright E<copy> Chris Williams | ||||||||||||||||||||||||||||||||||||||||||
| 1892 | |||||||||||||||||||||||||||||||||||||||||||
| 1893 | This module may be used, modified, and distributed under the same terms as | ||||||||||||||||||||||||||||||||||||||||||
| 1894 | Perl itself. Please see the license that came with your Perl distribution | ||||||||||||||||||||||||||||||||||||||||||
| 1895 | for details. | ||||||||||||||||||||||||||||||||||||||||||
| 1896 | |||||||||||||||||||||||||||||||||||||||||||
| 1897 | =head1 SEE ALSO | ||||||||||||||||||||||||||||||||||||||||||
| 1898 | |||||||||||||||||||||||||||||||||||||||||||
| 1899 | L<POE|POE> | ||||||||||||||||||||||||||||||||||||||||||
| 1900 | |||||||||||||||||||||||||||||||||||||||||||
| 1901 | L<POE::Filter::IRCD|POE::Filter::IRCD> | ||||||||||||||||||||||||||||||||||||||||||
| 1902 | |||||||||||||||||||||||||||||||||||||||||||
| 1903 | L<POE::Component::Server::IRC|POE::Component::Server::IRC> | ||||||||||||||||||||||||||||||||||||||||||
| 1904 | |||||||||||||||||||||||||||||||||||||||||||
| 1905 | =cut | ||||||||||||||||||||||||||||||||||||||||||