-- OISCP.mesa (last edited by: BLyon on: January 12, 1981  1:45 PM)
-- Function:  The definitions module for buffer/queue/packet length and start/stop.

DIRECTORY
  BufferDefs USING [
    BufferAccessHandle, GetFreeBuffer, MaybeGetFreeBuffer, OisBuffer, Queue,
    SppBuffer, systemAccessHandle],
  OISCPTypes USING [ConnectionID],
  SpecialSystem USING [
    broadcastHostNumber, HostNumber, NetworkAddress, NetworkNumber,
    nullHostNumber, SocketNumber];

OISCP: DEFINITIONS IMPORTS BufferDefs =
  BEGIN OPEN BufferDefs;

  -- Constants describing addresses and connections.
  unknownNetID: SpecialSystem.NetworkNumber = [0, 0];
  unknownHostID: SpecialSystem.HostNumber = SpecialSystem.nullHostNumber;
  -- all zeros
  allHostIDs: SpecialSystem.HostNumber = SpecialSystem.broadcastHostNumber;
  -- all ones
  unknownSocketID: SpecialSystem.SocketNumber = [0];
  uniqueAddress: SpecialSystem.NetworkAddress =
    [unknownNetID, unknownHostID, unknownSocketID];
  unknownConnID: OISCPTypes.ConnectionID = [0];
  uniqueConnID: OISCPTypes.ConnectionID = [0];

  -- interface

  -- Buffer/Queue procedures from the queue package modules
  EnqueueOis: PROCEDURE [q: Queue, b: OisBuffer];
  DequeueOis: PROCEDURE [q: Queue] RETURNS [OisBuffer];
  ExtractOisFromQueue: PROCEDURE [q: Queue, b: OisBuffer] RETURNS [OisBuffer];
  GetFreeOisBuffer: PROCEDURE RETURNS [OisBuffer] = INLINE {
    RETURN[
      LOOPHOLE[BufferDefs.GetFreeBuffer[
	ois, BufferDefs.systemAccessHandle, systemUse], OisBuffer]]};

  ReturnFreeOisBuffer: PROCEDURE [b: OisBuffer];
  GetFreeSendOisBufferFromPool: PROCEDURE [pool: BufferAccessHandle]
    RETURNS [OisBuffer] = INLINE {
    RETURN[LOOPHOLE[BufferDefs.GetFreeBuffer[ois, pool, send], OisBuffer]]};

  GetFreeReceiveOisBufferFromPool: PROCEDURE [pool: BufferAccessHandle]
    RETURNS [OisBuffer] = INLINE {
    RETURN[LOOPHOLE[BufferDefs.GetFreeBuffer[ois, pool, receive], OisBuffer]]};

  MaybeGetFreeSendOisBufferFromPool: PROCEDURE [pool: BufferAccessHandle]
    RETURNS [OisBuffer] = INLINE {
    RETURN[LOOPHOLE[BufferDefs.MaybeGetFreeBuffer[ois, pool, send], OisBuffer]]};

  MaybeGetFreeReceiveOisBufferFromPool: PROCEDURE [pool: BufferAccessHandle]
    RETURNS [OisBuffer] = INLINE {
    RETURN[
      LOOPHOLE[BufferDefs.MaybeGetFreeBuffer[ois, pool, receive], OisBuffer]]};

  CreditReceiveOisBuffer: PROCEDURE [aH: BufferAccessHandle, b: OisBuffer]
    RETURNS [gotCreadit: BOOLEAN];
  EnqueueSpp: PROCEDURE [q: Queue, b: SppBuffer];
  DequeueSpp: PROCEDURE [q: Queue] RETURNS [SppBuffer];
  ExtractSppFromQueue: PROCEDURE [q: Queue, b: SppBuffer] RETURNS [SppBuffer];
  GetFreeSendSppBufferFromPool: PROCEDURE [pool: BufferAccessHandle]
    RETURNS [SppBuffer] = INLINE {
    RETURN[LOOPHOLE[BufferDefs.GetFreeBuffer[oisSpp, pool, send], SppBuffer]]};

  GetFreeReceiveSppBufferFromPool: PROCEDURE [pool: BufferAccessHandle]
    RETURNS [SppBuffer] = INLINE {
    RETURN[LOOPHOLE[BufferDefs.GetFreeBuffer[oisSpp, pool, receive], SppBuffer]]};

  MaybeGetFreeSendSppBufferFromPool: PROCEDURE [pool: BufferAccessHandle]
    RETURNS [SppBuffer] = INLINE {
    RETURN[
      LOOPHOLE[BufferDefs.MaybeGetFreeBuffer[oisSpp, pool, send], SppBuffer]]};

  MaybeGetFreeReceiveSppBufferFromPool: PROCEDURE [pool: BufferAccessHandle]
    RETURNS [SppBuffer] = INLINE {
    RETURN[
      LOOPHOLE[BufferDefs.MaybeGetFreeBuffer[oisSpp, pool, receive], SppBuffer]]};
  -- length setting

  GetOisPacketTextLength: PROCEDURE [OisBuffer] RETURNS [CARDINAL];
  SetOisPacketTextLength: PROCEDURE [OisBuffer, CARDINAL];
  SetOisPacketLength: PROCEDURE [OisBuffer, CARDINAL];
  -- whether internal statistics is on or not
  GetDoStats: PROCEDURE RETURNS [BOOLEAN];

  -- start procedures from CommunicationControl
  OiscpPackageMake: PROCEDURE;
  OiscpPackageReady: PROCEDURE;
  OiscpPackageDestroy: PROCEDURE;

  END. -- OISCP

LOG

Time: May 9, 1979  11:00 AM  By: Dalal  Action: conversion to Pilot 3.0.
Time: January 20, 1980  10:55 AM  By: Dalal  Action: conversion for Amargosa.
Time: March 12, 1980  10:05 AM  By: BLyon  Action: Added GetFreeSendOisBufferFromPool, GetFreeReceiveOisBufferFromPool, MaybeGetFreeSendOisBufferFromPool, MaybeGetFreeReceiveOisBufferFromPool, ReturnSendOisBufferToPool, ReturnReceiveOisBufferToPool, GetFreeSendSppBufferFromPool, GetFreeReceiveSppBufferFromPool, MaybeGetFreeSendSppBufferFromPool, MaybeGetFreeReceiveSppBufferFromPool, ReturnSendSppBufferToPool, ReturnReceiveSppBufferToPool.  Also considering removing GetOisBufferFromPool, ReturnOisBufferToPool, GetFreeOisBuffer, ReturnFreeOisBuffer.