*DECK NS$EXC
USETEXT COM$NS
USETEXT DEF$NS
USETEXT ERR$NS
USETEXT NAT$NS
USETEXT NPT$NS
PROC NS$EXC; # NS EXECUTIVE #
# TITLE NS$EXC - NS EXECUTIVE. #
BEGIN # NS$EXC #
#
** NS$EXC - NS EXECUTIVE.
*
* J.C. LEE 1981
*
* THIS IS THE NS MAIN PROGRAM. IT IS THE EXECUTIVE.
*
* PROC NS$EXC
*
* ENTRY:
* NONE.
*
* EXIT:
* NONE.
*
* METHOD:
* LOAD AND EXECUTE NS INITIALIZATION OVERLAY.
* THIS PROC CONSISTS PRIMARY OF A LARGE LOOP.
* EACH TIME THROUGH THE LOOP, THE FOLLOWING IS DONE:
* GET REAL TIME CLOCK READING AND SET CURRENT TIME
* IN SECONDS.
* IF NS NOT IN NORMAL MODE AND STARTUP MODE TIMER
* EXPIRED:
* SET NS TO NORMAL MODE.
* CALL SM PROCESSOR TO PROCESS ALL INCOMING SMS.
* IF FORCE SHUTDOWN IN EFFECT:
* NETOFF NS.
* STOP RUN.
* IF NOT FORCE SHUTDOWN:
* CHECK NPU ACTIVITY TIMER.
* IF NPU-TIMEOUT-INTERVAL NQ 0:
* SET NETWAIT TIME TO NPU-TIMEOUT-INTERVAL.
* ELSE:
* SET NETWAIT TIME TO 4095 SECONDS.
* CALL TSB MANAGER TO PERFORM MEMORY COMPACTION.
* LOOP TERMINATES WHEN NS NETOFF, OR ERROR IS DETECTED.
*
#
$BEGIN
XREF
BEGIN
PROC NS$DBG; # TRACE PROCEDURE CALL #
END
$END
XREF
BEGIN
PROC NDLOVLD; # OVERLAY LOADER #
PROC NETCHEK; # AIP NETCHEK CALL #
PROC NETWAIT; # NETWAIT #
FUNC NS$FEC U; # FORMAT ERROR CODE #
PROC NS$MSG; # MESSAGE DISPATCHER #
PROC NS$OFF; # DISCONNECT FROM NETWORK #
PROC NS$SHD; # SHUTDOWN PROCESSOR #
PROC NS$SMP; # SUPERVISORY MESSAGE PROCESSOR #
PROC MOVEOK; # ALLOW TSB TO MOVE #
PROC RECALL; # RECALL #
PROC RTIME; # GET REAL TIME CLOCK READING #
PROC TSBINFO; # LOCATE TSB #
PROC XFLMGR; # EXCESS FIELD LENGTH MANAGER #
END
ITEM ERRCODE U; # ERROR CODE #
ITEM GTIMER U; # ACTIVITY TIMER #
ITEM I I; # LOOP VARIABLE #
ITEM LTIMER U; # RESPONSE TIMER #
ITEM NATFWA U; # NAT FWA #
ITEM NATSIZE U; # NAT SIZE #
ITEM NEXTNATTSB U; # NAT TSB NUMBER #
ITEM TSBN U; # TSB NUMBER #
DEF L$CSHDMSG # 3 #; # MESSAGE SIZE #
DEF DM$CSHDMSG # DM$LOCAL + DM$NAMLOG #; # ROUTING OPTIONS #
ARRAY MSG$CSHD [0:0] S(L$CSHDMSG);
BEGIN # SHUTDOWN COMPLETED MESSAGE #
ITEM CSHD$TEXT C(00,00,25) =
["SHUTDOWN COMPLETED."];
ITEM CSHD$END U(02,30,30) = [0];
END
ARRAY REALTIME [0:0] S(1);
BEGIN # STATUS WORD FOR RTIME CALL #
ITEM CURSEC U(00,00,24); # SECOND CLOCK #
ITEM CURMS U(00,24,36); # MILLISECOND CLOCK #
END
ARRAY NSI$OVLY [0:0] S(1);
BEGIN # INITIALIZATION OVERLAY NAME AND LEVEL #
ITEM NO$NAM C(00,00,07) = ["NSIOVLY"];
ITEM NO$LV1 U(00,42,09) = [1];
ITEM NO$LV2 U(00,51,09) = [0];
END
ARRAY MKD$OVLY [0:0] S(1);
BEGIN # K-DISPLAY MANAGER OVERLAY NAME/LEVEL #
ITEM MO$NAM C(00,00,07) = ["MKDOVLY"];
ITEM MO$LV1 U(00,42,09) = [3];
ITEM MO$LV2 U(00,51,09) = [0];
END
ARRAY ERR$OVLY [0:0] S(1);
BEGIN # ERROR PROCESSOR OVERLAY NAME AND LEVEL #
ITEM EO$NAM C(00,00,07) = ["ERROVLY"];
ITEM EO$LV1 U(00,42,09) = [5];
ITEM EO$LV2 U(00,51,09) = [0];
END
CONTROL EJECT;
$BEGIN
NS$DBG("EXC");
$END
#
LOAD AND EXECUTE NS INITIALIZATION OVERLAY
#
NDLOVLD(NSI$OVLY);
FOR I = 0
DO # NS EXECUTIVE LOOP #
BEGIN
RTIME(REALTIME); # GET REAL TIME CLOCK READING #
CURTIME = CURSEC[0]; # SET CURRENT TIME IN SECONDS #
IF NSM NQ M$NORMAL # NS NOT IN NORMAL MODE #
AND CURTIME GR NMTIME # STARTUP MODE TIMER EXPIRED #
THEN
NSM = M$NORMAL; # SET NS TO NORMAL MODE #
#
CALL SUPERVISORY MESSAGE PROCESSOR TO PROCESS ALL
INCOMING SUPERVISORY MESSAGES
#
NS$SMP;
IF NOT FORCESHUT
THEN # FORCE SHUTDOWN IS NOT IN EFFECT #
BEGIN
#
CHECK NPU ACTIVITY TIMERS FOR EXPIRATION
#
NEXTNATTSB = NPT$NLHEAD[0]; # HEAD PTR OF NAT LIST #
FOR I = 0 WHILE NEXTNATTSB NQ 0
DO # MORE NAT IN LIST #
BEGIN # CHECK NAT FOR TIMER EXPIRATION#
TSBINFO(NATSIZE,NATFWA,NEXTNATTSB); # LOCATE NAT #
P<NAT> = NATFWA; # FWA OF NAT #
TSBN = NEXTNATTSB; # SAVE CURRENT NAT TSBN #
NEXTNATTSB = NAT$NLFP[0]; # NEXT NAT IN LIST #
LTIMER = NAT$LTIMER[0]; # RESPONSE TIMER #
GTIMER = NAT$GTIMER[0]; # ACTIVITY TIMER #
IF CURTIME GR LTIMER
OR (GTIMER NQ 0
AND CURTIME GR GTIMER)
THEN # TIMEOUT ERROR #
BEGIN
NTORD = NAT$NTORD[0]; # NPU TABLE ORDINAL #
ERRCODE = NS$FEC(EC"ERR$TIMER",0);
NDLOVLD(ERR$OVLY,ERRCODE); # PROCESS TIMEOUT ERROR #
IF NPT$NATTSB[NTORD] NQ 0
THEN
NEXTNATTSB = TSBN;
END
ELSE # TIMER(S) ARE STILL RUNNING #
BEGIN
MOVEOK(TSBN); # ALLOW NAT TO MOVE #
END
END
END
IF FORCESHUT # FORCE SHUTDOWN IN EFFECT #
OR (GRADSHUT AND NPT$NLHEAD[0] EQ 0) # GRADUAL SHUTDOWN/NO NP#
THEN # SHUTDOWN NS #
BEGIN
NS$MSG(MSG$CSHD,L$CSHDMSG,DM$CSHDMSG);
NS$OFF; # DISCONNECT FROM NETWORK #
STOP; # ENDRUN #
END
IF DCW$F$SKD[0]
THEN # K-DISPLAY DATA TO SEND #
NDLOVLD(MKD$OVLY); # CALL K-DISPLAY MANAGER #
#
PERFORM EXCESS FIELD LENGTH PROCESSING
#
XFLMGR;
#
GIVE UP CPU WHILE WAITING FOR NEXT INPUT
#
IF NPT$NLHEAD[0] NQ 0
THEN # ACTIVE NPU(S) STILL EXIST #
BEGIN # STAY IN CONTROL POINT UNTIL ACTIVITY COMPLETED #
NETCHEK; # FLUSH WORKLIST AND GET UPDATED S/I STATUS #
RECALL(0); # RELINQUISH CPU WHILE WAITING FOR INPUT #
END
ELSE # NO ACTIVE NPU #
NETWAIT(MAX$NWTIME,FALSE);
END
RETURN;
END # NS$EXC #
TERM