Trailing-Edge
-
PDP-10 Archives
-
BB-R598A-RM_1983
-
swskit-v3/nvt/net20.bas
There is 1 other file named net20.bas in the archive. Click here to see a list.
2! PROGRAM : NET20.BAS
5! VERSION : Y2.0
6! EDIT : 02
7! EDIT DATE : 05-MAR-80
10 EXTEND
11 ! &
&
&
! C O P Y R I G H T &
&
&
! Copyright (C) 1978, 1979 by &
! Digital Equipment Corporation, Maynard, Mass. &
! &
! &
! This software is furnished under a license and may be used and &
! copied only in accordance with the terms of such license and &
! with the inclusion of the above copyright notice. This &
! software or any other copies thereof may not be provided or &
! otherwise made available to any other person. No title to and &
! ownership of the software is hereby transferred. &
! &
! The information in this software is subject to change without &
! notice and should not be construed as a commitment by Digital &
! Equipment Corporation. &
! &
! DIGITAL assumes no responsibility for the use or reliability &
! of its software on equipment that is not supplied by DIGITAL. &
! &
!******************************************************************* &
20 ! &
&
&
! M O D I F I C A T I O N H I S T O R Y &
&
21! VER/ED EDIT DATE REASON &
! &
100 ! &
&
! G E N E R A L D E S C R I P T I O N &
&
&
&
110! NET'S PURPOSE IS TO ALLOW A USER ON ONE SYSTEM TO &
! CONNECT HIS/HER TERMINAL TO ANOUTHER SYSTEM AND DO &
! WORK THERE. &
300 ! &
&
&
! I / O C H A N N E L S &
&
301! CHANNEL # USED FOR &
! 1 KB INPUT &
! 2 RECEIVED MESSAGES (NL:) &
! 3 KB OUTPUT &
&
400 ! &
! &
! V A R I A B L E D E F I N I T I O N S &
! &
401 ! &
! BAD.READ% FLAGS IF DID RECEIVE AND DID NOT GET MESSAGE. &
! BELLS$ 3 BELL CHAR FOR RINGING BELLS &
! BIT%(15) VECTOR OF BIT FOR ANDs/ORs (BIT%(I%) = 2%^I%) &
! C% &
! C$ &
! CCL% USED TO PARSE CORE COMMON &
! CCL$ USED TO PARSE CORE COMMON &
! CDB.ACC.DAT% FLAG TRUE IF ACCOUNTING DATA FOUND IN NETACT &
! CHR0$ CHR$(0%) &
! CMD$ USED TO READ COMMANDS FROM KB: &
! CNTR.C% CHR$(3%) &
! CR% CHR$(13%) &
! DC% USED IN PARSE OF CCL WHEN LOOKING FOR "::" &
! DEBUG% FLAG USED TO NOT EXIT WHEN DEBUGGING &
! E% HOLDS LAST ERR &
! E1% HOLDS LAST ERL &
! ECHO$ USED TO TURN ECHO ON AND OFF &
! EOL% LOCATION OF TERMINATOR IN INPUT LINE &
! ERRMSG$ CI ERROR MESSAGE &
! ESC% CHR$(27%) AN ESCAPE &
! ESC.MCH% FLAG = TRUE IF ESCAPE CHAR FOUND IN INPUT &
! ESC.MCH$ THE ESCAPE CHAR &
! FALSE% NOT(TRUE%) &
! FF% &
! FLAG% &
! I% &
! I$ &
! KB.BUFF$ USED TO FIELD KB INPUT BUFFER &
! KB.BUFF%(512) USED TO LOOK AT KB INPUT BUFFER &
! KB.CNT% COUNT OF DATA IN KB INPUT BUFFER NOT SENT &
! KB.MODE% THE MODE THE KB IS OPEN IN &
! L% &
! L.P.N$ LOCAL PROCESS NAME FOR CDB &
! LF% LINE FEED &
! LINK.ACT% FLAG IF LINK ACTIVE BEFORE SENDING CONFIG &
! LINK.UP% FLAG IF LINK ACTIVE AFTER SENDING CONFIG &
! MSG.LEN% LENGTH OF MESSAGE TO SEND USED IN SEGMENTATION &
! ROUTINE. &
! MY.NAME$ "NWTT"+JOB NUMBER FOR DECLARE RECEIVER &
! N.ERR$ NETWORK ERROR CODE FOR LOOK UP OF TEXT &
! N.N$ &
! NFN.JOB% NETFNC RETURNED MY JOB NUMBER &
! NFN.LCL.NOD$ NETFNC RETURNED THE LOCAL NODE NAME &
! NFN.LEN% NETFNC RETURNED LENGTH OF RECEIVE &
&
410 ! NFN.Z%( ) NETFNC SCRATCH VECTOR &
! NODE.NAME% LENGTH OF NODE NAME CONNECTING TO &
! NODE.NAME$ FIRST NODE NAME CONNECTING TO &
! NODEID$ &
! NPK.OBJ% THE OBJTYPE TO CONNECT TO 23 OR 123 &
! ODT% FLAG IF IN ODT MODE &
! ODT$ USED TO SET ODT MODE &
! PMR% LEN OF POOR MANS ROUTING STRING &
! PMR$ POOR MANS ROUTING STRING &
! PMR.ACK$ POORMANS ROUTING ACK OF LINK UP &
! Q.BLK% FNNODE.. BLOCK NUMBER &
! Q.CH% FNNODE.. CHAN &
! Q.ERR% FNNERR ERROR NUMBER TO GET TEXT FOR &
! Q.ERR$ FNNERR RETURNED TEXT &
! Q.INFO$ FNNODE.. &
! Q.INFO%(50) FNNODE.. &
! Q.JUNK$ FNNODE.. &
! Q.LEN0% FNNODE.. &
! Q.LEN1% FNNODE.. &
! Q.LEN2% FNNODE.. &
! Q.LEN3% FNNODE.. &
! Q.NDX% FNNODE.. &
! Q.NODE$ FNNODE.. &
! Q.OFF% FNNODE.. &
! Q.WHERE$ FNNODE.. &
! Q1$ FNNODE.. &
! Q2$ FNNODE.. &
! Q3$ FNNODE.. &
! R.D% LENGTH OF MESSAGE BEING RECEIVED NOW &
! R.D$ THE LAST HUNK OF THE MESSAGE RECEIVED &
! R.P.N$ REMOTE PROCESS NAME FOR CDB &
! REMOTE.ECHO% FLAG FOR WHO IS ECHOING &
! REST$ &
! S$ &
! S.T% &
! S1$ &
! S2$ &
! SEND.MAX% MAX SEG SIZE I CAN SEND &
! SENT% AMOUNT SENT FOR SEGMENTATION ROUTINE &
! SLPTIM% AMOUNT OF TIME TO SLEEP &
! T$ &
! TARGET.NODE$ THE YOU REALLY WANT TO CONNECT TO &
! TEMP$ &
! TEMP2$ &
! TEST% GENERAL TEST VAR FOR TESTING S/F OF FUNCTIONS &
! THIS.SEG% SEGMENTATION LEN OF THIS SEND &
! TRUE% -1% A LOGICAL TRUE &
! TRY.ONE$ FNNODE.. FIRST PLACE TO LOOK IN FOR NETACT &
! TRY.TWO$ FNNODE.. SENCOND PLACE TO LOOK IN FOR NETACT &
! TTY.FILL% TTY FILL VALUE &
! TTYSET$ STRING TO RESET TTY SETTING TO WHAT THEYY WERE &
! TTYSET%(40) &
! TTYTYP% TYPE OF TERMINAL BIT MAP &
! UNX% UNEXPECTED ERROR FLAG &
! VT% &
! WIDTH% WIDTH OF TERMINAL &
&
450 ! &
! &
! U S E R - D E F I N E D F U N C T I O N S &
! &
451 ! &
! FNCONNECT.INIT%( ) NETFNC FUNCTION &
! FNDECLARE.RECEIVER%( ) NETFNC FUNCTION &
! FNDISCONNECT%( ) NETFNC FUNCTION &
! FNMATCH%( ) USED TO MATCH KEYWORDS &
! FNNERR$( ) RETURNS ERROR TEXT FROM NFTRMS.ERR &
! FNNODE.TO.CDB.ACCT$( ) RETURNS ACCT FIELD FORN NETACT.DAT &
! FNNTRN$( ) LOGICAL NODE NAME TRANSLATER &
! FNPAD$( ) PADS STRINS WITH NULLS &
! FNRECEIVE%( ) NETFNC FUNCTION &
! FNREMOVE.RECEIVER% NETFNC FUNCTION &
! FNSEND.NET.DATA%( ) NETFNC FUNCTION &
&
900 DIM TTYSET%(40%),KB.BUFF%(512%),BIT%(15%),Q.INFO%(50%) &
! TTYSET% -> FOR READING TTY SETTINGS &
! KB.BUFF% -> TO SCAN INPUT DATA &
! BIT% -> BIT%(I%) = 2%^I% &
! Q.INFO% -> FOR FIELDING ACCOUNTING DATA &
&
999 ! &
! &
! M A I N C O D I N G A R E A &
! &
! &
1000 ON ERROR GOTO 19000 &
\ PRINT IF CCPOS(0%) <> 0% &
! SET STAND ERROR TRAP &
! RETURN KB TO LEFT MARGIN &
1010 I$="Y2.0-02" &
! SET VERSION/EDIT NUMBER &
1020 S$ = SYS(CHR$(6%)+CHR$(9%)) &
\ IF CCL% = 0% THEN &
PRINT "NET20"+CHR$(9%)+I$+CHR$(9%)+CVT$$(RIGHT(S$,3%),4%) &
! TELL OUR NAME IF RUN ENTRY SKIP IF CCL &
1100 ! PARSE COMMAND LINE AND CONNECT TO REMOTE SYSTEM &
1110 C$ = SYS(CHR$(6%)+CHR$(-7%)) &
\ GOSUB 23200 &
\ GOSUB 14000 &
\ INPUT "Node Name "; CCL$ IF LEN(CCL$) = 0% &
\ PRINT IF CCPOS(0%) <> 0% &
\ CCL$ = CVT$$(CCL$,4%) &
\ NODE.NAME% = INSTR(1%,CCL$,"::") &
\ NODE.NAME% = LEN(CCL$)+1% IF NODE.NAME% = 0% &
\ NODE.NAME$ = LEFT(CCL$,NODE.NAME%-1%) &
\ CCL$ = RIGHT(CCL$,NODE.NAME%+2%) &
\ NODE.NAME$ = FNNTRN$(NODE.NAME$) &
\ NODE.NAME$ = NODE.NAME$+"::" IF INSTR(1%,NODE.NAME$,"::") = 0% &
\ CCL$ = NODE.NAME$+CCL$ &
\ NODE.NAME% = INSTR(1%,CCL$,"::") &
\ NODE.NAME% = LEN(CCL$)+1% IF NODE.NAME% = 0% &
\ NODE.NAME$ = LEFT(CCL$,NODE.NAME%-1%) &
\ TARGET.NODE$ = NODE.NAME$ &
\ CCL$ = RIGHT(CCL$,NODE.NAME%+2%) &
\ NODE.NAME$ = CVT$$(NODE.NAME$,-1%) &
\ NODE.NAME$ = RIGHT(NODE.NAME$,2%) IF LEFT(NODE.NAME$,1%) = '_' &
\ NODE.NAME$ = NFN.LCL.NOD$ IF LEN(NODE.NAME$) = 0% &
\ GOSUB 18800 &
\ TARGET.NODE$ = CVT$$(RIGHT(TARGET.NODE$,2%),-1%) &
IF LEFT(TARGET.NODE$,1%) = '_' &
\ MY.NAME$="NWTT"+RIGHT(NUM1$(NFN.JOB%+100%),2%) &
\ TEST% = -1% &
\ TEST% = FNDECLARE.RECEIVER%(MY.NAME$,24%,4%,5%,0%) &
UNTIL ((TEST% >= 0%) AND (TEST% <> 4%)) &
\ PRINT "?Declare Receiver failed." IF TEST% &
\ GOTO 9000 IF TEST% &
\ OPEN "NL:" AS FILE 2%, RECORDSIZE 512% &
\ FIELD #2%, 6% AS N.N$,20% AS R.P.N$, 20% AS L.P.N$, 74% AS REST$ &
\ LSET N.N$ = FNPAD$(NODE.NAME$,6%)+"" &
\ LSET R.P.N$ = CHR0$+CHR$(NPK.OBJ%)+STRING$(18%,0%) &
\ LSET L.P.N$ = STRING$(20%,0%) &
\ LSET REST$ = &
FNNODE.TO.CDB.ACCT$(NODE.NAME$,"SY:","SY:")+STRING$(28%,0%) &
\ TEST% = -1% &
\ TEST% = FNCONNECT.INIT%(1%,2%,121%,0%,512%) &
UNTIL TEST% >= 0% AND TEST% <> 32% &
\ PRINT "?Connect Failure - "; IF TEST% <> 0% &
\ PRINT NODE.NAME$; " is an unknown node." IF TEST% = 6% &
\ PRINT "Too many links to node "; NODE.NAME$ IF TEST% = 17% &
\ PRINT "Node shutting down" IF TEST% = 22% &
\ GOTO 9000 IF TEST% &
\ FIELD #2%, 512% AS R.D$ &
\ TEST% = FNRECEIVE%(9%,2%,512%,0%,500%) &
UNTIL (TEST% = -3% OR TEST% = -4% OR (TEST% > 0% AND TEST% <> 5%)) &
\ GOTO 9000 IF TEST% > 0% &
\ GOTO 1200 IF TEST% = -3% &
\ N.ERR$ = FNNERR$(NFN.Z%(23%)) &
\ PRINT "?Connect Reject -- "+N.ERR$; &
\ PRINT "NSP reason code = "; NFN.Z%(23%); IF LEN(N.ERR$) = 0% &
\ PRINT &
\ PRINT LEFT(R.D$,NFN.LEN%) &
\ GOTO 9000 &
! INIT NETFNC AND COMMON VARIBLES &
! PARSE COMMAND LINE INTO NODE NAME AND STRING &
! DECLARE ME TO BE A RECEIVER &
! MAKE CONNECTION!! &
! IF REJECTED TELL USER AND QUIT &
! &
1200 KB.MODE% = 16%+1%+32% &
\ GOSUB 18900 &
\ SEND.MAX% = NFN.Z%(27%)+SWAP%(NFN.Z%(28%)) &
\ GOSUB 18850 &
\ PRINT #3%,"Connection Established to Node "; TARGET.NODE$ &
\ LINK.UP% = TRUE% &
\ ESC.MCH$ = CHR$(16%) &
! SEND PMR MESSAGE AND WAIT FOR ROUTING ACK/NAK &
! SET LINK UP FLAG &
! OPEN KB IN ^C GARDED MODE &
! SET ESC STRING TO ^P &
! SET SEND MAX TO MAX SEG I CAN SEND &
2000 ! MAIN FLOW LOOP &
! &
2005 REMOTE.ECHO%, ODT% = TRUE% &
\ IF LEN(CCL$) THEN &
FIELD #1%, LEN(CCL$)+1% AS KB.BUFF$ &
\ LSET KB.BUFF$ = CCL$+CHR$(CR%) &
\ KB.CNT% = LEN(CCL$)+1% &
! AND QUE ANY CCL DATA LEFT OVER &
2010 WHILE TRUE% &
\ GOSUB 10000 &
\ GOTO 3000 IF ESC.MCH% &
\ GOSUB 11000 &
\ GOSUB 12000 &
\ SLPTIM% = -1% &
\ SLPTIM% = 3%+(32767%+1%) IF KB.CNT% <> 0% &
\ SLPTIM% = 1%^15% OR 1% IF ODT% &
\ SLEEP SLPTIM% IF BAD.READ% &
\ NEXT &
! MAIN FLOW LOOP &
! 10000 - GET FROM KB: &
! 11000 - PUT TO NET &
! 12000 - GET FROM NET AND PRINT &
! GO DO AGAIN A DO FOREVER &
3000 ! ESC COMAND ROUTINE. &
3010 ON ERROR GOTO 3900 &
! SET TRAP &
3020 KB.CNT%,ESC.MCH% = 0% &
\ CLOSE 1%,3% &
\ KB.MODE% = 16% &
\ GOSUB 18900 &
\ PRINT #3%, IF CCPOS(3%) &
\ PRINT #3%, NFN.LCL.NOD$;"::NET>"; &
\ ECHO$ = SYS(CHR$(2%)) &
\ INPUT LINE #3%, CMD$ &
\ PRINT #3%, IF CCPOS(3%) &
\ CMD$ = CVT$$(CMD$,-1%) &
\ GOTO 3000 IF LEN(CMD$) = 0% &
\ GOTO 3400 IF FNMATCH%(CMD$,"EXIT",2%) &
\ GOTO 3820 IF FNMATCH%(CMD$,"CONTINUE",2%) &
\ GOTO 3600 IF FNMATCH%(CMD$,"HELP",2%) OR CMD$ = "?" &
\ GOTO 3830 IF FNMATCH%(CMD$,"CTRL/P",2%) &
\ PRINT #3%, "?Illegal command" &
\ GOTO 3000 &
! DO WHAT HE SAID TO &
3400 TEST% = FNDISCONNECT%(1%,"") &
\ TEST% = FNREMOVE.RECEIVER% &
\ GOTO 9000 &
! QUIT DISCONNECT LINK, REMOVE RECEIVER AND GO DIE &
3600 PRINT #3%, " NETWORK commands" &
\ PRINT #3%, &
\ PRINT #3%, "CO[NTINUE] Return to terminal mode." &
\ PRINT #3%, "EX[IT] Kill remote job, disconnect link, and exit." &
\ PRINT #3%, "HE[LP] Print help text." &
\ PRINT #3%, "OD[T] Enter ODT mode." &
\ PRINT #3%, 'CT[RL/P] Send a "^P" to other end.' &
\ PRINT #3%, "NO[RMAL] Exit ODT mode" &
\ PRINT #3%, &
\ GOTO 3000 &
! HELP TEXT PRINTER &
3800 REMOTE.ECHO%, ODT% = TRUE% &
\ CLOSE 1%,3% &
\ KB.MODE% = 1%+16%+32% &
\ GOSUB 18900 &
\ FIELD #1%, 6% AS KB.BUFF$ &
\ LSET KB.BUFF$ = CHR$(2%)+ &
CHR$(6%)+CHR$(SWAP%(6%))+ &
CHR$(1%)+CHR$(1%)+ &
CHR$(1%) &
\ KB.CNT% = 6% &
\ GOTO 2010 &
! SET ODT AND ECHO FLAG &
! REOPEN KB: IN BIN MODE BUT KEEP ^S/^Q ACTIVE &
! SET UP TO SEND CNTL MESSAGE FOR REMOTE ECHO &
3810 REMOTE.ECHO%, ODT% = FALSE% &
\ CLOSE 1%,3% &
\ KB.MODE% = 16% &
\ GOSUB 18900 &
\ FIELD #1%, 6% AS KB.BUFF$ &
\ LSET KB.BUFF$ = CHR$(2%)+ &
CHR$(6%)+CHR$(SWAP%(6%))+ &
CHR$(1%)+CHR$(1%)+ &
CHR$(2%) &
\ KB.CNT% = 6% &
\ GOTO 2010 &
! CLEAR ODT AND ECHO FLAG &
! REOPEN KB: IN ^C GUARDED MODE &
! SET UP TO SEND CNTL MESSAGE FOR LOCAL ECHO &
3820 IF NOT ODT% THEN 2010 ELSE &
CLOSE 1%,3% &
\ KB.MODE% = 1%+16%+32% &
\ GOSUB 18900 &
\ GOTO 2010 &
! IF ODT THEN REOPEN KB AND GO ON &
3830 IF NOT ODT% THEN 3835 ELSE &
CLOSE 1%,3% &
\ KB.MODE% = 1%+16%+32% &
\ GOSUB 18900 &
! REOPEN KB IN NORMAL OR ODT MODE AS NEEDED &
3835 FIELD #1%, 1% AS KB.BUFF$ &
\ LSET KB.BUFF$ = CHR$(16%) &
\ KB.CNT% = 1% &
\ GOTO 2010 &
! SEND A ^P IN DATA MESSAGE AND CONTINUE &
3900 T$ = SYS(CHR$(6%)+CHR$(-7%)) IF ERR = 28% &
\ RESUME 3000 &
! GO ASK FOR MORE &
&
9000 ! EXIT ROUTINE &
9010 TEST% = FNREMOVE.RECEIVER% &
\ GOSUB 18700 IF LEN(TTYSET$) > 0% &
\ PRINT "Link to Node "+TARGET.NODE$+" Disconnected"+BELLS$ &
IF LINK.UP% &
\ T$ = SYS(CHR$(9%)) UNLESS DEBUG% &
\ GOTO 32767 &
! REMOVE ME FROM RECEIVE TABLES &
! THIS MAY BE SECOND TIME BUT CANN'T ERROR &
! RESET TTY IF A CHANGED IT &
! CLEANUP THE WORLD AND BACK TO THE USER &
10000 ! &
! get from kb: if none buffer &
! kb chan = 1% &
! kb.cnt% = #bytes buffered &
! = 0 no data &
! > 0 data &
! data left in buffer do not use chan for other I/O &
! &
10010 IF KB.CNT% > 0% THEN 10810 &
ELSE KB.CNT%,ESC.MCH% = 0% &
\ ON ERROR GOTO 10900 &
\ GET #1%, RECORD 8192% &
\ KB.CNT% = RECOUNT &
\ FIELD #1%, KB.CNT% AS KB.BUFF$ &
\ ESC.MCH% = -1% IF CVT$$(KB.BUFF$,4%+1%) = ESC.MCH$ &
! &
! GET LINE STRIP AND CHECK OF ESC MATCH &
10800 ! GO EXIT &
10810 RETURN &
! GO BACK NOW ALL IS DONE &
10900 E% = ERR &
\ E1% = ERL &
\ RESUME 10810 IF E% = 28% &
\ RESUME 19100 IF E% <> 13% AND E% <> 11% &
\ RESUME 10810 IF E% = 13% &
\ KB.CNT% = 1% &
\ FIELD #1%, 1% AS KB.BUFF$ &
\ LSET KB.BUFF$ = CHR$(26%) &
\ RESUME 10800 &
! ERROR TRAP &
&
11000 ! SEND LINE TO SLAVE &
! IF I GET BACK/PRESSURED OF FLOW CONTROLED OFF &
! RETURN WITH BUFFER UPDATED. &
11010 GOTO 11800 IF KB.CNT% = 0% &
\ MSG.LEN% = KB.CNT% &
\ SENT% = 0% &
\ UNTIL MSG.LEN% = 0% &
\ THIS.SEG% = SEND.MAX% &
\ THIS.SEG% = MSG.LEN% IF MSG.LEN% < THIS.SEG% &
\ FLAG% = 0% &
\ FLAG% = 2% IF THIS.SEG% = MSG.LEN% &
\ TEST% = FNSEND.NET.DATA%(1%,1%,THIS.SEG%,SENT%,FLAG%) &
\ SENT% = SENT% + THIS.SEG% IF TEST% = 0% &
\ MSG.LEN% = MSG.LEN%-THIS.SEG% IF TEST% = 0% &
\ GOTO 11030 IF (TEST% <> 19% AND TEST% <> 0% AND &
TEST% <> 32% AND TEST% <> 4%) &
\ GOTO 11030 IF TEST% = 19% &
\ SLEEP 1% IF TEST% <> 0% &
\ NEXT &
\ KB.CNT% = 0% &
! SEGMENT MESSAGE AND SEND TILL &
! 1. ALL SEND OR &
! 2. FLOW CONTROLED OFF &
! 3. THE LINK DIES &
! KEEP RETRYING ALL SOFT BUFFER ERRORS &
11030 LINK.ACT%, LINK.UP% = FALSE% IF (TEST% <> 19% AND TEST% <> 0% AND &
TEST% <> 32% AND TEST% <> 4%) &
\ IF TEST% <> 19% THEN &
KB.CNT% = 0% &
ELSE &
KB.CNT% = MSG.LEN% &
\ LSET KB.BUFF$ = RIGHT(KB.BUFF$,SENT%+1%) &
! IF BP OFF THEN GET OUT BUT SAVE WHAT HAS NOT BEEN SENT &
11800 RETURN &
! THATS ALL FOLKS &
&
12000 ! RECEIVE MESSAGE FROM REMOTE &
! DATA MESSAGE FORMATES ARE: &
! <1><LEN><> - FOR CONFIG MESSAGE &
! <2><LEN><MENU:I><><><> - FOR CONTROL MESSAGES &
! <5><LEN><CNT><DATA> - FOR TO KB DATA MESSAGES &
12010 TEST% = FNRECEIVE%(8%,2%,512%-R.D%,R.D%,0%) &
\ BAD.READ% = -1% &
\ BAD.READ% = 0% IF TEST% < 0% &
\ GOTO 12900 IF TEST% = 5% &
\ GOTO 9000 IF TEST% = -8% OR TEST% = -9% &
\ GOTO 12000 IF TEST% = -7% &
\ GOTO 12900 IF TEST% = 28% &
\ GOTO 12000 IF TEST% = -6% &
\ GOTO 9000 IF TEST% <> -5% &
\ R.D% = R.D%+NFN.LEN% &
\ GOTO 12000 IF ((NFN.Z%(21%) AND 2%) = 0%) &
\ PRINT #3%,RECORD 1%, LEFT(R.D$,R.D%); UNLESS NOT(CONFIG.RCV%) &
\ CONFIG.RCV% = -1% &
\ R.D% = 0% &
\ GOTO 12900 &
! GET WHAT IS THERE AND PRINT IT &
12100 GOTO 12900 IF R.D% < 6% &
\ R.D% = 0% &
\ T$ = SYS(CHR$(2%)) IF ASCII(MID(R.D$,6%,1%)) = 0% &
\ T$ = SYS(CHR$(3%)) IF ASCII(MID(R.D$,6%,1%)) <> 0% &
\ GOTO 12900 &
! TURN ECHO ON OR OFF AS SPECIFIED &
&
12200 R.D% = 0% &
\ GOTO 12900 IF ASCII(R.D$)=1% &
! IF UNDEFINED FUNCTION THEN DROP ON FLOOR &
12900 RETURN &
! THATS ALL &
&
14000 ! INIT COMMONLY USED THINGS &
14010 CR% = 13% &
\ BIT%(I%) = 2%^I% FOR I% = 0% TO 15% &
\ LF% = 10% &
\ FF% = 12% &
\ VT% = 11% &
\ ESC%= 27% &
\ S.T% = 2%^15% OR 3% &
\ CNTR.C% = 3% &
\ NPK.OBJ% = 23% &
\ TRUE% = -1% &
\ FALSE% = NOT TRUE% &
\ BELLS$ = CHR$(7%)+CHR$(7%)+CHR$(7%) &
14999 RETURN &
15000 DEF* FNMATCH%(S1$,S2$,L%) &
! CHECK IF S1 = S2 WITH ABBRIVIATIONS TO L% LENGTH &
! S2$ = "SYSTAT" &
! L% = 2% &
! FNMATCH% WILL RETURN TRUE FOR &
! S1$ = "SY" OR &
! "SYS" OR &
! "SYST" OR &
! "SYSTA" OR &
! "SYSTAT" OR &
15010 FNMATCH% = 0% &
\ FNMATCH% = (S1$ = LEFT(S2$,LEN(S1$))) IF LEN(S1$) >= L% &
\ FNEND &
! SEE IF A MATCH &
15800 DEF FNNERR$(Q.ERR%) &
\ FNNERR$ = "" &
\ GOTO 15820 IF Q.ERR% < 0% OR Q.ERR% > 43% &
\ GOTO 15810 IF (BUFSIZ(Q.CH%) = 0%) &
FOR Q.CH%=12% TO 1% STEP -1% &
\ GOTO 15820 &
15810 ON ERROR GOTO 15890 &
\ OPEN 'LB:NFTRMS.ERR/RONLY' FOR INPUT AS FILE #Q.CH% &
\ GET #Q.CH%, RECORD ((Q.ERR%/8%)+1%) &
\ FIELD #Q.CH%, ((Q.ERR%-((Q.ERR%/8%)*8%))*64%) AS Q.JUNK$, &
64% AS Q.ERR$ &
\ FNNERR$ = CVT$$(Q.ERR$,4%) &
\ CLOSE Q.CH% &
\ GOTO 15890 &
! OPEN NFT'S ERR MESSAGE FILE AND GET ERR MESSAGE. &
15820 ON ERROR GOTO 19000 &
\ FNEND &
! THE END OF THE FUNCTION &
15890 RESUME 15820 &
! THE ERROR TRAP FOR OPEN OR READ FAILURE &
&
15900 DEF FNNODE.TO.CDB.ACCT$(NODEID$,TRY.ONE$,TRY.TWO$) &
! &
! FUNCTION: FNNODE.TO.CDB.ACCT$ GETS CDB DATA FROM NETACT &
! &
! PARAMETERS: NODEID$ NODE NAME TO LOOKUP ACCOUNTING &
! INFORMATION FOR. &
! &
! TRY.ONE$ DEV/PPN OF FIRST NETACT TO &
! LOOK IN. &
! IF TRY.ONE$ = TRY.TWO$ THEN &
! NETACT ONLY LOOKED IN ONCE. &
! &
! TRY.TWO$ DEV/PPN OF SECOND NETACT TO &
! LOOK IN. &
! &
! RETURNS: FNNODE.TO.CDB.ACCT$ = STRING IN FORMAT FOR CDB OF &
! PPN/PASSWORD/ACCOUNT WILL BE &
! ALL NULLS IF NETACT NOT FOUND &
! OR NODEID$ NOT IN NETACT. &
! &
! CDB.ACC.DAT% = 0 IF NETACT NOT FOUND OR &
! NODEID$ NOT IN NETACT. &
! &
! CDB.ACC.DAT% = -1 IF NETACT FOUND AND &
! NODEID$ IN NETACT. &
! &
15910 Q.OPEN.FILE%, CDB.ACC.DAT% = 0% &
\ Q.WHERE$=TRY.ONE$ &
\ FNNODE.TO.CDB.ACCT$=STRING$(46%,0%) &
\ NODEID$=CVT$$(NODEID$,1%+2%+4%+32%) &
\ GOTO 15920 IF (BUFSIZ(Q.CH%) = 0%) &
FOR Q.CH%=12% TO 1% STEP -1% &
\ GOTO 15990 &
15920 ON ERROR GOTO 15980 &
\ OPEN Q.WHERE$+'NETACT.DAT/RONLY' FOR INPUT AS FILE #Q.CH% &
\ Q.OPEN.FILE% = -1% &
15930 FOR Q.NDX%=0% TO 254% &
\ Q.BLK%=Q.NDX%/85% &
\ Q.OFF%=Q.NDX%-(Q.BLK%*85%) &
\ GET #Q.CH%, RECORD Q.BLK% &
IF (Q.OFF% = 0%) &
\ FIELD #Q.CH%, Q.OFF%*6% AS Q.JUNK$, 6% AS Q.NODE$ &
\ GOTO 15940 &
IF (NODEID$ = CVT$$(Q.NODE$,1%+2%+4%+32%)) &
\ NEXT Q.NDX% &
\ IF (Q.WHERE$ = TRY.TWO$) THEN &
GOTO 15990 &
ELSE &
Q.WHERE$=TRY.TWO$ &
\ GOTO 15920 &
15940 Q.BLK%=(Q.NDX%/10%) &
\ Q.OFF%=50%*(Q.NDX%-(Q.BLK%*10%)) &
\ GET #Q.CH%, RECORD 4%+Q.BLK% &
\ FIELD #Q.CH%, Q.OFF% AS Q.JUNK$, 50% AS Q.INFO$ &
\ CHANGE Q.INFO$ TO Q.INFO% &
\ CLOSE #Q.CH% &
\ Q.INFO%(Q.NDX%)=(Q.INFO%(Q.NDX%) XOR 85%) &
FOR Q.NDX%=1% TO 50% &
\ CHANGE Q.INFO% TO Q.INFO$ &
\ Q.LEN0%=ASCII(Q.INFO$) &
\ Q.LEN1%=ASCII(MID(Q.INFO$,1%+Q.LEN0%+1%,1%)) &
\ Q.LEN2%=ASCII(MID(Q.INFO$,1%+Q.LEN0%+1%+Q.LEN1%+1%,1%)) &
\ Q.LEN3%=ASCII(MID(Q.INFO$,1%+Q.LEN0%+1%+Q.LEN1%+1%+Q.LEN2%+1%,1%)) &
\ Q1$=MID(Q.INFO$,1%+1%+Q.LEN0%+1%,Q.LEN1%) &
\ Q2$=MID(Q.INFO$,1%+1%+Q.LEN0%+1%+Q.LEN1%+1%,Q.LEN2%) &
\ Q3$=MID(Q.INFO$,1%+1%+Q.LEN0%+1%+Q.LEN1%+1%+Q.LEN2%+1%,Q.LEN3%) &
\ Q1$=LEFT(Q1$,16%) &
\ Q1$=CHR$(0%)+CHR$(LEN(Q1$))+Q1$+STRING$(16%-LEN(Q1$),0%) &
\ Q2$=LEFT(Q2$,8%) &
\ Q2$=CHR$(0%)+CHR$(LEN(Q2$))+Q2$+STRING$(8%-LEN(Q2$),0%) &
\ Q3$=LEFT(Q3$,16%) &
\ Q3$=CHR$(0%)+CHR$(LEN(Q3$))+Q3$+STRING$(16%-LEN(Q3$),0%) &
\ FNNODE.TO.CDB.ACCT$=Q1$+Q2$+Q3$ &
\ CDB.ACC.DAT% = -1% &
\ GOTO 15990 &
15980 IF (Q.WHERE$ = TRY.TWO$) THEN &
RESUME 15990 &
ELSE &
Q.WHERE$=TRY.TWO$ &
\ RESUME 15920 &
15990 ON ERROR GOTO 19000 &
\ CLOSE Q.CH% IF Q.OPEN.FILE% &
\ FNEND &
&
16000 DEF FNNTRN$(Q.NN$) &
! FNNTRN LOOKS UP A LOGICAL STRING TO MAP A NODE NAME INTO &
! (e.g. FOO MAPS TO FOO1::FOO2::FOO3::FOO::). &
! IF THE NODE NAME STARTS WITH A "_" THEN THE &
! UNDERSCORE IS REMOVED AND THE REST PASSED BACK. &
! THE PASSED NODE NAME MAY OR MAY NOT HAVE VAX STYLE &
! ACCOUNTING INFO AND MAY OR MAY NOT END IN A ::. &
! IF THE TRANSLATION FAILS IN THE PRIVATE NETLOG, TRY THE &
! SYSTEM NETLOG (IF PRESENT). &
! IF A TRANSLATION TAKES PLACE IN THE PRIVATE NETLOG, AND THERE &
! IS A VALID NODE LEFT, TRY A SECOND TRANSLATION IN SYSTEM. &
16010 TRN.FOUND%,Q.FILE.OPEN% = 0% &
\ Q.PPN$ = "" &
\ Q.DEFAULT.PPN$ = "NETLIB:" &
\ Q.PATH$ = Q.NN$ &
\ Q.PATH.REST$ = "" &
16015 GOTO 16020 IF LEFT(Q.NN$,1%) <> "_" &
\ Q.PATH$ = RIGHT(Q.NN$,2%) UNLESS TRN.FOUND% &
\ GOTO 16070 &
! STRIP "_" IF THERE AND QUIT ELSE GO ON &
16020 GOTO 16030 IF (BUFSIZ(Q.CH%) = 0%) &
FOR Q.CH% = 12% TO 1% STEP -1% &
\ GOTO 16070 &
! FIND A FREE CHANNEL IF THERE IS ONE IF NOT TOO BAD. &
16030 ON ERROR GOTO 16090 &
\ Q.SET% = 0% &
\ Q.NN2M$ = Q.NN$ &
\ Q.NN2M$ = LEFT(Q.NN$,LEN(Q.NN$)-2%) &
IF INSTR(1%,Q.NN$,"::") <> 0% &
\ Q.NN2M% = INSTR(1%,Q.NN2M$,'"') &
\ Q.NN2M% = LEN(Q.NN2M$) IF Q.NN2M% = 0% &
\ Q.NN2M$ = CVT$$(LEFT(Q.NN2M$,Q.NN2M%),-1%) &
\ OPEN Q.PPN$+'NETLOG.DAT/RONLY' FOR INPUT AS FILE #Q.CH% &
\ Q.FILE.OPEN% = -1% &
! OPEN THE FILE IF THERE IS ONE &
16040 FOR Q.NDX% = 0% TO 49% &
\ Q.BLK% = ((Q.SET%*14%)+1%) &
\ Q.OFF% = Q.NDX%*10% &
\ GET #Q.CH%, RECORD Q.BLK% &
IF (Q.OFF% = 0%) &
\ FIELD #Q.CH%, Q.OFF% AS Q.JUNK$, 10% AS Q.FNN$ &
\ GOTO 16050 IF (Q.NN2M$ = CVT$$(Q.FNN$,-1%)) &
\ NEXT Q.NDX% &
\ FIELD #Q.CH%, 511% AS Q.JUNK$, 1% AS Q.MORE$ &
\ Q.SET% = Q.SET%+1% &
\ GOTO 16040 IF ASCII(Q.MORE$) &
\ GOTO 16080 &
! LOOK FOR THE NODE NAME TO MAP &
! IF FOUND GO TRANSLATE ELSE THAT'S ALL &
16050 Q.BLK% = (Q.SET% * 14%)+(Q.NDX%/4%)+2% &
\ Q.OFF% = (Q.NDX% AND 3%) * 128% &
\ GET #Q.CH%, RECORD Q.BLK% &
\ TRN.FOUND% = -1% &
\ FIELD #Q.CH%, Q.OFF% AS Q.JUNK$, 128% AS Q.F.PATH$ &
\ Q.PATH$ = CVT$$(Q.F.PATH$,4%+128%)+Q.PATH.REST$ &
! MAKEUP BLOCK NUMBER AND OFFSET &
! GET INFO FROM FILE &
16060 GOTO 16070 IF Q.PPN$=Q.DEFAULT.PPN$ &
\ Q.PPN$=Q.DEFAULT.PPN$ &
\ GOTO 16070 UNLESS LEN(Q.PPN$) &
\ Q.NN$=Q.PATH$ &
\ Q.OFF%=INSTR(1%,Q.NN$,"::") &
\ GOTO 16070 UNLESS Q.OFF% &
\ Q.PATH.REST$=RIGHT(Q.NN$,Q.OFF%+2%) &
\ Q.NN$=LEFT(Q.NN$,Q.OFF%-1%) &
\ CLOSE Q.CH% &
\ GOTO 16015 &
! IF WE HAVE A NODE FROM THE PRIVATE NETLOG, TRY THE SYSTEM. &
16070 Q.DEFAULT.PPN$ = "" &
! DISABLE ANY FURTHER LOOKING FOR NETLOG.DAT &
16080 ON ERROR GOTO 19000 &
\ CLOSE Q.CH% IF Q.FILE.OPEN% &
\ IF Q.PPN$ <> Q.DEFAULT.PPN$ THEN &
Q.PPN$ = Q.DEFAULT.PPN$ &
\ GOTO 16020 IF LEN(Q.PPN$) &
! IF WE HAVEN'T CHECKED THE SYSTEM DEFAULT, THEN DO IT
16085 FNNTRN$ = CVT$$(Q.PATH$,32%+4%) &
\ FNEND &
! RESET ERROR TRAP &
! CLOSE FILE IF OPENED &
! AND THAT'S ALL FOLKS &
16090 RESUME 16080 &
! A SIMPLE ERROR TRAP &
18500 !SEND CONFIG MESSAGE &
18510 FIELD #1%, 3% AS KB.BUFF$ &
\ KB.CNT% = 3% &
\ LSET KB.BUFF$ = CHR$(1%)+CHR$(3%)+CHR$(0%) &
\ WHILE KB.CNT% AND LINK.UP% &
\ GOSUB 11000 &
\ SLEEP 1% OR BIT%(15%) IF KB.CNT% &
\ NEXT &
\ RETURN &
&
18600 !SEND CTRL AND SET ^T PRIV DELIMITER &
18610 CHANGE SYS(CHR$(6%)+CHR$(16%)+CHR$(0%)+CHR$(-1%)+STRING$(28%,0%)) &
TO TTYSET% &
\ TTYSET$=SYS(CHR$(6%)+CHR$(16%)+CHR$(-0%)+CHR$(-1%)+ &
STRING$(18%,0%)+CHR$(20%)+CHR$(0%)) &
\ WIDTH% = TTYSET%(5%)-1% &
\ TTY.FILL% = TTYSET%(13%) &
\ TTYTYP% = 0% &
\ TTYTYP% = TTYTYP% OR BIT%(0%) IF TTYSET%(11%) = 255% &
\ TTYTYP% = TTYTYP% OR BIT%(1%) IF TTYSET%(6%) = 128% &
\ TTYTYP% = TTYTYP% OR BIT%(2%) IF TTYSET%(12%) = 255% &
\ TTYTYP% = TTYTYP% OR BIT%(3%) IF TTYSET%(8%) = 128% &
\ TTYTYP% = TTYTYP% OR BIT%(4%) IF TTYSET%(9%) = 255% &
\ TTYTYP% = TTYTYP% OR BIT%(5%) IF TTYSET%(7%) = 255% &
\ FIELD #1%, 11% AS KB.BUFF$ &
\ KB.CNT% = 11% &
\ LSET KB.BUFF$ = CHR$(2%)+CHR$(KB.CNT%)+CHR$(0%)+ &
CHR$(1%)+CHR$(4%+8%+16%)+ &
CHR$(WIDTH%)+CHR$(0%)+ &
CHR$(TTYTYP%)+CHR$(0%)+ &
CHR$(TTY.FILL%)+CHR$(0%) &
\ WHILE KB.CNT% AND LINK.UP% &
\ GOSUB 11000 &
\ SLEEP 1% OR BIT%(15%) IF KB.CNT% &
\ NEXT &
\ TTYSET%(1%) = 6% &
\ TTYSET%(2%) = 16% &
\ TTYSET%(3%) = 0% &
\ TTYSET%(4%) = 255% &
\ CHANGE TTYSET% TO TTYSET$ &
\ RETURN &
18700 !RESET TTY &
18710 TTYSET$ = SYS(TTYSET$) &
\ RETURN &
&
18800 ! REMOVE LINE 18810 TO ENABLE PMR PARSE &
! THE FOLLOWING ROUTINE PARSES CCL$ INTO A NODE LIST &
! AND A STRING. &
! &
! A NODE_LIST IS A NODE_NAME::|NODE_NAME::NODE_LIST &
! THE STRING FOLLOWS THE NODE_LIST. &
! &
! FOR EXAMPLE &
! NODE1::NODE2::NODE3::SY &
! GIVES &
! PMR$ = NODE1::NODE2::NODE3:: &
! TARGET.NODE$ = "NODE3" &
! CCL$ = SY &
! PMR% = TRUE% &
! NPK.OBJ% = 123% &
18820 DC% = INSTR(1%,CCL$,"::") &
\ WHILE DC% &
\ PMR$ = PMR$+LEFT(CCL$,DC%+1%) &
\ TARGET.NODE$ = LEFT(CCL$,DC%-1%) &
\ CCL$ = RIGHT(CCL$,DC%+2%) &
\ PMR% = TRUE% &
\ NPK.OBJ% = 123% &
\ DC% = INSTR(1%,CCL$,"::") &
\ NEXT &
! PARSE CCL$ INTO NODE LIST AND STRING &
! PASS NODE LIST BACK IN PMR$ AND STRING IN CCL$ &
18830 RETURN &
! ALL DONE FOR NOW &
18850 ! SEND PMR$ (POOR MANS ROUTING MESSAGE) TO ROUTER &
! THEN WAIT FOR ACK OR NAK. &
! ACK WILL BE MESSAGE WITH FIRST A ASCII 1 &
! IE =CHR$(1%) &
! NAK WILL BE MESSAGE WITH FIRST CHARACTER A ASCII 2 &
! AND REST OF MESSAGE IS PRINTABLE TEXT THAT IS AN ERROR &
! THIS ROUTINE RETURNS AFTER A DISCONNECT OR A ACK. &
! MESSAGE THAT TELLS WHERE THE ROUTING DIED. &
! PMR MESSAGE = <1B:NUMBER OF HOPS SO FAR><A:NODE_LIST> &
! where &
! NODE_LIST :== NODE_NAME:: or NODE_NAME::NODE_LIST &
18860 GOTO 18880 IF PMR$ = "" &
\ PMR$ = CHR$(0%)+PMR$+'"23="' &
\ LINK.ACT% = TRUE% &
\ KB.CNT% = LEN(PMR$) &
\ FIELD #1%, KB.CNT% AS KB.BUFF$ &
\ LSET KB.BUFF$ = PMR$ &
\ WHILE KB.CNT% AND LINK.ACT% &
\ GOSUB 11000 &
\ SLEEP (1% OR BIT%(15%)) IF KB.CNT% &
\ NEXT &
! PUT PMR$ IN BUFFER AND FAKE AS IF KB INPUT &
! CALL MESSAGE SEND(11000) TILL MESSAGE SENT &
&
18870 TEST% = 0% &
\ TEST% = FNRECEIVE%(1%+2%+8%,2%,512%-R.D%,R.D%,500%) &
UNTIL ((TEST% < 0%) OR ((TEST% > 0%) AND (TEST% <> 5%))) &
\ GOTO 18870 IF TEST% = -7% &
\ GOTO 18890 IF TEST% <> -5% &
\ R.D% = R.D%+NFN.LEN% &
\ GOTO 18870 IF ((NFN.Z%(21%) AND 2%) <> 2%) &
\ FIELD #2%, 1% AS PMR.ACK$, R.D%-1% AS ERRMSG$ &
\ IF ASCII(PMR.ACK$) <> 1% THEN &
PRINT ERRMSG$ &
\ R.D% = 0% &
\ GOTO 18870 &
! WAIT FOR ACK OR NAK &
! IF ACK THEN RETURN AND GO ON ELSE TELL USER WHAT OTHER &
! END TOLD YOU. &
&
18880 RETURN &
! BACK TO MAIN LINE CODE &
18890 PRINT "?Link could not be establish to node "; TARGET.NODE$;"::." &
\ GOTO 9000 &
! IF NOT A GOOD MESSAGE THEN DIE &
18900 OPEN "_KB:NETIN.DAT" AS FILE 1%, RECORDSIZE 128%, MODE KB.MODE% &
\ OPEN "_KB:NETOUT.DAT" AS FILE 3%, RECORDSIZE 128%, MODE KB.MODE% &
\ RETURN &
! OPEN KB ON CHANNEL 1 + 3 IN MODE NEEDED. &
! THIS IS USED BY &
! \ KB.MODE% = X% &
! \ GOSUB 18900 &
&
19000 ! ALL ERRORS ARE TRAPED IN LOCAL ROUTINES &
! THIS IS A FOR ANY THAT ARE MISSED BY THE LOCAL ROUTINES. &
! THIS CODE SHOULD NOT HAPPEN &
! &
19010 E% = ERR &
\ E1% = ERL &
\ RESUME 9000 IF E% = 28% &
\ RESUME 19100 &
! ERROR TRAP &
19100 PRINT "?Unexpected error "; E% ; "at line ";E1% &
\ STOP IF UNX% = -1% &
\ UNX% = -1% &
\ GOTO 9000 &
! WHEN THE WORLD DIES THAT IS ALL ONE CAN DO. &
! THIS CODE SHOULD NOT HAPPEN. &
&
30000 ! &
! CCL ENTRY &
! CORE COMMON = NETWORK COMMAND &
! NETWORK ARK::HELLO 1/2 &
&
30010 CCL$ = SYS(CHR$(7%)) &
\ CCL% = INSTR(1%,CCL$," ") &
\ CCL% = LEN(CCL$) IF CCL% = 0% &
\ CCL$ = RIGHT(CCL$,CCL%+1%) &
\ CCL% = -1% &
\ GOTO 1000 &
! GET CORE COMMON &
! NETWORK NODENM::string &
! DROP KEYWORD STRING (NET-WORK) &
! CCL :== NODENM::STRING &
! SET NODE.NAME% TO POINT TO END OF NODE NAME &
! GET NODENAME AND COMMAND STRING. &
! SET ESC.MCH$ TO ^P &
! GOTO MAIN LINE CODE &
&
32767 END