*DECK NETGETQ
USETEXT AIPDEF
USETEXT HEADER
USETEXT NP$DB
USETEXT NP$GETS
USETEXT NP$MODE
USETEXT NP$NWL
USETEXT NP$STAT
*IF,DEF,XFR
USETEXT NX$ACBF
*ENDIF
PROC NETGETQ((ADR),HA,ATA,(TLMAX),OPTWD);
#
*1DC NETGETQ
*
* 1. PROC NAME AUTHOR DATE
* NETGETQ E. GEE 05/05/85
*
* 2. FUNCTIONAL DESCRIPTION.
* THIS ROUTINE GETS DATA OR SUPERVISORY MESSAGES FROM EITHER
* AIP-S OR NIP-S DATA OR SUPERVISORY MESSAGE BUFFER.
*
* 3. METHOD USED.
* IF APPLICATION HAS ALREADY NETTED ON,
* IF APPLICATION WANTS DATA ONLY AND EITHER WANTS ONLY
* DATA QUEUED IN AIP OR AIP HAS DATA QUEUED,
* CALL NP$GETQ TO GET THE DATA.
* ELSE (APPLICATION DOES NOT WANT DATA ONLY),
* IF APPLICATION WANTS SUPERVISORY MESSAGES ONLY,
* CALL NP$GET TO GET THE SUP MSG.
* ELSE (APPLICATION WANTS EITHER DATA OR SUP MSG),
* IF AIP DOES NOT HAVE ANY SUP MSGS QUEUED AND EITHER
* THE APP WANTS MSGS ONLY FROM AIP-S BUFFERS OR
* AIP HAS DATA QUEUED AND EITHER THE APP WANTS
* AIP-QUEUED DATA MORE THAN SUP-MSGS QUEUED IN
* NIP OR NIP HAS NO SUP MSGS QUEUED,
* CALL NP$GETQ TO GET DATA FROM AIP-S BUFFER.
* ELSE (DELIVER SUP MSG QUEUED IN AIP/NIP OR DATA
* QUEUED IN NIP),
* CALL NP$GET TO GET THE SUP MSG OR DATA.
* IF DELIVERED SUP MSG IS FC/BRK,
* CALL NP$GETQ TO DISCARD MSGS FOR THAT CON.
* ELSE (APPLICATION HAS NOT NETTED ON YET),
* CALL NP$ERR TO ISSUE DAYFILE MSG AND ABORT APP.
*
* 4. ENTRY CONDITIONS.
* ADR CONNECTION/LIST NUMBER
* HA ADDR OF WORD TO RECEIVE APP BLK HEADER
* ATA ADDR OF BUFFER TO RECEIVE THE TEXT
* TLMAX SIZE OF BUFFER IN WORDS
* OPTWD ADDR OF WORD TO PROVIDE ADDITIONAL OPTIONS
* FOR THE CALL. THE FOLLOWING BITS (BIT 0 =
* RIGHTMOST BIT) IN THAT WORD ARE USED.
* BIT 0 = 0 GET DATA OR SUP MSG FROM AIP-S
* OR NIP-S BUFFERS.
* = 1 GET DATA OR SUP MSG FROM AIP-S
* BUFFER ONLY.
* BIT 1 = 0 DELIVER SUP MSGS FIRST EVEN IF
* DATA MSGS ARE QUEUED IN UPLINE
* DATA BUFFER.
* BIT 1 = 1 DELIVER DATA QUEUED IN UPLINE
* DATA BUFFER FIRST EVEN IF SUP
* MSGS ARE QUEUED IN NIP.
* 5. EXIT CONDITIONS.
* HA CONTAIN NULL BLOCK IF NOT DATA/SUP MSG WAS
* AVAILABLE. OTHERWISE, IT WILL CONTAIN THE
* APP BLOCK HEADER OF THE MESSAGE.
* ATA CONTAINS TEXT OF MESSAGE IF ONE WAS
* DELIVERED.
*
* 6. COMDECKS AND SYMPL TEXT USED.
* AIPDEF CONSTANT DEFINITIONS
* HEADER ABH AND SUP MSG TEMPLATES
* NP$DB UPLINE DATA BUFFER TEMPLATE
* NP$GETS GLOBAL VARIABLES
* NP$MODE GLOBAL VARIABLES
* NP$NWL NETWORK WORKLIST TABLE
* NP$STAT STATISTICS TABLE
* NX$ACBF FILE TRANSFER TABLE
*
* 7. PROCEDURES/FUNCTIONS CALLED.
* NP$ERR ISSUE ERROR MSG AND ABORT APP
* NP$GET GET DATA/SUP MSG FROM AIP/NIP
* NP$GETQ GET DATA MSG IN GMM BUFFER
* NP$SN INCREMENT AIP STATISTICS
*
* 8. DAYFILE MESSAGES OR OTHER IMPORTANT INFORMATION.
* THIS PROGRAM HAS A SECOND ENTRY POINT NETGTLQ FOR GETTING
* DATA FROM A CONNECTION ON LIST ADR.
*
* * APPLICATION ABORTED, RC = 52. *
* * NETFUNC: INVALID FUNCTION CODE USED. *
#
BEGIN
#
EXTERNAL ROUTINES CALLED
#
XREF
BEGIN
PROC NETXFRC; # FILE TRANSFER COMPLETE ROUTINE#
PROC NP$ERR; # ISSUE ERROR MSG AND ABORT APP #
PROC NP$GET; # GET DATA/SUP MSG FROM AIP/NIP #
PROC NP$GETQ; # GET DATA MSG IN GMM BUFFER #
PROC NP$SN; # INCREMENT AIP STATISTICS #
END
#
INPUT VARIABLES
#
ITEM ADR; # CONNECTION/LIST NUMBER #
ITEM HA; # APPLICATION BLOCK HEADER ADDR #
ITEM ATA; # APPLICATION TEXT AREA ADDRESS #
ITEM TLMAX; # MAXIMUM TEXT LENGTH #
ARRAY OPTWD S(1); # ADDR OF WD CONTAINING OPTIONS #
BEGIN
ITEM OPTWDD B(0,58,01); # GET DATA FROM QUEUE BEFORE #
# GETTING SUP MSG FROM NIP #
ITEM OPTWDQ B(0,59,01); # GET MSG FROM DATA QUEUE ONLY #
END
#
LOCAL VARIABLES
#
ITEM GETQDATA B; # GET-DATA-FROM-AIP-BUF FLAG #
ITEM GMMSC; # SEARCH CODE FOR NP$GETQ CALL #
#**********************************************************************#
CONTROL EJECT;
#
EXECUTABLE CODE BEGINS HERE
#
IF NOT ACCEPTED
THEN # APPLICATION HAS NOT NETTED ON #
BEGIN
NP$ERR("36"); # ISSUE DAYFILE MSG AND ABORT AP#
END
OPCODE = OP$GET; # GET DATA FOR CONNECTION OPCODE#
*IF,DEF,STAT
IAM = TYPE"GETQ"; # TYPE OF AIP CALL #
*ENDIF
GETQDATA = FALSE;
AIPQONLY = OPTWDQ[0]; # GET-MSGS-FROM-AIP-BUF-ONLY FLG#
PRIDATA = OPTWDD[0]; # GIVE-PRIORITY-TO-AIP-DATA FLAG#
IF (ADR NQ 0 ) AND
(GMBHEAD NQ GMBFOOT)
THEN # WANT TO GET DATA FROM AIP BUF #
BEGIN
GETQDATA = TRUE; # SET GET-DATA-FROM-AIP-BUF FLAG#
END
*IF,DEF,DEBUG
DB$CALL = LOC(NETGETQ); # TRACE CALLING ADDRESS #
*ENDIF
GMMSC = GMMSCN; # GET DATA FOR CONNECTION #
LIST = FALSE; # SET FLAG FOR NOT LIST PROCESS #
GOTO NETGETQ1;
ENTRY PROC NETGTLQ((ADR),HA,ATA,(TLMAX),OPTWD);
IF NOT ACCEPTED
THEN # APPLICATION HAS NOT NETTED ON #
BEGIN
NP$ERR("37"); # ISSUE DAYFILE MSG AND ABORT AP#
END
OPCODE = OP$GETL; # GET DATA FOR LIST OPCODE #
*IF,DEF,STAT
IAM = TYPE"GTLQ"; # TYPE OF AIP CALL #
*ENDIF
GETQDATA = FALSE;
AIPQONLY = OPTWDQ[0]; # GET-MSGS-FROM-AIP-BUF-ONLY FLG#
PRIDATA = OPTWDD[0]; # GIVE-PRIORITY-TO-AIP-DATA FLAG#
IF ( (ADR EQ 0 ) AND
(HEAD EQ FOOT ) AND
( (GMBHEAD NQ GMBFOOT) AND
( (SD$FLAG EQ 0) OR
(PRIDATA ) ) ) ) OR
( (ADR NQ 0 ) AND
(GMBHEAD NQ GMBFOOT) )
THEN # WANT TO GET DATA FROM AIP BUF #
BEGIN
GETQDATA = TRUE; # SET GET-DATA-FROM-AIP-BUF FLAG#
END
*IF,DEF,DEBUG
DB$CALL = LOC(NETGTLQ); # TRACE CALLING ADDRESS #
*ENDIF
GMMSC = GMMSLN; # GET DATA FOR LIST NUMBER #
LIST = TRUE; # SET FLAG FOR LIST PROCESSING #
NETGETQ1:
#
STORE INPUT PARAMETERS IN COMMON BLOCK
#
*IF,DEF,DEBUG
DB$OP = OPCODE; # OPCODE FOR TYPE OF CALL #
*ENDIF
ACLN = ADR; # CONNECTION/LIST NUMBER #
LOC$HA = LOC(HA); # ADDRESS FOR APPL BLK HEADER #
LOC$TA = LOC(ATA); # ADDRESS FOR DATA #
TLMX = TLMAX; # MAXIMUM TEXT LENGTH ALLOWED #
P<HEADER> = LOC$HA; # ADDR OF ABH OF UPLINE MSG #
ABHABT[0] = APPNULL; # INITIALIZE BLOCK TYPE FIELD #
IF GETQDATA
THEN # ONLY WANT DATA QUEUED IN AIP #
BEGIN
NP$GETQ(GMMSC); # GET DATA MSG QUEUED IN AIP #
END
IF ABHABT[0] EQ APPNULL # NO MESSAGES IN AIP DATA QUEUE #
THEN # GET MSG FROM AIP SM QUEUE/NIP #
BEGIN # OR ANY TYPE OF MSG FROM NIP #
NWL[NEXT] = 0; # CLEAR NWL OPCODE WORD #
NWL$TA[NEXT] = LOC$TA; # ADDR TO WRITE TEXT TO #
BS = OPABHSIZ; # SIZE OF WORKLIST ENTRY #
NP$GET;
P<SUPMSG> = LOC$TA; # ADDR OF TEXT OF UPLINE MSG #
IF (PFCSFC[0] EQ FCBRK ) AND # DELIVERED UPLINE FC/BRK S M #
(ABHABT[0] EQ APPCMD) AND # DELIVERED SUPERVISORY MESSAGE #
(ABHADR[0] EQ 0 ) # ASYNC SUPERVISORY MESSAGE #
THEN # NEED TO GET RID OF MSG IN QUE #
BEGIN
ACLN = SPACN[0]; # CONNECTION NUMBER OF FC/BRK #
NP$GETQ(GMMDCN); # DISCARD MSGS IN QUEUE #
END
END
*IF DEF,XFR
IF NUMFILEXFR NQ 0
THEN # FILE TRANSFER OUTSTANDING #
BEGIN
NETXFRC; # CONTINUE TRANSFERRING FILE #
END
*ENDIF
RETURN;
END
TERM