Google
 

Trailing-Edge - PDP-10 Archives - SRI_NIC_PERM_SRC_3_19910112 - stanford/ftp/ftpdef.mac
There are no other files named ftpdef.mac in the archive.
;<FTP>FTPDEF.MAC.108, 18-Dec-84 13:29:15, Edit by SATZ
; Make more room for the CODE psect.
;<FTP>FTPDEF.MAC.106, 15-Oct-84 12:50:44, Edit by LOUGHEED
; Add operating system types that are new with TOPS-20 5.4 and 6.0
;<FTP>FTPDEF.MAC.105,  4-Sep-84 01:22:33, Edit by LOUGHEED
; Define F%ANON flag for SET ANONYMOUS-LOGIN command
;<FTP>FTPDEF.MAC.104, 31-Aug-84 15:26:31, Edit by SATZ
; Add .SDEFS vector so setting transfer defaults is now protocol dependent
;<FTP>FTPDEF.MAC.103, 25-Aug-84 14:16:46, Edit by LOUGHEED
; Add .QUOTE vector for QUOTE command
;<FTP>FTPDEF.MAC.102, 29-Jun-84 14:38:08, Edit by KRONJ
; Increase string lengths for Unix subdirectory insanity
;<FTP>FTPDEF.MAC.101, 31-Mar-84 17:45:11, Edit by LOUGHEED
; Define STANSW if not defined already
	UNIVERSAL FTPDEF -- Definitions common to FTP program modules

	;; Based on PUPDEF, definitions for the Pup FTP programs written
	;; by E. Taft, September 1975, Copyright 1979 by Xerox Corporation
	;;
	;; Copyright (C) 1984 Board of Trustees, Stanford University
	;; The information in this software is subject to change without
	;; notice and should not be construed as a commitment by Stanford
	;; University.  Stanford assumes no responsibility for the use or
	;; reliability of this software.

IFNDEF STANSW,<STANSW==:0>	; Default to no Stanford dependencies

; Standard Accumulator assignments

	F=:0			; Flags

	A=:1			; General scratch
	B=:2
	C=:3
	D=:4

	P1=:5			; Permanent -- saved by callees
	P2=:6

	V=:7			; Vector of protocol-dependant routines (FTP)
				; Service table index (PUPFSV)
	FX=:10			; Directory command flags (FTP)
				; Fork index of executing fork (PUPFSV)

	FP=:15			; Frame pointer for TRVARs
	CX=:16			; Scratch for MACSYM
	P=:17			; Stack

; PUPFSV server only accumulators
	PB=:11			; Pointer to packet buffer
	CNX=:12			; Connection table index

; FTP user only accumulators
	KF=:13			; KEEP flags for current command
	IOP=:14			; TAKE file JFN stack pointer
; Protocol-dependant routine vector offset definitions
; These routines must not mung any ACs without permission here.
; Unless specified otherwise they take no args and return +1.

.CLOSE==0			; Close connection (this, .OPEN change F%COPN)
.OPEN==1			; Open connection.  Returns +1/fail, +2/success
				; Called with HSTNUM/host number, HSTSTR/name
				; Should type an error message on failure
.LOGIN==2			; Log in.  Returns +1/failure, +2/success
				; Uses USRNAM,USRPSW,USRACT
				; Should call GETPSW if necessary
.CWDIR==3			; Connect to dir - same conventions as .LOGIN
				; Uses CONNAM,CONPSW
.CFLAG==4			; Set up flags for current connection
				; called when F%NCSM changes etc
.OPSYS==5			; Look up operating system (same args as .OPEN)
				; returns +1 always with A/operating sys num
.SEND==6			; Send file, JFN in A, plist in FILPRP
				; JFN is open, will be closed but not released
				; Returns +1/permanent failure, +2/success
				; Should take care of F%UPDA etc itself
				; but may call SNDCNF to help do so
.RECV==7			; Receive file, plist in FILPRP
				; Shd call RECFIL: +1/ignore, +2/Opened FILJFN
				; Should call TIMEIN just before receiving
				; Should call FILOUT when file is received
				; to close files, finish timing, etc.
				; Returns +1/always
.DELFL==10			; Delete file, plist in FILPRP (returns +1)
				; Should call DELCNF with updated plist
.PRINT==11			; Print file, JFN in FILJFN (may be wild)
.RENAM==12			; Rename file in FILPRP to string ptr in A
.DIREC==13			; Directory of files in FILPRP to jfn in A
				; Can call DIRPNT with FILPRP set (A unused)
				; Or if directories come as an unparsable
				; text stream, can merely copy output to A
				; (but if so should set L%HDR in FX).
.PARSK==14			; Parse socket in OPEN command
.UFTPM==15			; Protocol-dependant yoyo
.STAT==16			; Print status of connection
.QUOTE==17			; Quote server command, returns +1 always
.SDEFS==20			; Setup default transfer info based on opsys
	VECSIZ==:.SDEFS+1	; How many entries there are in the vector

DEFINE CHKVEC (LAB) <
	IF2,<IFN <.-LAB-VECSIZ>,<
		PRINTX % Vector length does not match expected length>>
>

; Operating system names - same as .HSxxx but shifted over for convenience
	OS.UNK==0		; Unknown
	OS.10X==1		; TENEX
	OS.ITS==2		; ITS
	OS.DEC==3		; TOPS-10
	OS.TIP==4		; TIP
	OS.MTP==5		; MTIP
	OS.ELF==6		; ELF
	OS.ANT==7		; ANTS
	OS.MLT==10		; MULTICS
	OS.T20==11		; TOPS-20
	OS.UNX==12		; UNIX
	OS.NET==13		; Network
	OS.FUZ==14		; Fuzzballs
	OS.VMS==15		; VMS
	OS.TAC==16		; TAC
	OS.DOS==17		; MS-DOS

	OS.MAX=OS.DOS		; Highest known OS number
; Macros

; For labels which may or may not be defined
DEFINE EXTN (NAM) <IFNDEF NAM,<EXTERN NAM>>

; Define abort macros for ^G aborts via ABTINT (FTP only)

; Fancy aborts (reentrant)

DEFINE SETABORT (ADDR) <	;; Warning: expands to more than 1 instr
	EXTN .SETAB		;; Make sure .SETAB is defined
	EXTN ABTLOC		;; and place to put aborts
	JSP CX,.SETAB		;; Do all setup except actual setting of ABTLOC
	XMOVEI CX,ADDR		;; Get address to set as abort location
	MOVEM CX,ABTLOC		;; Set as new abort
>

DEFINE CLRABORT <
	EXTN .CLRAB		;; Make sure .CLRAB is defined
	JSP CX,.CLRAB		;; Call routine to clear abort for us
>


; Simple aborts (not reentrant)

DEFINE ABTSET <
	EXTN ABTLOC		;; Make sure ABTLOC is defined
	SETOM ABTLOC		;; Set abort loc to something changed by ^G
>
DEFINE ABTSKIP <
	EXTN ABTLOC		;; Make sure ABTLOC is defined
	SKIPE ABTLOC		;; See if ABTSET abort was hit
>

; Timeouts based on abort system
DEFINE TMOSET (MSEC,LOC) <
	EXTN ABTCHN		;; Use abort channel

	SETABORT(LOC)		;; Set the abort
	MOVX A,<.FHSLF,,.TIMEL>	;; Elapsed msec timeout, interrupting self
	MOVX B,^D<MSEC>		;; How many mseconds to wait
	MOVX C,ABTCHN		;; On this channel
	TIMER%			;; Set timeout
	 FATAL <Couldn't set timeout interrupt>
>

; Clear timeout and abort
DEFINE TMOCLR <
	CLRTMO			;; No timeout interrupt
	CLRABORT		;; Abort is no longer set
>

; Just clear timeout (for start of abort routine)
DEFINE CLRTMO <
	MOVX A,<.FHSLF,,.TIMAL>	;; Removing all timeout interrupts
	TIMER%			;; Clear them
	 FATAL <Couldn't clear timeout interrupt>
>
; Flag assignments (accumulator F) for both PUPFSV and FTP

; LH flags are global in importance
	F%NSTO==1B0		; All right to use New-Store
	F%NCSM==1B1		; Don't use PUP checksumming
	F%PSET==1B2		; Property list has already been set up
	F%COPN==1B3		; A connection is open

; FTP only permanent flags
	F%ANON==1B5		; Use ANONYMOUS login if no default username
	F%ALTS==1B6		; Use alternate sockets for data connections
	F%NSMD==1B7		; No smart directories for TCP
	F%MUNG==1B10		; Mung headers for BKR
	F%UPDC==1B11		; Confirm updates and installs.
	F%DELC==1B12		; Confirm deletes.
	F%GETC==1B13		; Confirm gets.
	F%SENC==1B14		; Confirm sends.
	F%ALLC==F%UPDC!F%DELC!F%GETC!F%SENC
	F%INIC==F%ALLC
	F%QUIT==1B15		; Andy's fancy QUIT option
	F%STAT==1B16		; Gathering statistics.
	F%LOWR==1B17		; Lowercase UNIX filenames

; PUPFSV only permanent flags
	F%NLOG==1B13		; Not really logged in
	F%CTIM==1B14		; Need to check timers immediately
	F%CLOG==1B15		; Login parameters have been checked
	F%CACT==1B16		; Account has been checked
	F%CCON==1B17		; Connect parameters have been checked

; RH flags -- local, reset at start of each command
	F%ABTD==1B18		; Have already told user that command aborted
	; 1B19 free
	F%DSKF==1B20		; Current file is on disk
	F%TEMP==1B21		; Temporary flag
	F%STYO==1B22		; Suppress typeout (i.e. for TYPE, FANCY-QUIT)
	F%INDV==1B23		; Individual file parse for SEND
	F%NPRF==1B24		; "No" prefix in force
	F%UPDA==1B25		; Distinguish UPDATE/GET, INSTALL/SEND
	F%NCRF==1B26		; Need a CRLF in directory
	F%ABTC==1B27		; Abort COMND% input and restart command

; DIRECTORY command flags (must all be right half)
	L%TYPE==1B18		; List type and byte size
	L%SIZE==1B19		; List size (number of bytes)
	L%CDAT==1B20		; List creation date
	L%WDAT==1B21		; List write date
	L%RDAT==1B22		; List read date
	L%TIME==1B23		; List times as well as dates
	L%AUTH==1B24		; List author
	L%OUTF==1B25		; Output to file
	L%QUIT==1B26		; Abort subcommand loop
	L%OAUT==1B27		; List creator
	L%PROT==1B28		; List protection
	L%HELP==1B29		; Explain the directory command
	L%NO==1B30		; Negate an option
	L%HDR==1B31		; Header lines have been typed
	L%NDIR==1B32		; New directory name
	L%VERB==L%TYPE+L%SIZE+L%PROT+L%WDAT+L%RDAT+L%AUTH ; "Verbose" options
; Bits for the KEEP command

	K%VERS==1B18		; Keep generation of files
	K%AUTH==1B19		; Keep author fields
	K%PROT==1B20		; Keep protection
	K%RDAT==1B21		; Keep read-date
	K%WDAT==1B22		; Keep write-date
	K%CDAT==1B23		; Keep creation-date

	K%DATE==K%RDAT!K%CDAT!K%WDAT
	K%ALL==K%VERS!K%AUTH!K%PROT!K%DATE
	K%INIT==K%AUTH!K%PROT!K%DATE

DEFINE KFLAGS (MAC) <
	MAC GET,KF.GET		; KEEP on GET
	MAC RENAME,KF.REN	; KEEP on RENAME
	MAC SEND,KF.SND		; KEEP on SEND
>;KFLAGS

;TCP FTP flags
	T%NTIC==1B18		;Counter for network interrupts
	T%IMAG==1B19		;Image mode bit shuffling required
	T%NULL==1B20		;Receive side going to NUL:
	T%KJFN==1B21		;Keep local JFN after data transfer
	T%DISK==1B22		;Local file is on dsk
	T%PAGD==1B23		;Transfer is paged mode
	T%TEMP==1B24		;Temp flag used in mget
	T%SEND==1B25		;We are sending (else receiving)
	T%DOPN==1B26		;Flag to assure data conn opened
	T%HASH==1B27		;User wants hash marks every page
; Typeout modes (verbosity)

	VB.SRV==0		;Super-terse (server)
	VB.TRS==1		;Terse
	VB.NRM==2		;Normal
	VB.VRB==3		;Verbose
	VB.EVB==4		;Extra-verbose
	VB.DEB==5		;Debugging

DEFINE SKVERB (LVL) <		;;Skip if at least this verbose
	EXTN VRBSTY		;;Make sure verbosity declared
	MOVE CX,VRBSTY		;;Get verbosity
    IFN <LVL-VB.DEB>,<
	CAIL CX,LVL		;;Check against given level
	TXNE F,F%STYO		;;If typeout suppressed then never verbose
    >
    IFE <LVL-VB.DEB>,<CAIGE CX,LVL>
>

DEFINE SKTERS (LVL,%TG) <	;;Skip if less than this verbosity
	EXTN VRBSTY		;;Make sure verbosity declared
IFN <LVL-VB.DEB>,<JN F%STYO,F,%TG+1> ;;If typeout suppressed then always terse
	MOVE CX,VRBSTY		;;Get verbosity
	CAIL CX,LVL		;;Check against given level
%TG:!
>

DEFINE IFVERB (LVL,CODE) <	;;Do if at least this verbosity
	SKVERB LVL		;;Check verbosity
    IFNB <CODE>,<IFSKP. <CODE>>	;;Handle one-line case
    IFB <CODE>,<IFSKP.>		;;and multi-line case
>

DEFINE IFTERS (LVL,CODE) <	;;Do if less than this verbosity
	SKTERS LVL		;;Check verbosity
    IFNB <CODE>,<IFSKP. <CODE>>	;;Handle one-line case
    IFB <CODE>,<IFSKP.>		;;and multi-line case
>
Subttl Storage and Code Allocation Macros

;Define the beginning of a psect

DEFINE PBEGIN(PSECT,ORG)<
	.PSECT PSECT,ORG	;; Start the PSECT
B'PSECT::BLOCK 0		;; Define its start
	P'PSECT==:B'PSECT_-^D9	;; and the page it starts on
	.ENDPS PSECT		;; Stop adding symbols to this one
>

;Define the end of a psect

DEFINE PEND(PSECT),<
    IRP PSECT,<
	.PSECT PSECT		;; For each PSECT, select it
	Z'PSECT=:.-1		;; Find last location in the PSECT
	L'PSECT==:Z'PSECT_-^D9	;; Find how many words in the PSECT
	.ENDPS PSECT		;; Exit that PSECT
    >
>

;Unmap pages of a PSECT

DEFINE PCLEAR (PSECT,FORK) <
	EXTN P'PSECT		;; Define start of PSECT
	EXTN L'PSECT		;; and length of PSECT
	HRLZ B,FORK		;; Set up fork handle
	HRRI B,P'PSECT		;; Set up first fork page
	SETO A,			;; -1 for unmapping
	MOVX C,<PM%CNT!<1+L'PSECT-P'PSECT>> ;; Repeat count
	PMAP%			;; Unmap the pages
>
;Individual PSECT definitions

DEFINE SRVCD <
	.ENDPS
	.PSECT CODE		;;SERVER CODE
>

DEFINE LS(LOC,SIZE<1>) <
	.PSECT DATA
	LOC:: BLOCK SIZE	;;LOCAL STORAGE
	.ENDPS DATA

>

DEFINE LSP(LOC,SIZE<1>) <
	.PSECT DATPAG
	..SIZE==1000*SIZE
	LOC:: BLOCK ..SIZE	;;LOCAL PAGE STORAGE
	PURGE ..SIZE
	.ENDPS DATPAG
>

DEFINE GS(LOC,SIZE<1>) <
	.PSECT GDATA
	LOC:: BLOCK SIZE	;;GLOBAL STORAGE
	.ENDPS GDATA
>
DEFINE TTITLE (TT,STR) <	;; TITLE with extras
	TITLE TT'STR
	SEARCH MONSYM,MACSYM
	SALL
	.PSECT CODE
>

DEFINE PTITLE (NAME,STR) <	;; Like TTITLE but for the top-level module
	PBEGIN CODE,1000	;; Code starts at page 1
	PBEGIN GDATA,70000	;; Global data at page 70
	PBEGIN DATA,100000	;; Local data at page 100
	PBEGIN DATPAG,120000	;; Paged data at page 120

	TTITLE (NAME,STR)	;; Do normal startup for every module

EVEC::	JRST START		;; Make an entry vector
	JRST REENTR		;; And reentry
	BYTE (3)VWHO (9)VMAJOR (6)VMINOR (18)VEDIT
EVECL==:.-EVEC			;; Set entry vector length

DEFINE VERSTR (MAJ,MIN) <ASCIZ\MAJ'.'MIN\>
VERTXT::VERSTR(\VMAJOR,\VMINOR)	;; String of program version
				;; (the next three filled in by PUPLUD)
VERDAT::0			;; Date and time of compilation
VERWHO::BLOCK 10		;; User name of compiler
VERHST::BLOCK 10		;; Host name of site compiled on

SAVNAM::ASCIZ\NAME'.EXE\	;; What PUPLUD should save us as
PRGNAM::ASCIZ\NAME\		;; What we should tell the world we are

	.TEXT "NAME'/SAVE"	;; Save as appropriate name
	.TEXT "/HASHSIZE:12007"
 	.TEXT "/SYMSEG:PSECT:CODE" ;; Symbols and patch area go with code
	.REQUIRE SYS:MACREL	;; MACSYM support routines
>;DEFINE PTITLE

;FATAL - jacket for SCREWUP routine

DEFINE FATAL (STR) <
	EXTN SCREW		;; Make sure SCREW is defined
	CALL [ HRROI B,[ASCIZ\Fatal - STR\]
	       JRST SCREW ]
>

;JFATAL  - jacket for fatal errors after jsys calls

DEFINE JFATAL (STR<Unexpected JSYS error>) <
	EXTN SCREW		;; Make sure SCREW is defined
	ERCAL [ HRROI B,[ASCIZ\Fatal - STR\]
	       JRST SCREW ]
>
; Definitions needed to append items to a list and then extract
;  them all for assembly in a single place

DEFINE APPEND(DEF,ITEM) <
	DEFINE DEF(XX,MORE) <XX DEF,<ITEM,MORE>>
>
DEFINE EXPAND(DEF,OP) <
	DEFINE OPMAC(A,ITEM) <IRP ITEM <IFNB <ITEM>,<OP>>>
	DEF(OPMAC)
	PURGE OPMAC
>

DEFINE UUO(OP,DISP) <
	UUON==UUON+1
	OPDEF OP [<UUON>B8]
IFB <DISP>,<UUOS(APPEND,%'OP)>
IFNB <DISP>,<UUOS(APPEND,DISP)>
>

APPEND(UUOS)	;INIT DISPATCH LIST
UUON==0		;INIT UUO NUMBERS


; UUOs used in PUPSRV and FTP

	UUO UTYPE		; Type message on TTY
	UUO UWRITE		; Write message on arbitrary designator
	UUO UFTPM		; Send FTP command (protocol dependant)
	UUO UETYPE		; Like TYPE but ESOUT% instead of PSOUT%

; Macros to call the above UUOs

DEFINE TYPE(STRING) <UTYPE [ASCIZ \STRING\]>
DEFINE DTYPE(STRING) <UTYPE [ASCIZ STRING]>

DEFINE ETYPE(STRING,INS<NOP>) <UETYPE [ INS
					ASCIZ \STRING\ ]>

DEFINE WRITE(AC,STRING) <
	IFNB <STRING>,<UWRITE AC,[ASCIZ \STRING\]>
	IFB <STRING>,<UWRITE A,[ASCIZ \AC\]>
>

; MACRO definitions to save and restore lists of locations
DEFINE SAVE(LST)<
   IRP LST,<PUSH P,LST>		; Save stuff on stack
>

DEFINE RSTR(LST)<
   IRP LST,<POP P,LST>		; Recover stuff from stack
>

DEFINE ERNOP <ERJMP .+1>	; Ignore a JSYS error

DEFINE UPCASE(AC)<		; Make a character uppercase
	TRNE AC,100
	 TRZ AC,40
>

DEFINE MKPTR(AC)<		; Make sure we have a standard byte pointer
	TLC AC,-1
	TLCN AC,-1
	 HRLI AC,(POINT 7)
>

; Test if AC is a member of some set of halfwords
DEFINE INSET (AC,SET,ACT) <
	..ISET==-1			 ;; No saved yet
	IRP SET,<			 ;; For each member of the set
		..IST0==0		 ;; Set flag saying do it this time
		IFL ..ISET,<..ISET==SET	 ;; If no saved yet
			    ..IST0==1>	 ;; Then clear flag, save this one
		IFE ..IST0,<CAIE AC,..ISET
			     CAIN AC,SET
			      ACT	 ;; Else build cascaded test
			    ..ISET==-1>> ;; Clear saved set, now used
	IFGE ..ISET,<CAIN AC,..ISET	 ;; If we have a saved one left over
		      ACT>		 ;; Build a test for it
>
; FTP error message macros

DEFINE ERMSG (TEXT) <
	EXTN .ERMSG
	ETYPE <TEXT - %J>,<JRST .ERMSG>
>
DEFINE ERMSGX (TEXT) <
	EXTN .ERMSX
	ETYPE <TEXT>,<JRST .ERMSX>
>
DEFINE ERMSGB (TEXT) <
	EXTN .ERMSG
	ETYPE <TEXT>,<JRST .ERMSG>
>
DEFINE JERMSG (TEXT) <
	EXTN .ERMSJ
	ETYPE <TEXT>,<JRST .ERMSJ>
>
; PupFTP-related definitions common to server and user

; Herald for version reply
FTPVER==1			; Pup Protocol version implemented

USRSTL==^D119			; Maximum name/password/acct string lengths
NAMSTL==^D239			; Maximum name+ext (must be at least 160)
SFNSTL==USRSTL+4+NAMSTL+7	; Server-Filename string length

PQUOTE=="'"		; Quote character in property lists
CR==15			; Char defs
LF==12
FF==14
DEL==177
EOL==37			; Tenex EOL character (internal use only)


; FTP end-of-line conventions

EC.CR==0			; CR
EC.CRL==1			; CRLF
EC.TRN==2			; Transparent

; FTP Transfer types

; note that the transfer type can never be set to Tenex-Paged by the user or
; as a default transfer type.  The protocol-dependant routines are responsible
; for keeping a distinction (if desired) between TT.MEI and TT.PAG and
; updating FILPRP and DEFPRP accordingly.  For instance, in the Pup protocol,
; TT.MEI should be used only between computers with software up-to-date enough
; so that it can take advantage of the various MEIS data modes.  If either end
; cannot handle MEIS-Paged transfers P.TYPE will be changed to TT.PAG instead.

TT.UNS==0			; Unspecified
TT.TXT==1			; Text
TT.BIN==2			; Binary
TT.PAG==3			; Tenex-Paged
TT.DIR==4			; Directory (for DIRECTORY command only)
TT.MEI==5			; MEIS-Paged
TT.EBC==6			; EBCDIC
TT.IMG==7			; Image

; Transfer mode types

MD.ABK==0			; Auto-Block
MD.STR==1			; Stream
MD.BLK==2			; Block
MD.CMP==3			; Compressed

; MULTIPLE GET right half states
; left half is zero/ok, -1/host can't handle
MG.ON==0			; Always use MULTIPLE GET (default)
MG.OFF==1			; Never use MULTIPLE GET
MG.TMP==2			; Temporarily on for this command
MG.HEU==3			; Use heuristically if there are stars in name
MG.THE==4			; Temporarily on but normally heuristic

; Formats for printing ASCII or EBCDIC (ignored for the most part)

FM.UNS==0
FM.NPR==1			; Non-print
FM.TEL==2			; TELNET format effectors
FM.ASA==3			; Carriage Control (ASA)
SHXINT==^D10			; Type a "!" every 10 pages if not debugging

; Property list names and assignments
; Calls are of the form
;	X internal mnemonic , property name , storage
; The internal mnemonic must be 4 characters or less.
; Entries must be sorted alphabetically by property name.
; "Storage" is the maximum number of words needed to store
;  the property (default 1).
; Offsets in a property list are assigned to P.' mnemonic.
; Dispatches to process received properties are PP' mnemonic.

DEFINE PNAMES <
	X AUTH,<AUTHOR>,USRSTL/5+1
	X BYTE,<BYTE-SIZE>
	X CNAM,<CONNECT-NAME>
	X CPSW,<CONNECT-PASSWORD>,USRSTL/5+1
	X CDAT,<CREATION-DATE>
	X DEVI,<DEVICE>,USRSTL/5+1
	X DIRE,<DIRECTORY>,USRSTL/5+1
	X EOLC,<END-OF-LINE-CONVENTION>
	X GPRT,<GROUP-ACCESS>,0
	X MLBX,<MAILBOX>,0
	X NAMB,<NAME-BODY>,NAMSTL/5+1
	X OAUT,<ORIGINAL-AUTHOR>,USRSTL/5+1
	X OPRT,<OWNER-ACCESS>,0
	X PLOT,<PLOT-FILE>
	X PWDT,<PREVIOUS-WRITE-DATE>
	X PROT,<PUBLIC-ACCESS>
	X RDAT,<READ-DATE>
	X SNDR,<SENDER>,SFNSTL/5+1
	X SFIL,<SERVER-FILENAME>,SFNSTL/5+1
	X SIZE,<SIZE>
	X TFRM,<TCP-FORMAT>	;;Not just "FORMAT" in case seen in a Pup
	X TMOD,<TCP-MODE>	;;property list, might mean something else
	X TYPE,<TYPE>
	X UACC,<USER-ACCESS>,0
	X UACT,<USER-ACCOUNT>,USRSTL/5+2
	X UNAM,<USER-NAME>
	X UPSW,<USER-PASSWORD>,USRSTL/5+1
	X VERS,<VERSION>
	X WDAT,<WRITE-DATE>
	X XBYT,<XXX-BYTE-SIZE>	;;P.BYTE that we lyingly tell other end
	X XTYP,<XXX-TYPE>	;;Same for P.TYPE
>

; Assign offsets for individual properties in a property list

DEFINE X(SYM,NAME,SIZE<1>) <
	P.'SYM==PLSIZE
	PLSIZE==PLSIZE+SIZE
>
	PLSIZE==0

	PNAMES
; Mark type assignments
; Calls are of the form
;	XN internal mnemonic , mark type , name string , flags
; or	XS internal mnemonic , mark type , name string , flags
; The internal mnemonic must be 4 characters or less.
; Mark type must be octal.  Entries must be in order of Mark type.
; Mark types are assigned to MK' mnemonic.
; Dispatches to process received Marks are C.' mnemonic.
; The XS macro declares the Mark to have sub-codes.

; Flag assignments
;	B0			; Command has subcommands
	NFETCH==1B1		; Do not pre-fetch command text

DEFINE MARKS <
	XN RETR, 1,<Retrieve>
	XN STOR, 2,<Store>
	XS YES,  3,<Yes>
	XS NO,   4,<No>
	XN FILE, 5,<Here-is-file>,NFETCH
	XN EOC,  6,<End-of-command>,NFETCH
	XN COMM, 7,<Comment>
	XS VERS,10,<Version>
	XN NSTO,11,<New-store>
	XN DIR, 12,<Directory>
	XN PLST,13,<Here-is-property-list>
	XN YUSR,14,<You-are-user>
	XN ABOR,15,<Abort>
	XN DELE,16,<Delete>
	XN RENA,17,<Rename>
	XN SMAI,20,<Store-mail>
	XN RMAI,21,<Retrieve-mail>
	XN FMAI,22,<Flush-mail>
	XS MBEX,23,<Mailbox-exception>
>


; Assign the Mark type symbols

DEFINE XN(SYM,TYPE,NAME,FLAGS) <
	MK'SYM==TYPE
	NMARKS==NMARKS+1
>
DEFINE XS(SYM,TYPE,NAME,FLAGS) <
	MK'SYM==TYPE
	NMARKS==NMARKS+1
>

	NMARKS==0
	MARKS
; COMND% and TBLUK% table stuff

DEFINE KEY (CMD,VAL,FLG) <
	[ IFNB <FLG>,<CM%FW!FLG>
	  ASCIZ \CMD\ ] ,, VAL
>

DEFINE TABLE <			;; Begin command table.
	0			;; Filled in by next TEND
	..T==.			;; Used by next TEND
>

DEFINE TEND <			;; End command table.
	..U==.			;; Save current location
	RELOC ..T-1		;; Go back to head of table
	..U-..T,,..U-..T	;; Fill in first word of table
	RELOC ..U		;; Now return to end of table
>

; Set a prompt for command parsing
DEFINE PROMPT (LOC,AC<CX>) <
	EXTN CMDBLK		;; Make sure command block is defined
	HRROI AC,LOC
	MOVEM AC,CMDBLK+.CMRTY
>

; Output guide words.
DEFINE NOISE (TEXT) <
	EXTN .COMND		;; Make sure command parser is defined
	MOVEI B,[FLDDB. .CMNOI,,<-1,,[ASCIZ\TEXT\]>]
	CALL .COMND
	 ERMSG <Invalid guide word>
>
DEFINE NOISE2 (TEXT,ALT) <
	EXTN .COMND		;; Make sure command parser is defined
	MOVEI B,[FLDDB. .CMNOI,,<-1,,[ASCIZ\TEXT\]>,,,[
		 FLDDB. .CMNOI,,<-1,,[ASCIZ\ALT\]>]]
	CALL .COMND
	 ERMSG <Invalid guide word>
>
; Parameters

NFORKS==^D10			; Max # of inferior forks
NCONNS==^D100			; Max # of connections maintained

; All time parameters are in seconds
GCCINT==^D<30*60>		; Garbage-collect connection table interval
POLINT==^D30			; Poll interval (for top fork)
WDTINT==^D<5*60>		; Watchdog timer interval for inferiors

; Parameters and byte pointers defining the structure of a Packet Buffer (PB)

PBHEAD=:0			; Start of Pup Header (all the rest in PUPPAR)

; Declaration of all implemented services
; Macro call is:
;	X(name, socket, subroutine)

DEFINE SERVERS <
	X(FTP,3,FTPSRV)		; FTP server
	X(Mail,7,MALSRV)	; Mail server
>

DEFINE X(NAME,SOCKET,ROUTINE) <
	SV.'ROUTINE==NSERVS
	NSERVS==NSERVS+1
>
NSERVS==0
	SERVERS			; Count them

FEVSRV==NSERVS			; Index of first Event Report server
NEVSRV==5			; Max # event report servers suppoerted
NSERVS==NSERVS+NEVSRV		; Accumulate total number of servers

	END