*DECK HCONCBU
USETEXT NIPDEF
USETEXT ACB
USETEXT ACNB
USETEXT ACNT
USETEXT AHEADER
USETEXT APPSTAT
USETEXT AT
USETEXT PARAMS
USETEXT PT
USETEXT SUPMSG
PRGM HCONCBU;
STARTIMS;
#
*1DC HCONCBU
*
* 1. PROC NAME AUTHOR DATE
* HCONCBU E. GEE 01/02/86
*
* 2. FUNCTIONAL DESCRIPTION.
* SEND CON/CB/U TO PRIMARY AND/OR SECONDARY APPLICATION.
*
* 3. METHOD USED
* DETERMINE IF CON/CB IS TO BE SENT TO PRIMARY APPLICATION.
* DETERMINE IF CON/CB IS TO BE SENT TO SECONDARY APPLICATION.
* LOOP BUILDING CON/CB SUP MSG TO SEND TO ZERO, ONE, OR TWO APPS.
* FORMAT APPLICATION BLOCK HEADER
* SET UP CON/CB/U MESSAGE
* QUEUE MESSAGE ON APPLICATION-S ACB
*
* 4. ENTRY PARAMETERS
* PARAMS1 REASON CODE FOR CON/CB SUP MSG
* PARAMS2 ACNB OF APPLICATION
*
* 5. EXIT PARAMETERS
* NONE
*
* 6. COMDECKS CALLED AND SYMPL TEXTS USED
* ACB APPLICATION CONTROL BLOCK TEMPLATE
* ACNB APPLICATION CONNECTION BLOCK TEMPLATE
* ACNT APPLICATION CONNECTION TABLE TEMPLATE
* AHEADER APPLICATION BLOCK HEADER WORD TEMPLATE
* AT APPLICATION TABLE
* NIPDEF CONSTANT DEFINITIONS
* PARAMS COM BLK FOR PASSING PARAMETERS TO SEC OVLYS
* PT MISCELLANEOUS VARIABLES, POINTERS
* SUPMSG SUPERVISORY MESSAGE TEMPLATE
*
* 7. ROUTINES CALLED
* BLINK LINK MESSAGE ON APPLICATION-S ACB
* MGETS ALLOCATE EMTPY BUFFER
* OSCHAPP SCHEDULE APPLICATION
* XTRACE TRACE PROCEDURE CALL
*
* 8. DAYFILE MESSAGES AND OTHER IMPORTANT INFORMATION
* THIS IS A SECONDARY OVERLAY CALLED BY HCSTTP.
*
* W A R N I N G - THIS PROGRAM CANNOT EXCEED THE SECONDARY
* OVERLAY BUFFER SIZE MINUS 5 (443B WORDS).
*
*
#
STOPIMS;
#
EXTERNAL VARIABLES
#
XREF
BEGIN
PROC BLINK; # LINK MSG ON APPL-S ACB #
PROC MGETS; # ALLOCATE EMPTY BUFFER #
PROC OSCHAPP; # SCHEDULE APPLICATION #
PROC XTRACE; # TRACE PROCEDURE CALL #
LABEL RJMAIN; # RETURN ADDRESS IN OVLCALL #
END
#
INTERNAL VARIABLES
#
ITEM BUFADDR; # SM BUFFER ADDRESS #
ITEM I ; # INDUCTION VARIABLE #
ITEM ACNTINDX ;
ITEM INDX ;
ITEM FOUND B ;
ITEM PRIAPP; # = 0 IF SENDING CON/CB TO PRIMARY APP #
# = 1 IF NOT SENDING CON/CB TO PRIMARY AP #
ITEM SECAPP; # = 0 IF NOT SENDING CON/CB TO SEC APP #
# = 1 IF SENDING CON/CB TO SEC APP #
#**********************************************************************#
BEGIN
CONTROL IFEQ DEBUG,1;
XTRACE("CONCB"); # RECORD PROCEDURE CALL #
CONTROL FI;
P<ACNB> = PARAMS2 ; # ADDRESS OF ACNB #
P<ACB> = ATACBA[ACNBAN[0]] ;
P<ACNT> = ACBACNT[0] ;
IF (ACBORD2[0]) # THIS APPLICATION SENT SAC/NCL#
# TO SET ERROR CONDITION FOR #
THEN # CON/CB/U. #
BEGIN
ACBABTCB[0] = TRUE ; # READY TO ABORT THIS APPL #
# AND DONT QUEUE ANY SM #
GOTO HCONCBE ;
END
#
DETERMINE IF PRIMARY APPLICATION NEEDS TO INFORMED
#
IF (ACNBPRID[0] NQ 0 ) AND # THERE IS A PRIMARY APP #
(NOT ACNBPRAF[0] ) AND # PRIMARY APP HAS NOT FAILED #
(PARAMS1 NQ RCB"CNB") # SEC APP NOT SENT BAD CON/REQ/N#
THEN # NEED TO SEND CON/CB TO PRI APP#
BEGIN
PRIAPP = 0; # SET FLAG TO SEND CON/CB TO PRI#
END
ELSE # NO NEED TO SEND CON/CB TO PRI #
BEGIN
PRIAPP = 1; # SET FLAG TO NOT SEND CON/CB #
END
#
DETERMINE IF SECONDARY APPLICATION NEEDS TO BE INFORMED. THE
SECONDARY APPLICATION IS CONSIDERED TO BE THE APPLICATION THAT
THE ACNB IS CURRENTLY CONNECTED TO.
#
IF (ACNBAN[0] EQ NVFAN ) OR # SEC APP IS NVF #
(PARAMS1 EQ RCB"LCA") # SEC APP ABORTING CONNECTION #
THEN # NEED TO SEND CON/CB TO SEC APP#
BEGIN
SECAPP = 0; # SET FLAG TO NOT SEND CON/CB #
END
ELSE
BEGIN
IF ( ACNTCS[ACNBACN[0] + ACNTHSIZE - ACNTMINACN[0]]
EQ HCSINVF ) # IN THE STATE THAT IS EXPECTING#
# CON/REQ/N FROM APPLICATION #
THEN # DO NOT SEND CON/CB/U NOW #
SECAPP = 0 ; # SEND IT WHEN CON/REQ/N COMES #
ELSE
SECAPP = 1 ; # SET FLAG TO SEND CON/CB/U #
END
#
LOOPING ISSUING CON/CB SUPERVISORY MESSAGES
#
FOR I = PRIAPP STEP 1 WHILE I LQ SECAPP
DO
BEGIN
IF I EQ 0
THEN # SENDING CON/CB TO PRI APP #
BEGIN # THIS IS A LOANED CONNECTION #
P<ACB> = ATACBA[ACNBPRAN[0]];# ACB OF PRIMARY APP #
P<ACNT> = ACBACNT[0] ;
ACNTSECID[ACNBPRACN[0] + ACNTHSIZE - ACNTMINACN[0]] = 0 ;
#
PRIMARY APPLICATION RECEIVES CON/CB/U ON THIS LOANED CONNECTION,
IT CONSIDERS THIS CONNECTION IS GONE, NIP NEEDS TO CLEAN UP THE
ACNT TABLE FOR FUTURE USAGE.
#
ACNTINDX = ACNBPRACN[0] + ACNTHSIZE - ACNTMINACN[0] ;
ACNTNFE[0] = ACNTNFE[0] + 1 ; # UPDATE NUMBER OF FREE ENTR#
IF ACNBPRACN[0] LS ACNTFFCN[0]
THEN
ACNTFFCN[0] = ACNBPRACN[0] ; # UPDATE FIRST FREE ACN #
FOUND = FALSE;
IF ACNBPRACN[0] EQ ACNTHCN[0]
THEN # UPDATE HIGHEST CN IN USE #
BEGIN # SEARCH FOR HIGHEST CN IN USE #
FOR INDX = ACNTINDX - 1 STEP -1 WHILE INDX GQ ACNTHSIZE
AND NOT FOUND
DO
BEGIN
IF ACNTWD[INDX] NQ 0
THEN # HIGHEST CN FOUND #
BEGIN
ACNTHCN[0] = INDX + ACNTMINACN[0] - ACNTHSIZE;
FOUND = TRUE; # SET HIGHEST CN IN USE FOUND FLAG #
END
END
IF NOT FOUND
THEN # THERE ARE NO ENTRIES IN ACNT #
ACNTHCN[0] = 0;
END
END
ELSE # SENDING CON/CB TO SEC APP #
BEGIN
P<ACB> = ATACBA[ACNBAN[0]] ; # ACB OF SECONDARY APP #
END
#
ALLOCATE BUFFER FOR CON/CB/U
#
MGETS(LCONCB + BLKHSIZE + ABHSIZE,BUFADDR,TRUE);
#
SET UP APPLICATION BLOCK HEADER
#
P<AHEADER> = BUFADDR + BLKHSIZE; # BASE ABH #
ABHABT[0] = APPCMD; # BLOCK TYPE #
ABHACT[0] = CT60TRANS; # CHARACTER TYPE - TRANSPARENT #
ABHTLC[0] = LCONCB; # TEXT LENGTH #
#
SET UP CON/CB/U MESSAGE
#
P<SUPMSG> = P<AHEADER> + ABHSIZE; # FWA OF TEXT #
PFCSFC[0] = CONCB; # SET FUNCTION CODE #
CONRCB[0] = PARAMS1; # CONN. WITH RC FROM HCSTTP #
IF I EQ 0 # CON/CB FOR PRIMARY APPLICATION#
THEN
BEGIN # SEND CON/CB TO PRIM. APPL. TOO#
CONACN[0] = ACNBPRACN[0]; # ACN OF PRIMARY. #
CONLOAN[0] = TRUE; # LOANED CONNECTION TERMINATED #
END
ELSE
BEGIN # SEND CON/CB TO SECONDARY APP #
CONACN[0] = ACNBACN[0] ;
END
#
QUEUE CON/CB/U ON APPLICATION-S ACB
#
BLINK(BUFADDR,P<ACB>) ; # LINK CON/CB TO APPL. ACB #
OSCHAPP(P<ACB>) ;
END # END OF I FOR LOOP #
HCONCBE:
ACNBPRID[0] = 0 ; # CLEAR PRIMARY ID ,ANYWAY #
GOTO RJMAIN; # RETURN TO CALLING PROGRAM #
END
TERM