Google
 

Trailing-Edge - PDP-10 Archives - bb-x130a-sb - dnet.mac
There are no other files named dnet.mac in the archive.
	TITLE DNET - Super-cheap node information program

	SEARCH MACTEN,UUOSYM,SCNMAC

	.REQUI REL:SCAN
	.TEXT "/LOCALS/SYMSEG:HIGH"
	SALL

;AC Definitions

	F==0

	T1==1
	T2==2
	T3==3
	T4==4

	P1==5
	P2==6
	P3==7
	P4==10

	N==P3
	C==P4

	P==17

	SUBTTL Miscellaneous definitions

;Take these out when we get the right UUOSYM

	.DNLKN==2		;List known nodes function
	.DNLAN==3		;List active nodes function

	OPDEF CALL [PUSHJ P,]
	OPDEF RET  [POPJ P,]
	OPDEF CALLRET [JRST]
	DEFINE RETSKP,<JRST .POPJ1>

	ND $HIGH,600K		;Start of high segment
	ND $PDLLEN,^D100	;Length of PDL

;Macros

DEFINE ERROR(PRE,TEXT),<
	JRST [	MOVEI T1,[ASCIZ/?DNT'PRE 'TEXT/]
		CALL .TSTRG##
		CALL .TCRLF##
		JRST DONE]
>

;Define high segment

	TWOSEG	$HIGH
	RELOC	$HIGH
	SUBTTL SCAN switch definitions

	DEFINE SWTCHS,<
	XLIST

	SN KNOWN,S.KNOWN,FS.NFS
	SN LINKS,S.LINK,FS.NFS
	SN SHORT,S.SHOR,FS.NFS

	LIST
	>

;Generate the switches

	DOSCAN DNTSW
	SUBTTL High segment data

;ISCAN block

.ISBLK:	IOWD 1,[SIXBIT/DNET/]
	XWD OFFSET,'DNT'
.ISBLS==.-.ISBLK
	EXP 0
	EXP 0
	XWD PROMPT,0
.ISBLL==.-.ISBLK

;TSCAN and OSCAN blocks

.TSBLK:
.OSBLK:	IOWD DNTSWL,DNTSWN
	XWD DNTSWD,DNTSWM
	XWD 0,DNTSWP
	EXP -1
	EXP 0
.OSBLL==.-.OSBLK
	XWD ALCIN,ALCOUT
	EXP 0
	EXP 0
.TSBLL==.-.TSBLK
	SUBTTL Volitile storage

	RELOC 0

BEGZER:
PDL:	BLOCK ^D100
	PDLLEN==.-PDL
OFFSET:	BLOCK 1
JOBFF:	BLOCK 1

FILSPC:	BLOCK .FXLEN		;Place for file spec (node name)

NODBLK:	BLOCK ^D500
	NODMAX==.-NODBLK-1

DNTBLK:	BLOCK	^D10
	DNTMAX==.-DNTBLK
ENDZER==.-1

S.FRST:
S.LINK:	BLOCK 1
S.KNOW: BLOCK 1
S.SHOR:	BLOCK 1
S.LAST==.-1

	RELOC			;Back to high segment
	SUBTTL Initializing code

START:	PORTAL .+2
	PORTAL .+2
	TDZA P1,P1
	MOVEI P1,1
	MOVEM P1,OFFSET
	MOVE T1,.JBFF
	MOVEM T1,JOBFF
	RESET
	SETZ F,			;Initialize the flags

RESTAR:	MOVE P,[IOWD PDLLEN,PDL] ;Set up the stack
	MOVE T1,[XWD .ISBLL,.ISBLK]
	CALL .ISCAN##		;Initialize SCAN
	SUBTTL Command loop

LOOP:	MOVE T1,[XWD BEGZER,BEGZER+1] ;Zero the volitile storage
	SETZM BEGZER
	BLT T1,ENDZER
	SETOM S.FRST		;Initialize SCAN switches
	MOVE T1,[XWD S.FRST,S.FRST+1]
	BLT T1,S.LAST

	MOVE T1,[XWD .TSBLL,.TSBLK] ;Get commands in traditional mode
	CALL .TSCAN##

	MOVE T1,[XWD .OSBLL,.OSBLK] ;Get switches from SWITCH.INI
	CALL .OSCAN##

	MOVE T1,[XWD .DNLAN,NODMAX] ;Assume ACTIVE
	SKIPL S.KNOW		;Did he want known?
	MOVE T1,[XWD .DNLKN,NODMAX] ;Yes, give it to him

	MOVEM T1,NODBLK
	MOVEI T1,NODBLK
	DNET. T1,
	 ERROR DLS,<DNET. for listing nodes failed>

	MOVEI P1,NODBLK+2	;Set up a pointer to names

	SKIPLE S.SHOR		;Did user type /SHORT?
	JRST NOTITL		;Yes, don't print title

	MOVEI T1,[ASCIZ/Node	Number		Hops	Cost	Delay	Links	Circuit/]
	CALL .TSTRG##		;Type out header
	CALL .TCRLF##
	CALL .TCRLF##

	SETZ P2,		;Initialize count of nodes

NOTITL:
NEXT:	SKIPN T1,(P1)		;Get the first name
	JRST DONE		;No more

	MOVEM T1,DNTBLK+1	;Stick it in block
	MOVE T1,[XWD .DNNDI,DNTMAX] ;Get node information function
	MOVEM T1,DNTBLK
	MOVEI T1,DNTBLK		;Point to the block
	DNET. T1,		;Find out the information
	 ERROR DNI,<DNET. for node information failed>

	HRRZ T1,DNTBLK+3	;Get the active link count
	SKIPLE S.LINK		;Did user say /LINKs or nothing?
	JUMPE T1,NOLOOK		;If there are no active links, punt

	MOVE T1,(P1)		;Get the name
	CALL .TSIXN##		;Type the name
	CALL .TTABC##		;Type the tab

	SKIPLE S.SHOR		;Did user type /SHORT?
	JRST NOPRI		;Yes, don't print anything else

	MOVE T1,DNTBLK+4	;Get the node number
	CALL .TDECW##		;Type the node number
	CALL .TTABC##
	CALL .TTABC##

	HLRZ T1,DNTBLK+2	;Get the hops
	ANDI T1,777
	CALL .TDECW##		;Type it out
	CALL .TTABC##

	HRRZ T1,DNTBLK+2	;Get RCH word again
	CALL .TDECW##		;Type it
	CALL .TTABC##

	HLRZ T1,DNTBLK+3	;Get the delay
	CALL .TDECW##		;Type it
	CALL .TTABC##

	HRRZ T1,DNTBLK+3	;Get the active link count
	CALL .TDECW##		;Type it
	CALL .TTABC##

;Now print the output circuit

	HLRZ T1,DNTBLK+5	;Get the device name

	SKIPN T1		;If it's zero, it's local
	JRST [MOVEI T1,[ASCIZ/local/]
	      CALL .TSTRG##
	      JRST NOCIRC]

	MOVE T1,[SIXBIT/???/
		 SIXBIT/DTE/
		 SIXBIT/KDP/](T1) ;Get the sixbit name
	CALL .TSIXN##		;Type it out
	MOVEI T1,"-"
	CALL .TCHAR##
	HRRZ T1,DNTBLK+5	;Get CONtroller and UNIt
	LSH T1,-^D9		;Position correctly for CONtroller (CPU)
	CALL .TDECW##
	MOVEI T1,"-"
	CALL .TCHAR##
	HRRZ T1,DNTBLK+5	;Get CONtroller and UNIt
	ANDI T1,777		;Just UNIt number
	CALL .TDECW##

NOCIRC:	CALL .TCRLF##		;Type the CR-LF
NOPRI:	AOJ P2,			;Increment total number of nodes

NOLOOK:	AOJA P1,NEXT		;Look at next name
DONE:	SKIPLE S.SHOR		;Did user type /SHORt?
	JRST [	CALL .TCRLF##	;Yes, type extra CRLF
		JRST DONE1]	; and finish

	MOVEI T1,[ASCIZ/
Total of /]
	CALL .TSTRG##
	MOVE T1,P2		;Get count of nodes
	CALL .TDECW##		;Type it
	MOVEI T1,[ASCIZ/ nodes.
/]
	CALL .TSTRG##

DONE1:	SKIPN OFFSET		;CCL entry?
	JRST LOOP		;No, ask again for command
	EXIT			;No more
	SUBTTL SCAN things

.HELPR::MOVEI T1,HLPTXT
	CALL .TSTRG##
	JRST DONE1

HLPTXT:	ASCIZ |
DNET returns information about DECnet nodes.  The following is a list
of the returned data with a small explaination of each.

Hops	The current number of nodes in the least cost path to that node.
Cost	The current cost of the least cost path to that node.
Delay	The current round-trip delay to that node.
Links	The number of links to that node currently in use.
Circuit	The circuit onto which to reach that node.

The switches are:

/LINKS	Just print nodes which have active links open to them.
/KNOWN	List all nodes known by Session Control (not necessarily reachable)
/SHORT	Just list the node names
|

ALCIN:
ALCOUT:	MOVEI T1,FILSPC
	MOVE T2,.FXLEN
	POPJ P,

PROMPT:	OUTSTR [ASCIZ/
DNET/]
	JUMPL T1,PRMPT1
	OUTCHR [">"]
	POPJ P,
PRMPT1:	OUTCHR ["#"]
	POPJ P,

	SUBTTL	End of DNET

	END START