Trailing-Edge
-
PDP-10 Archives
-
decuslib10-08
-
43,50512/setnod.b36
There are no other files named setnod.b36 in the archive.
MODULE SETNOD=
!Set the status of a node in NODTBL
BEGIN
!
! Table of Contents
!
FORWARD ROUTINE
SETNOD,
SETLIM, !Set the MLIMIT for a node
CURNOD, !Display the current settings for a node or nodes
CURR1, !Display settings of a single node
NODNDB, !Fill in the NDB from NODTBL
CHKLIM, !Check if a request is over the LIMIT
LKNODE, !Find a node in NODTBL
NODINI; !INITIALIZE command: Initialize the OPR-setable fields in node table
!
! REQUIRE & LIBRARY files
!
REQUIRE 'INTR.REQ';
LIBRARY 'DAPLIB'; !DAP defs
LIBRARY 'NODTBL'; !Node table definitions
!
THIS_IS [SETN] VERSION [1] VMINOR [A] EDIT [5] DATE[4,Mar,80]
!
!
! Revision History
!
![5] (NODINI) The INITIALIZE command to reset the node table
![4] (NODNDB) Look up node "??????" if connected by unknown host
![3] (LKNODE) Don't blow up if last entry near end of last page
![2] ???
![1] The beginning...
!
! Literals
!
COMPILETIME SETABLE=%FIELDEXPAND(NOD$TF_SETABLE,1);
!Position of first setable bit
COMPILETIME NSETABLE=(1^(%FIELDEXPAND(NOD$TF_SETABLE,2)))-1;
!# of setable bits in unary
LITERAL
WILDCARD_NODE=%SIXBIT '??????', !If he didn't identify himself
TIMOMIN=30*60, !Minimum timeout value = 30 seconds
JIF_TO_UDT=20; !Divide by this to get UDT from jiffies
!
! Macros
!
MACRO LOSE(ARG)=RETURN((ARG^3))%; !Fail & return error code
!shifted 3 bits. severity is "WARNING"
!
! Externals
!
EXTERNAL ROUTINE ERTEXT,RDSIXA,GETARG,TIMER;
GLOBAL ROUTINE SETNOD(PTR,ARGS)=
!Set the status of a node in NODTBL
!PTR: Address of byte pointer to command string
!ARGS: Addtional args (none)
BEGIN
EXTERNAL ROUTINE DOSWITCHES;
EXTERNAL NODSWITCHES; !The switch table
LOCAL NODEID; !Node we are fiddling with
LOCAL SW; !Bitmap for switches we have seen
LOCAL NODE: REF NODTBL_ENTRY; !Pointer to node entry in NODTBL
LOCAL ADDARGS: VECTOR[3]; !Additional arguments to switch processors
IF GETARG(.PTR) NEQ 1 THEN (WARNING(ILLCMD);RETURN);
NODEID=RDSIXA(.PTR); !Get the nodeid off the top
NODE=LKNODE(.NODEID); !Find the node if we can
IF .NODE EQL 0 THEN (WARNING(UNNCMD);RETURN); !Undefined network node
IF .NODE[NOD$F_TYPE] EQL 0 THEN (WARNING(UNNCMD);RETURN); !2780 NODE
NODE[NOD$TF_CHANGED]=1; !Remember we diddled
WHILE CH$RCHAR(..PTR) EQL %C':' DO CH$RCHAR_A(.PTR); !Eat the ::
ADDARGS[0]=1; ADDARGS[1]=.NODE;
SW=DOSWITCHES(NODSWITCHES,.PTR,ADDARGS); !Crunch those bits!
IF .SW GTR 1^16 THEN (TSTR(ERTEXT(.SW));TYPE(CRLF);RETURN .SW);
IF .SW<7,1> THEN SW=(.SW OR NSETABLE); !UP, ALL, ANY
IF .SW<15,1> THEN SW=NSETABLE^8; !DOWN, NONE
NODE[NOD$TFLG]=(.NODE[NOD$TFLG] OR (.SW<0,8>^SETABLE))
AND NOT (.SW<8,8>^SETABLE);
END; !SETNOD
GLOBAL ROUTINE SETLIM(PTR,ARGS)=
!Set MLIMIT for a node
!PTR: ADDRESS of byte pointer
!ARGS: Vector of additional args from SETNOD:
!ARGS[1]: Address of entry in NODTBL
BEGIN
EXTERNAL ROUTINE EATSPACES,RDNUMA;
MAP ARGS: REF VECTOR;
BIND NODE=.ARGS[1]: NODTBL_ENTRY;
IF EATSPACES(.PTR) EQL %C':' THEN CH$RCHAR_A(.PTR); !Eat colon, if any
NODE[NOD$TLIMIT]=RDNUMA(.PTR,10); !Get the value and set it
END; !SETLIM
GLOBAL ROUTINE CURNOD(PTR,ARGS)=
!Routine to implement the CURRENT command
!PTR: ADDRESS of byte pointer to command line
!ARGS: additional arguments (ignored)
BEGIN
EXTERNAL ROUTINE GETARG,RDSIXA,EATSPACES;
EXTERNAL ROUTINE TMJOB,TNEXT;
EXTERNAL MLEVEL;
IF GETARG(.PTR) EQL 1 THEN !Specific nodes only
DO BEGIN
LOCAL NODEID,
V: REF NODTBL_ENTRY;
NODEID=RDSIXA(.PTR); !Get the nodeid
IF CH$RCHAR(..PTR) EQL %C':' THEN !Eat :: if present
BEGIN
IF CH$A_RCHAR(.PTR) EQL %C':' THEN CH$RCHAR_A(.PTR);
END;
V=LKNODE(.NODEID); !Try to find the node
IF .V EQL 0 THEN (WARNING(UNNCMD);RETURN);
IF .V[NOD$F_TYPE] EQL 0 THEN (WARNING(UNNCMD);RETURN);
!A 2780 node
CURR1(.V); !Display the stuff for this node
END WHILE EATSPACES(.PTR) EQL %C','
ELSE BEGIN
EXTERNAL LOGBLK: FILE_BLOCK;
EXTERNAL ROUTINE TFB;
EXTERNAL ROUTINE TMESSAGE;
IF .LOGBLK[FILE$NAME] NEQ 0 THEN
BEGIN
TYPE('Log file is: ');TFB(LOGBLK);TYPE(CRLF)
END;
TMJOB();
TNEXT();
TMESSAGE();
INCR NODE FROM NODTBL$BASE BY .NODTBL$ENTLEN DO
BEGIN
MAP NODE: REF NODTBL_ENTRY;
IF .NODE[NOD$ID] EQL 0 THEN EXITLOOP;
!If this is a real entry and has been changed
IF (.NODE[NOD$ID] NEQ -1) AND .NODE[NOD$TF_CHANGED]
THEN CURR1(.NODE)
END
END
END; !CURNOD
ROUTINE CURR1(NODE)=
!Print out the status of a node
!NODE: Address of node entry in NODTBL
BEGIN
MAP NODE: REF NODTBL_ENTRY;
EXTERNAL ROUTINE WRSIXA,WRNUMA,MOVEAZ;
LOCAL TBUF: VECTOR[CH$ALLOCATION(120)],
PTR;
PTR=CH$PTR(TBUF);
WRSIXA(.NODE[NOD$ID],PTR); !Start out with NODEID::
CH$WCHAR_A(%C':',PTR);CH$WCHAR_A(%C':',PTR);
CH$WCHAR_A(9,PTR); !and a TAB
IF .NODE[NOD$TF_OVERRIDE] THEN
MOVEAZ(%REF(CH$PTR(UPLIT(%ASCIZ'/OVERRIDE* '))),PTR);
!Say if we have overridden time-of-day checking
MOVEAZ(%REF(CH$PTR(UPLIT(%ASCIZ'/LIMIT:'))),PTR);
WRNUMA(.NODE[NOD$TLIMIT],10,PTR); !Write out the current limit
IF .NODE[NOD$LIMIT] NEQ .NODE[NOD$TLIMIT] THEN CH$WCHAR_A(%C'*',PTR);
!Indicate if value differs from permanent one
!Now type out the bits in turn
IF .NODE[NOD$TF_RSND] THEN
MOVEAZ(%REF(CH$PTR(UPLIT(%ASCIZ' /RTRANSMIT'))),PTR)
ELSE MOVEAZ(%REF(CH$PTR(UPLIT(%ASCIZ' /NORTRANSMIT'))),PTR);
IF .NODE[NOD$F_RSND] NEQ .NODE[NOD$TF_RSND] THEN CH$WCHAR_A(%C'*',PTR);
IF .NODE[NOD$TF_RRTV] THEN
MOVEAZ(%REF(CH$PTR(UPLIT(%ASCIZ' /RRECEIVE'))),PTR)
ELSE MOVEAZ(%REF(CH$PTR(UPLIT(%ASCIZ' /NORRECEIVE'))),PTR);
IF .NODE[NOD$F_RRTV] NEQ .NODE[NOD$TF_RRTV] THEN CH$WCHAR_A(%C'*',PTR);
IF .NODE[NOD$TF_LSND] THEN
MOVEAZ(%REF(CH$PTR(UPLIT(%ASCIZ' /LTRANSMIT'))),PTR)
ELSE MOVEAZ(%REF(CH$PTR(UPLIT(%ASCIZ' /NOLTRANSMIT'))),PTR);
IF .NODE[NOD$F_LSND] NEQ .NODE[NOD$TF_LSND] THEN CH$WCHAR_A(%C'*',PTR);
IF .NODE[NOD$TF_LRTV] THEN
MOVEAZ(%REF(CH$PTR(UPLIT(%ASCIZ' /LRECEIVE'))),PTR)
ELSE MOVEAZ(%REF(CH$PTR(UPLIT(%ASCIZ' /NOLRECEIVE'))),PTR);
IF .NODE[NOD$F_LRTV] NEQ .NODE[NOD$TF_LRTV] THEN CH$WCHAR_A(%C'*',PTR);
CH$WCHAR_A(%O'15',PTR);CH$WCHAR_A(%O'12',PTR);CH$WCHAR_A(0,PTR);!CRLF & ASCIZ
TSTR(TBUF); !Type it all out
END; !CURR1
GLOBAL ROUTINE NODNDB(NB)=
!Fill in the appropriate fields in an NDB from NODTBL
!NB: address of NDB
!Returns: 1 if we can process this now, error code otherwise
BEGIN
MAP NB: REF NDB;
LOCAL NOD: REF NODTBL_ENTRY;
IF .NB[NDB$NODEID] EQL 0 THEN NB[NDB$NODEID]=WILDCARD_NODE;
!If he didn't say who he was
NOD=LKNODE(.NB[NDB$NODEID]); !Try to find the entry
IF .NB[NDB$MASTER] AND (.NOD EQL 0)
THEN NOD=LKNODE(WILDCARD_NODE); !Try wild card
IF .NOD EQL 0 THEN LOSE(NODUNN); !Undefined network node
NB[NDB$REQUE]=.NOD[NOD$REQUE]; !How long an AFTER on REQUE
NB[NDB$INACTO]=.NOD[NOD$INACTO]; !How long we let him sit there
NB[NDB$CONTO]= !Check for reasonable value
(IF (.NOD[NOD$CONTO] GTR TIMOMIN)
THEN .NOD[NOD$CONTO]/JIF_TO_UDT
ELSE TIMOMIN); !How long to connect
NB[NDB$REPTO]=
(IF (.NOD[NOD$REPTO] GTR TIMOMIN)
THEN .NOD[NOD$REPTO]/JIF_TO_UDT
ELSE TIMOMIN); !How long to connect
CASE .NB[NDB$ACCFUNC] FROM 0 TO 8 OF SET
[ACC$OPEN]: IF .NB[NDB$MASTER] THEN
(IF .NOD[NOD$TF_LRTV] EQL 0 THEN LOSE(NODDIS))
ELSE
(IF .NOD[NOD$TF_RSND] EQL 0 THEN LOSE(NODDIS));
[ACC$CREATE,ACC$RENAME,ACC$ERASE]:
IF .NB[NDB$MASTER] THEN
(IF .NOD[NOD$TF_LSND] EQL 0 THEN LOSE(NODDIS))
ELSE
(IF .NOD[NOD$TF_RRTV] EQL 0 THEN LOSE(NODDIS));
[INRANGE,OUTRANGE]:;
TES;
IF (.NOD[NOD$TIMUP] NEQ .NOD[NOD$TIMDN]) AND (NOT .NOD[NOD$TF_OVERRIDE]) THEN
BEGIN !See if this is a good time of day for us
LOCAL T;
T=TIMER(); !Get the time of day
IF .NOD[NOD$TIMUP] GTR .NOD[NOD$TIMDN]
THEN BEGIN !System down between the times
IF (.T GTR .NOD[NOD$TIMDN]) AND (.T LSS .NOD[NOD$TIMUP])
THEN LOSE(NODTOD) !Wrong time of day
END
ELSE BEGIN !System up between the times
IF (.T GTR .NOD[NOD$TIMDN]) OR (.T LSS .NOD[NOD$TIMUP])
THEN LOSE(NODTOD) !Wrong time of day
END
END;
WIN !If we got this far we deserve to win
END; !NODNDB
GLOBAL ROUTINE CHKLIM(NB)=
BEGIN
!Check if a request is over the limit
!The size of the local file (FILE$ALLOC or FILE$EST) is compared with NOD$TLIMIT
!The condition NODLIM is signalled if the request is over the limit and
!FILE$PF_NOSIG in the NDB is not set
!
! Formal Parameters
!
MAP NB: REF NDB; !address of node data block
!
! Implicit inputs
!
!The NOD$TLIMIT field of the node entry in NODTBL for the remote node
!
! Returned value
!
!SS$_NORMAL if successful,
!error code if not
!
! Implicit outputs
!
!none
LOCAL NODE: REF NODTBL_ENTRY,
SIZE; !Size of associated file
BIND FB=.NB[NDB$FB]: FILE_BLOCK; !Get associated file block
IF FB EQL 0 THEN RETURN WIN; !No local file, can't lose
NODE=LKNODE(.NB[NDB$NODEID]); !Find the entry in NODTBL
IF .NODE EQL 0
THEN BEGIN
IF .NB[FILE$PF_NOSIG] EQL 0 THEN SIGNALE(NODUNN,NB[FILE$START]);
!Signal error condition unless told not to
LOSE(NODUNN); !Return error code
END;
SIZE=.FB[FILE$ALLOC]; !Try allocated length if any yet
IF .SIZE EQL 0 THEN SIZE=.FB[FILE$EST]; !Use estimated length otherwise
IF .SIZE GTR .NODE[NOD$TLIMIT]
THEN BEGIN
IF .NB[FILE$PF_NOSIG] EQL 0 THEN SIGNALE(NODLIM,NB[FILE$START]);
!Signal error condition unless told not to
RETURN(NODLIM^3+SS$_ERROR); !Return error code anyway
END;
END; !CHKLIM
GLOBAL ROUTINE LKNODE(NODEID)=
!Find a node in NODTBL
!NODEID: SIXBIT name of node
!Returns: Address of node entry if found, 0 otherwise
BEGIN
INCR I FROM NODTBL$BASE BY .NODTBL$ENTLEN DO
BEGIN
MAP I: REF NODTBL_ENTRY;
IF .I[NOD$ID] EQL 0 THEN RETURN 0; !Didn't find it
IF .I[NOD$F_TYPE] THEN !A NETSPL node
BEGIN
IF .NODEID EQL .I[NOD$ID] THEN RETURN .I; !Found it
END;
END
END; !LKNODE
GLOBAL ROUTINE NODINI(PTR,ARGS)=
!The INITIALIZE command to reset the OPR-settable fields in the node table
BEGIN
INCR I FROM NODTBL$BASE BY .NODTBL$ENTLEN DO
BEGIN
MAP I: REF NODTBL_ENTRY;
IF .I[NOD$ID] EQL 0 THEN EXITLOOP; !Reached the end
IF .I[NOD$ID] NEQ -1 THEN
BEGIN
I[NOD$TLIMIT]=.I[NOD$LIMIT];
I[NOD$TFLG]=.I[NOD$FLG];!Reset temp flags
I[NOD$TF_OVERRIDE]=0; !Reset Time-of-day override
END
END;
END;
END ELUDOM