home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 22 gnu / 22-gnu.zip / db02_src.zip / gib.h < prev    next >
C/C++ Source or Header  |  1993-11-05  |  4KB  |  133 lines

  1. /**************************************************************************
  2.  * Source Id :
  3.  *
  4.  * $Id: gib.h,v 1.10 1993/11/05 13:46:57 kevinl Exp $
  5.  *-------------------------------------------------------------------------
  6.  * Project Notes :
  7.  *
  8.  *  Diamond Base
  9.  *  ============
  10.  *      A solid database implementation, spurred on by the continuing
  11.  *  Metal (Lead) Base saga.
  12.  *
  13.  *  Project Team :
  14.  *        A. Davison
  15.  *        K. Lentin
  16.  *        D. Platt
  17.  *
  18.  *    Project Commenced : 05-02-1993
  19.  *
  20.  *-------------------------------------------------------------------------
  21.  *  Module Notes :
  22.  *
  23.  *  Header for gib.cc
  24.  *
  25.  *  Original Author : Darren Platt
  26.  *
  27.  *-------------------------------------------------------------------------
  28.  * Revision History:
  29.  *
  30.  * $Log: gib.h,v $
  31.  * Revision 1.10  1993/11/05  13:46:57  kevinl
  32.  * Protocol and fixes
  33.  *
  34.  * Revision 1.9  1993/11/05  12:45:05  kevinl
  35.  * Fixed problems that CC picked up (and some multi bugs)
  36.  *
  37.  * Revision 1.8  1993/11/04  15:10:53  kevinl
  38.  * recMess now has 3 state return
  39.  * Alarm set to clean up dead clients
  40.  * creat replaces open
  41.  * More signal handling
  42.  * We now do the shared memory creation/removal
  43.  * Removed fork
  44.  *
  45.  * Revision 1.7  1993/11/03  12:41:54  darrenp
  46.  * Added sigterm shutdown facilitites.
  47.  *
  48.  * Revision 1.6  1993/10/31  17:22:11  darrenp
  49.  * Fix to returnErr to shut up compiler.
  50.  *
  51.  * Revision 1.5  1993/10/29  15:54:37  darrenp
  52.  * bug fixes in memorary attachment.
  53.  *
  54.  * Revision 1.4  1993/10/13  10:26:28  daz
  55.  * *** empty log message ***
  56.  *
  57.  * Revision 1.3  1993/07/21  14:25:42  daz
  58.  * *** empty log message ***
  59.  *
  60.  * Revision 1.2  1993/07/04  16:08:03  daz
  61.  * *** empty log message ***
  62.  *
  63.  * Revision 1.1  1993/07/04  02:21:13  daz
  64.  * Initial revision
  65.  *
  66.  * Revision 1.1  1993/07/04  02:21:13  daz
  67.  * Initial revision
  68.  *
  69.  **************************************************************************/
  70.  
  71. #ifndef __gib_incl__
  72. #define __gib_incl__
  73.  
  74.  
  75. #include "diagrel.h"
  76.  
  77. const SLEEP_TIME = 60;
  78. enum rcvRes {rcvOK, rcvINTR, rcvERR};
  79.  
  80. //
  81. // Class for holding all the data pertaining to a single
  82. // client. We will hold the data in a linked list for the moment.
  83. //
  84.  
  85. class clientInfo {
  86.     public:
  87.         long    pid;        // Their process id
  88.         long    shmId;        // Shared memory id
  89.         char    *transArea;    // Their designated transfer area.
  90.         clientInfo *next;
  91.         clientInfo *prev;
  92. };
  93.  
  94. // A fakeObject is instantiated in the server to provide all the
  95. // services an object would normally provide - it cheats now that the
  96. // diaGRel object is available. It used to pass info to the client to
  97. // do the work, but now the diaGRel does most of the work, and the
  98. // fakeObject just holds a little extra info.
  99.  
  100. class fakeObject : public diaGRel {
  101.     private:
  102. //        bool     tradeLongs(char code,long send,long &rec);
  103.  
  104.                 // We are interested in the redefining the following two
  105.                 // functions in order to detect when to transfer memory.
  106. //        void     getData(void);
  107. //        void     putData(void);
  108.     public:
  109.                 fakeObject(const char *relName);
  110.         long    client;
  111.         char    *transArea; // copy of that application's transfer area
  112. };
  113.  
  114. // Use fakenodes to keep a list of objects that are
  115. // currently being mirrored in the server.
  116. // Each fake node has a pointer to the node which it is faking,
  117. // the client's pid and the refId for that object.
  118.  
  119. struct fakeNode {
  120.     fakeObject    *obj;
  121.     long        client; // equals pid.
  122.     long        refId;
  123.     fakeNode    *next; // Maintained in a list
  124.     fakeNode    *prev;
  125. };
  126.  
  127. // Prototypes.
  128. bool sendMess(void *data,long len,long chan);
  129. rcvRes recMess(void *data,long len,long chan);
  130. void returnErr(long e,long client);
  131.  
  132. #endif
  133.