*DECK NLOBCH
USETEXT AHEADER
USETEXT BPIPBUF
USETEXT DBGBUF
USETEXT DRHDR
USETEXT NBT
USETEXT NHEADER
USETEXT NIPDEF
USETEXT OVERLAY
USETEXT PARAMP
USETEXT SUPMSG
USETEXT SYSTIME
PROC NLOBCH(BUFAD,ERRORF);
# LINK MESSAGE TO PIP OUTBOUND CHAIN #
STARTIMS;
#
*1DC NLOBCH
*
* 1. PROC NAME AUTHOR DATE
* NLOBCH E.T.WAN 81/06/08
* L.T.NGUYEN 81/09/30
*
* 2. FUNCTIONAL DESCRIPTION
* LINK SM REG/CP AND MESSAGES FROM NS,CS TO PIP OUTBOUND BUFFER.
*
* 3. METHOD USED
* CHECK THAT THERE IS A CORRECT NBT ENTRY FOR THE SPECIFIC
* COUPLER.
* CHECK NPU OFF FLAG, ACTIVE FLAG, DOWN FLAG, BOOTSTRAP FLAG, AND
* LLK FLAG TO ALLOW SUITABLE MESSAGES TO BE LINKED.
* CONVERT APPLICATION HEADER TO NETWORK HEADER.
* LINK MESSAGE TO PIP OUTBOUND CHAIN.
*
* 4. ENTRY PARAMETERS
* BUFAD MESSAGE BUFFER ADDRESS
*
* 5. EXIT PARAMETERS
* ERRORF
*
* 6. COMDECKS CALLED
* AHEADER
* DRHDR
* NBT
* NHEADER
* NIPDEF
* SUPMSG
*
* 7. ROUTINES AND OVERLAYS CALLED
* NXBLINK LINK MESSAGE ON PIP OUTBOUND CHAIN
* XTRACE TRACE CALLS
*
* 8. DAYFILE MESSAGES AND OTHER IMPORTANT INFORMATION
* THIS PROCEDURE IS CALLED BY HPPUT AND NCREGCP.
*
#
STOPIMS;
#
**** EXTERNAL ENTRY POINTS
#
XREF
BEGIN
PROC MRELS; # RELEASE BUFFER SPACE #
PROC NXBLINK ; # LOG MESSAGE INTO PIP OUT #
PROC XTRACE; # RECORD TRACES #
END
# LOCAL VARIABLES #
ITEM BUFAD; # BUFFER ADDRESS #
ITEM ERRORF ; # ERROR FLAG #
ITEM CNODE; # COUPLER NODE #
ITEM I; # LOOP CONTROL VARIABLE #
ITEM IND; # INDEX #
ITEM INDX; # INDEX #
ITEM TEMP; # SAVE APPLICATION BLOCK HEADER #
ITEM FOUND B ; # MATCHED NPU FLAG #
ITEM TEMPDN ; # TEMPORARY DEST. NODE #
#*********************************************************************#
BEGIN # NLOBCH #
CONTROL IFEQ DEBUG,1;
XTRACE("LOBCH") ;
CONTROL FI;
P<DRHDRWD> = 0; # DATA BLOCK HEADER ADDRESS #
P<SUPMSG> = BUFAD + DBHSIZE + ABHSIZE; # SM ADDRESS #
P<AHEADER> = BUFAD + DBHSIZE; # APPLICATION HEADER ADDR #
CNODE = ABHSN[0]; # COUPLER NODE #
P<SMNIP> = P<SUPMSG>;
TEMPDN = ABHDN[0] ; # DESTINATION NODE #
FOUND = FALSE;
ERRORF = 0; # INITIALIZE ERROR FLAG #
FOR I = 0 STEP NBTFETNO WHILE I LQ NBTMAXID
AND NOT FOUND
DO
BEGIN # SEARCH FOR NBTE WITH HN = COUPLE #
IF NBTHN[I] EQ CNODE
AND NBTIUF[I]
THEN
BEGIN # FOUND THE ENTRY #
FOUND = TRUE ;
IND = I; # SAVE INDEX #
END
END # SEARCH FOR NBTE WITH HN = COUPLR #
I = IND;
INDX = I+4; # INDEX INTO PIP FLAGS IN NBT 5TH FET #
IF FOUND # ACTIVE NBT EXISTS FOR THIS HN #
AND NOT NBTOF[INDX] # NPU NOT OFF IN EST #
AND ((NBTAF[INDX] # NPU ACTIVE #
AND NOT NBTMF[INDX]) # AND SAMP IS NOT RUNNING #
OR (PFC EQ NPU # NS DUMP-LOAD SM #
AND CNODE EQ TEMPDN # FOR LOCAL NPU-S WHICH IS #
AND (NOT NBTAF[INDX] # NOT ACTIVE AND SAMP NOT LOADED #
OR NBTDF[INDX])) # OR IS IN NPU DUMP-LOAD PHASE #
OR (NBTLF[INDX] # PIP WAITING FOR REG/CP RESPONSE #
AND PFCSFC[0] EQ REGCP # REG/CP RESPONSE TO PIP ALLOWED #
AND REGR[0])) # RESPONSE BIT IS ON #
THEN
BEGIN
# CONVERT ABH TO NETWORK HEADER #
TEMP = ABHWORD[0]; # SAVE APPLICATION HEADER #
ABHWORD[0] = 0; # CLEAR APPLICATION HEADER #
P<NHEADER> = BUFAD + DBHSIZE; # NETW HEADER ADDR #
P<AHEADER> = LOC(TEMP); # APPLICATION HEADER #
DN[0] = TEMPDN; # DESTINATION NODE #
SN[0] = CNODE; # SOURCE NODE #
CN[0] = 0;
BT[0] = NETCMD; # BLOCK TYPE #
NHACT[0] = ABHACT[0]; # CHARACTER TYPE #
CC[0] = ABHTLC[0]; # TEXT LENGTH #
IND = NBTINDX[I]*NBTFETNO + OSTFET;
NXBLINK(BUFAD,IND) ;
END
ELSE
BEGIN # DISCARD MESSAGE #
CONTROL IFEQ DEBUG,1;
ERRORF = 1;
CONTROL FI;
END
RETURN;
END
TERM