*DECK NP$INIT *IF DEF,XFR USETEXT AIPDEF USETEXT NX$ACBF USETEXT NX$ACBX USETEXT NX$MSG USETEXT NX$CHAR PROC NP$INIT (ACN, FILENAME, OPCODE, STATIS, DATADEC, TIMEOUT, ABL, BSIZE,CWS,ICKVAL); # TITLE NP$INIT - INITIALIZE FILE TRANSFER. # BEGIN # NP$INIT # # *** * PROC NAME: AUTHOR DATE * NP$INIT L.T.NGUYEN 03/20/83 * * NP$INIT PERFORMS THE INITIALIZATION REQUIRED PRIOR TO ACTUAL DATA * TRANSFER. * * PROC NP$INIT (ACN, FILENAME, OPCODE, STATIS, DATADEC, TIMEOUT, ABL * ,BSIZE) * * ENTRY ACN - APPLICATION CONNECTION NUMBER. * FILENAME - FILE NAME TO BE TRANSFERRED, IN DISPLAY * CODE, 7 CHARACTERS MAXIMUM. * OPCODE = 0, FILE IS TO BE READ FROM THE NETWORK. * = 1, FILE IS TO BE WRITTEN TO THE NETWORK. * STATIS - CALLING PROGRAM REPLY STATUS * WORD. * DATADEC - FORMAT OF DATA BEING TRANSFERRED - * - 0, UH * - 1, US * - 2, UU * - 3, C6 * - 4, C8. * TIMEOUT - TIME IN SECONDS TO WAIT FOR A FUNCTION * RESPONSE BEFORE TIMING OUT. * ABL - APPLICATION BLOCK LIMIT. * BSIZE - BLOCK SIZE TO TRANSMIT. * CWS - CHECK MARK WINDOW SIZE. * ICKVAL - INITIAL CHECK MARK VALUE. * PRESNO - PRU OFFSET AND BIT OFFSET. * * EXIT FTTINDEX - INDEX INTO FTT TABLE. ( GLOBAL ) * * PROCESS INITIALIZE VALUES IN COMMON BLOCKS COMACBX AND COMADFM. * IF ACN IS NOT WITHIN ALLOWABLE RANGE, * THEN: * CALL NP$ERR TO WRITE DAYFILE ERROR MESSAGE AND * ABORT C.P. * SET STATUS TO INDICATE ACN NOT WITHIN ALLOWABLE * RANGE. * ELSE: * IF COMACBX HAS NOT BEEN INTIALIZED, * THEN * INITIALIZE VARIOUS DATA CELLS IN COMACBX. * CALL GMEMCMM TO OBTAIN MEMORY FOR FETS, BUFFERS, * AND RHF PARAMETER BLOCK. * SET FTTTIMEOUT[FTTINDEX] = TIMEOUT. * SET FTTDIRECN[FTTINDEX] = OPCODE. * SET FTTSTATADR[FTTINDEX] = STATUS ADDRESS. * SET FTTDXPA = OK (P$ES$OK). * SET FTTERRORD = 0 (NO ERROR). * CALL BUILDFT TO BUILD FETS, ALLOCATE BUFFER, AND * BUILD RHF NETXFR REQUEST/REPLY PARAMETER BLOCK. * CALL CALLCIO TO OPEN LOCAL FILE WITHOUT RECALL. * SET FTTSTATE[FTTINDEX] = 1 TO INDICATE WAITING FOR * COMPLETION OF OPEN FILE REQUEST. * # ITEM ACN I; # APPLICATION CONNECTION NUMBER # ITEM FILENAME C(7); # FILE NAME # ITEM OPCODE I; # READ OR WRITE CODE # ITEM STATIS I; # STATUS WORD # ITEM DATADEC I; # DATA FORMAT DECLARATION # ITEM TIMEOUT I; # SECONDS TO TIME OUT # ITEM ABL I ; ITEM BSIZE U ; ITEM CWS U ; ITEM ICKVAL U ; # **** PROC NP$INIT - XREF LIST BEGIN. # XREF BEGIN PROC NP$BFET; # BUILT FETS # PROC NP$CIO ; # CALL CIO # FUNC NP$CMAR U; # ASSIGN GROUP NAME # FUNC NP$CMAF U; PROC NP$CMSF; # SHRINK FIXED MEMORY # PROC NP$CMFF; # FREE FIXED MEMORY # FUNC NP$CS63 B; # DETERMINE IF 63 CHAR SET # PROC NP$ERR ; # WRITE DAYFILE MESSAGE # FUNC GMEMCMM U; # GET CENTRAL MEMORY VIA CMM # PROC NP$RTIM ; # INITIALIZE FTTTIME # PROC NP$S63; # SET TRANSLATION FOR 63 SET # PROC NP$ZWDS; # CLEAR CM BLOCK # PROC NP$INFO ; # GET FILE STATUS # PROC NP$ZRBK ; PROC NP$OSIF ; END # **** PROC NP$INIT - XREF LIST END. # ITEM FOUND B ; # FLAG FOR LOCATING EMPTY FTT ENTRY # ITEM I ; ITEM BUFFERADR I ; # ADDRESS OF TOTAL BUFFER # ITEM BUFLENGTH I ; # TOTAL LENGTH OF BUFFER NEEDED # ITEM CODE I ; # CODE FOR CIO OPEN # ITEM CIO$WORD U ; # LENGTH OF DISK BUFFER # ITEM NET$WORD U ; # LENGTH OF NETWORKING BUFFER # ITEM FSTATUS I; CONTROL EJECT; IF NUMFILEXFR EQ 1 THEN BEGIN GROUPNAME = NP$CMAR(0); # ASSIGN GROUP NAME # END FOUND = FALSE ; FOR I = 0 STEP 1 WHILE I LS MAXFILEXFR AND NOT FOUND DO BEGIN # LOOP THROUGH FTT ENTRIES TO FIND AN EMPTY ONE # IF FTTACN[I] EQ ACN THEN BEGIN # SECOND FILE ON SAME CONN. # P = LOC(STATIS) ; STATUSWD = S$XFR$2 ; # SET STATUS FLAG # RETURN ; # THEN RETURN TO NETXFR # END ELSE IF FTTACN[I] EQ 0 THEN BEGIN # REMEMBER THIS IS EMPTY ENTRY # FTTINDEX = I ; FOUND = TRUE ; END END # LOOP TO FIND FTT ENTRY # IF NOT FOUND THEN NP$ERR("48") ; # NO EMPTY ENTRY IN FTT FOUND # # SEND DAYFILE MSG THEN ABORT C.P. # # READY TO BUILD FTT ENTRY. # NP$ZWDS(LOC(FTT$WD0[FTTINDEX]),FTTENTRYSIZE); # ZERO OUT ENTRY # NP$RTIM(TIME$WORD) ; # GET CURRENT TIME # FTTACN[FTTINDEX] = ACN ; # EMPTY ENTRY IN FTT, SAVE ACN # FTTSTATE[FTTINDEX] = STATX ; # INITIALIZE CURRENT STATE # *IF DEF,DEBUG,2 FTTPREST[FTTINDEX] = STATX ; # INITIALIZE PREV. STATE # FTTPRETRIG[FTTINDEX] = NOCHG ; # INITIALIZE PREV. TRIG # # ASSIGNING THE STATE TABLE ORDINAL # FTTSTORD[FTTINDEX] = ASSIGNORD[DATADEC] - OPCODE ; FTTOPCODE[FTTINDEX] = OPCODE ; FTTTIME[FTTINDEX] = TIME$SEC[0] ; # SAVE THE INITIAL TIME # FTTTIMOUT[FTTINDEX] = TIMEOUT ; # SET TIME OUT TIME # FTTSTATUS[FTTINDEX] = LOC(STATIS) ; # SAVE STATUS ADDRESS # FTTUDD[FTTINDEX] = DATADEC ; # DATADECLARARION # FTTABL[FTTINDEX] = ABL ; FTTCURBLK[FTTINDEX] = ABL; # COPY ABL TO RUNNING ABL # # WINDOW # FTTOUTCWS[FTTINDEX] = 0; # ZERO OUT OUTSTANDING # # CHECKMARKS # FTTBLK$MS[FTTINDEX] = MSWINDOWSZ; # SET CHECK MARK WINDOW # # VALUE # FTTNOTRAN[FTTINDEX] = FALSE; # DEFAULT IS TRANSLATION # # NEEDED # IF MFAC[0] EQ 1 # IF MFACIL USED # THEN BEGIN FTTMFACIL[FTTINDEX] = TRUE; # SET MFACIL FLAG TO TRUE # END IF RFAC[0] EQ 1 # IF RFACIL SPECIFIED # THEN BEGIN FTTRFACIL[FTTINDEX] = TRUE; # RFACIL SPECIFIED # FTTNRETRY[FTTINDEX] = MAXRETRY; # MAXIMUM RETRY COUNT # END FACILWD[0] = 0; # CLEAR BIT MASK # FTTTBN[FTTINDEX] = 0 ; # INITIALIZE SERIAL BLOCK # FTTCWS[FTTINDEX] = CWS ; FTTOPENB[FTTINDEX] = ABL ; FTTOPENC[FTTINDEX] = CWS ; FTTICKVAL[FTTINDEX] = ICKVAL ; FTTCURPRU[FTTINDEX] = 1 ; # INITIALIZE TO ONE # IF DATADEC GQ C6 THEN BEGIN # IVT CONN. NEED TO BUILD FET # # * OBTAIN MEMORY FOR LOCAL FETS (CIO AND WORKING FET ) AND * BUFFER FOR CIO AND WORKING AREAS. # NET$WORD = (( BSIZE + TBH$HSIZE) * OCTETSIZE)/WORDLENGTH + 3; # CALCULATE SIZE OF NETWORK # IF OPCODE EQ RECEIVE # IF RECEIVER # THEN BEGIN NET$WORD = NET$WORD + TOTALHDRBLK; # ADD HDR BLOCK SIZE # FTTBSIZE[FTTINDEX] = NET$WORD; # BUFFER SIZE OF NETWORK # END ELSE BEGIN FTTBSIZE[FTTINDEX] = BSIZE + TBH$HSIZE; END CIO$WORD = LEN$CIOB ; BUFLENGTH = LEN$FET # LENGTH OF CIO FET # + LEN$FETW # LENGTH OF WORKING FET # + LEN$CMB # LENGTH OF CONVERSION PARAM BLK# + LEN$CIOB # LENGTH OF CIO DISK BUFFER # + NET$WORD # LENGTH OF NETWORK BUFFER # + LEN$CHK;# LENGTH OF CHECKMARK BUFFER # BUFFERADR = NP$CMAF(BUFLENGTH,0,GROUPNAME); FTTFETADR[FTTINDEX] = BUFFERADR ; # CIO BUFFER AREA# FTTCMV$BLK[FTTINDEX] = BUFFERADR + LEN$FET + LEN$CIOB ; FTTFETW[FTTINDEX] = BUFFERADR + LEN$CMB + LEN$FET + LEN$CIOB ; FTTCKTBL[FTTINDEX] = FTTFETW[FTTINDEX] + NET$WORD + LEN$FETW; FTTCURPRU[FTTINDEX] = 0; # START WITH 0 PRU NUMBER # END # IVT CONN. NEED TO BUILD FET # ELSE BEGIN # PRU CONECTION # BUFLENGTH = LEN$FET ; CIO$WORD = 64 + 1 ; # MIM CIO BUFFER, FOR OPEN # BUFFERADR = NP$CMAF(BUFLENGTH+CIO$WORD,0,GROUPNAME);# GET BUF# # FOR FET AND IO ONLY # FTTFETADR[FTTINDEX] = BUFFERADR ; FTTFETW[FTTINDEX] = 0 ; FTTBSIZE[FTTINDEX] = BSIZE ; END # PRU CONNECTION # NP$ZWDS(BUFFERADR,BUFLENGTH) ; # ZERO OUT ALLOCATED MEMORY # FTTBUFSIZE[FTTINDEX] = BUFLENGTH ; NP$BFET(FILENAME,CIO$WORD,NET$WORD) ; IF OPCODE EQ SEND THEN # READ FILE # BEGIN CODE = CIO$OPENR ; # CALL CIO TO OPEN READ # NP$CIO(CODE); END ELSE BEGIN CODE = CIO$OPENW ; # CALL CIO TO OPEN WRITE # NP$CIO(CODE); IF DATADEC LS C6 # IF PRU RECEIVER # THEN BEGIN CODE = CIO$WRITEF; # PREPARE EOF MARKER ON FILE # NP$CIO(CODE); # WRITEF # END END NP$ZRBK(LOC(FILENAME),1) ; # ZERO TRAILLING BLANK # NP$INFO(FILENAME,FSTATUS) ; # GET STATUS OF FILE # IF FSTATUS NQ 0 THEN BEGIN # ILLEGAL FILE TYPE FOR TRANSFERRING # STATUSWD = ILL$FTP ; FTTACN[FTTINDEX] = 0 ; # AGAIN FREE THE ENTRY IN FTT # NP$CMFF(BUFFERADR) ; # RELEASE THE ALLOCATED BUFFER # END # ILLEGAL FILE TYPE FOR TRANSFERRING # RETURN ; END # NP$INIT # TERM *ENDIF