Specification of package Tgx.Shared_Memory_Eorb







 ========================================================================= --
 ===                                                                   === --
 ===                 Top Graph'X CORBA Implementation                  === --
 ===                                                                   === --
 ===                 Copyright (c) 1996, Top Graph'X.                  === --
 ===                                                                   === --
 ===                     --- Copyright Notice ---                      === --
 ===                                                                   === --
 ===    This software is protected as an unpublished work under the    === --
 ===     Copyright Act of 1976.  All rights reserved.  Top Graph'X.    === --
 ===                                                                   === --
 ========================================================================= -- ;

with System ;
with Tgx.System_Ios ;
package Tgx.Shared_Memory_Eorb is

   ##########################################################################
    A global shared memory segment will contain the description of all the
    client and services (address book) and their associated mailboxes.
    
   ##########################################################################

   Shared_Memory_Error : exception ;

   subtype Server_Name is Standard.String (1 .. 3) ;

   type String_Pointer is access all String ;

    Message Box Types

   type Channel_Id is mod 2 ** 16 ;
   for Channel_Id'Size use 16 ;

   type Message_Index is mod 2 ** 16 ;
   for Message_Index'Size use 16 ;

   type Waiter_Index is mod 2 ** 16 ;
   for Waiter_Index'Size use 16 ;

   Max_Per_Box : constant := 252 ;
   type Message_Array is array
      (Message_Index range 1 .. Max_Per_Box) of Natural ;

   subtype Queue_Id is Tgx.System_Ios.Integer_32;
   subtype Size_T is Tgx.System_Ios.Integer_32;

   type Process_Id is mod 2 ** 32 ;
   type Signal_Type is mod 2 ** 16 ;

    Description in shared memory

    Message data store type
   Max_Message_Area_Size : constant := 5 * 1024 * 1024 ;
   type Message_Area is array (1 .. Max_Message_Area_Size) of Tgx.System_Ios.Byte ;
   type Message_Area_Ptr is access all Message_Area ;

   Max_Message_Size : constant := Max_Message_Area_Size / 8 ;

   type Memory_Id is range - 2 ** 31 .. 2 ** 31 - 1 ;
   

   use type Tgx.System_Ios.Integer_32 ;

   type Semaphore_Set is range - 2 ** 31 .. 2 ** 31 - 1 ;


    Header of the global memory segment
   type Memory_Header is
   record
      Client       : Process_Id;     Client Pid
      Mid          : Memory_Id;      Segment Id
      Sem          : Semaphore_Set;  Semaphore Id
      Cnq          : Queue_Id ;      Connect queue Id
      Txq          : Queue_Id ;      Transmit queue Id
      Rxq          : Queue_Id ;      Receive queue Id      
      Data         : Size_T ;        Size of data written to segment
      Size         : Size_T ;        Segment size (excluding size of this record)
      Index        : Size_T ;        Read Offset
   end record ;
   for Memory_Header use 
   record
      Client       at 0 range   0 .. 31 ;
      Mid          at 0 range  32 .. 63 ;
      Sem          at 0 range  64 .. 95 ;
      Cnq          at 0 range  96 .. 127 ;
      Txq          at 0 range 128 .. 159 ;
      Rxq          at 0 range 160 .. 191 ;
      Data         at 0 range 192 .. 223 ;
      Size         at 0 range 224 .. 255 ;
      Index        at 0 range 256 .. 287;
   end record ;
   type Memory_Header_Ptr is access all Memory_Header ;

    Description of the shared memory segment
    The Guard is the  semaphore
   type Description_Type is
   record
      Is_Server   : Boolean := False;
      Server      : Process_Id := 0;
      Mem         : Memory_Id  := 0;
      Addr        : System.Address := System.Null_Address ;
      Header      : Memory_Header_Ptr := null;
      Messages    : System.Address := System.Null_Address ;
      Guard       : Semaphore_Set := 0;
   end record ;
   Null_Description : Description_Type;
   
    Shared memory segment description used by clients and servers
   type Description is access all Description_Type ;

    Create a connection server channel
   procedure Create_Server (Area    : out Description) ;

    Close a connection server channel
   procedure Close_Server ( Area    : in out Description) ;

    Establish connection with the given server
   procedure Connect ( Shmid   : in Memory_Id := 0;
                       Server  : in Process_Id ;
                       Area    : in out Description) ;

    Wait for input on the given area
   procedure Wait ( Area : in Description);

    Read given amount of input on the given channel
   procedure Read ( Area    : in Description ;
                    Buffer  : in System.Address ;
                    Number  : in out Size_T) ;

    Write given amount of output on the given channel
   procedure Write ( Area    : in Description ;
                     Buffer  : in System.Address ;
                     Number  : in Size_T) ;

   function Readable (Area : in Description) return Natural;
   
    End of communication
   procedure Disconnect (Area    : in out Description) ;

end Tgx.Shared_Memory_Eorb ;



List of definition uses










This page was generated by PrismTech's ada2html on Friday Mai 12 2006 16:18