ARCv2

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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

231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
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

135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
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

420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
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

159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
        }
 
#       $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

407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
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

476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
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

42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
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

709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
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

778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
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

595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
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

664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
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

325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
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

111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
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

147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
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

45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
=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

93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
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

198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
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

1
2
3
4
5
6
7
8
# 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

25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
         
[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

1
2
3
4
5
6
7
8
9
10
11
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

21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
                                        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

53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
                        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.447 second using v1.01-cache-2.11-cpan-2b0bae70ee8 )