;;; -*- Mode:LISP; Package:KERMIT; Ibase:8; Base:8; Readtable:T -*- ;1; Note that Ibase and Readtable are not known and are ignored on 3600. ;****************************************************************************** ; Copyright (c) 1984, 1985 by Lisp Machine Inc. ; Symbolics-specific portions Copyright (c) 1985 by Honeywell, Inc. ; Permission to copy all or part of this material is granted, provided ; that the copies are not made or distributed for resale, and the ; copyright notices and reference to the source file and the software ; distribution version appear, and that notice is given that copying is ; by permission of Lisp Machine Inc. LMI reserves for itself the ; sole commercial right to use any part of this KERMIT/H19-Emulator ; not covered by any Columbia University copyright. Inquiries concerning ; copyright should be directed to Mr. Damon Lawrence at (213) 642-1116. ; ; Version Information: ; LMKERMIT 1.0 -- Original LMI code, plus edit ;1; for 3600 port ; ; Authorship Information: ; Mark David (LMI) Original version, using KERMIT.C as a guide ; George Carrette (LMI) Various enhancements ; Mark Ahlstrom (Honeywell) Port to 3600 (edits marked with ";1;" comments) ; ; Author Addresses: ; George Carrette ARPANET: GJC at MIT-MC ; ; Mark Ahlstrom ARPANET: Ahlstrom at HI-Multics ; PHONE: (612) 887-4006 ; USMAIL: Honeywell MN09-1400 ; Computer Sciences Center ; 10701 Lyndale Avenue South ; Bloomington, MN 55420 ;****************************************************************************** ;;; Pre-initial release changes to this module... ;;; 6/21/85 Slight modification to prevent divide by zero in give-state-info, MLA ;;; KERMIT in LISP by Mark David at LMI ;;; this implementation is based on and closely resembles ;;; kermit for unix, written in c by columbia university. ;;; this file encodes the basic protocol for sending ;;; and receiving files to/from any other kermit. ;;; the two highest level functions, which are not ;;; however user functions, that are in this file are: ;;; SENDSW -- the send state table switcher and dispatcher ;;; RECSW -- the receive state table switcher and dispatcher ;;;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ;;; SOME POINTERS TO "KERMIT-" OTHER FILES: ;;;________________________________________ ;;; ;;; @@@ main: toplevel ;;;= ;;; main routine - parse command and options, set up the tty lines, ;;; and dispatch to the appropriate routine. ;;;= ;;; ;; (... ;;; ;; (make-serial-stream ...) ;;; ;;... ) ;;; ;;; ;;; FOR THE MAIN TOPLEVEL INTERFACE ROUTINES SEE THE FILE: ;;; "sys: kermit; window" and "sys: kermit; calls" ;;; ;;; the window file runs the window interface to kermit. upon ;;; selection of a routine on the command menu, a call is made ;;; to a top level function defined in calls. the calls ;;; file contains the top level calls as methods of the flavor ;;; kstate. a kstate instance has special instance variables ;;; corresponding to most of the specials declared here. ;;; ;;; there is a special variable called KSTATE bound to the current ;;; instance of kstate. Thus (funcall 'kstate ':send-files) is the ;;; form called when you mouse "Send" on the kermit command menu. ;;; thus, you must change the instance variables of a kstate ;;; flavor instance to affect the binding of the specials during ;;; execution of its methods. ;;; ;;; thus "reinitializing" is just evaluating the form ;;; (setq kstate (make-instance 'kstate)) ;;; ;;;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ;;; @@@ CONNECT ;;; ;;; connect with another kermit over an assigned tty line. ;;; some degree of terminal emulation is attempted. ;;; ;;; FOR THE Connect FUNCTION: ;;; ;;; SEE THE FILE: "sys:kermit; terminal" ;;;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ;;; @@@ SERVER (talk to one) ;;; ;;; Defined in calls, basically. ;;;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ;;; @@@ SERVER (be one) ;;; ;;; a login server interface is in "SYS: KERMIT; PS-TERMINAL" ;;; a KERMIT server is coded in "SYS: KERMIT; SERVER" ;;;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ;;; @@@ OPENNING FILE STUFF ;;; ;;; FOR THE OPENNING FILE STUFF, SEE THE FILE: ;;; ;;; "sys:kermit;open.lisp" ;;; ;;;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;basic KERMIT protocol: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (DECLARE (SPECIAL INTERACTION-PANE DEBUG-PANE STATUS-PANE)) ;;; @@@ SYMBOL DEFINITIONS ["'constants'"] ;;; actually should be initialized by making an instance of kstate (in the file ;;; calls) which calls the functions herein with these (mostly) as special ;;; instance variables. (DEFCONST *MAXPACKSIZ* #O136 "maximum packet size") (DEFCONST *SOH* 1 "start of header") (DEFCONST *CR* #O15 "ascii carriage return") (DEFCONST *DEL* #O177 "ascii delete (rubout)") (DEFCONST *ESCCHR* #\NETWORK "default escape char for Connect") (DEFCONST *MAXTRY* #O12 "times to retry a packet") (DEFCONST *MYQUOTE* #\# "Quote character I want to use to quote /"control characters/"") (DEFCONST *MYPAD* 0 "number of padding characters I require") (DEFCONST *MYPCHAR* 0 "char I will use as a padding char") (DEFCONST *MYEOL* #O15 "my kind of return char") ; LM's 215, which won't fit in 7 bits...? (DEFCONST *MYTIME* #O12 "seconds after which i should be timed out") (DEFCONST *MAXTIM* #O74 "maximum timeout interval in seconds") (DEFCONST *MINTIM* 2 "minimum timeout interval in seconds") (DEFCONST *CHECKSUM-TYPE* 1 "1 for one character checksum, 2 for 2-character. 3 not available.") (DEFCONST *TRUE* -1 "-1 = boolean constant true") (DEFCONST *FALSE* 0 "0 = boolean constant false") ;;; @@@global variables ;;; integers: (DEFVAR *RPSIZ* 0 "maximum receive packet size") (DEFVAR *SPSIZ* 0 "maximum send packet size") (DEFVAR *PAD* 0 "how much padding to send") (DEFVAR *TIMINT* 0 "timeout for foreign host on sends") (DEFVAR *REMOTE* NIL "t means we're a remote kermit") (DEFVAR *FILECOUNT* 0 "number of files left to send") (DEFVAR *SIZE* 0 "size of present data") (DEFVAR *PACKET-NUMBER* 0 "the packet number") (DEFVAR *NUMTRY* 0 "times this packet retried") (DEFVAR *OLDTRY* 0 "times previous packet retried") ;;; @@@ CHARACTERS: (DEFVAR *QUOTE* 0 "quote character in incoming data") (DEFVAR *STATE* 0 "present state of the machine") (DEFVAR *PADCHAR* 0 "padding character to send") (DEFVAR *EOL* #O15 "end-of-line character to send") (DEFVAR *ESCCHR* 0 "quote character in incoming data") (DEFVAR *EOF* 0 "character marking end of file") ;;; other data types: (DEFVAR BUFEMP-IGNORE-LINE-FEED NIL "Initially nil for each file, this tells bufemp whether to ignore the line feed or not at this point in the file over an entire file transfer.") (DEFVAR *FILNAMCNV* ':GENERIC ":GENERIC means do filename conversions to generic standards. ...others will be here some day...") (DEFVAR DATA-XFER-START-TIME :UNBOUND "Start time of this xfer") (DEFVAR *BYTECOUNT* :UNBOUND "Bytes sent during this xfer, roughly") (DEFVAR *FILE-CLOSING-DISPOSITION* ':ABORT "How to handle partially finished files, delete or just close?") (DEFVAR *SUCCESSFUL-TRANSACTIONS* () "a list of lists:(