*DECK BLDNCNB
USETEXT NIPDEF
USETEXT LLCB
USETEXT KDIS
USETEXT KHDRX
USETEXT NCNB
USETEXT NCNT
USETEXT OVERLAY
USETEXT PARAMS
USETEXT ACKHEAD
USETEXT NHEADER
USETEXT PT
USETEXT STATTAB
USETEXT SUPMSG
PROC BLDNCNB; # BUILD NCNT AND NCNB #
STARTIMS;
#
*1DC BLDNCNB
* 1. PROC NAME AUTHOR DATE
* BLDNCNB C. BITTNER 81/03/17
*
* 2. FUNCTIONAL DESCRIPTION
* BUILD NCNB. IF THERE IS A CORRESPONDING NCNT THEN
* JUST BUILD NCNT ENTRY, ELSE BUILD NCNT ALSO. BUILD
* LLCB ENTRY.
* 3. METHOD
*
* IF THERE IS NO CORRESPONDING NCNT THEN CREATE
* AN NCNT AND FILL IN HEADER INFORMATION. ALSO
* FILL IN ENTRY INFORMATION FOR THE LLCB.
*
* ALLOCATE A BUFFER FOR THE NETWORK
* CONNECTION BLOCK (NCNB). FILL IN INFORMATION
* FOR NCNB AND LINK NCNT WITH NCNB. UPDATE THE
* TOTAL NUMBER OF CONNECTIONS ON THIS LOGICAL
* LINK IN THE LLCB HEADER.
*
* BUILD AN ACKNOWLEDGE QUEUE OF DBL+1 WORDS.
*
* FILL IN NCNB ENTRY INFORMATION
* 1) SFC = TE (ICN/TE/R)
* FILL IN NCNB ENTRY INFORMATION USING THE
* INFORMATION FROM THE ICN/TE/R AND UPDATE THE
* TOTAL NUMBER OF ACTIVE CONNECTIONS IN THE NCNT
* HEADER.
* 2) SFC = AP (ICN/AP/R)
* FILL IN NCNB ENTRY INFORMATION FROM ICN/AP/R MESSAGE.
* UPDATE K-DISPLAY BUFFERS IF NECESSARY.
*
* 4. ENTRY PARAMETERS
* PARAMS1 - ADDRESS OF SM BUFFER (ICN/AP/R,ICN/TE/R)
* PARAMS2 - LLCB ADDRESS
*
* 5. EXIT PARAMETERS
* PARAMS3 - NCNB ADDRESS
* PARAMS4 - NCNT ENTRY ADDRESS
*
* 6. COMDECKS CALLED AND SYMPL TEXTS USED
* NIPDEF SUPMSG
* LLCB PARAMS
* NCNB ACKHEAD
* NCNT NHEADER
* STATTAB PT
* KDIS MSGIDX
*
* 7. ROUTINES AND OVERLAYS CALLED
* KPUT - UPDATE K-DISPLAY BUFFER
* MGETS - ALLOCATE A BUFFER
* OMSG - OUTPUT DAYFILE MESSAGE
* XDROP - SET PIP DROP FLAG AND STOP
* XTRACE - RECORD PROCEDURE CALL
*
* 8. DAYFILE MESSAGES AND OTHER IMPORTANT INFORMATION
* "NIP INTERNAL ERROR - BLDNCNB"
* THIS PROCEDURE IS CALLED BY OVERLAY STRTCON VIA NCSTTP.
*
*
#
STOPIMS;
#
EXTERNAL VARIABLES
#
XREF
BEGIN
PROC ABORT; # ABORT NAM #
PROC KPUT; # UPDATE NAM STATUS DISPLAY #
PROC MGETS; # ALLOCATE A BUFFER #
PROC OVLCALL; # LOAD AND EXECUTE OVERLAY #
PROC XTRACE; # RECORD PROCEDURE CALL #
END
#
INTERNAL VARIABLES
#
ARRAY CNX;
BEGIN
ITEM NCN U(00,00,60); # NETWORK CONNECTION NUMBER #
ITEM CN1 U(00,52,04); # CONNECTION INDEX #
ITEM CN2 U(00,56,04); # NCNT INDEX #
END
ITEM KN U;
ITEM ACKQBUF; # ACKNOWLEDGE QUEUE BUFFER ADDRESS #
ITEM ACKQSIZE; # ACKNOWLEDGE QUEUE SIZE #
ITEM NCNTADDR; # NCNT ADDRESS #
ITEM CI; # CONNECTION INDEX #
ITEM FOUND B; # CN FOUND FLAG #
ITEM NCNTINDX; # INDEX INTO NCNT #
ITEM LLCBINDX; # INDEX INTO LLCB #
ITEM MAXNCNTCN; # MAXIMUM NO. OF CONNECTIONS FOR NCNT #
ITEM NCNBADDR; # NCNB ADDRESS #
ITEM PFCSFCV; # PFC/SFC FUNCTION CODE #
ARRAY ERR$MSG [0:0] S(4);
BEGIN # ERROR MESSAGE #
ITEM MSG$TEXT C(00,00,38) =
["BLDNCNB/INVALID CONNECTION NUMBER."];
ITEM MSG$END U(03,48,12) = [0];
END
#**********************************************************************#
BEGIN
CONTROL IFEQ DEBUG,1;
XTRACE("BNCNB") ;
CONTROL FI;
P<SUPMSG> = PARAMS1;
P<SMNIP> = PARAMS1; # BASE SM #
P<SMNVF> = PARAMS1;
P<LLCB> = PARAMS2; # BASE LLCB #
NCN = ICNCN[0]; # NETWORK CONNECTION NUMBER #
LLCBINDX = CN1 + LLCBHSIZE; # INDEX INTO LLCB #
PFCSFCV = PFCSFC[0]; # PFC/SFC VALUE #
PARAMS3 = 0; # INITIALIZE RESPONSE CODE #
IF NCN EQ 0
THEN # NETWORK CONNECTION NUMBER IN SM IS ZERO #
BEGIN # DETERMINE WHOSE AT FAULT #
IF PFCSFCV EQ ICNTE
OR PFCSFCV EQ ICNEX
THEN # CCP ERROR, INVALID CONNECTION NUMBER #
PARAMS3 = RTEA"TCE";
ELSE # CR/IAP/N OR ICN/AP/R #
BEGIN
IF PFCSFCV EQ CRIAPN
THEN # INTERNAL NIP ERROR, ABORT #
ABORT(ERR$MSG,0); # INVALID CR/IAP/N #
ELSE # INVALID ICN/AP/R FROM NETWORK #
PARAMS3 = RAPA"SNA";
END
GOTO BNCNB$EXIT;
END
IF LLCBNCNT[LLCBINDX] EQ 0
THEN # ALLOCATE AN NCNT #
BEGIN
MGETS(NCNTSIZE,NCNTADDR,TRUE); # ALLOCATE NCNT BUFFER #
P<NCNT> = NCNTADDR;
# FILL IN NCNT HEADER INFORMATION #
NCNTID[0] = NCNTIDVALUE;
NCNTHN[0] = LLCBHN[0]; # HOST NODE #
NCNTTN[0] = LLCBTN[0]; # TERMINAL NODE #
NCNTCI[0] = CN1; # CONNECTION INDEX #
LLCBNCNT[LLCBINDX] = NCNTADDR; # SET POINTER TO NCNT #
LLCBCI[LLCBINDX] = CN1; # INITIALIZE LLCB CONN INDX #
END
ELSE
BEGIN
P<NCNT> = LLCBNCNT[LLCBINDX]; # BASE NCNT #
CONTROL IFEQ DEBUG,1;
NCNTINDX = CN2 + NCNTHSIZE; # INDEX INTO NCNT #
IF NCNTNCNB[NCNTINDX] NQ 0
THEN # CONNECTION ALREADY EXISTS #
ABORT(ERR$MSG,0); # NIP ERROR, ABORT #
CONTROL FI;
END
# ALLOCATE AN NCNB #
MGETS(NCNBSIZE,NCNBADDR,TRUE); # ALLOCATE NCNB BUFFER #
P<NCNB> = NCNBADDR; # BASE NCNB #
NCNBID[0] = NCNBIDVALUE; # SET BLOCK ID #
NCNBCTAD[0] = P<NCNT>; # SET NCNT POINTER #
NCNBNBTE[0] = LLCBNBTE[0]; # INITIALIZE NETWORK BUFFER TAB ENTRY#
# FILL IN INFORMATION FOR NCNB #
IF PFCSFCV EQ ICNTE
THEN
BEGIN # ICN/TE/R #
NCNBDBL[0] = ICNDBL[0]; # DOWNLINE BLOCK LIMIT #
IF ICNTPRI[0]
THEN
NCNBPRI[0] = 1; # HIGH PRIORITY CONNECTION #
ELSE
NCNBPRI[0] = 2; # LOW PRIORITY CONNECTION #
NCNBDT[0] = ICNDT[0]; # DEVICE TYPE #
NCNBTC[0] = ICNTC[0]; # TERMINAL CLASS #
NCNBPW[0] = ICNPW[0]; # PAGE WIDTH #
NCNBPL[0] = ICNPL[0]; # PAGE LENGTH #
END
ELSE
BEGIN # CR/IAP/N OR ICN/EX/R OR ICN/AP/R #
IF PFCSFCV EQ CRIAPN
THEN # CR/IAP/N FROM NVF, SET DOWNLINE BLOCK LIMIT #
BEGIN # SET CONNECTION PRIORITY AS WELL #
NCNBDBL[0] = CRADBL[0];
IF CRAPRI[0]
THEN # ITS A HIGH PRIORITY CONNECTION #
NCNBPRI[0] = 1;
ELSE # ITS A LOW PRIORITY CONNECTION #
NCNBPRI[0] = 2;
END
IF PFCSFCV EQ ICNEX
THEN # ICN/EX/R FROM NETWORK, SET X.25 INDICATOR #
NCNBX25[0] = TRUE;
NCNBAA[0] = TRUE; # SET A-A FLAG #
IF ICNSNOD[0] EQ 0 OR ICNDNOD[0] EQ 0
THEN
NCNBDT[0] = DT$INTA ; # CONNECTION IN THE SAME HOST #
ELSE
NCNBDT[0] = DT$INTE ; # CONNECTION BETWEEN 2 HOSTS #
END
IF LLCBNRL[0] EQ BUFLSM # BUFFER REGULATION LEVEL 1 #
THEN
BEGIN
NCNBNR[0] = TRUE; # PUT NCNB IN REGULATION #
END
ELSE
BEGIN
IF LLCBNRL[0] EQ BUFLHDS # BUFFER REGULATION LEVEL 2 #
THEN
BEGIN
IF NCNBPRI[0] EQ 2 # LOW PRIORITY DATA #
THEN
BEGIN
NCNBNR[0] = TRUE; # PUT NCNB IN REGULATION #
END
END
END
IF NCNBDBL[0] NQ 0
THEN # DOWNLINE BLOCK LIMIT SET, BUILD ACKNOWLEDGE QUEUE #
BEGIN
ACKQSIZE = NCNBDBL[0]+ACKHSIZE; # ACK QUEUE SIZE #
MGETS(ACKQSIZE,ACKQBUF,TRUE); # ALLOCATE ACK QUEUE BUFFER #
P<ACKHEAD> = ACKQBUF; # FWA OF ACK QUEUE #
ACKQID[0] = ACKQIDVALUE; # SET BLOCK ID #
ACKNCNB[0] = NCNBADDR; # SET CORR NCNB ADDRESS #
NCNBAKIN[0] = 0; # SET IN PTR #
NCNBAKOU[0] = 0; # SET OUT PTR #
NCNBACKQ[0] = ACKQBUF; # SET ACK QUEUE ADDRESS #
CONTROL IFEQ STAT,1;
ST$AQ = ST$AQ+1; # INCREMENT ACKNOWLEDGE QUEUE COUNT #
CONTROL FI;
END
NCNBHN[0] = LLCBHN[0]; # HOST NODE #
NCNBTN[0] = LLCBTN[0]; # TERMINAL NODE #
NCNBCN[0] = NCN; # NETWORK CONNECTION NUMBER #
NCNBCST[0] = STATX; # SET INITIAL STATE FOR CONNECTION TABLE #
NCNBBST[0] = STATX; # AND FOR BLOCK STATE TABLE PROCCESORS #
# FILL IN NCNT INFORMATION #
NCNTINDX = CN2 + NCNTHSIZE; # NCNT INDEX #
NCNTNCN[0] = NCNTNCN[0] + 1; # INCREMENT NO. ACTIVE CONN #
CONCOUNT = CONCOUNT + 1;
IF CONCOUNT GR MAXSWIT
THEN
BEGIN
TBUF = 60000;
NFSIZE = 2560;
END
NCNTNCNB[NCNTINDX] = NCNBADDR; # NETWORK CONN BLOCK ADDR #
NCNTBHS[NCNTINDX] = 1; # SET BLOCK HANDLER STATE #
NCNTNIB[NCNTINDX] = 1 ; # BSN OF NEXT INPUT BLOCK #
LLCBNC[0] = LLCBNC[0] + 1; # INCREMENT NO. OF CONN ON LOG LINK #
IF KDIS$RT # REAL TIME UPDATE MODE IN EFFECT #
AND NCNBDT[0] NQ DT$INTA # NOT INTRA-HOST A-A CONNECTION #
AND LLCBKNDX[0] NQ 0 # LLCB ENTRY EXISTS IN STATUS DISPLAY #
AND LLCBKNDX[0] GQ KDLGLST[0]
AND LLCBKNDX[0] LQ KDLGLND[0]
THEN
BEGIN
IF KDESTST[0] EQ 0 THEN
KN=LLCBKNDX[0]-KDLGLST[0];
ELSE
IF KDAPPST[0] EQ 0 THEN
KN=LLCBKNDX[0]+KDESTND[0]-KDESTST[0];
ELSE
KN=LLCBKNDX[0]+KDESTND[0]+KDAPPND[0]-KDAPPST[0];
KPUT(KHDRNP[0],KN,KPLGNCN,LLCBNC[0]) ;
END
PARAMS1 = NCNBADDR; # NCNB ADDRESS #
PARAMS2 = P<NCNT>+NCNTINDX; # NCNT ENTRY ADDRESS #
BNCNB$EXIT:
RETURN ;
END
TERM