Trailing-Edge
-
PDP-10 Archives
-
BB-H348C-RM_1982
-
swskit-v21/pmr/snolib.mac
There is 1 other file named snolib.mac in the archive. Click here to see a list.
SEARCH MONSYM,MACSYM
OPDEF ERJMP [JUMP 16,]
P==17
BUFF: BLOCK 30000 ;PAGE FOR DATA MOVEMENT
BUFFD: BLOCK 30000 ;DOWNSTREEAM INPUT
JFN: BLOCK 1 ;UPSTREAM JFN
JFN1: BLOCK 1 ;DOWNSTREAM JFN
FORK: BLOCK 1
SINRMX==30000*4 ;MAX SIZE OF BUFFER
;MACRO TO MAKE ENTRIES IN NSP ERROR TABLE
MAXMSG==^D50 ; Maximum number of NSP error messages
DEFINE NSPERR (CODE,TEXT,BASE<MSGTBL>),<
.ORG BASE+CODE
POINT 7,[ASCIZ\: TEXT\]
.ORG
>
MSGTBL: ;DECNET ERROR TEXT TABLE
REPEAT MAXMSG,<POINT 7,[ASCIZ\: Undefined NSP error\]> ;MAKE TABLE SPACE
; & UNDEFINED ENTRIES
NSPERR (.DCX0,<No special error>)
NSPERR (.DCX1,<Resource allocation failure>)
NSPERR (.DCX2,<Destination node does not exist>)
NSPERR (.DCX3,<Node shutting down>)
NSPERR (.DCX4,<Destination NRT process does not exist>)
NSPERR (.DCX5,<Invalid name field>)
NSPERR (.DCX9,<NRT server aborted link>)
NSPERR (.DCX11,<Undefined error>)
NSPERR (.DCX21,<CI with illegal destination address>)
NSPERR (.DCX24,<Flow control violation>)
NSPERR (.DCX32,<Too many connections to node>)
NSPERR (.DCX33,<Too many connections to destination NRT process>)
NSPERR (.DCX34,<Access not permitted>)
NSPERR (.DCX35,<Logical link services mismatch>)
NSPERR (.DCX36,<Invalid account>)
NSPERR (.DCX37,<Segment size too small>)
NSPERR (.DCX38,<Process aborted>)
NSPERR (.DCX39,<No path to destination node>)
NSPERR (.DCX40,<Link aborted due to data loss>)
NSPERR (.DCX41,<Destination logical link address does not exist>)
NSPERR (.DCX42,<Confirmation of disconnect initiate>)
NSPERR (.DCX43,<Image data field too long>)
;INIT routine called from SNOBOL main program
CASEER::HRRZ 1,@0(16) ;GET ROUTINE TO DO
JRST @[ INITER
GETNET
DONETN
DONETL](1)
INITER: RET
GETNET: MOVX 1,GJ%SHT
HRROI 2,[ASCIZ /SRV:123/] ;BECOME A SERVER
GTJFN
JRST RSKP ;FAIL!
MOVEM 1,JFN ;SAVE SERVER JFN
MOVE 2,[100000,,300000]
OPENF ;OPEN IT UP
ERJMP [MOVE 1,JFN
RLJFN ;RELEASE JFN
JFCL
SETZM JFN
JRST RSKP] ;AND GIVE UP
;NOW WAIT FOR SOMETHING TO DO
MOVNI 3,SINRMX
HRROI 2,BUFF
SINR ;WAIT FOR DATA
ERJMP [RESET
JRST RSKP] ;FAILURE
SETZM 3
IDPB 3,2 ;TIE OFF STRING
MOVX 3,1B6
ADDM 3,BUFF
MOVEI BUFF ;RETURN STRING
POPJ P, ;DO IT
;UTILITIES
ABOAL0: MOVE 1,JFN
MOVEI 2,2
BOUT ;INDICATE FAILURE
ERJMP ABOALL
MOVEI 2,"%"
BOUT
ERJMP ABOALL
HRRO 2,3(16) ;GET NAME WE ARE GOING TO
SETZM 3
SOUT ;OUTPUT IT
ERJMP ABOALL
HRROI 2,[ASCIZ / not reachable because /]
SOUT ;say so
ERJMP ABOALL
MOVE 1,JFN1
MOVEI 2,.MORLS
MTOPR
ERJMP ABOALL
MOVE 1,JFN
HRRZS 3
MOVE 2,MSGTBL(3)
SETZM 3
SOUTR
ERJMP ABOALL
CLOSF ; close it now
ERJMP ABOALL
ABOALL: SKIPN 1,JFN ;ANYTHING HERE?
JRST ABOALZ ;NO
TXO 1,CZ%ABT
CLOSF
JFCL
SETZM JFN
ABOALZ: SKIPN 1,JFN1
JRST RSKP
TXO 1,CZ%ABT
CLOSF
JFCL
SETZM JFN1
RSKP: AOS 0(17)
POPJ P, ;FAIL RETURN
OPNCOM: MOVX 1,GJ%SHT
HRRO 2,1(16) ;GET STRING POINTER
GTJFN ;OPEN THE LINE
POPJ P, ;ERROR
MOVEM 1,JFN1 ;SAVE OTHER SIDE OF THE LINK
MOVE 2,[100000,,300000]
OPENF
ERJMP[ SETZM 1
EXCH 1,JFN1
RLJFN
JFCL
POPJ P,]
JRST RSKP ;DID IT
;HERE IF WE ARE NOT THE LAST PASS THROUGH SERVER IN THE CHAIN.
;OPEN LINK TO NEXT SERVER INDICATED BY FIRST ARG AND PASS
;IT THE DATA INDICATED BY THE SECOND ARG.
DONETN::
PUSHJ P,OPNCOM
JRST ABOAL0
HRRO 2,2(16) ;GET STRING TO SEND
SETZM 3
MOVE 1,JFN1
SOUTR ;SEND IT TO OTHER GUY
ERJMP ABOAL0 ;ZAP ALL LINKS AND PROCEED
WAITM: MOVE 1,JFN1
HRROI 2,BUFF
MOVNI 3,SINRMX
SINR ;WAIT FOR REPLY
ERJMP ABOAL0 ;OOPS
SETZM 3
IDPB 3,2 ;TIE OFF STRING
;HAVE REPLY FROM OTHER SERVERS. PUT ON NAME WE DID AND SEND IT BACK
MOVE 4,[POINT 7,BUFF]
MOVE 1,JFN
ILDB 2,4
BOUT
ERJMP ABOALL
SOJG 2,FAIL ;IF FAILURE, DON'T ADD OUR NAME
HRRO 2,3(16) ;GET OUR NAME
SETZM 3
SOUT
ERJMP ABOALL
FAIL: MOVE 2,4
SOUTR ;SEND REST OF MESSAGE
ERJMP ABOALL
LDB 2,[POINT 7,BUFF,6]
JUMPE 2,WAITM
JRST DODATA ;READY TO DO DATA MOVING
;ENTRY IF WE ARE THE LAST IN LINE
DONETL::
PUSHJ P,OPNCOM ;DO OPEN
JRST ABOALL ;BAD
MOVEI 4,^D60 ;WAIT 30 SECS FOR THIS
WAITER: MOVEI 1,^D500 ;WAIT 1/2 SEC
DISMS
MOVE 1,JFN1 ;POLL CONNECTION
MOVEI 2,.MORLS
MTOPR ;GET STATUS
ERJMP ABOALL ;IF BOMBED, ERROR
TXNE 3,MO%CON ;NOW CONNECTED?
JRST YESCON
TXNE 3,MO%ABT!MO%SYN ;ABORTED?
JRST ZAPPED
SOJG 4,WAITER
JRST ABOALL
;LINK ACCEPTED IT HERE
YESCON: MOVE 1,JFN
MOVEI 2,1
BOUT
ERJMP ABOALL
HRRO 2,3(16)
SETZM 3
SOUTR ;SAY WE DID IT
ERJMP ABOALL
JRST DODATA
;LINK ABORTED IF HERE
ZAPPED: MOVE 1,JFN
MOVEI 2,2
BOUT
ERJMP ABOALL
MOVEI 2,"%"
BOUT
ERJMP ABOALL
HRRZ 4,3 ;SAVE REASON
HRRO 2,3(16)
SETZM 3
SOUT
ERJMP ABOALL
HRROI 2,[ASCIZ / not reachable because /]
SOUT
ERJMP ABOALL
MOVE 2,MSGTBL(4)
SOUTR
ERJMP ABOALL
MOVE 1,JFN
CLOSF ;NORMAL CLOSE
ERJMP ABOALL
SETZM JFN ;NOTHING HERE ANYMORE
SKIPN 1,JFN1 ;GET OTHER JFN
POPJ P, ;NONE HERE. STRANGE
TXO 1,CZ%ABT ;GET RID OF IT
CLOSF ;""
NOP ;HAS TO WORK
SETZM JFN1 ;NOTHING LEFT
POPJ P, ;DONE
;HERE WHEN READY TO MOVE DATA. CREATE ANOTHE FORK TO READ FROM
;DOWNSTEAM SIDE, AND READ FROM UPSTREAM SIDE HERE.
DODATA: MOVX 1,CR%MAP!CR%ST
HRRI 1,DWNSTM
CFORK ;CREATE AND START FORK
ERJMP ABOALL ;OOPS
MOVEM 1,FORK ;SAVE HANDLE
;START OF UPSTREAM CODE. READ UPSTREAM DATA AND WRITE DOWNSTREAM DATA
UPS: MOVE 1,JFN
MOVE 2,[POINT 8,BUFF]
MOVNI 3,SINRMX
SINR ;GET IT
ERJMP [MOVE 1,FORK
KFORK ;ZAP FORK
JRST ABOALL] ;AND DONE
ADDI 3,SINRMX ;COMPUTE BYTES TAKEN
MOVNS 3 ;GET NEG OF BYTES TAKEN
MOVE 1,JFN1
MOVE 2,[POINT 8,BUFF]
SOUTR ;WRITE IT
ERJMP [MOVE 1,FORK
KFORK
JRST ABOALL] ;DONE
JRST UPS ;DO IT AGAIN
DWNSTM: MOVE 1,JFN1
MOVE 2,[POINT 8,BUFFD]
MOVNI 3,SINRMX
SINR ;GET DATA
ERJMP ABOALL ;MAKE OTHER GUY SEE IT
ADDI 3,SINRMX
JUMPE 3,ABOALL ;IF EOF, DONE
MOVNS 3
MOVE 1,JFN
MOVE 2,[POINT 8,BUFFD]
SOUTR ;SEND IT UPSTREAM
ERJMP ABOALL
JRST DWNSTM ;AND GO ON
END