(DEFINE-FILE-INFO PACKAGE "INTERLISP" READTABLE "INTERLISP" BASE 10) (FILECREATED "25-Sep-91 13:23:32" |{PELE:MV:ENVOS}MEDLEY>ETHERBOOT.;2| 15353 changes to%: (VARS ETHERBOOTCOMS) previous date%: "13-Jul-88 17:04:37" |{PELE:MV:ENVOS}MEDLEY>ETHERBOOT.;1|) (* ; " Copyright (c) 1985, 1986, 1987, 1988, 1991 by Stanford University. All rights reserved. ") (PRETTYCOMPRINT ETHERBOOTCOMS) (RPAQQ ETHERBOOTCOMS ( (* ;; "Lisp-based Ethernet Boot server, requires ETHERRECORDS and EXPORTS.ALL to compile") (DECLARE%: EVAL@COMPILE DONTCOPY (FILES (LOADCOMP) ETHERRECORDS SPPDECLS)) (FNS ETHERBOOT SENDSIMPLEDATA SENDSPPDATA CACHE.BOOT.FILES) (VARS ETHERBOOTFILES BOOTREQUESTTYPES) (ADDVARS (BOOTFILEDIRECTORIES {CORE} {DSK}) (BOOTFILECACHETYPES DB GERM)) (INITVARS (BOOTFILECACHEDIRECTORY '{CORE})) (DECLARE%: DONTCOPY (RECORDS ETHERBOOTPACKET ETHERBOOTFILE BOOTREQUESTTYPE) (CONSTANTS (ETHERBOOTPACKETTYPE 9) (BOOTSERVERSOCKET 10) (SIMPLEREQUEST 1) (SIMPLEDATA 2) (SPPREQUEST 3))) (GLOBALVARS ETHERBOOTFILES BOOTREQUESTTYPES BOOTFILEDIRECTORIES BOOTFILECACHETYPES BOOTFILECACHEDIRECTORY))) (* ;; "Lisp-based Ethernet Boot server, requires ETHERRECORDS and EXPORTS.ALL to compile") (DECLARE%: EVAL@COMPILE DONTCOPY (FILESLOAD (LOADCOMP) ETHERRECORDS SPPDECLS) ) (DEFINEQ (ETHERBOOT [LAMBDA (LOGFILE) (* ; "Edited 13-Jul-88 17:03 by cdl") (DECLARE (SPECVARS . T)) (LET (XIP NSOCKET BOOTFILE BOOTSTREAM BOOTREQUESTTYPE FILENUMBER ETHERBOOTFILE) (DECLARE (SPECVARS . T)) (RESETLST [RESETSAVE NIL `(CLOSENSOCKET ,(SETQ NSOCKET (OPENNSOCKET BOOTSERVERSOCKET 'ACCEPT] [do (DISCARDXIPS NSOCKET) (if LOGFILE then (printout LOGFILE "Listening ..." T)) (RESETLST [RESETSAVE NIL `(RELEASE.XIP ,(SETQ XIP (GETXIP NSOCKET T] (if (SETQ BOOTREQUESTTYPE (FASSOC (with ETHERBOOTPACKET XIP ETHERBOOTREQUESTTYPE) BOOTREQUESTTYPES)) then (SETQ FILENUMBER (with ETHERBOOTPACKET XIP ETHERBOOTFILENUMBER)) (if [SETQ ETHERBOOTFILE (for BOOTFILE in ETHERBOOTFILES thereis (with ETHERBOOTFILE BOOTFILE (EQP BOOTFILENUMBER FILENUMBER] then (with ETHERBOOTFILE ETHERBOOTFILE (if LOGFILE then (printout LOGFILE (DATE) %, (with BOOTREQUESTTYPE BOOTREQUESTTYPE REQUESTDESCRIPTION) %, "Request for" %, BOOTFILEDESCRIPTION %, "from" %, (with XIP XIP XIPSOURCENSADDRESS) T)) (if (SETQ BOOTFILE (FINDFILE BOOTFILENAME NIL BOOTFILEDIRECTORIES)) then (RESETLST [RESETSAVE NIL `(CLOSEF? ,(SETQ BOOTSTREAM (OPENSTREAM BOOTFILE 'INPUT] (if LOGFILE then (printout LOGFILE "Opened" %, (FULLNAME BOOTSTREAM) T)) [NLSETQ (with XIP XIP (with BOOTREQUESTTYPE BOOTREQUESTTYPE (APPLY* REQUESTFN BOOTSTREAM XIP LOGFILE]) (if LOGFILE then (printout LOGFILE T "Closed" %, (FULLNAME BOOTSTREAM ) T)) elseif LOGFILE then (printout LOGFILE "Error, File Not Found:" %, BOOTFILENAME T))) elseif LOGFILE then (printout LOGFILE "Error, Unknown File Number:" %, FILENUMBER T)) elseif LOGFILE then (printout LOGFILE "Error, Unknown Request Type:" %, (with ETHERBOOTPACKET XIP ETHERBOOTREQUESTTYPE ) T)))])]) (SENDSIMPLEDATA [LAMBDA (BOOTSTREAM PACKET LOGFILE) (* ; "Edited 13-Jul-88 15:45 by cdl") (LET (SOCKET) (DECLARE (SPECVARS SOCKET)) (if LOGFILE then (printout LOGFILE "Packets")) (RESETLST [RESETSAVE NIL `(CLOSENSOCKET ,(SETQ SOCKET (OPENNSOCKET] (bind XIP (BYTECOUNT _ (GETFILEINFO BOOTSTREAM 'LENGTH)) for PACKETNUMBER to (ADD1 (GETFILEINFO BOOTSTREAM 'SIZE)) do (if LOGFILE then (printout LOGFILE %, PACKETNUMBER)) (SETQ XIP (with NSADDRESS (with XIP PACKET XIPSOURCENSADDRESS) (\FILLINXIP ETHERBOOTPACKETTYPE SOCKET NSHOSTNUMBER NSSOCKET NSNET))) (XIPAPPEND.WORD XIP SIMPLEDATA) (with ETHERBOOTPACKET PACKET (XIPAPPEND.WORD XIP ETHERBOOTBFNHI) (XIPAPPEND.WORD XIP ETHERBOOTBFNMID) (XIPAPPEND.WORD XIP ETHERBOOTBFNLOW)) (XIPAPPEND.WORD XIP PACKETNUMBER) (to BYTESPERPAGE as old BYTECOUNT by -1 until (ZEROP BYTECOUNT) do (XIPAPPEND.BYTE XIP (BIN BOOTSTREAM))) (SENDXIP SOCKET XIP) (BLOCK)))]) (SENDSPPDATA [LAMBDA (BOOTSTREAM PACKET LOGFILE) (* ; "Edited 13-Jul-88 16:56 by cdl") (DECLARE (SPECVARS . T)) (LET (INPUTSTREAM OUTPUTSTREAM) (DECLARE (SPECVARS . T)) (RESETLST [RESETSAVE NIL `(SPP.CLOSE ,(SETQ INPUTSTREAM (with NSADDRESS (with XIP PACKET XIPSOURCENSADDRESS ) (SPP.OPEN NSHOSTNUMBER NSSOCKET NIL NIL '(EOM.ON.FORCEOUTPUT T] (with SPPSTREAM (SETQ OUTPUTSTREAM (SPPOUTPUTSTREAM INPUTSTREAM)) (with SPPCON SPP.CONNECTION (* Switch to negotiated connection  id) (SETQ SPPDESTID (with ETHERBOOTPACKET PACKET ETHERBOOTSPPDESTID))) (* Send SYS packet to establish  (Dove fix)) (\SPP.SENDPKT SPP.CONNECTION (\SPP.SYSPKT SPP.CONNECTION 0))) (if LOGFILE then (printout LOGFILE "Packets")) (for PAGES to (SUB1 (GETFILEINFO BOOTSTREAM 'SIZE)) as COUNTER from 1 do (COPYBYTES BOOTSTREAM OUTPUTSTREAM BYTESPERPAGE) (FORCEOUTPUT OUTPUTSTREAM) (if LOGFILE then (if (GEQ COUNTER 10) then (SETQ COUNTER 0) (printout LOGFILE %, PAGES))) finally (COPYBYTES BOOTSTREAM OUTPUTSTREAM))) (if LOGFILE then (printout LOGFILE T "SPP Stream closed"]) (CACHE.BOOT.FILES [LAMBDA (TYPES) (* cdl "24-Sep-86 15:31") (bind FILE TOFILE for ETHERBOOTFILE in ETHERBOOTFILES do (with ETHERBOOTFILE ETHERBOOTFILE (if (AND (EQMEMB (U-CASE (FILENAMEFIELD BOOTFILENAME 'EXTENSION)) (OR TYPES BOOTFILECACHETYPES)) [NOT (INFILEP (SETQ TOFILE (PACKFILENAME 'NAME BOOTFILENAME 'DIRECTORY BOOTFILECACHEDIRECTORY ] (SETQ FILE (FINDFILE BOOTFILENAME NIL BOOTFILEDIRECTORIES))) then (COPYFILE FILE TOFILE) (PRINTOUT T FILE T]) ) (RPAQQ ETHERBOOTFILES (("Standard DLion Ethernet Initial Microcode" EtherInitial.db 2852126720) ("Standard DLion Diagnostic Microcode" MoonBoot.db 2852126728) ("Standard DLion Mesa Microcode" Mesa.db 2852126736) ("Standard DLion Germ" DLion.germ 2852126744) ("Standard DLion Boot File" SimpleNetExecDLion.boot 2852126752) ("Standard DLion Diagnostics Boot File" EIDiskDLion.boot 2852127232) ("Standard DLion Installer Boot File" InstallerNSDLion.boot 2852127234) ("Alternate DLion Ethernet Initial Microcode" EtherInitialAlt.db 2852126721) ("Alternate DLion Mesa Microcode" Mesa.db 2852126738) ("Alternate DLion Germ" DLion.germ 2852126746) ("Alternate DLion Boot File" InstallerNSDLion.boot 2852126754) ("Standard TriDLion Diagnostic Microcode" Moonboot.db 2852126729) ("Standard TriDLion Mesa Microcode" TridentRavenMesa.db 2852126737) ("Standard TriDLion Germ" TriDlion.germ 2852126745) ("Standard TriDLion Boot File" SimpleNetExecTriDlion.boot 2852126753) ("Alternate TriDLion Mesa Microcode" TridentRavenMesa.db 2852126739) ("Alternate TriDLion Germ" TriDlion.germ 2852126747) ("Alternate TriDLion Boot File" InstallerNSTriDlion.boot 2852126753) ("Standard Dove Ethernet Initial Microcode" EtherInitialDove.db 2852128768) ("Standard Dove Diagnostic Microcode" MoonRise.db 2852128776) ("Standard Dove Mesa Microcode" MesaDove.db 2852128784) ("Standard Dove Germ" Dove.germ 2852128792) ("Standard Dove Boot File" SimpleNetExecDove.boot 2852128800) ("Alternate Dove Ethernet Initial Microcode" EtherInitialDove.db 2852128769) ("Alternate Dove Diagnostic Microcode" MoonRise.db 2852128777) ("Alternate Dove Mesa Microcode" MesaDove.db 2852128785) ("Alternate Dove Germ" Dove.germ 2852128793) ("Alternate Dove Boot File" InstallerNSDove.boot 2852128801) ("Dove Simple Net Exec" SimpleNetExecDove.boot 2852128824) ("Dove Configuration Utility" SysConfigOfflineDove.boot 2852128825) ("Dove Installer" InstallerNSDove.boot 2852128826) ("Dove Diagnostics Utility" DiagDiskUtilDove.boot 2852128828) ("Dove Rigid Disk Diagnostics Utility" DiagRDDove.boot 2852128829) ("Dove Ethernet Diagnostics Utility" DiagEtherDove.boot 2852128830) ("Dove Keyboard & Display Diagnostics Utility" KDMDove.boot 2852128831))) (RPAQQ BOOTREQUESTTYPES ((1 Simple SENDSIMPLEDATA) (3 SPP SENDSPPDATA))) (ADDTOVAR BOOTFILEDIRECTORIES {CORE} {DSK}) (ADDTOVAR BOOTFILECACHETYPES DB GERM) (RPAQ? BOOTFILECACHEDIRECTORY '{CORE}) (DECLARE%: DONTCOPY (DECLARE%: EVAL@COMPILE (ACCESSFNS ETHERBOOTPACKET [(ETHERBOOTBASE (with XIP DATUM XIPCONTENTS)) (ETHERBOOTFILENUMBER (with ETHERBOOTPACKET DATUM (PLUS (LSH ETHERBOOTBFNHI 32) (LSH ETHERBOOTBFNMID 16) ETHERBOOTBFNLOW] (BLOCKRECORD ETHERBOOTBASE ((ETHERBOOTREQUESTTYPE WORD) (ETHERBOOTBFNHI WORD) (ETHERBOOTBFNMID WORD) (ETHERBOOTBFNLOW WORD) (ETHERBOOTSPPDESTID WORD)))) (RECORD ETHERBOOTFILE (BOOTFILEDESCRIPTION BOOTFILENAME BOOTFILENUMBER)) (RECORD BOOTREQUESTTYPE (REQUESTTYPE REQUESTDESCRIPTION REQUESTFN)) ) (DECLARE%: EVAL@COMPILE (RPAQQ ETHERBOOTPACKETTYPE 9) (RPAQQ BOOTSERVERSOCKET 10) (RPAQQ SIMPLEREQUEST 1) (RPAQQ SIMPLEDATA 2) (RPAQQ SPPREQUEST 3) (CONSTANTS (ETHERBOOTPACKETTYPE 9) (BOOTSERVERSOCKET 10) (SIMPLEREQUEST 1) (SIMPLEDATA 2) (SPPREQUEST 3)) ) ) (DECLARE%: DOEVAL@COMPILE DONTCOPY (GLOBALVARS ETHERBOOTFILES BOOTREQUESTTYPES BOOTFILEDIRECTORIES BOOTFILECACHETYPES BOOTFILECACHEDIRECTORY) ) (PUTPROPS ETHERBOOT COPYRIGHT ("Stanford University" 1985 1986 1987 1988 1991)) (DECLARE%: DONTCOPY (FILEMAP (NIL (1585 11003 (ETHERBOOT 1595 . 6049) (SENDSIMPLEDATA 6051 . 7503) (SENDSPPDATA 7505 . 9712) (CACHE.BOOT.FILES 9714 . 11001))))) STOP