UNIVERSAL SNDDEF - Definitions for Stanford SNDSRV terminal messages
	SUBTTL David Eppstein/DE/KSL/MRC/WHP4

	SEARCH MONSYM,MACSYM

	COMMENT	\

		    Format of IPCF pages used by SNDSRV
		    ===================================

SN$HDR	On write contains SIXBIT function type.  Currently defined types:
		SNDALL - send to all logged in users
		SNDLIN - send to a specific line
		SNDUSR - send to all logged in jobs of a specific user
		SNDSTA - send statistics back to requestor
	On read, contains -1 if an error was encountered, zero otherwise.

SN$DAT	Contains a line number or usernumber as appropriate.

SN$FLG	Format flags specified by the requestor.  Currently defined flags:
		T%HDR  - the header has already been made, don't make another
		T%RSYS - obey REFUSE SYSTEM even if caller is a wheel
		(T%USER and T%RAFT defined but ignored by SNDSRV)

SN$ERR	On read contains an error code

SN$STR	On read contains the first word of a short ASCIZ error string
	corresponding to the error code in SN$ERR

SN$TTY	Unused on write.  On read, this word contains the number of ttys
	the server attempted to send messages too.  Succeeding words are
	of the form <state,,line number>, where state is one of
		-1  user was refusing messages
		 0  message was successfully send
		+1  a timeout occured (the SOUT% was blocked too long)
		+2  the line was inactive (the SOUT% failed)

SN$MSG	The user's message (an ASCIZ string) starts at this location.

\

; Offsets and flags

	SN$HDR==0		;SIXBIT function name
	SN$DAT==1		;Data for function
	SN$FLG==2		;User flags
	SN$ERR==3		;Error code, if any
	SN$STR==4		;Error string, if any
	SN$TTY==20		;TTY list header
	SN$MSG==100		;Start of user message


; Format flags specified in SN$FLG by current requestor

	T%USER==1B0		;Turn on "user program" features:
				;if recipient has multiple tty type status
	T%RAFT==1B1		;Obey REFUSE SYS after this message
				;(used by $SEND, ignored by SNDSRV)
	T%HDR==1B2		;Header already supplied, don't make another
	T%RSYS==1B3		;Obey REFUSE SYS always

; Error codes and strings returned in SN$ERR and SN$STR

DEFINE SNDERRS <
	X 000,TTXIEC,<SNDSRV confused!  Unknown error code>
	X 001,TTXCAP,<WHEEL or OPERATOR capabilities required>
	X 002,TTXUNK,<Unknown function code>
	X 003,TTXDET,<User has detached jobs only, use MAIL>
	X 004,TTXNLG,<User is not logged in, use MAIL>
	X 005,TTXUIR,<Unable to identify requesting job>
	X 006,TTXLNG,<Message too long to send>
	X 007,TTXREF,<User refusing messages>
	X 010,TTXIMP,<Function not yet implemented>
	X 011,TTXTIM,<Unable to send message, server timed out>
	X 012,TTXNSU,<No such user>
	X 013,TTXUSM,<Unable to send message>
	X 014,TTXNST,<No such terminal>
	X 015,TTXFIL,<Message sent, but could not append to sends file>
	X 016,TTXNBD,<Nobody logged in>
	X 017,TTXACT,<Receiving terminal is not in use>
	X 020,TTXNLI,<Must be logged in to do that>
	X 021,TTXBAT,<Can't send to a batch job>
	X 022,TTXIPC,<Failure in local send>
	X 023,TTXNET,<Failure in net send>
>


DEFINE X (VALUE,SYMBOL,STRING) <
	SYMBOL==VALUE
	IFG <VALUE-MAXTTX>,<MAXTTX==VALUE>
>
	MAXTTX==0
	SNDERRS			;Define values for each symbol

; Storage parameters shared by SEND/SNDSRV
	
	MAXCHR==^D3000		;Maximum number of characters that can be sent

; Definitions for SNDMSG subroutine package

	RC%TYP==.LHALF		;Type of recipient
	RC%NXT==.RHALF		;Next link in recipient chain

	RC.TTY==0		;Send to terminal (must be 0)
	RC.USR==1		;Send to local user
	RC.ALL==2		;Send to all local logged-in users
	RC.NET==3		;Send to a net user

	.SDPID==0		;Offset in argument block for sender PID
	.SDFLG==1		;Flags for IP$FLG
	.SDTCC==2		;Interrupt channel for TCP interrupt

; Useful macros

DEFINE MKPTR (AC) <		;;Turn HRROI pointer into the real thing
	TLC AC,-1
	TLCN AC,-1
	 HRLI AC,(POINT 7,)
>

	END