*DECK IPIPIDB
USETEXT TEXTIPL
PROC IPIPIDB;
*CALL COPYRITE CDCNET - COPYRIGHT CONTROL DATA. 1992.
# TITLE IPIPIDB - PROCESS INPUT DATA BLOCK. #
BEGIN # IPIPIDB #
#
**** IPIPIDB PROCESS INPUT DATA BLOCK.
*
* THIS PROCEDURE PROCESSES ALL NON-SUPERVISORY MESSAGES RECEIVED BY
* SOCKET LIBRARY. THE DATA IS STORED IN A QUEUE ARRAY BASED ON THE
* CONNECTION NUMBER.
*
* PROC IPIPIDB
*
* ENTRY INPBUF = ARRAY CONTAINING INPUT DATA BLOCK.
* P<ABH> = PTR TO INPUT APPLICATION BLOCK HEADER.
*
* EXIT QUE$BUF = ARRAY CONTAINS THE INPUT DATA BLOCK.
*
* METHOD IF THE CONNECTION STATE IS NOT *CONNECTED* OR *IDLE*
* THEN TREAT AS A NAM PROTOCOL ERROR.
*
* IF THE STATE IS NOT *OPEN* OR *BOUND* THE DATA IS
* DISCARDED.
*
* IF THE BLOCK TYPE IS *APPBLK* OR *APMSG* THEN THE
* DATA IS MOVED INTO THE CONNECTIONS QUEUE STORAGE AREA.
* A LST/OFF SUPERVISORY MESSAGE IS SENT SO NO MORE DATA
* WILL BE RECEIVED ON THE CONNECTION UNTIL THE APPLICATION
* PROCESSES IT.
*
* IF THE BLOCK TYPE IS NOT *APPBLK* OR *APMSG*, THEN THE
* CONNECTION IS TERMINATED.
*
#
#
**** PROC IPIPIDB - XREF LIST
#
XREF
BEGIN
PROC IPIAIPA; # ABORT THE IP APPLICATION #
PROC IPIDOSM; # DISPATCH OUTPUT SUPERVISORY MESSAGE #
END
#
**
#
ITEM DATALNTH I; # RECEIVED DATA LENGTH IN WORDS #
ITEM LOOP I; # DATA ARRAY LOOP COUNTER #
CONTROL EJECT;
#
**** START MAIN PROCEDURE
#
CURACN = ABHADR [0]; # DETERMINE CONNECTION NUMBER #
#
**** IF CONNECTION STATE IS *CONNECTED* OR *IDLE*, THEN TREAT AS A NAM
* PROTOCOL ERROR.
#
IF (ACN$STATE [CURACN] EQ S"IDLE") OR
(ACN$STATE [CURACN] EQ S"CONNECTED")
THEN
BEGIN
IPIAIPA (NDATA$); # NAM PROTOCOL ERROR #
RETURN;
END;
#
**** IF CONNECTION OPEN, THEN ACCEPT DATA. ALL OTHER STATES
* ARE IGNORED. ONLY *BLK* AND *MSG* TYPE BLOCK ARE ACCEPTED,
* ALL OTHERS ARE TREATED AS A CONNECTION PROTOCOL ERROR AND THE
* CONNECTION IS TERMINATED.
*
#
IF (ACN$CONNECT [CURACN])
THEN
BEGIN
IF (ABHABT [0] NQ APPBLK)
AND (ABHABT [0] NQ APMSG)
THEN
BEGIN
ACN$ABORT [CURACN] = TRUE;
RETURN;
END
#
**** MOVE THE RECEIVED BUFFER INTO THE INPUT QUEUE STORAGE AREA.
*
#
P<REA$BUF> = ACN$BUFFER [CURACN];
ACN$DATAV [CURACN] = TRUE;
ACN$DATALNTH [CURACN] = ABHTLC [0];# RECEIVED BLOCK LENGTH #
DATALNTH = ABHTLC [0] * 10 / 75 - 1; # BLOCK LENGTH IN WORDS #
ACN$MORE [CURACN] = (ABHABT [0] EQ APPBLK);
FOR LOOP = 0 STEP 1 UNTIL (ACN$DATALNTH [CURACN] - 1)
DO
BEGIN
REA$WORD [LOOP] = INP$WORD [LOOP];
END
#
**** SET FLOW CONTROL ON THIS CONNECTION UNTIL THE DATA HAS BEEN
* PROCESSED.
*
#
P<APSM> = LOC(OUTBUF);
SPMSG0 [0] = 0;
LSTACN [0] = CURACN;
IPIDOSM (LSTOFF, LLST); # ISSUE LST/OFF/R SM #
END
RETURN; # RETURN TO CALLER #
END # IPIPIDB #
TERM