<p>
<!-- Created: Sun Dec 13 20:25:14 GMT 1998 -->
<!-- hhmts start -->
-Last modified: Tue Apr 10 00:21:34 BST 2001
+Last modified: Sun Sep 2 22:02:36 BST 2001
<!-- hhmts end -->
<p>At the moment, anybody can connect inwards at any time from outside, either by ax25 or by
telnet (assuming you have followed the instructions in <a href="install.html">installation</a>
<p><em>Connect</em> scripts live in the <tt>/spider/connect</tt> directory and are simple ascii scripts
that are written using a normal editor. There are a couple of examples in the issue directory.
-
- <p>Here are a few of basic types, first a telnet connection where the
- client is set up in the passwd file thus:-
- <pre>
- gb7djk:x:1372:1291::/home/gb7djk:/usr/bin/perl /spider/perl/client.pl gb7djk telnet
- </pre>
- and the connect script would be:-
+
+ <p>The first example is a simple telnet (TCP/IP) connect to port 7000 of WR3D (this will actually
+ work if you have or make an arrangement to connect to WR3D)[oh, and substitute x1xxx for your real
+ node callsign].</p>
+
+ <p>The colouration will be explained later on in this page, you don't have to try to emulate the colours!</p>
+
<pre>
- timeout 15
+ <span class=cmd>timeout 15</span>
# this is a comment
- connect telnet dirkl.tobit.co.uk
- 'login' 'gb7djk'
- 'word' 'gb7djk'
- client gb7djk telnet
+ <span class=connect>connect telnet wr3d.dxcluster.net 7000</span>
+ <span class=expect>'login'</span> <span class=send>'x1xxx'</span>
+ <span class=cmd>client wr3d telnet</span>
</pre>
+
+ <p>If you put the above script in a file called: <tt>/spider/connect/wr3d</tt> then you can leave out
+ line: <span class=cmd>client wr3d telnet</span>.
<p>For a connect that requires a login and execution of the programs
- from a normal shell, do:-
+ from a normal shell, do:-</p>
<pre>
- timeout 15
- connect telnet dirkl.tobit.co.uk
- 'login' 'gb7djk'
- 'word' 'gb7djk'
- '\$' 'cd /spider/perl'
+ <span class=cmd>timeout 15</span>
+ <span class=connect>connect telnet dirkl.tobit.co.uk</span>
+ <span class=expect>'login'</span> <span class=send>'gb7djk'</span>
+ <span class=expect>'word'</span> <span class=send>'gb7djk'</span>
+ <span class=expect>'\$'</span> <span class=send>'cd /spider/perl'</span>
# set the line to prevent echoing, leaving this out will
# confuse whole networks for hours!
- '\$' 'stty -echo raw'
+ <span class=expect>'\$'</span> <span class=send>'stty -echo raw'</span>
# tell GB7DJK that you are GB7DJK-1
- '\$' '/spider/src/client gb7djk-1 telnet'
+ <span class=expect>'\$'</span> <span class=send>'/spider/src/client gb7djk-1 telnet'</span>
# tell GB7DJK-1 that it is connected to GB7DJK
# you can leave this out if you call this script 'gb7djk'
- client gb7djk telnet
+ <span class=cmd>client gb7djk telnet</span>
</pre>
- <p>a ax25 example:-
+ <p>a ax25 example (connecting from GB7DJK, to GB7DXM via my local BPQ node and one X1J intermediate node):-
+
<pre>
- timeout 60
- abort (Busy|Sorry|Fail)
+ <span class=cmd>timeout 60</span>
+ <span class=cmd>abort (Busy|Sorry|Fail)</span>
# don't forget to chmod 4775 netrom_call!
- connect ax25 /usr/sbin/netrom_call bbs gb7djk-0 g1tlh-0
- 'Connect' ''
- 'Connect' 'c np7'
- 'Connect' 'c gb7dxm'
- 'Connect' ''
+ <span class=connect>connect ax25 /usr/sbin/netrom_call bbs gb7djk-0 g1tlh-0</span>
+ <span class=expect>'Connected'</span> <span class=send>'c np7'</span>
+ <span class=expect>'*** Connect'</span> <span class=send>'c gb7dxm'</span>
+ <span class=expect>'Connect'</span> <span class=send>''</span>
</pre>
- The <tt>-0</tt> ssid is important if you want it to work reliably. Obviously if you are
- using a different ssid then you would use that.
+ <p>The <tt>-0</tt> ssid is important if you want it to work reliably. Obviously if you are
+ using a different ssid then you would use that. You can use the Netrom alias instead if it
+ it is in the machines node table.</p>
+
+ <p>The line: "<tt><span class=expect>'Connected'</span> <span class=send>''</span></tt>" means: wait for
+ the string <span class=expect>Connected</span> and when that is seen, then move onto the next line
+ <b>without <span class=send>sending</span> anything</b>. The reason you do this (in this case) is to wait
+ for the final "connect" string from the BPQ node that directly connects you to the
+ cluster node itself.</p>
+
+ <p>A AGW Engine example would be very similar and look like this:-</p>
- <p>A AGW Engine example would be very similar and look like this:-
<pre>
- timeout 60
- abort (Busy|Sorry|Fail)
- connect agw 2 g1tlh
- 'Connect' ''
- 'Connect' 'c np7'
- 'Connect' 'c gb7dxm'
- 'Connect' ''
+ <span class=cmd>timeout 60</span>
+ <span class=cmd>abort (Busy|Sorry|Fail)</span>
+ <span class=connect>connect agw 2 g1tlh</span>
+ <span class=expect>'*** Connect'</span> <span class=send>'c np7'</span>
+ <span class=expect>'Connected'</span> <span class=send>'c gb7dxm'</span>
+ <span class=expect>'Connect'</span> <span class=send>''</span>
</pre>
<p>A connection is started manually by typing in <tt>connect <scriptname></tt> on a sysop enabled
- <tt>client.pl</tt> session. For example:-
+ <tt>client.pl</tt> session. For example:-</p>
+
<pre>
G1TLH de GB7DJK 13-Dec-1998 2041Z > connect gb7djk-1
connection to GB7DJK-1 started
G1TLH de GB7DJK 13-Dec-1998 2043Z >
</pre>
+ <p>Consider the following specific example, it is located in the file <tt>/spider/connect/gb7djk-1</tt> :-</p>
+
+ <pre>
+ <span class=cmd>timeout 15</span>
+ <span class=connect>connect telnet dirkl.tobit.co.uk</span>
+ <span class=expect>'login'</span> <span class=send>'gb7djk'</span>
+ <span class=expect>'ssword'</span> <span class=send>'gb7djk'</span>
+ </pre>
+
<p>You can watch the progress of the connection (if you have <tt>connect</tt>
debugging enabled [<tt>set/debug connect</tt>]) on the
- <tt>cluster.pl</tt> screen and you should see something like this:-
+ <tt>cluster.pl</tt> screen and you should see something like this:-</p>
+
<pre>
<- D G1TLH connect gb7djk-1
-> D G1TLH connection to GB7DJK-1 started
-> D G1TLH G1TLH de GB7DJK 13-Dec-1998 2046Z >
- timeout set to 15
- CONNECT sort: telnet command: dirkl.tobit.co.uk
+ <span class=cmd>timeout set to 15</span>
+ <span class=connect>CONNECT sort: telnet command: dirkl.tobit.co.uk</span>
CHAT "login" -> "gb7djk"
received "
Red Hat Linux release 5.1 (Manhattan)
Kernel 2.0.35 on an i586
"
- received "login: "
- sent "gb7djk"
+ <span class=expect>received "login: "</span>
+ <span class=send>sent "gb7djk"</span>
CHAT "word" -> "gb7djk"
received "gb7djk
"
- received "Password: "
- sent "gb7djk"
+ <span class=expect>received "Password: "</span>
+ <span class=send>sent "gb7djk"</span>
Connected to GB7DJK-1, starting normal protocol
<- O GB7DJK-1 telnet
-> B GB7DJK-1 0
<- D GB7DJK-1 PC18^ 1 nodes, 0 local / 1 total users Max users 0 Uptime 0 00:00^5447^~
etc
</pre>
-
+
+ <p>I have coloured the commands in an attempt to make it clear as
+ to what goes on, where and why. Lines that are <span
+ class=cmd>coloured thus</span> are miscellaneous setup
+ commands. Lines that are <span class=connect>this colour</span>
+ are lines that make the initial <span
+ class=connect>connection</span> to the first hop. The things that
+ are <span class=expect>this colour</span> are the strings I am
+ looking for (what I am <span class=expect>"expecting"</span>) and
+ the things that are <span class=send>this colour</span> are the
+ commands I am going to <span class=send>send</span> when I see the
+ "expect" strings in the input.</p>
+
+ <p>The script starts by setting the timeout to 15 seconds, then starts
+ the connection. It is <b>important</b> to note that, in the case of
+ an ax25 connection (usually) this will be the callsign of the <i>first hop</i> along the
+ route that you are going to take to the destination, so this will be typically the callsign
+ of your local node.</p>
+
+ <p>You will notice that the script <span class=expect>waits</span>
+ until it sees the left hand string of the pair and <b>only
+ then</b> does it <span class=send>send</span> the string on the
+ right hand side. This is called a <i>State Machine</i>.</p>
+
+ <p>A <i>state machine</i> "walks" through a conversation (in this
+ case) looking for "<span class=expect>states</span>" (in this case
+ particular strings) and then performs some "<span
+ class=send>action</span>" (usually some kind of connect command
+ for the type of system you are trying to navigate). When one
+ "<span class=expect>state</span>" "fires"
+ (detects the string are looking for), it <span class=send>sends the command</span>
+ associated with that state and then moves onto the next "<span
+ class=expect>state</span>", in our case: the next line.</p>
+
+ <p><b>PLEASE NOTE</b>: the colouration in the above example is for illustrative purposes
+ only, the debug output is all one colour.</p>
+
<p>The connect scripts consist of lines which start with the
- following keywords or symbols:-
+ following keywords or symbols:-</p>
<ul>
ignored, as are wholly blank lines.
<br><br>
- <li><b>timeout</b> followed by a number is the number of
+ <li><b><span class=cmd>timeout</span></b> followed by a number is the number of
seconds to wait for a command to complete. If there is no
- <b>timeout</b> specified in the script then the default is 60
+ <b><span class=cmd>timeout</span></b> specified in the script then the default is 60
seconds.
<br><br>
- <li><b>abort</b> is a regular expression containing one or
+ <li><b><span class=cmd>abort</span></b> is a regular expression containing one or
more strings to look for to abort a connection. This is a perl
regular expression and is executed ignoring case.
<br><br>
- <li><b>connect</b> followed by <b>ax25</b>, <b>telnet</b> or <b>agw</b>
+ <li><b><span class=connect>connect</span></b> followed by <b>ax25</b>, <b>telnet</b> or <b>agw</b>
and some type dependent information.
<p>In the case of a
from 1) and the callsign of the first "hop" along the way.
<br><br>
- <li><b>'</b> is the delimiting character for a word or
- phrase of an expect/send line in a <tt>chat</tt> type
- script. The words/phrases normally come in pairs, either can
- be empty. Each line reads input from the connection until it
- sees the string (or perl regular expression) contained in the
- left hand string. If the left hand string is empty then it
- doesn't read or wait for anything. The comparison is done
- ignoring case.
+ <li><b>'</b> is the delimiting character for a word or phrase
+ of an <span class=expect>expect</span>/<span
+ class=send>send</span> line. The words/phrases normally come
+ in pairs, but either can be empty. Each line reads input from
+ the connection until it sees the string (or perl regular
+ expression) that
+ is contained in the left hand string. If the left hand
+ string is empty then it doesn't read or wait for anything. The
+ comparison is done ignoring case.
- <p>When the left hand string has found what it is looking (if
- it is) then the right hand string is sent to the connection.
+ <p>When the left hand string has found what it is <span class=expect>expecting</span> (if
+ it is) then the right hand string is <span class=send>sent</span> to the connection.
+
+ <p>If the right hand string is empty ('') then nothing is <span class=send>sent</span>, the
+ script simply moves onto the next line.</P>
<p>This process is repeated for every line of <tt>chat</tt> script.
<br><br>
- <li><b>client</b> starts the connection, put the arguments
+ <li><b><span=cmd>client</span></b> starts the connection, put the arguments
you would want here if you were starting the client program
manually. You only need this if the script has a different
name to the callsign you are trying to connect to (i.e. you
<!-- Standard Footer!! -->
<p> </p>
- <p>
- <FONT COLOR="#606060"><hr></font>
- <font color="#FF0000" size=-2>
- Copyright © 1998 by Dirk Koopman G1TLH. All Rights Reserved<br>
- </font>
- <font color="#000000" size=-2>$Id$</font>
+ <hr>
+ <span class=copy>Copyright © 1998 by Dirk Koopman G1TLH. All Rights Reserved</span><br>
+ <span class=id>$Id$</span>
</body>
</html>