ARCv2

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN


IMPORTANT: Due the automatic generation of the pod-files, first of all
you have to run:
   make -C docs

This is a workaround until I'll have a better idea.

Then to install
   perl Makefile.PL
   make
   make test
   make install

It is possible to add default value argumenting it to perl Makefile.PL:

e.g.

perl Makefile.PL --ConfigPath=/etc/arcx --DefaultPort=4242 --DefaultHost=arcdserv

Maybe this makes rpm & deb handling easier.

lib/Arc.pod  view on Meta::CPAN

Copyright (c) 2003-5 Patrick Boettcher <patrick.boettcher@desy.de> and others.
All rights reserved.
Zeuthen, Germany, (old) Europe

 This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.

 Special thanks go to:
DESY Zeuthen, in particular:

- Wolfgang Friebel for bleeding edge testing and heavy bug reporting (and the idea of reimplementing ARC).

- Waltraut Niepraschk and Andreas Haupt for their help and support during the development. 

=cut

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

C<Arc::Command::Test>.

By default, these classes are mapped to B<Command Names> as follows (in the 
default arcxd.conf for arcxd):
  uptime => Arc::Command::Uptime,
  whoami => Arc::Command::Whoami,
  copy   => Arc::Command::Get,
  cp     => Arc::Command::Get,
  get    => Arc::Command::Get,
  put    => Arc::Command::Put,
  test   => Arc::Command::Test,
  help   => Arc::Command::Help,
 
B<Caution>: Especially take care of the C<Arc::Command::Get> and 
C<Arc::Command::Put> in production environment. As ARCv2 will probably
run as root and by default the Get and Put command do NOT have an access
control, everyone can get or put any files from/to your ARCv2 server.

There are some member variables, which contain information about the 
client. See 'Class VARIABLES' for a complete list of them. These values 
are filled by Arc::Connection::Server, when the client wants to run a command.

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

Copyright (c) 2003-5 Patrick Boettcher <patrick.boettcher@desy.de> and others.
All rights reserved.
Zeuthen, Germany, (old) Europe

 This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.

 Special thanks go to:
DESY Zeuthen, in particular:

- Wolfgang Friebel for bleeding edge testing and heavy bug reporting (and the idea of reimplementing ARC).

- Waltraut Niepraschk and Andreas Haupt for their help and support during the development. 

=cut

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

	}

#	$this->_Debug("RW Binary ended.");
	return 1;
}

## send a line. (protocol)
## This function sends a command line to the ARCv2 socket.
##in> ... (line)
##out> true if writing has succeeded, otherwise false.
##eg> $this->_SendLine($cmd,"test"); 
sub _SendLine
{
	my $this = shift;
	return unless @_;
	my $line = join("",@_);
	$line =~ s/\r//g;
	$line =~ s/\n/ /g;
	return $this->_SetError("SendLine only available when connection and select is set.") unless $this->{_connected};

	if ($this->{_select}->can_write($this->{timeout})) { 

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


B<Description>: send a line. (protocol)
This function sends a command line to the ARCv2 socket.


B<Returns:> true if writing has succeeded, otherwise false.


B<Example:>

$this->_SendLine($cmd,"test"); 


=back 

=over 2

=item _Debug ( ... (message) ) I<inherited from Arc>

B<Description>: Debug function.
Logs messages with "DEBUG" 

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

Copyright (c) 2003-5 Patrick Boettcher <patrick.boettcher@desy.de> and others.
All rights reserved.
Zeuthen, Germany, (old) Europe

 This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.

 Special thanks go to:
DESY Zeuthen, in particular:

- Wolfgang Friebel for bleeding edge testing and heavy bug reporting (and the idea of reimplementing ARC).

- Waltraut Niepraschk and Andreas Haupt for their help and support during the development. 

=cut

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

  sasl_cb_user => \&username,
  sasl_cb_auth => \&username,
  sasl_cb_pass => \&password,
 );

 if (my $m = $arc->IsError()) {
  die $m;
 }

 if ($arc->StartSession) {
  $arc->CommandStart("test");
  $arc->CommandWrite("hallo\n");
  if (my $t = $arc->CommandRead()) {
   print $t,"\n"; # should give 'all'
  }
  $arc->CommandEnd();
 }

 sub username
 {
  return $ENV{'USER'};

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


B<Description>: send a line. (protocol)
This function sends a command line to the ARCv2 socket.


B<Returns:> true if writing has succeeded, otherwise false.


B<Example:>

$this->_SendLine($cmd,"test"); 


=back 

=over 2

=item _Debug ( ... (message) ) I<inherited from Arc>

B<Description>: Debug function.
Logs messages with "DEBUG" 

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

Copyright (c) 2003-5 Patrick Boettcher <patrick.boettcher@desy.de> and others.
All rights reserved.
Zeuthen, Germany, (old) Europe

 This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.

 Special thanks go to:
DESY Zeuthen, in particular:

- Wolfgang Friebel for bleeding edge testing and heavy bug reporting (and the idea of reimplementing ARC).

- Waltraut Niepraschk and Andreas Haupt for their help and support during the development. 

=cut

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


B<Description>: send a line. (protocol)
This function sends a command line to the ARCv2 socket.


B<Returns:> true if writing has succeeded, otherwise false.


B<Example:>

$this->_SendLine($cmd,"test"); 


=back 

=over 2

=item _Debug ( ... (message) ) I<inherited from Arc>

B<Description>: Debug function.
Logs messages with "DEBUG" 

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

Copyright (c) 2003-5 Patrick Boettcher <patrick.boettcher@desy.de> and others.
All rights reserved.
Zeuthen, Germany, (old) Europe

 This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.

 Special thanks go to:
DESY Zeuthen, in particular:

- Wolfgang Friebel for bleeding edge testing and heavy bug reporting (and the idea of reimplementing ARC).

- Waltraut Niepraschk and Andreas Haupt for their help and support during the development. 

=cut

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

Copyright (c) 2003-5 Patrick Boettcher <patrick.boettcher@desy.de> and others.
All rights reserved.
Zeuthen, Germany, (old) Europe

 This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.

 Special thanks go to:
DESY Zeuthen, in particular:

- Wolfgang Friebel for bleeding edge testing and heavy bug reporting (and the idea of reimplementing ARC).

- Waltraut Niepraschk and Andreas Haupt for their help and support during the development. 

=cut

lib/arcx.pod  view on Meta::CPAN

For authentication use the given <mechanism>. (Default: let the server decide.)

=item -t <timeout>

Timeout in seconds to wait for data in control and command connection.

=item -r <string>

<string> is going to be written to the established command connection, when command is used. (Do not wait for user input on STDIN).

eg.: arcx -r "data" test 
results in "at".

=item command

Run this ARCv2 command. Run "help" to see, which commands are available.

=item command-arguments

Some ARCv2 command can handle arguments. They should go here.

lib/arcx.pod  view on Meta::CPAN

Copyright (c) 2003-5 Patrick Boettcher <patrick.boettcher@desy.de> and others.
All rights reserved.
Zeuthen, Germany, (old) Europe

 This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.

 Special thanks go to:
DESY Zeuthen, in particular:

- Wolfgang Friebel for bleeding edge testing and heavy bug reporting (and the idea of reimplementing ARC).

- Waltraut Niepraschk and Andreas Haupt for their help and support during the development. 

=cut

lib/arcxd.pod  view on Meta::CPAN

=head2 Parameter

=over 4

=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

lib/arcxd.pod  view on Meta::CPAN

 PLAIN
 EOM

 [commands]
   uptime = Arc::Command::Uptime
   whoami = Arc::Command::Whoami
   copy = Arc::Command::Get
   cp = Arc::Command::Get
   get = Arc::Command::Get
   put = Arc::Command::Put
   test = Arc::Command::Test
   help = Arc::Command::Help
   h = Arc::Command::Help
   hlp = Arc::Command::Help

 [logging]
   level = 7
   destination = syslog

The configuration file is based on .ini format, known from Windows (sorry). 
In perl we can parse it, using Config::IniFiles. The configuration file is divided into

lib/arcxd.pod  view on Meta::CPAN

Copyright (c) 2003-5 Patrick Boettcher <patrick.boettcher@desy.de> and others.
All rights reserved.
Zeuthen, Germany, (old) Europe

 This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.

 Special thanks go to:
DESY Zeuthen, in particular:

- Wolfgang Friebel for bleeding edge testing and heavy bug reporting (and the idea of reimplementing ARC).

- Waltraut Niepraschk and Andreas Haupt for their help and support during the development. 

=cut

scripts/arcx.conf  view on Meta::CPAN

# a very simple config file, which lists servers and their ARCv2 commands

[server_command_map]
    hekate.ifh.de:4243 = kstart,fs;vos:blah
    hekate.ifh.de:4242 = fs;vos:blah
    hekate2.ifh.de     = whoami,test,
# fallback
    hekate.ifh.de      = *

scripts/arcxd.conf  view on Meta::CPAN

	
[commands]
	uptime = Arc::Command::Uptime
	whoami = Arc::Command::Whoami
	copy = Arc::Command::Get
	cp = Arc::Command::Get
	get = Arc::Command::Get
	put = Arc::Command::Put
	crontab = Arc::Command::Acrontab
	acrontab = Arc::Command::Acrontab
	test = Arc::Command::Test
	help = Arc::Command::Help
	h = Arc::Command::Help
	hlp = Arc::Command::Help
	rpc = Arc::Command::Rpc

	fs = Fs
	
	vos = Fs

	pv = Pv

t/arc1.t  view on Meta::CPAN

use Test::More tests => 17;
use strict;

# To work as a client/server we have to fork

my $pid = fork();

my $user = "mannfred";
my $pass = "klaus";

if ($pid == 0) { # Child

t/arc1.t  view on Meta::CPAN

					host => "localhost", 
				},
				connection_vars => {
					loglevel => 0,
					logdestination => 'stderr',
					sasl_mechanisms => ['PLAIN'],
					sasl_cb_checkpass => \&checkpass,
					sasl_cb_getsecret => \&getsecret,
					service => "arc",
					commands => { 
						test => 'Arc::Command::Test',
						whoami => 'Arc::Command::Whoami',
						uptime => 'Arc::Command::Uptime',
					}
				}
	);

	$server->Start();

	exit 0;
} elsif ($pid) { # Parent

t/arc1.t  view on Meta::CPAN

				sasl_mechanism => "PLAIN",
				sasl_cb_user => $user,
				sasl_cb_auth => $user,
				sasl_cb_pass => $pass,
	) or ok(0);
	ok(1); #2

	my $s; 
	if ($client->StartSession()) { ok(1); } else { ok(0); } #3

	if ($client->CommandStart("test")) { ok(1); } else { ok(0); } #4
	if ($client->CommandWrite("hallo\n")) { ok(1); } else { ok(0); } #5
	if ($s = $client->CommandRead()) { ok(1); } else { ok(0); } #5
	if ($s eq "all\n") { ok(1); } else { ok(0); } #6
	if ($client->CommandEnd()) { ok(1); } else { ok(0); } #7
	
	if ($client->CommandStart("whoami")) { ok(1); } else { ok(0); }
	if ($s = $client->CommandRead()) { ok(1); } else { ok(0); }
	if ($client->CommandEnd()) { ok(1); } else { ok(0); }
	
	if ($client->CommandStart("uptime")) { ok(1); } else { ok(0); }



( run in 0.522 second using v1.01-cache-2.11-cpan-2b0bae70ee8 )