-- XConnection.mesa
-- Created By Jeff Weinstein on  2-May-87 15:52:09

DIRECTORY
  Environment,
  TcpStream;
    
XConnection: DEFINITIONS =
  BEGIN
  
  -- Constants --
  
  MaxClients:CARDINAL = 32;
  
  -- Types --
  
  State:TYPE = { open, unused, closing };
  Client:TYPE = [0..MaxClients);
  
  -- Signals and Errors --
  
  ConnectionInUse:ERROR;
  ConnectionNotOpen:ERROR;
  ConnectionNotClosing:ERROR;
  QueueEmpty:ERROR;
  
  -- Procedures --
  
  CreateConnection: PROCEDURE [client:Client, connection:TcpStream.Handle];
  
  DestroyConnection: PROCEDURE [client:Client];
  
  ClosingConnection: PROCEDURE [client:Client];
  
  EnQueueRequest: PROCEDURE [client:Client, request:LONG POINTER TO UNSPECIFIED, size:LONG CARDINAL];
  
  DeQueueRequest: PROCEDURE [client:Client] RETURNS [request:LONG POINTER TO UNSPECIFIED, size:LONG CARDINAL];
  
  PendingRequests: PROCEDURE RETURNS [numRequests:CARDINAL, clients:ARRAY[0..MaxClients) OF BOOLEAN];
  
  PendingConnections: PROCEDURE RETURNS[anyPending:BOOLEAN];
  
  EnQueueConnection: PROCEDURE [connection:TcpStream.Handle];
  
  DeQueueConnection: PROCEDURE RETURNS [connection:TcpStream.Handle];
  
  SendToClient: PROCEDURE [client:Client, data:Environment.Block];
  
  WaitForEventOrClient:PROCEDURE;
  
  END...