ARCv2

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

	- heavy documentation update (thanks to Wolfgang Friebel for reading
	  all this pages)
	- deadlock fixed in when the client uses the same object to reconnect
	  (arcx)
	- arcx reconnects automatically when lost connection during a session
	- small bug in Put command
	- put all .pm file in lib/

0.04  Tue Jan 27 2004
	- Added the raw pod documentation to the package. The installation
	  process will now build the pod when running perl Makefile.PL.
	- Updating Documentation (for arcx and arcxd).
	- Removed some debug statements. (also known as 'code cleanup').
	- Added the IP*PORT parameter to SASL *_new function, KERBEROS_V4
	  is possible now (depends on Authen::SASL::Cyrus 0.10)
	- removed the CheckAcl method from the Command class, since there
	  is apparently no need for it.

0.03  Fri Jan 23 2004
	- Documentation improvements (reimplemented members are hidden)
	- Name for ARCv2 command line interface (arcx, arcxd) 01/23/2004

lib/Arc/Command.pod  view on Meta::CPAN

    _cmd => $cmd,
    logfileprefix => "command",
  );
  $object->Execute(@a);
  $cmderr = $object->IsError();

  return -1;
 };
 
When everything went alright, the command will be executed. The command runs
in a separate process. Therefore STDIN, STDOUT and STDERR are duped to two
pipes, one for the in, one for the out direction. In the parent process data
from the encrypted network command connection is read from and written to these pipes.
Same situation on the client side, STDIN and STDOUT are used to put and get the 
data through the network.
 
                   encrypted
          /--->>---| net- |--->>-----\   
        / /---<<---| work |---<<-----\ \
      / /                              \ \
     | |     in                         | |    p2
  |--------|->>--\                  |--------|->>--\ 

lib/Arc/Connection.pm  view on Meta::CPAN


	my $command = undef;
	if (my $line = $this->_RecvLine()) { # Fetch and parse a cmd from queue
		$line =~ s/[\r\n]//g;
		($command,$this->{_cmdparameter}) = $line =~ m/^([A-Z]+)\ ?(.*)?$/;
	}
		
	return $command; # There was an error if undef is return 
}

## process an ARCv2 command. (protocol)
## Process a command by evaling $this->_R$cmd. Also checks if 
## this command was expected now (looks into the $this->{_expectedcmds} array). 
## Used by client and server.
##in> $cmd
##out> true, if ARCv2 command has been in place, otherwise false
##eg> while (my $cmd = $this->_RecvCommand() && $this->_ProcessLine($cmd)) {}
sub _ProcessLine
{
	my $this = shift;
	my $cmd = shift;

lib/Arc/Connection.pod  view on Meta::CPAN

B<Returns:> true if successful, otherwise false


B<Example:>

$this->_PrepareAuthentication() || return;


=item _ProcessLine ( $cmd ) 

B<Description>: process an ARCv2 command. (protocol)
Process a command by evaling $this->_R$cmd. Also checks if 
this command was expected now (looks into the $this->{_expectedcmds} array). 
Used by client and server.


B<Returns:> true, if ARCv2 command has been in place, otherwise false


B<Example:>

lib/Arc/Connection/Client.pm  view on Meta::CPAN

sub _Cmd
{
	my $this = shift;
	my $str = join " ",@_;
	$str =~ s/[\r\n]//g;
	return $this->_SetError("Empty command won't be sent.") unless length $str;
	@{$this->{_expectedcmds}} = qw(ERR CMDPASV DONE);
	return $this->_SendCommand("CMD",$str);
}

# The _R subs are processing a server response, call resp. subs and set the expectedcmds array approp.
## parses the AUTH <list of SASL mech>\r\n, sent by the server
sub _RAUTH
{
	my $this = shift;
	@{$this->{server_sasl_mechanisms}} = split(',',$this->{_cmdparameter});

	return $this->_Authenticate();
}

## parses the AUTHTYPE <SASL mech>\r\n, sent by the server.

lib/Arc/Connection/Client.pm  view on Meta::CPAN

sub Quit
{
	my $this = shift;
	$this->_SendCommand("QUIT");
	$this->{_connection}->close();
	$this->{_connected} = 0;
	$this->{_expectedcmds} = qw();
	return 1;
}

## process a command.
## This function runs a command with STDIN and STDOUT as clients 
## in- and output control.
##in> ... (command and its parameters)
##out> true if successful, false if not. (IsError is set appropriatly)
##eg> $arc->ProcessCommand("whoami");
sub ProcessCommand
{
	my $this = shift;

	return unless $this->CommandStart(@_);

lib/Arc/Connection/Client.pod  view on Meta::CPAN

B<Returns:> true if successful, false if not. (IsError is set appropriatly)


B<Example:>

last unless $this->CommandWrite();


=item ProcessCommand ( ... (command and its parameters) ) 

B<Description>: process a command.
This function runs a command with STDIN and STDOUT as clients 
in- and output control.


B<Returns:> true if successful, false if not. (IsError is set appropriatly)


B<Example:>

$arc->ProcessCommand("whoami");

lib/Arc/Connection/Client.pod  view on Meta::CPAN

B<Returns:> true if successful, otherwise false


B<Example:>

$this->_PrepareAuthentication() || return;


=item _ProcessLine ( $cmd ) I<inherited from Arc::Connection>

B<Description>: process an ARCv2 command. (protocol)
Process a command by evaling $this->_R$cmd. Also checks if 
this command was expected now (looks into the $this->{_expectedcmds} array). 
Used by client and server.


B<Returns:> true, if ARCv2 command has been in place, otherwise false


B<Example:>

lib/Arc/Connection/Server.pod  view on Meta::CPAN

B<Returns:> true if successful, otherwise false


B<Example:>

$this->_PrepareAuthentication() || return;


=item _ProcessLine ( $cmd ) I<inherited from Arc::Connection>

B<Description>: process an ARCv2 command. (protocol)
Process a command by evaling $this->_R$cmd. Also checks if 
this command was expected now (looks into the $this->{_expectedcmds} array). 
Used by client and server.


B<Returns:> true, if ARCv2 command has been in place, otherwise false


B<Example:>

lib/Arc/Server.pm  view on Meta::CPAN

	my $this = shift;
	my $ct = $this->{connection_type};
	eval "require $ct";
	croak "Please \"use $ct\" before calling Start(): $@" if $@;
	$this->run();
	return 1;
}

# Net::Server::* hooks and overrides

sub process_request
{
	my $this = shift;
	my $arc = $this->{__arc};
#	my $arc = new Arc::Connection::Server(
#		%{$this->{connection_vars}},
#	);
	return $this->_SetError("No Arc::Connection::Server object was created.")
		unless $arc;
	$this->Log(LOG_USER,"Client connection from",$this->{server}->{client}->peerhost);
	$arc->HandleClient($this->{server}->{client});

lib/Arc/Server.pod  view on Meta::CPAN

=head1 Class METHODS

=head3 PUBLIC METHODS

=over 2

=item child_init_hook (  ) 

=item post_accept (  ) 

=item process_request (  ) 

=item Start (  ) 

B<Description>: start the server
This function is used by the user to start the server and enter the main accept-loop.
Only by calling the C<Interrupt> function this call can be aborted.


B<Returns:> return true if everything worked fine, otherwise false is returned and C<IsError> should be checked.

lib/arcxd.pod  view on Meta::CPAN

=item arcxd -p 1234

Same as L<arcxd> but listens on port 1234.

=item arcxd -d 5

Stay in foreground and log messages to stderr.

=item arcxd -P arcxd.pid 

Let arcxd store the pid of the master process in arcxd.pid.

=back

=head1 USAGE

Some parameters can be supplied to this scripts. The most of them come from the configuration file.

By default arcxd fork itself into background. If you want to run arcx in the foreground set the -d option.

The scheme looks like this:

lib/arcxd.pod  view on Meta::CPAN

=item -d <loglevel>

Let the server put its log output to "stderr" and set the log level to <loglevel>. Also tells the server to do not fork into the background.

=item -p <port>

On which port the server shall listen on. (override the one from the configuration file and the default port). Change this for testing purposes.

=item -P <pid_file>

Where should the Net::Server store the PID of the master process.

=item -F <config file>

Specify the configuration file, to fill ARCv2 appropriately. Default is arcxd.conf in the default path $Arc::Default Path.

=item -v

The verbose option. If this option is set, arcxd is verbose in its context. This option does not influence the ARCv2 object. Use -d for it.

=back

scripts/arcxd.init.d.solaris  view on Meta::CPAN

#!/bin/sh
# last mod 05.05.04 WN
#
# Need the commands ps, awk, kill, sleep
PATH=${PATH}${PATH:+:}/sbin:/bin:/usr/bin
 

killproc() {            # kill the named process(es)
        for x in `ps -e |grep " $@" |sed -e 's/^  *//' -e 's/ .*//'`
	do
                echo "PID: $x"
                [ ! -z "$pid" ] && echo killing $x && kill $pid &
        done
}

 
ARCXD_PATH=/opt/products/perl/5.8.2/scripts



( run in 0.407 second using v1.01-cache-2.11-cpan-8d75d55dd25 )