!iso4.inc
! Uni-process interface to implementation of ISO-TL

%recordformat tc f (%string(*)%name LSAP, RSAP, SECURITY,
             %byte EXP, ERR TAR, ERR MIN, ERR TSDU,
             %half DO TAR, DO MAX, DI TAR, DI MAX,
             %half MAX ACK, PRIORITY,
             %integer TO TAR, TO MIN, TI TAR, TI MIN)
! A local reference describing a transport connection.  The first two
! fields are the transport addresses of the participating session
! level entities.  The remaining fields describe the quality of
! service, as follows:
! SECURITY user-defined parameter
! EXP      zero if expedited data service is not required
! ERR *    parameters describing the acceptable residual error rate
! DO/I *   target/maximum output/input transit delays (ms)
! MAX ACK  maximum acknowledge delay (ms) (? perhaps doesn't belong here?)
! PRIORITY of the connection relative to others (0=max)
! TO/I *   target/minimum output/input throughput (bytes/sec: max 2\\24-1)
! The record contains further fields off the end, but these are private
! to the TS provider.

%externalrecord(tc f)%mapspec T ALLOCATE TC REF (%string(63) LSAP, RSAP)
! Returns a reference to a (new) connection record.

%externalroutinespec T CONNECT REQUEST -
   (%record(tc f)%name REF, %string(32) DATA)
! Attempt to make a connection to the remote entity indicated by REF_RSAP,
! with the QOS parameters in REF, and with optional DATA as provided.

%externalrecord(tc f)%mapspec T CONNECT INDICATED -
   (%string(63) LSAP, %integer WAIT)
! If some other end has attempted to establish a connection with the
! caller, identified as LSAP, a reference to a connection record is
! returned.  If not, NIL is returned if WAIT=0; otherwise the called
! is suspended.

%externalroutinespec T CONNECT RESPONSE -
   (%record(tc f)%name REF, %string(32) DATA)
! Either this or T DISCONNECT REQUEST should be called by someone who
! has received a non-NIL result from T CONNECT INDICATED.

%externalroutinespec T DISCONNECT REQUEST -
   (%record(tc f)%name REF, %string(43) REASON, %string(64) DATA)
! Shut down the connection identified by REF, optionally supplying
! an explanatory reason and data.

%externalintegerfnspec T CONNECTED -
   (%record(tc f)%name REF, %string(*)%name REASON, DATA, %integer WAIT)
! If the connection is still being negotiated (the other end has not
! yet responded), then the result is 0 (if WAIT=0, otherwise caller
! is suspended) and REASON and DATA are unaffected.
! If the connection has been established, the result is >0, and DATA
! receives the message supplied at the other end via T CONNECT RESPONSE.
! Otherwise the connection has been shut down, the result is <0, and DATA
! and REASON receive information provided by T DISCONNECT REQUEST.

%externalroutinespec T EXPEDITED DATA REQUEST -
   (%record(tc f)%name REF, %string(16) DATA)
! Sends a quickie (if enabled by negotiation).

%externalroutinespec T DATA REQUEST-
   (%record(tc f)%name REF, %name WHERE, %integer SIZE, %byte EOF)
! Passes a TIDU across the interface.  SIZE bytes of data, in store at
! WHERE, are transmitted.  If EOF#0, this constitutes the last TIDU
! making up a TSDU.

%externalintegerfnspec T DATA INDICATED (%record(tc f)%name REF, %integer WAIT)
! If no TSDU has arrived on the connection, the result is 0 (unless
! WAIT#0, in which case the caller is suspended).
! If a DATA unit is available, the result is >0.
! If an EXPEDITED DATA unit is available, or the connection has been
! broken, the result is <0.

%externalroutinespec T ACCEPT DATA (%record(tc f)%name REF, -
   %name WHERE, %integername SIZE, %bytename EOF, %integer WAIT)
! A pending data unit is copied into store at WHERE.  SIZE on entry
! indicates the maximum size of the TIDU the caller is prepared to accept.
! SIZE will be set to the number of bytes actually copied.  This will
! be negative if the connection is broken or an EXPEDITED DATA unit
! is pending, or no data is available and WAIT=0.  EOF is set if this
! was the last TIDU of a TSDU.

%externalroutinespec T ACCEPT EXPEDITED DATA -
   (%record(tc f)%name REF, %string(16)%name DATA)
! Should only be called when an expedited data unit is known to be there.
