-- File: PupPktDefs.Mesa,  Last Edit: HGM  December 15, 1980  8:17 PM

DIRECTORY
  PupStream USING [PupListener, PupOpenMode],
  PupDefs USING [Byte, PupBuffer, Tocks],
  PupTypes USING [Pair, PupAddress, PupSocketID];

PupPktDefs: DEFINITIONS =
  BEGIN

  -- Packet Stream Interface
  PupPktStreamCreate: PROCEDURE [
    remote: PupTypes.PupAddress, ticks: PupDefs.Tocks] RETURNS [PupPktStream];
  PupPktStreamMake: PROCEDURE [
    local: PupTypes.PupSocketID, remote: PupTypes.PupAddress,
    ticks: PupDefs.Tocks, mode: PupStream.PupOpenMode, id: PupTypes.Pair]
    RETURNS [PupPktStream];
  PupPktStreamDestroy: PROCEDURE [PupPktStream];
  PupPktStreamAbort: PROCEDURE [PupPktStream, STRING];
  PupPktStream: TYPE = POINTER TO PupPktStreamObject;
  PupPktStreamObject: TYPE = RECORD [
    put: PROCEDURE [PupDefs.PupBuffer],
    putMark: PROCEDURE [PupDefs.Byte],
    get: PROCEDURE RETURNS [PupDefs.PupBuffer], -- if none, wait, then return NIL
    sendAttention: PROCEDURE,
    waitForAttention: PROCEDURE,
    getSenderSizeLimit: PROCEDURE RETURNS [CARDINAL],
    getLocalAddress: PROCEDURE RETURNS [PupTypes.PupAddress]];

  -- Listeners
  PupListener: TYPE = PupStream.PupListener;
  CreatePupPktStreamListener: PROCEDURE [
    local: PupTypes.PupSocketID,
    proc: PROCEDURE [PupPktStream, PupTypes.PupAddress], ticks: PupDefs.Tocks,
    filter: PROCEDURE [PupTypes.PupAddress] ← DontReject] RETURNS [PupListener];
  DestroyPupListener: PROCEDURE [PupListener];
  DontReject: PROCEDURE [PupTypes.PupAddress];
  RejectThisRequest: ERROR [error: STRING];

  END.