;	.TITLE sclidat - Global data for SCLI
;	.IDENT /V123/

.REM |
*+	sclidat - Global data for SCLI

	File:sclidat.mac
	Version: V123
	Author:
	Last Edit: 16-DEC-1985 16:28:44 
	Last Update: 16-Dec-1985 16:50:27 
		     Changed passwords after RB left


	This is the global data definition module for SCLI. 
	Note that not all modules need include this module, 
	but that any accessing the global database should contain
	the following:
		.include /sclidat.mac/

*-
|


	.psect gdata,d,gbl,ovr
;
; this is an overlaid psect, so all copies (from modules which .include
; this file) will occupy one copy in core. 
;
.rem |
	Define the TT-record. There is one of these per protected port
 (tt). It is defined in terms of offsets. 
|
tt.num = 0	; port number (ttxx:)
tt.foo = 2	; foo-count (invalid commands rcvd)
tt.efn = 4	; efn used by MRKT for this tt
tt.flg = 6	; flags word 
	; flag word bits
	fl.mbl = 1	; 1-> this tt in mumble mode
	fl.pro = 2	; 1-> this tt's cli is SCLI
tt.uid = 10	; pointer to plaintext id of logged on user, or nil
tt.tot = 12	; accumulated foo  count (between logins)
ttsiz = 14	; size of tt record

; define command record, which contains info for each known command
; (password), or message (CLI /MES=xxxxxxxx) 
;
    

cm.rpl = 0	; pointer to reply string
cm.id = 2	; pointer to plain-text id string
cm.act = 4	; action integer
	; currently defined actions:
	ac.fai = 0	; illegal command
	ac.pas = 1	; valid password - let user into mcr
			; all command action numbers must be 
			; less than ac.mes!
	ac.mes = 2	; all higher or equal this are messages!
	ac.mai = 2	; maintenance mode
	ac.vrb = 3	; verbose mode on
	ac.qui = 4	; verbose mode off
	
cmdsiz = 6	; size of command record

;
; define the tt-table, containing one tt-rec per protected tt
;
	.macro deftt num,efn
; macro to define tt-record
	.word	num
	.word	0		; foo
	.word	efn
	.word	0		; flags word
	.word	0		; user id pointer
	.word	0		; accumulated foo
	numtt = numtt+1
	.even
	.endm

numtt = 0	; initialize, incremented by deftt
tttbl:
	deftt 32, 5	; dial in/out tt
	deftt 36, 6	; dial in/out tt
	.word 0		; mark end of table

; macro to define command table entries
	.macro defcmd rpl,id,act
	.word rpl
	.word id
	.word act
	.endm
;
; define the reply strings. Must be ASCIZ!
;
rpl0:	.ASCIZ /Get a grip!!!/
rpl1:	.ASCIZ /--->/
rpl2:	.ASCIZ /--->/
rpl3:	.ASCIZ /wrong, wrong, wrong!/
rpl4:	.ASCIZ /you are in a maze of twisty little passages, all alike/
rpl5:	.ASCIZ /what do you think this is? RSTS?/
rpl6:	.ASCIZ /there is no help for the wicked!/
rpl7:	.ASCIZ /Hi Jim, I recognize your typing./
rpl8:	.ASCIZ /Hi Pete, where have you been./
rpl9:	.ASCIZ /Hi Phil, what's up?/
rpl10:	.ASCIZ /Bonjour.  Ca va?/
; 
; define USER-ID's 
; 
; For real users, this is the plain-text ID. Not used for 
; bogus passwords, so don't bother with an ID string for them. 
; If you use 15 or less characters, the log message to Error Log
; will show up completely on /BR brief mode of Error Report.
;
id1:	.ASCIZ /Remote user 1/
id2:	.ASCIZ /Remote user 2/
id3:	.ASCIZ /Remote user 3/
id4:	.ASCIZ /Remote user 4/
	.even
;
; define the command table. There is a catchall entry (the first),
; followed by one entry for each known command or message. By custom
; the message entries are last, but this is not required.
cmdtbl:
cmd0:	defcmd  rpl0,0,ac.fai		; cmd0: is the required null entry
cmd1:	defcmd	rpl1,0,ac.fai
cmd2:	defcmd	rpl2,0,ac.fai
cmd3:	defcmd	rpl3,0, ac.fai
cmd4:	defcmd	rpl4,0, ac.fai
cmd5:	defcmd	rpl5,0, ac.fai	
cmd6:	defcmd	rpl6,0, ac.fai
cmd7:	defcmd	rpl7,id1,ac.pas
cmd8:	defcmd	rpl8,id2,ac.pas
cmd9:	defcmd	rpl9,id3,ac.pas
cmd10:	defcmd	rpl10,id4,ac.pas
; now the messages - 
mes1:	defcmd	rpl0,0, ac.mai		; maintenance mode
mes2:	defcmd	rpl0,0, ac.vrb		; verbose
mes3:	defcmd	rpl0,0, ac.qui		; quiet
maxcmd = .-cmdtbl	; compute maximum index allowed
	.word 0	; mark end of table

	.even
ctptr:	.word 	0		; pointer into command table
ttptr:	.word 	0		; pointer into tt table
ttnum:	.word	0		; tt number used for logging
flags:	.word	0		; global flags word
	gf.kil = 1	; 1->maintenance shutdown mode
	gf.vrb = 2	; 1->verbose logging (to co:)
			;    verbose logging turned on by /message
 
; define some more constants
maxfoo = 3		; trigger point for mumble-mode
mbltim = 2		; count for mumble timer
mbluni = 3		; units for mumble timer
				; 2 = seconds
				; 3 = minutes
	.even

	.sbttl SCLI MACROS

.rem |
	This section defines macros which are global to SCLI.
	Current macros are:

	1. DOLOG -- special call to LOG
		see module LOGMSG.MAC for required
		parameters for a given message


|


	.macro dolog,msg,args
	.if b msg
	.error must supply message number
	.mexit
	.endc
	$c = 1
	.irp	$t,<args>
	$c=$c+1
	.endm
	.if gt <$c-10.>
	.error  $c ; too many parameters!
	.mexit
	.iff
	.print  $c ; parameters supplied
	.endc
	jsr	r5, log
	.word	$c		; num  of arg
	.word	msg		; message number
	.irp	$t,<args>	
	.word	$t
	.endm
	.endm	; dolog

