/**************************************************************************
 * Source Id :
 *
 * $Id: gib.h,v 1.1 2001/04/03 20:10:26 aleksandras Exp $
 *-------------------------------------------------------------------------
 * Project Notes :
 *
 *  Diamond Base
 *  ============
 *      A solid database implementation, spurred on by the continuing
 *  Metal (Lead) Base saga.
 *
 *  Project Team :
 *        A. Davison
 *        K. Lentin
 *        D. Platt
 *
 *	Project Commenced : 05-02-1993
 *
 *-------------------------------------------------------------------------
 *  Module Notes :
 *
 *  Header for gib.cc
 *
 *  Original Author : Darren Platt
 *
 **************************************************************************/

#ifndef __DB_GIB_H__
#define __DB_GIB_H__


#include <diamond/diagrel.h>
#include <diamond/cserver.h>

const SLEEP_TIME = 60;
enum rcvRes {rcvOK, rcvINTR, rcvERR};

//
// Class for holding all the data pertaining to a single
// client. We will hold the data in a linked list for the moment.
//

class DiaClientInfo : public DiaClient {
		int	clientId;
	public:
				DiaClientInfo(int f_clientId);
				~DiaClientInfo();

		static	DiaHash	find;
		int32	pid;		// Their process id
		int32	shmId;		// Shared memory id
		char	*transArea;	// Their designated transfer area.
		bool	transferChange;
		int32	transAreaSize;
};

//
// Prototypes.
//
bool 		sendMess(void *data,int32 len,int32 chan);
rcvRes 		recMess(void *data,int32 len,int32 chan);
void 		returnErr(int32 e,int32 client);
void 		clientDetach(DiaClientInfo *ci);
void 		handleAttach(int32 m[]);	// Handle attachment.
void 		handleTrans(int32 m[]);		// Handle transaction.
void 		returnErr(int32 e,int32 client);


#endif

///////////////////////////////////////////////////////////////////////////
// Revision History:
//
// $Log: gib.h,v $
// Revision 1.1  2001/04/03 20:10:26  aleksandras
// big one 3.1 (comments later)
//
// Revision 1.12  1996/01/30  21:49:02  dmb
// Cleaned up and went to cserver code.
//
// Revision 1.11  1994/02/03  05:54:19  kevinl
// Moved include files to diamond/ and fixed HAVE_MALLOC_H
//
// Revision 1.10  1993/11/05  13:46:57  kevinl
// Protocol and fixes
//
// Revision 1.9  1993/11/05  12:45:05  kevinl
// Fixed problems that CC picked up (and some multi bugs)
//
// Revision 1.8  1993/11/04  15:10:53  kevinl
// recMess now has 3 state return
// Alarm set to clean up dead clients
// creat replaces open
// More signal handling
// We now do the shared memory creation/removal
// Removed fork
//
// Revision 1.7  1993/11/03  12:41:54  darrenp
// Added sigterm shutdown facilitites.
//
// Revision 1.6  1993/10/31  17:22:11  darrenp
// Fix to returnErr to shut up compiler.
//
// Revision 1.5  1993/10/29  15:54:37  darrenp
// bug fixes in memorary attachment.
//
// Revision 1.4  1993/10/13  10:26:28  daz
// *** empty log message ***
//
// Revision 1.3  1993/07/21  14:25:42  daz
// *** empty log message ***
//
// Revision 1.2  1993/07/04  16:08:03  daz
// *** empty log message ***
//
// Revision 1.1  1993/07/04  02:21:13  daz
// Initial revision
//
// Revision 1.1  1993/07/04  02:21:13  daz
// Initial revision
//
///////////////////////////////////////////////////////////////////////////


