/* FBDatabaseDefs.h created by geert on Wed 03-Dec-1997 */

#ifndef FBDatabaseDefs__H
#define FBDatabaseDefs__H

#ifndef FBVersion
#define FBVersion 7
#elif FBVersion != 7
#error "The headers for FBCAccess version have been Mixed"
#endif

#define FBTNoVersion (0xffffffffffffffffLL)

typedef enum FBExecClientType
{
   FBUnknownType      = 0,
   FBDatabaseManager  = 1,
   FBUserManager     = 2,
   FBDatabaseServer  = 4,
   FBExecServer      = 8,
   FBClientApp       = 16,
   FBLasso           = 32,
   FBReplicatorServer = 64,
   FBReplicatorClient = 128
} FBExecClientType;

#define FBCUnknownType      FBUnknownType
#define FBCDatabaseManager  FBDatabaseManager
#define FBCUserManager      FBUserManager
#define FBCDatabaseServer   FBDatabaseServer
#define FBCExecServer       FBExecServer
#define FBCClientApp        FBClientApp
#define FBCLasso            FBLasso
#define FBCReplicatorServer FBReplicatorServer
#define FBCReplicatorClient FBReplicatorClient

typedef enum 
{  FBUnknownStatus      = -1,
   FBStopped            = 0,
   FBStarting           = 1,
   FBRunning            = 2,
   FBStopping           = 3,
   FBNoExec             = 4
} FBDatabaseStatus;


// A client that wishes to receive broadcast message from the FBExec needs to enable
// this mechanism via the EMCD_ENABLE_BROADCASTS API function. A client can decide
// only to receive certain types of broadcast messages or all. To only receive broadcasts
// about databases e.g. being deleted or created, FBDatabaseDeletedMask|FBDatabaseCreatedMask
// should be given as argument to EMCD_ENABLE_BROADCASTS

typedef enum FBBroadcastMask
{  FBDatabaseStatusChangesMask  = 1,
   FBDatabaseDeletedMask        = 2,
   FBDatabaseCreatedMask        = 4,
   FBDatabaseRenamedMask        = 8,
   FBRelicatorStatusChangesMask = 16,
   FBRelicatorDeletedMask       = 32,

   FBBroadcastAllMask           = 255
} FBBroadcastMask;


// When a client receives a broadcast message it has this layout:
//      2$<exec uid>$<broadcast kind>$<kind specific information>
//
// Example:
//    To broadcast the status change of a database, the following message will
//    be broadcasted:
//
//      2$<exec uid>$100$<host name>$<short database name>$<new status>
//
//    which means that the database <short database name> on host <host name> now has 
//    the status <new status>.
//
// The format for a Deleted broadcast message:
//      2$<exec uid>$101$<host name>$<short name>$<long name>
//
// The format for a Created broadcast message:
//      2$<exec uid>$102$<host name>$<short name>$<long name>
//
// The format for a Renamed broadcast message:
//      2$<exec uid>$103$<host name>$<old long name>$<new long name>
//
// The format for a Replicator status change broadcast message:
//      2$<exec uid>$104$<host name>$<short name>$<port number>
//
// The format for a Replicator file deleted broadcast message:
//      2$<exec uid>$105$<host name>$<short name>
//

typedef enum FBBroadcastKind
{  BCKDatabaseStatusChange   = 100,
   BCKDatabaseDeleted        = 101,
   BCKDatabaseCreated        = 102,
   BCKDatabaseRenamed        = 103,
   BCKReplicatorStatusChange = 104,
   BCKReplicatorDeleted      = 105
} FBBroadcastKind;

#endif /* FBDatabaseDefs__H */
