home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
kermit.columbia.edu
/
kermit.columbia.edu.tar
/
kermit.columbia.edu
/
archives
/
modcomp.zip
/
sdata.
< prev
next >
Wrap
Text File
|
1987-01-26
|
6KB
|
182 lines
INTEGER FUNCTION SDATA (X)
C
C ****************************************************************
C
C KERMIT for the MODCOMP MAXIV operating system
C
C Compliments of:
C
C SETPOINT, Inc.
C 10245 Brecksville Rd.
C Brecksville, Ohio 44141
C
C
C KERMIT is a copyrighted protocol of Columbia Univ. The authors
C of this version hereby grant permission to copy this software
C provided that it is not used for an explicitly commercial
C purpose and that proper credit be given. SETPOINT, Inc. makes
C no warranty whatsoever regarding the accuracy of this package
C and will assume no liability resulting from it's use.
C
C ****************************************************************
C
C Abstract: Send a data packet to the remote Kermit.
C
C MODIFICATION HISTORY
C
C BY DATE REASON PROGRAMS AFFECTED
C
C ****************************************************************
C
C Author: Rick Burke Version: A.0 Date: Sep-86
C
C Calling Parameters:
C
C R X - Dummy argument required by FORTRAN
C
C ****************************************************************
C
C Messages generated by this module : None
C
C ****************************************************************
C
C Subroutines called directly : BUFILL, MOD, RPACK, SPACK
C
C ****************************************************************
C
C Files referenced : None
C
C ****************************************************************
C
C Local variable definitions :
C
C LEN - Length of received packet
C NUM - Number of received packet
C TNUM - Expected packet number
C TV1 - Temporary variable
C
C ****************************************************************
C
C Commons referenced : KER and KERPAR local commons
C
C ****************************************************************
C
C (*$END.DOCUMENT*)
C
C ****************************************************************
C * *
C * D I M E N S I O N S T A T E M E N T S *
C * *
C ****************************************************************
C
IMPLICIT INTEGER (A-Z)
C
C ****************************************************************
C * *
C * T Y P E S T A T E M E N T S *
C * *
C ****************************************************************
C
C
C ****************************************************************
C * *
C * C O M M O N S T A T E M E N T S *
C * *
C ****************************************************************
C
INCLUDE USL/KERCOM
INCLUDE USL/KERPMC
C
C ****************************************************************
C * *
C * E Q U I V A L E N C E S T A T E M E N T S *
C * *
C ****************************************************************
C
C
C ****************************************************************
C * *
C * D A T A S T A T E M E N T S *
C * *
C ****************************************************************
C
C
C ****************************************************************
C
C Code starts here :
C
C
C-----> Assume some kind of error.
C
SDATA = BIGA
C
C-----> Retry counter exceeded?
C
IF (NUMTRY .GT. MAXTRY) RETURN
NUMTRY = NUMTRY + 1
C
C-----> Send the data packet.
C
TNUM = N
TV1 = BIGD
CALL SPACK (TV1,TNUM,SIZE,PACKET)
C
C-----> If we are in local mode then display the packet
C-----> sequence number.
C
IF (HOSTON .EQ. NO) WRITE (LOCALO,100) TNUM
C
C-----> Get the reply from the remote.
C
STATUS = RPACK (LEN,NUM,RECPKT)
C
C-----> The next statements are to make sure that we are not one
C-----> packet ahead of the other Kermit. This will happen if the
C-----> other Kermit sends a NAK (due to a timeout detection)
C-----> before we send the first SINIT packet.
C
IF (STATUS .EQ. BIGY .AND.
> N .EQ. NUM+1 ) STATUS = RPACK (LEN,NUM,RECPKT)
IF (STATUS .NE. BIGN) GO TO 10
C
C-----> We got a NAK.
C
IF (N .EQ. NUM-1) GO TO 50
SDATA = STATE
RETURN
10 CONTINUE
IF (STATUS .NE. BIGY) GO TO 40
C
C-----> We got an ACK.
C
IF (N .EQ. NUM) GO TO 20
C
C-----> But, it was for the last packet.
C
SDATA = STATE
RETURN
20 CONTINUE
NUMTRY = 0
N = MOD((N+1),64)
SIZE = BUFILL (PACKET)
IF (SIZE .NE. EOF) GO TO 30
SDATA = BIGZ
RETURN
30 CONTINUE
SDATA = BIGD
RETURN
40 CONTINUE
IF (STATUS .NE. BAD) GO TO 50
C
C-----> We got a checksum error, try again.
C
SDATA = STATE
RETURN
50 CONTINUE
C
C-----> Here we got an unknown packet type or an error occurred.
C
RETURN
100 FORMAT('+PACKET #',I3,' ')
END