<> <> <> <> <> <> <> DIRECTORY IO USING [STREAM], IPDefs USING [DByte, Address, nullAddress]; TCP: 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: IPDefs.DByte _ 0, -- TCP port matchForeignAddr: BOOL _ TRUE, -- true to match ForeignAddress foreignAddress: IPDefs.Address _ IPDefs.nullAddress, -- address of remote TCP matchForeignPort: BOOL _ TRUE, -- true to match ForeignPort foreignPort: IPDefs.DByte _ 0, -- 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) maxTimeout: INT ~ LAST[INT] / 1000; -- don't make it bigger than this neverTimeout: INT ~ -1; -- use this to never timeout STREAM: TYPE = IO.STREAM; <> <> CreateTCPStream: PROC [tcpInfo: TCPInfo] RETURNS [s: STREAM]; <> AbortTCPStream: PROC [s: STREAM]; <> WaitForListenerOpen: PROC [s: STREAM, timeout: INT _ neverTimeout]; <> GetRemoteAddress: PROC [s: STREAM] RETURNS [IPDefs.Address]; 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.