started connect process
authordjk <djk>
Wed, 4 Nov 1998 15:01:24 +0000 (15:01 +0000)
committerdjk <djk>
Wed, 4 Nov 1998 15:01:24 +0000 (15:01 +0000)
connect/gb7baa [new file with mode: 0644]
connect/gb7tlh [new file with mode: 0644]
perl/connect.pl [new file with mode: 0755]

diff --git a/connect/gb7baa b/connect/gb7baa
new file mode 100644 (file)
index 0000000..995b1ea
--- /dev/null
@@ -0,0 +1,3 @@
+timeout 45
+connect net gb7baa.tubby.org
+client /spider/perl/client.pl gb7baa
diff --git a/connect/gb7tlh b/connect/gb7tlh
new file mode 100644 (file)
index 0000000..8cd7be8
--- /dev/null
@@ -0,0 +1,5 @@
+timeout 15
+connect ax25 ax25_call g1tlh gb7djk
+'CONNECTED' 'cluster'
+'Connected' ''
+client /spider/perl/client.pl gb7tlh ax25
diff --git a/perl/connect.pl b/perl/connect.pl
new file mode 100755 (executable)
index 0000000..99c4565
--- /dev/null
@@ -0,0 +1,92 @@
+#!/usr/bin/perl
+#
+# connect to an external entity
+#
+# This is the routine that is called by the cluster to manage
+# an outgoing connection to the point where it is 'connected'.
+# From there the client program is forked and execed over the top of
+# this program and that connects back to the cluster as though
+# it were an incoming connection.
+#
+# Essentially this porgram does the same as chat in that there
+# are 'expect', 'send' pairs of strings. The 'expect' string is 
+# a pattern. You can include timeout and abort string statements
+# at any time.
+#
+# Commands are:-
+#
+# connect <type> <destination>|<program>
+# timeout <secs>
+# abort <regexp>
+# client <client name> <parameters>
+# '<regexp>' '<send string>'
+#
+# Copyright (c) Dirk Koopman G1TLH
+#
+# $Id$
+#
+
+# search local then perl directories
+BEGIN {
+  # root of directory tree for this system
+  $root = "/spider"; 
+  $root = $ENV{'DXSPIDER_ROOT'} if $ENV{'DXSPIDER_ROOT'};
+
+  unshift @INC, "$root/perl";   # this IS the right way round!
+  unshift @INC, "$root/local";
+}
+
+use DXVars;
+use IO::Socket;
+use Carp;
+
+$timeout = 30;         # default timeout for each stage of the connect
+$abort = '';           # default connection abort string
+$path = "$root/connect";    # the basic connect directory
+$client = "$root/perl/client.pl";   # default client
+
+$connected = 0;        # we have successfully connected or started an interface program
+
+exit(1) if !$ARGV[0];       # bang out if no callsign
+open(IN, "$path/$ARGV[0]") or exit(2);
+
+while (<IN>) {
+  chomp;
+  next if /^\s*#/o;
+  next if /^\s*$/o;
+  doconnect($1, $2) if /^\s*co\w*\s+(.*)$/io;
+  doclient($1) if /^\s*cl\w*\s+(.*)$/io;
+  doabort($1) if /^\s*a\w*\s+(.*)/io;
+  dotimeout($1) if /^\s*t\w*\s+(\d+)/io;
+  dochat($1, $2) if /\s*\'(.*)\'\s+\'(.*)'/io;
+}
+
+sub doconnect
+{
+  my ($sort, $name) = @_;
+  print "connect $sort $name\n";
+}
+
+sub doabort
+{
+  my $string = shift;
+  print "abort $string\n";
+}
+
+sub dotimeout
+{
+  my $val = shift;
+  print "timeout $val\n";
+}
+
+sub dochat
+{
+  my ($expect, $send) = @_;
+  print "chat '$expect' '$send'\n";
+}
+
+sub doclient
+{
+  my $cl = shift;
+  print "client $cl\n";
+}