connect.con
Purpose
Controls communication connections and data transfer.
Description
The connection configuration file,
/usr/lib/INnet/connect.con or $HOME/bin/connect.con, con-
trols the setup of connections for the connect program
and for certain optional communications programs. It
provides a very general, flexible mechanism to specify
how connections are made and how data is transferred
after making a connection.
The connect.con files are attribute files. The following
attributes may appear in the connection control file.
Connection Options
The connection options and their descriptions are:
prefix, address, suffix
The telephone number to dial or the network
address to contact. The actual number is con-
structed by concatenating the prefix (if any),
the address, and the suffix (if any). Usually
the prefix and suffix are defined in
/etc/ports because they depend on the peculi-
arities of the dialer, and the address is
defined in connect.con.
Multiple addresses can be specified by consec-
utive address assignment lines or by multiple
address values separated by commas. The
addresses are tried in the order given. To
specify a comma as part of the command that is
sent to the modem, enclose the entire address
value in quotation marks.
connect Type of connection to make. This option is
specified in /etc/ports since it is usually
associated with the hardware configuration of
the outgoing line. Permissible values are:
permanent The connection is hard-wired.
No dialing or other special
attention is needed.
manual The connection must be completed
manually. This generally
implies a modem that does not
dial, for example, an acoustic
coupler.
hayes_1200 The line has a Hayes Stack
Smartmodem 1200.
hayes_2400 The line has a Hayes Stack
Smartmodem 2400.
vadic The line has a Racal-Vadic 3451P
autodialer.
ventel The line has a Ventel MD212+
autodialer.
other_name The line is associated with a
dialer program, which is not
built into the connect program.
This option allows you to
augment the capabilities of the
connect program and other commu-
nications programs when dealing
with new types of communications
lines and dialers. The program
searches for the named dialer
program in
/usr/lib/INnet/dialers or
$HOME/bin.
The assumptions made for dialer
programs you supply are: the
port to be used can be opened
prior to dialing and the file
will be opened as descriptor 3.
Two parameters are passed:
number to dial as parameter 1,
and dialer hardware to use or
value of the dialer option, if
any as parameter 2. Any code
exit from the dialer except 0
indicates the dialer failed.
The failure code returned by the
dialer determines the message
printed by the programs.
linetype Type of communication line protocols, either
synchronous or asynchronous. Different proto-
cols are used on different line types, so the
talker programs may differ. The default
linetype is asynchronous.
type The name invoked with the connect program that
determines the kind of connection attempted.
Only those stanzas with the proper type are
processed. Currently, the connect program
itself uses only terminal type stanzas. The
default type is terminal.
use This option directs the connect program to
read the named stanza and follow the
instructions there.
Line Options and Parameters
Line options and parameters used are:
min The minimum value to use in kernel buffering.
Min value characters must be received before a
call to the read system call returns, unless
value specified in time elapses.
parity The line is checked for the indicated parity:
even, odd, any, or none.
speed The transmission speed, generally 110, 300,
1200, 2400, 9600, and so on.
time The value to use in kernel buffering. Time in
tenths of a second to receive a character
before a call to the read system call returns
unless min characters are received. See the
discussion of ICANON in "termio." Setting these
parameters can result in improved performance.
timeout The time limit to complete the connection in
seconds. When the time limit expires, the con-
nection is aborted. This attribute is not
needed for devices with a built-in timeout.
System Options
The system options are:
device The name of the special file to use to make the
connection. The device must appear in
/etc/ports (see "ports") and the information in
the ports file entry that is made available to
the connect program. Note that this attribute
can appear only in the last of the list of
stanzas associated with making the connection on
this device, and that the use option must not
appear.
dialer This option specifies the dialer hardware to be
used in dialing the number. It is normally in
/etc/ports file, associated with the device to
be used. It may also be specified in a con-
nection file, so that its value can be passed to
a user-specified dialer program.
Diagnostics
The following diagnostics are displayed, based on the
return value from system- or user-supplied dialer pro-
grams. The values 8 through 14 are treated as fatal
errors.
Code Message
0 Connected
1 Cannot open dialer
2 Busy or no answer
3 Not able to fork
4 Terminated attempts
5 Communication failure
6 Busy
7 No answer
8 Dead phone
9 Bad phone number
10 Cannot open device specified
11 Address not specified
12 Bad connect.con format
13 Cannot run dialer
14 No autodialer specified.
Login Script
A login script is file with the given name that is inter-
preted prior to notifying you that the connection is com-
plete. Script files are located either in the $HOME/bin
file or in the /usr/lib/INnet/scripts file.
script A script file is organized into a group of
states. In each state, the script file
optionally sends a string to the remote system,
then waits for a response. Several possible
responses can be listed for each state along
with an action to be performed if the response
is received. A time limit can also be set in
each state, along with an action to be performed
if the time expires without an expected string
arriving. The actions are to terminate script
interpretations, with either a success or
failure indication, or to move to another state.
A sample script is shown under "Example."
DONE
A successful termination of script interpre-
tation.
ERROR string
An unsuccessful termination of script inter-
pretation. The last message received from
the remote site is reported to you.
GOTO n
Continues processing in state n.
RECV string action
This action is performed if the given string
is received.
SEND string
Sends the given string to the remote system.
Any name enclosed in braces in the string is
taken to be an option reference and is
replaced by the value of that option. If
that option is not present in the list of
stanzas, you are prompted for its value using
the option name as the prompt. If a - (dash)
precedes the name within the braces, the
typed characters are not echoed. This is
handy for including passwords as parameters
in the script file without having them stored
on the system. Thus, script files can be
given parameters so that they can be used in
different connection stanzas and by different
users.
STATE n
Declares the beginning of state n.
TIMER n action
This action is performed if no expected
string is received in n seconds.
Talker Program
A talker program handles the work of moving data across a
connection. This program runs after a connection is
established. The default talker for the connect program
is atalk. You can override this and specify your own
talker program.
talker This is name of the program to run when the con-
nection is made. The conventions observed
between the connect program and the talker are
not complex: the connection is opened by the
program as file descriptor 3. The only flag
passed by connect to the talker program is:
-llockfile
Note: If the -l flag is present, the talker
must remove the named lockfile to make the port
available to other users.
flags This option passes flags (other than the above)
to the talker program. This option is valid
with both default or user-specified talkers.
Example
A typical script might be:
STATE 0 RECV User: GOTO 1
TIMER 10 ERROR "No login"
STATE 1 SEND "{myname}\n"
RECV Password: GOTO 2
RECV "Unknown:" ERROR "Name unknown"
TIMER 10 ERROR "No password msg"
STATE 2 SEND "{-mypass}\n"
RECV "$" DONE
RECV Invalid ERROR "Wrong password"
TIMER 20 ERROR "No prompt"
This script could be used for login to a remote RT PC
system. In this file, connect waits up to 10 seconds for
a "User:" prompt. When received, it sends the value of
the myname option from the control file or by prompt, as
the user name. It then waits for 10 seconds for the
"Password:" prompt, then it sends the value of mypass as
the password. The password is not echoed. It then waits
another 20 seconds for another prompt. At each stage, it
looks for messages that could occur if the given user
name or password is invalid. With more states, you can
write a script that tries several different user names
and types the necessary information to dial through a
port selector.
Files
/usr/lib/INnet/connect.con
$HOME/bin/connect.con
Related Information
In this book: "attributes," "ports," and "termio."
The connect and uucp commands in AIX Operating System
Commands Reference.
INmail/INnet/FTP.