ASNMTAP
view release on metacpan or search on metacpan
lib/ASNMTAP/Asnmtap/Plugins/IO.pod view on Meta::CPAN
protocol => $protocol,
host => $host,
port => $port,
service => $service,
request => $request,
socketTimeout => 5,
POP3 => {
username => $username,
password => $password,
serviceReady => "[XMail [0-9.]+ POP3 Server] service ready",
passwordRequired => 'Password required for',
mailMessages => "Maildrop has [0-9.]+ messages",
closingSession => "[XMail [0-9.]+ POP3 Server] closing session"
}
);
=head1 FUNCTIONS
=head2 Socket based functions
=over 4
=item *
scan_socket_info()
=over 4
=item asnmtapInherited
A required reference to an ASNMTAP::Asnmtap::Plugins or ASNMTAP::Asnmtap::Plugins::Nagios subclass
Through this way of working we inherited the command line option I<--debug>.
=item custom
optional, is an reference to your own custom defined function
=over 4
=item $asnmtapInherited
A required reference to an ASNMTAP::Asnmtap::Plugins or ASNMTAP::Asnmtap::Plugins::Nagios subclass
Through this way of working we inherited the command line option I<--debug>.
=item $parms
a reference to the scan_socket_info () parameters
=item $INET
$INET provides an object interface to using sockets in the AF_INET domain. It is built upon the IO::Socket interface and inherits all the methods defined by IO::Socket.
=item $action
a reference to the action
=back
sub actionOnSocketResponse {
my ($asnmtapInherited, $parms, $INET, $action) = @_;
while ( <$$INET> ) {
chomp;
if ( $exit ) { $$action = "<TIMEOUT>"; last; }
SWITCH: {
if ( $_ =~ /^220 / ) { print $$INET "HELP\n"; }
if ( $_ =~ /^211 / ) { print $$INET "QUIT\n"; $$action = 'OK (211)'; }
if ( $_ =~ /^214 / ) { print $$INET "QUIT\n"; $$action = 'OK (214)'; }
if ( $_ =~ /^250 / ) { print $$INET "QUIT\n"; $$action = 'OK (250)'; }
if ( $_ =~ /^421 / ) { print $$INET "QUIT\n"; $$action = 'OK (421)'; }
if ( $_ =~ /^500 / ) { print $$INET "QUIT\n"; $$action = 'OK (500)'; }
if ( $_ =~ /^501 / ) { print $$INET "QUIT\n"; $$action = 'OK (501)'; }
if ( $_ =~ /^502 / ) { print $$INET "QUIT\n"; $$action = 'OK (502)'; }
if ( $_ =~ /^504 / ) { print $$INET "QUIT\n"; $$action = 'OK (504)'; }
if ( $_ =~ /^221 / ) { $$action = 'OK (221)'; last; }
}
}
}
and now with customArguments:
sub actionOnSocketResponse {
my ($asnmtapInherited, $parms, $INET, $action, $arguments) = @_;
while ( <$$INET> ) {
chomp;
if ( $exit ) { $$action = "<TIMEOUT>"; last; }
SWITCH: {
if ( $_ =~ /^220 / ) { print $$INET "HELP\n"; }
if ( $_ =~ /^211 / ) { print $$INET "QUIT\n"; $$action = 'OK (211)'; }
if ( $_ =~ /^214 / ) { print $$INET "QUIT\n"; $$action = 'OK (214)'; }
if ( $_ =~ /^250 / ) { print $$INET "QUIT\n"; $$action = 'OK (250)'; }
if ( $_ =~ /^421 / ) { print $$INET "QUIT\n"; $$action = 'OK (421)'; }
if ( $_ =~ /^500 / ) { print $$INET "QUIT\n"; $$action = 'OK (500)'; }
if ( $_ =~ /^501 / ) { print $$INET "QUIT\n"; $$action = 'OK (501)'; }
if ( $_ =~ /^502 / ) { print $$INET "QUIT\n"; $$action = 'OK (502)'; }
if ( $_ =~ /^504 / ) { print $$INET "QUIT\n"; $$action = 'OK (504)'; }
if ( $_ =~ /^221 / ) { $$action = 'OK (221)'; last; }
}
}
}
=item customArguments
optional, when you need to pass parameters to your own custom defined function, this can be done with customArguments.
customArguments: SCALAR, ARRAY, HASH,
REF SCALAR, REF ARRAY, REF HASH
=item protocol
required, can be 'udp' of 'tcp'
=item host
required, scalar, remote host address <hostname>[:<port>]
=item port
required, scalar, remote port
=item service
required, scalar, remote service
=item request
optional, scalar, default
=item socketTimeout
timeout value for various operations
optional, scalar
=item timeout
timeout value for all operations to die
optional, scalar, default 10
( run in 0.729 second using v1.01-cache-2.11-cpan-39bf76dae61 )