Mobile-Location
view release on metacpan or search on metacpan
Location.pm view on Meta::CPAN
print $keysock_obj @entire_keyfile;
$keysock_obj->close;
$self->_logger( "Location registered with keyserver." ) if $self->{ Web };
}
sub start_concurrent {
# Start a passive server/location that executes concurrently. For
# each relocation request, a child process is spawned to process it.
#
# IN: nothing.
#
# OUT: nothing.
#
# This method is never returned from. Remember: servers are PERMANENT.
my $self = shift;
my $listening_socket = IO::Socket::INET->new( LocalPort => $self->{ Port },
Location.pm view on Meta::CPAN
if ( -e RUN_LOCATION_DIR )
{
chdir( RUN_LOCATION_DIR );
}
else # Or, if it does NOT exist, we create it then change into it.
{
mkdir( RUN_LOCATION_DIR );
chdir( RUN_LOCATION_DIR );
}
# As we are now in the run-time directory, we continue with the relocation.
if ( $self->{ Log } )
{
my $logname = "last_agent_" . $$ . ".log"; # Note use of PID.
# Put a copy of the mobile agent into the log file.
my $logOK = open AGENTLOGFILE, ">$logname"
or warn "Mobile::Location: could not open log file: $!.\n";
Location.pm view on Meta::CPAN
my $chunk = shift @entire_thing;
# Print the "magic" first line.
print FILETOCHECK $chunk;
# # Add the Opcode mask to the code.
#
# print FILETOCHECK "\nuse ops qw( " .
#
# # Basic operation mask - relocating to a single Location.
#
# 'aassign add aelem av2arylen ' .
# 'backtick ' .
# 'caller chdir chomp chop closedir concat const ' .
# 'defined die ' .
# 'enter entereval enteriter entersub eq ' .
# 'ftdir fteexec ftewrite ' .
# 'gelem goto grepstart gv ' .
# 'helem ' .
# 'iter ' .
Location.pm view on Meta::CPAN
=back
Optional named parameters (with default values) are:
=over 4
B<Debug (0)> - set to 1 to receive STDERR status messages from the object.
B<Port (2001)> - sets the protocol port number to accept connections on.
B<Log (0)> - set to 1 to instruct the Location to log the received mobile agent to disk prior to performing any mutation. The name of the logged agent is "last_agent_PID.log", where PID is the process identifier of the Location. On sequential Locat...
B<Ops ('')> - add a list of Opcodes to the Opcode mask that is in effect when the mobile agent executes. Study the standard B<Opcode> and B<Ops> modules for details on Opcodes and how they are set. One way to secure your Location against attack is ...
B<Web (1)> - turns on the HTTP-based Monitoring Service running on port 8080 (HTTP_PORT), thus enabling remote monitoring of the Locations current status. It also logs interactions with this Location into 'location.log' (LOGFILE). Set to 0 to disab...
=back
Note that any received mobile agent executes in a directory called "Location", which will be created (if needs be) in the directory that houses this Location. Any "logs" are also created in the "Location" directory.
A constructor example is:
=over 4
my $place = Mobile::Location->new( Port => 5555, Debug => 1 );
=back
creates an object that will display all STDERR status messages, and use protocol port number 5555 for connections. Logging of received agents to disk is off. The standard Opcode mask is in effect. And logging to disk is on, as is the HTTP server.
When the Location is constructed with B<new>, a second network service is created, running at protocol port number B<Port+1>. In the example above, this second network service would run at protocol port number 5556. When sent the names of a set of ...
Note: If a Location crashes (or is killed), the second network service can sometimes keeps running. After all, it is a separate process (albeit a child of the original). Trying to restart the Location results in an "bind to address failed" error me...
=head1 Class and object methods
=over 4
=item B<start_concurrent>
Start the location as a passive server, which operates concurrently. Once connected to a client, the server forks another process to receive and continue executing a mobile agent. This is the preferred method to use when there exists the potential ...
Location.pm view on Meta::CPAN
=item B<_check_for_modules>
Given a list of module names, checks to see if the Location's Perl system has the module installed or not.
=item B<_spawn_network_service>
Used by the B<new> constructor to spawn the Port+1 network service which listens for a list of modules names from a mobile agent, then checks for their existence within the locally installed Perl system.
=item B<_service_client>
Given a socket object (and the instances init data), service the relocation of a Scooby mobile agent.
=item B<_register_with_keyserver>
Creates a PK+ and PK- value for the server, storing the PK+ in the keyserver, and the PK- in the object's state.
=item B<_logger> and B<_logger2>
Logs a message to the LOGFILE.
=item B<_build_index_dot_html>
Mobile::Location version 4.02
=============================
A class for creating Scooby Locations to relocate to.
See: http://glasnost.itcarlow.ie/~scooby/ for more details.
INSTALLATION
To install this module type the following:
perl Makefile.PL
make
make test
( run in 0.604 second using v1.01-cache-2.11-cpan-5511b514fd6 )