C−Kermit Third−Party Communication Software

When phone number is specified, tip looks for an entry in the remote file of the form: tip −speed−entry to set the connection speed accordingly. When device is specified, tip attempts to open that device, but will do so using the access privileges of the user the user must have readwrite access to the device. tip interprets any character string beginning with the slash character as a device name. When establishing the connection, tip sends a connection message to the remote system. The default value for this message can be found in the remote file. When tip starts up, it reads commands from the file .tiprc in the users home directory. Some other UNIX commands that belong to this category are, for example, the Solaris−flavored commands ttymon and ttyadm for control of the serial lines, or the same purpose Linux−flavored commands mgetty or agetty.

24.3 Third−Party Communication Software

The existing gap in the full UNIX control of modems is partially filled with the third−party software. Most of this software is available across different UNIX flavors, sometimes free for an implementaion, and sometimes even distributed with the operating system itself. Popular programs of this type are, for example, minicom, C−kermit, ecu, pcommprocomm, or xcomm. We will briefly present the C−kermit program.

24.3.1 C−Kermit

Kermit is a family of file transfer, management, and communication software programs from Columbia University available for most computers and operating systems known as C−kermit. The version of Kermit for UNIX supports both serial connections direct or dialed and TCPIP connections. C−Kermit can be thought of as a user−friendly and powerful alternative to cu, tip, uucp, ftp, and telnet; a single package for both network and serial communications, offering automation, convenience, and language features not found in the other packages. It fully supports modem dialing, file transfer and management, terminal connection, character−set translation, and script programming. Together, C−Kermit, Kermit 95, MS−DOS Kermit, and IBM Mainframe Kermit offer a consistent and nearly universal approach to inter−computer communications. C−Kermit is Copyright C 1985, 1996 by the Trustees of Columbia University in the City of New York. The copyright notice must not be removed, altered, or obscured. C−Kermit is thoroughly documented in the book by Frank da Cruz and Christine M. Gianone, Digital Press, Second Edition, 1997. For serious users of C−Kermit, particularly those who plan to write C−Kermit script programs, this book is highly recommended. Book sales are the primary source of funding for the nonprofit Kermit Project. New features added since the most recent edition of the book was published are documented in the online file ckcker.upd. Hints, tips, limitations, and restrictions are listed in ckcker.bwr general C−Kermit and ckuker.bwr UNIX−specific; http link is www.columbia.edukermit. C−Kermit can be used in two modes: 595 Local mode when C−Kermit gives a terminal connection to the remote computer, using an actual terminal, emulator, or UNIX workstation terminal window or console driver for specific terminal emulation. 2. C−Kermit also has two types of commands: The familiar UNIX−style command−line options. 1. An interactive dialog with a prompt that provides a small but useful subset of C−Kermits features for terminal connection and file transfer, plus the ability to pipe files into or out of C−Kermit for transfer. It also provides an access to dialing, script programming, character−set translation, and in general, detailed control and display of all C−Kermits features. Interactive commands can also be collected into command files or macros. 2. The format of the command to start C−Kermit is: kermit [command−file] [options…] Among the options there is a group of so−called action options that require certain actions to be accomplished. If there are no action options on the command line, C−Kermit starts in interactive command mode: a greeting message and then the C−Kermit prompt. If the action options are specified on the command line, C−Kermit takes the indicated actions and then exits directly back to UNIX. Either way, C−Kermit executes the commands in its initialization file ckermit.ini usually located in the directory usrsharelibkermit, before it executes any other commands. An exception is when an alternative initialization is explicitly requested. C−Kermit is an extremely powerful and versatile program with many C−Kermit commands for: Program management • Connection establishment and release • Terminal connection • File transfer • File management • Clientserver operation • Script programming • Each of the listed command groups contain a decent number of C−Kermit commands; all together it enables the most sophisticated tasks to be successfully completed. It is common to specify C−Kermit commands with capital letters, and we will follow this convention. A large number of existing options can also be divided into: Action options of the type connect, sendreceive files, enterterminate server mode and similar • Setting options that specify in more detail different kermit parameters involved in the file transfer, connection procedure, and similar • Other options of the type skipalternate initialization, foreground, background, forced stay, explicit interactive, remote, or debug mode, etc. • For a better understanding of how C−Kermit works, lets see the most common scenario for C−Kermit file transfer between two directly connected computers, identified here as local and remote computer. The file transfer is slightly different over the network. Although other methods are 596 Start C−Kermit on the local computer and establish a connection to the remote computer. Use the sequence: SET MODEM TYPE modem−name ♦ SET LINE device−name ♦ SET SPEED bits−per−second ♦ DIAL phone−number if you are dialing. ♦ SET NETWORK network−type and SET HOST host−name−or−address for network connections. ♦ • Set any other necessary communication parameters, such as PARITY, DUPLEX, and FLOW−CONTROL. • Give the CONNECT command. • Log in to the remote computer. • Start C−Kermit on the remote computer, give any desired SET commands for the file, communication, or protocol−related parameters. If a transfer of binary files is supposed, on the transmitting side SET FILE TYPE BINARY to the C−Kermit program. • To transfer a file or file group, give the local C−Kermit a SEND command, followed by a filename or wildcard file specification, for example: send filename.txt send one file ♦ send filename. send a group of files ♦ • To receive a file or files, give the remote C−Kermit a RECEIVE command. The sending and receiving C−Kermit will exchange name and other attributes of each file. • Escape back to the C−Kermit program on the local computer to get a local Kermit programs prompt. • To transfer binary files, give the command SET FILE TYPE BINARY to the Kermit program that is sending the files. • To receive files, tell the local C−Kermit program to RECEIVE; to transfer files tell the local C−Kermit program to SEND, specifying a filename or wildcard file specification. In other words, tell the C−Kermit program what to do first, SEND or RECEIVE, then escape back to the local C−Kermit and give it the opposite command, RECEIVE or SEND. • When the transfer is complete, give a CONNECT command to talk to C−Kermit on the remote computer again. Type EXIT to get back to the command prompt on the remote computer. When everything is done, log out and then if necessary escape back to Kermit on the local computer. Then another connection could be made, or EXIT from the local C−Kermit program. • C−Kermits file transfer protocol defaults are deliberately conservative, resulting in file transfer that almost always works, but might be somewhat slow. To increase file transfer performance on computers and connections that permit it, use: SET RECEIVE PACKET−LENGTH to increase the packet length • SET WINDOW to increase the packet window size • SET PREFIXING to reduce the overhead of control−character prefixing • Alternatively, it is worth it to try the FAST command to enable all these performance options at once. Also on serial connections, use hardware flow control SET FLOW RTSCTS if available, rather than software XONXOFF flow control. Obviously, there are quite a number of steps that should be properly done for a successful output. It 597 Two examples how to use C−Kermit: Remote−mode example C−Kermit is on the far end — send the file filename.bin in the binary mode option −i using a window size of 4 option −v 4: kermit −v 4 −i −s filename.bin • Local−mode example C−Kermit makes the connection: kermit −l devtty0p0 −b 19200 −c −r −n This command takes following actions: Makes a 19200−bps direct connection through the device devtty0p0 ♦ Connects option −c to login ♦ Presumably starts a remote C−Kermit program and tells it to send a file ♦ Receives the file option −r ♦ Then connects back option −n to finish up and log out ♦ • For dialing out, specify a modem type, and use a different device name: kermit −m hayes −l devcul0p0 −b 2400 −c −r –n At the end lets see one quite complex real−life example. The task is to transfer data on a regular daily basis from a UNIX system to the bulletin−board site. The available resources are: 16−line modem pool modem server on the local area network and used by many users, and public telephone network. The UNIX system accesses the modem pool through the local area network. The solution presented here supposes: Data to be transferred are ready and saved in the file FileToGo. • A dynamic creation of the take−file that will reflect the actual environment and status of modem lines. • Invoke the C−Kermit program the file take−file is used for its initialization. • A file transfer from UNIX system to the bulletin−board site with a verbose message displaying. • The following script named bbkermit.ksh fully accomplishes this task. The command syntax is: sharelocalckermitbin bbkermit.ksh sharelocalckermitetcbbkermit.ini Assuming specified paths and filenames filenames are presented in bold, the script dynamically specifies the so−called take−file and then invokes C−Kermit program, which uses the so created take−file for its own initialization. The created take−file consists of two parts: Dynamic modem−pool−related portion created in the script 1. Static bulletin−board−specific portion specified in the passed file bbkermit.init 2. The presented script bbkermit.ksh, as well as bbkermit.ini file, corresponds to a specific C−Kermit implementation; however, they can be easily used as templates for many other similar implementations. Both are well commented and quite comprehensive. Please read them for more detailed information. 598 binksh This script modifies kermit take−file, and accomplishes the transfer of the file FileToGo to the bulletin−board site via 24−port modem−pool. The modified kermit take−file consists of two major part: modem−pool specific part dynamically specified within this script, and static site specific part specified in the file bbsite.ini, and passed as an argument to this script. To fully understand this script a basic knowledge of C−Kermit is supposed. All path and file names are arbitrary Define global variables CKERMIT=sharelocalc−kermitbinkermit C−Kermit executable ZMDIR=sharelocalzmodembin zmodem executables directory mpool=mpoolhost actual modem−pool host name user=modpool actual modem−pool user ID password=abc48fgh actual modem−pool password min_port= 2000 starting modem−pool port number max_port= 2024 ending modem−pool port number Define a usage statement function function show_usage { echo Usage: bbkermit.ksh takefile } Check usage if [ −lt 1 ]; then show_usage fi takefile=1 Check specified file if [ −f takefile ]; then echo Error: Cannot read file takefile exit 1 fi Create a temporary file that can only be read by the current user This file will keep final kermit take−file data TMPFILE=tmpbbkermit. touch TMPFILE chmod 600 TMPFILE Create the final take file for kermit dynamically The here document specifies a sequence of C−Kermit commands for the final kermit take−file cat EOF TMPFILE Start of the here document Setup the paths and macros for the zmodem executables All zmodem executables named sz, sb, sx, csz, csb and csx, as well as rz, rb, rx, crz, crb and crx reside in this directory define \t ZMDIR Setup send macro definitions define sz if = \vargc 1 end 1 {sz what files?}, − redirect \tcsz \1 \2 \3 \4 \5 \6 \7 \8 \9 define sb if = \vargc 1 end 1 {sb what files?}, − redirect \tcsb \1 \2 \3 \4 \5 \6 \7 \8 \9 define sx if = \vargc 1 end 1 {sx what file?}, − redirect \tcsx \1 \2 \3 \4 \5 \6 \7 Setup receive macro definitions 599 Define the starting modem−pool port number define \p min_port This is the reference starting point to acquire a free modem−pool port :ACQUIRE_MODEM Clear the line Only needed for multiple passes through this loop hangup Increment the port \p by one The real starting port is 2001 assign \p \Feval\p + 1 If weve tried all the ports and cant get in, then just exit if \p max_port exit 1 Attempt to connect to the specified port echo Attempting to connect on port \p telnet mpool \p If port is in use, then jump back up to :ACQUIRE_MODEM and try the next port if failure goto ACQUIRE_MODEM Log into modem−pool input 5 sername: if failure goto ACQUIRE_MODEM Enter userid and password output user\13 input 5 assword: if failure goto ACQUIRE_MODEM To prevent the appearance of the clear password in the take−file the password itself is previously saved in the kermit variable \w output \w\13 sleep 3 Check that modem is responding output AT\13 input 5 OK if failure goto ACQUIRE_MODEM EOF End of the here document Add the user specified take−file onto the end of the temporary file cat takefile TMPFILE if [ ? −ne 0 ]; then rm TMPFILE exit 1 fi Run kermit using TMPFILE as a final take−file. The password is define here, so that it wont show up in the temporary file. CKERMIT EOF define \w password take TMPFILE EOF Remove tempfile rm −f TMPFILE 600 cat bbsite.ini This file presents the second portion of the kermit initialization sequence that is dynamically created before the C−Kermit invocation and saved in the then created kermit take−file. It contains bulletin−board site specific data, cannot be copied as it is. The displayed syntax is C−Kermit specific. Phone number to dial output ATDT12125671234\13 The following sequence depends on the actual dialogue between this host and the bulletin−board site. Each input entry specifies the time to wait and the expected pattern to be received input 70 CONNECT if failure goto ACQUIRE_MODEM input 20 logon id: if failure goto ACQUIRE_MODEM Login ID – for zmodem TP002324 output TP002324\13 input 20 password: if failure goto ACQUIRE_MODEM No password on this account output \13 input 20 cmd if failure exit 1 zmodem production= 1224, test= 1299 output ADD ID=TP002324 BID=TESTING\13 input 20 seconds if failure exit 1 Change directory for file to send named FileToGo cd sharebulletin−boarddata Send the file with periodic fake key insertion Program sz to transmit the file is dynamically set sz −w16384 FileToGo if failure exit 2 input 50 cmd if failure exit 1 output LOGOFF\13 input 30 LOGOFF completed

24.4 Introduction to UUCP