3 # connect to an external entity
5 # This is the routine that is called by the cluster to manage
6 # an outgoing connection to the point where it is 'connected'.
7 # From there the client program is forked and execed over the top of
8 # this program and that connects back to the cluster as though
9 # it were an incoming connection.
11 # Essentially this porgram does the same as chat in that there
12 # are 'expect', 'send' pairs of strings. The 'expect' string is
13 # a pattern. You can include timeout and abort string statements
18 # connect <type> <destination>|<program>
21 # client <client name> <parameters>
22 # '<regexp>' '<send string>'
24 # Copyright (c) Dirk Koopman G1TLH
29 # search local then perl directories
31 # root of directory tree for this system
33 $root = $ENV{'DXSPIDER_ROOT'} if $ENV{'DXSPIDER_ROOT'};
35 unshift @INC, "$root/perl"; # this IS the right way round!
36 unshift @INC, "$root/local";
44 $timeout = 30; # default timeout for each stage of the connect
45 $abort = ''; # default connection abort string
46 $path = "$root/connect"; # the basic connect directory
47 $client = "$root/perl/client.pl"; # default client
49 $connected = 0; # we have successfully connected or started an interface program
51 exit(1) if !$ARGV[0]; # bang out if no callsign
52 open(IN, "$path/$ARGV[0]") or exit(2);
58 doconnect($1, $2) if /^\s*co\w*\s+(.*)$/io;
59 doclient($1) if /^\s*cl\w*\s+(.*)$/io;
60 doabort($1) if /^\s*a\w*\s+(.*)/io;
61 dotimeout($1) if /^\s*t\w*\s+(\d+)/io;
62 dochat($1, $2) if /\s*\'(.*)\'\s+\'(.*)'/io;
67 my ($sort, $name) = @_;
68 print "connect $sort $name\n";
74 print "abort $string\n";
80 print "timeout $val\n";
85 my ($expect, $send) = @_;
86 print "chat '$expect' '$send'\n";