<> <> <> <> <> <> <> <> <> <> DIRECTORY Arpa USING [Address, nullAddress], IO USING [STREAM]; ArpaTCP: CEDAR DEFINITIONS = BEGIN <> TCPInfo: TYPE ~ RECORD [ -- describes the kind of connection we want. matchLocalPort: BOOL _ FALSE, -- true to use LocalPort field, false to assign an unused local port localPort: Port _ nullPort, -- TCP port matchForeignAddr: BOOL _ TRUE, -- true to match ForeignAddress foreignAddress: Arpa.Address _ Arpa.nullAddress, -- address of remote TCP matchForeignPort: BOOL _ TRUE, -- true to match ForeignPort foreignPort: Port _ nullPort, -- TCP port at remote TCP active: BOOL _ TRUE, -- true to initiate connection, false to wait as listener. If true, matchForeignAddr and matchForeignPort must also be true. timeout: INT _ neverTimeout, -- raise Timeout if data not delivered in this time (in msec) maxSegmentSize: INT _ 0 -- max bytes we can send in a datagram (If 0, default to maxArpanetSegmentSize when sending to external destinations, ArpaTCPOps.maxTCPDataLength otherwise) ]; maxArpanetSegmentSize: INT = 536; maxTimeout: INT ~ LAST[INT] / 1000; -- don't make it bigger than this neverTimeout: INT ~ -1; -- use this to never timeout DByte: TYPE ~ INT [0..65535]; -- Two byte field. Port: TYPE ~ DByte; nullPort: Port ~ 0; STREAM: TYPE = IO.STREAM; <> <> CreateTCPStream: PROC [tcpInfo: TCPInfo] RETURNS [s: STREAM]; <> AbortTCPStream: PROC [s: STREAM]; <> GetTimeout: PROC [s: STREAM] RETURNS [timeout: INT]; <> SetTimeout: PROC [s: STREAM, timeout: INT _ neverTimeout]; <> WaitForListenerOpen: PROC [s: STREAM, timeout: INT _ neverTimeout]; <> GetRemoteSocket: PROC [s: STREAM] RETURNS [addr: Arpa.Address, port: Port]; GetLocalSocket: PROC [s: STREAM] RETURNS [addr: Arpa.Address, port: Port]; SendNow: PROC [s: STREAM]; <> SetUrgent: PROC [s: STREAM]; <> WaitForUrgentData: PROC [s: STREAM] RETURNS [urgentIndex: INT]; <> <> <> <> Error: ERROR [reason: Reason]; Reason: TYPE ~ { localConflict, unspecifiedRemoteEnd, neverOpen, localClose, localAbort, remoteClose, remoteAbort, transmissionTimeout, protocolViolation }; ErrorFromStream: PROC [s: STREAM] RETURNS [reason: Reason]; <> Timeout: SIGNAL; <> <> <> END.