*DECK NS$MSG
USETEXT COM$NS
USETEXT DEF$NS
USETEXT HIS$NS
USETEXT LIN$NS
USETEXT NPT$NS
USETEXT NST$NS
USETEXT PFC$NS
USETEXT SMD$NS
USETEXT SMB$NS
PROC NS$MSG(MSG$TXT,(MSGSIZE),(MSGROUTING)); # DISPATCH MSG #
# TITLE NS$MSG - DISPATCH MESSAGE. #
BEGIN # NS$MSG #
#
** NS$MSG - DISPATCH MESSAGE.
*
* J.C. LEE 1981
*
* THIS ROUTINE DISPATCHES MESSAGES.
*
* PROC NS$MSG(MSG$TXT,(MSGSIZE),(MSGROUTING))
*
* ENTRY:
* MSG$TXT = A MESSAGE TEXT ARRAY OF UP TO 58
* CHARACTERS AND LINE TERMINATOR.
* (ZERO BYTE)
* MSGSIZE = LENGTH OF MESSAGE TEXT IN CM WORDS.
* MSGROUTING = MESSAGE ROUTING OPTIONS, CAN ONE OR
* ANY COMBINATIONS OF THE FOLLOWING:
* - HOP COMMAND INDICATOR.
* - ABORT NS INDICATOR.
* - NAM ERROR INDICATOR.
* - NETWORK LOG FILE INDICATOR.
* - SIGNIFICANT EVENT INDICATOR.
* - DAYFILE MESSAGE INDICATOR.
* - MACREL MESSAGE MACRO ROUTING OPTIONS.
*
* EXIT:
* NONE.
*
* METHOD:
* USE *MSGROUTING* TO DETERMINE ACTION TO TAKE.
* IF MESSAGE MACRO OPTIONS:
* USE MESSAGE MACRO TO ROUTE IT TO THE
* SPECIFIED DAYFILES.
* IF NETWORK LOG FILE OPTION:
* ADD LINE HEADER.
* TIME STAMP IT.
* SEND IT TO HISTORY BUFFER.
* IF K-DISPLAY ASSIGNED:
* SEND IT TO *KDB*.
* ELSE
* IF SIGNIFICANT EVENT:
* LOG IN NPU STATUS TABLE.
* SET PROGRAM ID, SEND HOP/LG
* IF NAM ERROR INDICATOR SET:
* SEND DBG/STOP TO ABORT NIP.
* IF ABORT NS INDICATOR SET:
* NETCHECK
* ABORT NS.
*
#
ARRAY MSG$TXT; # MESSAGE TEXT #
BEGIN
ITEM MSGTXTWORD U(0,0,60);
END
ITEM MSGSIZE U; # MESSAGE TEXT SIZE IN CM WORDS #
ITEM MSGROUTING U; # MESSAGE ROUTING OPTIONS #
$BEGIN
XREF
BEGIN
PROC NS$DBG; # TRACE CALL #
END
$END
XREF
BEGIN
PROC ABORT; # ABORT NS #
PROC CLOCK; # GET DISPLAY-CODED CLOCK TIME #
PROC EXINCSZ; # INCREASE TSB SIZE #
PROC EXREDUC; # REDUCE TSB SIZE #
PROC MESSAGE; # ISSUE DAYFILE MESSAGE #
PROC MOVEI; # MOVE DATA #
PROC MOVEOK; # ALLOW TSB TO MOVE #
PROC NETCHEK; # FLUSH NWL BUFFER TO SEND ALL SM-S #
PROC NETPUT; # NETPUT #
PROC NS$TKD; # MOVE DATA TO K-DISPLAY TSB #
PROC TSBINFO; # LOCATE TSB #
END
DEF L$CLOCK # 1 #; # NUMBER OF WORDS FOR TIME STAMP #
DEF L$MSGTEXT # 7 #; # SIZE OF MESSAGE TEXT #
ITEM ADDR U; # TEMPORARY VARIABLE #
ITEM I I; # LOOP VARIABLE #
ITEM LNSIZE U; # LINE SIZE #
ITEM NSTTSBN U; # TSB NUMBER OF NPU STATUS TABLE #
ITEM TIME U; # DISPLAY CODED TIME OF DAY #
ITEM TSBFWA U; # TSB FWA #
ITEM TSBSIZE U; # TSB SIZE #
ARRAY ROPTIONS [0:0] S(1);
BEGIN # MESSAGE ROUTING OPTIONS #
ITEM ROUTING U(00,00,60);
ITEM F$HOPCMD B(00,50,01); # HOP COMMAND INDICATOR #
ITEM F$ABORT B(00,51,01); # ABORT NS INDICATOR #
ITEM F$NAMERR B(00,52,01); # NAM ERROR INDICATOR #
ITEM F$NAMLOG B(00,53,01); # NETWORK LOG FILE INDICATOR #
ITEM F$SIGEVENT B(00,54,01); # SIGNIFICANT EVENT INDICATOR #
ITEM F$EVENT B(00,55,01); # EVENT MESSAGE INDICATOR #
ITEM F$MESSAGE B(00,56,01); # DAYFILE MESSAGE INDICATOR #
ITEM MSGOPTIONS U(00,57,03); # MESSAGE MACRO ROUTING OPTIONS #
END
ARRAY ABH [0:0] S(1);
BEGIN # APPLICATION BLOCK HEADER #
ITEM ABH$ABT U(00,00,06) = [APPCMD];
ITEM ABH$ADR U(00,06,12) = [0];
ITEM ABH$ABN U(00,18,18) = [0];
ITEM ABH$ACT U(00,36,04) = [CT60TRANS];
ITEM ABH$DBC U(00,40,08) = [0];
ITEM ABH$TLC U(00,48,12);
END
ARRAY SMHDR[00:00] S(1);
BEGIN
ITEM SM$PFCSFC U(00,00,16); # SM PFC/SFC CODE #
ITEM SM$HDRWORD U(00,00,60); # WHOLE WORD REFERENCE #
END
DEF L$MSGLINE # 8 #; # SIZE OF MESSAGE LINE #
ARRAY MSGLINE [0:0] S(L$MSGLINE);
BEGIN # MESSAGE LINE FORMAT #
ITEM MSG$LINHDR U(00,00,60); # LINE HEADER WORD #
ITEM MSG$LINID U(00,00,24);
ITEM MSG$LINSIZ U(00,42,18); # LINE SIZE IN WORDS #
ITEM MSG$LINEND B(00,41,01); # END OF CMD RESPONSE FLAG #
ITEM MSG$PROCID C(00,00,10); # NS ID #
ITEM MSG$TIME U(01,00,60); # TIME STAMP #
ITEM MSG$TXTWD U(02,00,60); # MESSAGE TEXT #
END
CONTROL EJECT;
$BEGIN
NS$DBG("MSG"); # TRACE CALL #
$END
ROUTING[0] = MSGROUTING; # MESSAGE ROUTING OPTIONS #
IF F$MESSAGE[0]
THEN # ISSUE DAYFILE MESSAGE #
MESSAGE(MSG$TXT,MSGOPTIONS[0]);
IF F$NAMLOG[0]
THEN # NETWORK LOG FILE MESSAGE #
BEGIN
CLOCK(TIME); # GET DISPLAY CODED TIME OF DAY #
LNSIZE = LIN$HDRL + L$CLOCK + MSGSIZE; # SIZE OF NEW LINE #
P<LIN$HEADER> = LOC(MSG$LINHDR);
LIN$HDRWD[0] = 0;
LIN$ID[0] = LIN$IDENT;
LIN$LNSIZE[0] = LNSIZE;
MSG$TIME[0] = TIME; # TIME STAMPED NEW LINE #
MOVEI(MSGSIZE,LOC(MSG$TXT),LOC(MSG$TXTWD));
#
ADD NEW MESSAGE LINE TO HISTORY BUFFER
#
IF HISTSBN NQ 0
THEN # NS INITIALIZATION HAS COMPLETED #
BEGIN
TSBINFO(TSBSIZE,TSBFWA,HISTSBN); # LOCATE HISTORY BUFFER #
P<HIS$BUFFER> = 0;
IF HIS$LC[TSBFWA] GQ HIS$MAX$LN
THEN # MAX HISTORY BUFFER LINE COUNT REACHED #
BEGIN # REMOVE FIRST LINE OF HISTORY BUFFER #
P<LIN$HEADER> = TSBFWA + HIS$HDRL; # FWA OF FIRST LINE #
I = LIN$LNSIZE[0]; # SIZE OF FIRST LINE #
MOVEI(HIS$HDRL,TSBFWA,TSBFWA+I); # REMOVE FIRST LINE #
EXREDUC(I,HISTSBN,TRUE,TSBFWA); # RETURN UNUSED SPACE #
HIS$WC[TSBFWA] = HIS$WC[TSBFWA] - I; # UPDATE WORD COUNT #
END
ELSE # UPDATE HISTORY BUFFER LINE COUNT #
HIS$LC[TSBFWA] = HIS$LC[TSBFWA] + 1; # INCREMENT LINE COUNT#
EXINCSZ(LNSIZE,TSBFWA,HISTSBN); # INCREASE HISTORY BUFF SIZE #
MSG$LINEND[0] = FALSE; # NOT COMMAND RESPONSE #
MOVEI(LNSIZE,LOC(MSG$LINHDR),TSBFWA+HIS$WC[TSBFWA]);
HIS$WC[TSBFWA] = HIS$WC[TSBFWA] + LNSIZE; # UPDATE WORD CNT #
MOVEOK(HISTSBN); # ALLOW HISTORY BUFFER TO MOVE #
END
#
IF K DISPLAY IS ASSIGNED, SEND LINE TO K DISPLAY
#
IF DCW$F$ASS[0]
THEN # K-DISPLAY ASSIGNED #
BEGIN
IF NOT F$HOPCMD[0]
THEN # NOT A HOP COMMAND #
BEGIN # DRIBBLE LINE TO K DISPLAY #
MSG$LINEND[0] = TRUE; # END OF RESPONSE #
NS$TKD(MSGLINE,LNSIZE,1); # MOVE LINE TO K DISPLAY TSB #
END
END
ELSE # K-DISPLAY NOT ASSIGNED #
BEGIN
IF F$SIGEVENT[0] # A SIGNIFICANT EVENT MESSAGE #
AND NOT DCW$F$IG[0] # ALERT ALLOWED #
THEN # SEND HOP/ALT TO ALERT HOP #
BEGIN
ABH$TLC[0] = LHOPALT; # SET TEXT LENGTH #
SM$HDRWORD[0] = 0;
SM$PFCSFC[0] = HOPALT; # SET PFC/SFC CODE #
NETPUT(ABH,SMHDR); # SEND HOP/ALT/SM #
END
END
IF F$EVENT[0]
THEN # AN EVENT MESSAGE #
BEGIN # LOG IN NPU STATUS TABLE #
NSTTSBN = NPT$NSTTSB[NTORD]; # TSB NUMBER OF NST #
TSBINFO(TSBSIZE,TSBFWA,NSTTSBN); # LOCATE NST #
P<NST> = TSBFWA; # FWA OF NST #
ADDR = LOC(NST$EVMSG[0]); # FWA OF EVENT MESSAGE IN NST #
MOVEI(MSGSIZE+L$CLOCK,LOC(MSG$TIME[0]),ADDR); # MOVE TO NST #
MOVEOK(NSTTSBN); # ALLOW NST TO MOVE #
END
#
SEND HOP/LG TO NIP TO ENTER MESSAGE IN NETWORK LOG FILE
#
MSG$PROCID[0] = "NS/ "; # SET PROGRAM ID #
ABH$TLC[0] = LNSIZE + 1;
SM$HDRWORD[0] = 0;
SM$PFCSFC[0] = HOPLG;
NETPUT(ABH,SMHDR); # SEND HOP/LG TO NIP #
END
$BEGIN
IF F$NAMERR[0]
THEN # NAM ERROR DETECTED #
BEGIN # SEND DBG/STP TO NIP #
ABH$TLC[0] = LDBG; # SET TEXT LENGTH IN CHARACTERS #
SM$HDRWORD[0] = 0;
SM$PFCSFC[0] = DBGSTOP; # SET PFC/SFC CODE #
NETPUT(ABH,SMHDR); # SEND DBG/STOP TO ABORT NIP #
END
$END
IF F$ABORT[0]
THEN
BEGIN # A FATAL NS ERROR MESSAGE #
NETCHEK; # MAKE SURE ALL SM-S ARE SENT #
ABORT; # ABORT NS #
END
RETURN;
END # NS$MSG #
TERM