8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-29 06:43:03 +01:00
firebird-mirror/src/alice/alice.h

203 lines
4.8 KiB
C
Raw Normal View History

2001-05-23 15:26:42 +02:00
/*
* PROGRAM: Alice
* MODULE: alice.h
* DESCRIPTION: Block definitions
*
* The contents of this file are subject to the Interbase Public
* License Version 1.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy
* of the License at http://www.Inprise.com/IPL.html
*
* Software distributed under the License is distributed on an
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
* or implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code was created by Inprise Corporation
* and its predecessors. Portions created by Inprise Corporation are
* Copyright (C) Inprise Corporation.
*
* All Rights Reserved.
* Contributor(s): ______________________________________.
*/
2001-12-24 03:51:06 +01:00
#ifndef ALICE_ALICE_H
#define ALICE_ALICE_H
2001-05-23 15:26:42 +02:00
#include "../jrd/ib_stdio.h"
#include "../jrd/y_ref.h"
2001-05-23 15:26:42 +02:00
#include "../jrd/ibase.h"
#include "../jrd/thd.h"
#include "../alice/all.h"
2001-12-24 03:51:06 +01:00
#include "../include/fb_blk.h"
#include "../common/classes/alloc.h"
2001-05-23 15:26:42 +02:00
2001-12-24 03:51:06 +01:00
#include <vector>
2001-05-23 15:26:42 +02:00
#include "../alice/blk.h"
2003-09-22 10:49:45 +02:00
enum val_errors {
VAL_INVALID_DB_VERSION = 0,
VAL_RECORD_ERRORS = 1,
VAL_BLOB_PAGE_ERRORS = 2,
VAL_DATA_PAGE_ERRORS = 3,
VAL_INDEX_PAGE_ERRORS = 4,
VAL_POINTER_PAGE_ERRORS = 5,
VAL_TIP_PAGE_ERRORS = 6,
VAL_PAGE_ERRORS = 7,
MAX_VAL_ERRORS = 8
};
2001-05-23 15:26:42 +02:00
typedef struct user_action
{
ULONG ua_switches;
2003-10-16 10:51:06 +02:00
UCHAR* ua_user;
UCHAR* ua_password;
2003-09-10 19:52:12 +02:00
bool ua_use;
bool ua_force;
bool ua_read_only;
2001-05-23 15:26:42 +02:00
SLONG ua_shutdown_delay;
SLONG ua_sweep_interval;
SLONG ua_transaction;
SLONG ua_page_buffers;
USHORT ua_debug;
SLONG ua_val_errors[MAX_VAL_ERRORS];
TEXT ua_log_file[MAXPATHLEN];
USHORT ua_db_SQL_dialect;
} *USER_ACTION;
/* String block: used to store a string of constant length. */
2001-12-24 03:51:06 +01:00
class str : public pool_alloc_rpt<UCHAR, alice_type_str>
{
public:
2001-05-23 15:26:42 +02:00
USHORT str_length;
UCHAR str_data[2];
2001-12-24 03:51:06 +01:00
};
typedef str* STR;
2001-05-23 15:26:42 +02:00
/* Transaction block: used to store info about a multidatabase transaction. */
2001-12-25 05:53:56 +01:00
typedef struct tdr : public pool_alloc<alice_type_tdr>
2001-05-23 15:26:42 +02:00
{
2003-10-16 10:51:06 +02:00
tdr* tdr_next; /* next subtransaction */
2001-05-23 15:26:42 +02:00
SLONG tdr_id; /* database-specific transaction id */
2003-10-16 10:51:06 +02:00
str* tdr_fullpath; /* full (possibly) remote pathname */
const TEXT* tdr_filename; /* filename within full pathname */
str* tdr_host_site; /* host for transaction */
str* tdr_remote_site; /* site for remote transaction */
FRBRD* tdr_handle; /* reconnected transaction handle */
FRBRD* tdr_db_handle; /* reattached database handle */
2001-05-23 15:26:42 +02:00
USHORT tdr_db_caps; /* capabilities of database */
USHORT tdr_state; /* see flags below */
} *TDR;
/* Transaction Description Record */
const int TDR_VERSION = 1;
2003-09-22 10:49:45 +02:00
enum tdr_vals {
TDR_HOST_SITE = 1,
TDR_DATABASE_PATH = 2,
TDR_TRANSACTION_ID = 3,
TDR_REMOTE_SITE = 4,
TDR_PROTOCOL = 5
};
2001-05-23 15:26:42 +02:00
/* flags for tdr_db_caps */
enum tdr_db_caps_vals {
CAP_none = 0,
CAP_transactions = 1
};
/* db has a RDB$TRANSACTIONS relation */
2001-05-23 15:26:42 +02:00
/* flags for tdr_state */
enum tdr_state_vals {
TRA_none = 0, /* transaction description record is missing */
TRA_limbo = 1, /* has been prepared */
TRA_commit = 2, /* has committed */
TRA_rollback = 3, /* has rolled back */
TRA_unknown = 4 /* database couldn't be reattached, state is unknown */
};
2001-05-23 15:26:42 +02:00
/* a couple of obscure blocks used only in data allocator routines */
2001-12-24 03:51:06 +01:00
class vec : public pool_alloc_rpt<class blk*, alice_type_vec>
2001-05-23 15:26:42 +02:00
{
2001-12-24 03:51:06 +01:00
public:
2001-05-23 15:26:42 +02:00
ULONG vec_count;
blk *vec_object[1];
2001-12-24 03:51:06 +01:00
};
2003-10-16 10:51:06 +02:00
typedef vec* VEC;
2001-05-23 15:26:42 +02:00
2001-12-24 03:51:06 +01:00
class vcl : public pool_alloc_rpt<SLONG, alice_type_vcl>
2001-05-23 15:26:42 +02:00
{
ULONG vcl_count;
SLONG vcl_long[1];
2001-12-24 03:51:06 +01:00
};
2003-10-16 10:51:06 +02:00
typedef vcl* VCL;
2001-05-23 15:26:42 +02:00
/* Global switches and data */
#include "../jrd/svc.h"
enum redirect_vals {
NOREDIRECT = 0,
REDIRECT = 1,
NOOUTPUT = 2
};
2001-12-24 03:51:06 +01:00
class tgbl
2001-05-23 15:26:42 +02:00
{
2001-12-24 03:51:06 +01:00
public:
2003-10-16 10:51:06 +02:00
tgbl(AliceMemoryPool* p) : pools(0, (AliceMemoryPool*)0,
2001-12-24 03:51:06 +01:00
pool_vec_t::allocator_type(*p)) {}
thdd tgbl_thd_data;
user_action ALICE_data;
2003-10-16 10:51:06 +02:00
AliceMemoryPool* ALICE_permanent_pool;
AliceMemoryPool* ALICE_default_pool;
2003-04-16 12:18:51 +02:00
ISC_STATUS_ARRAY status_vector;
2001-12-24 03:51:06 +01:00
typedef std::vector<AliceMemoryPool*, Firebird::allocator<AliceMemoryPool*> > pool_vec_t;
pool_vec_t pools;
2001-05-23 15:26:42 +02:00
int exit_code;
pfn_svc_output output_proc;
svc* output_data;
2001-05-23 15:26:42 +02:00
IB_FILE* output_file;
SVC service_blk;
isc_db_handle db_handle;
isc_tr_handle tr_handle;
2003-04-10 08:32:58 +02:00
ISC_STATUS* status;
redirect_vals sw_redirect;
2003-09-10 19:52:12 +02:00
bool sw_service;
bool sw_service_thd;
2001-12-24 03:51:06 +01:00
};
2003-10-16 10:51:06 +02:00
typedef tgbl* TGBL;
2001-05-23 15:26:42 +02:00
#ifdef GET_THREAD_DATA
#undef GET_THREAD_DATA
#endif
#ifdef SUPERSERVER
#define GET_THREAD_DATA ((TGBL) THD_get_specific())
#define SET_THREAD_DATA THD_put_specific ((THDD) tdgbl); \
tdgbl->tgbl_thd_data.thdd_type = \
2001-12-25 08:57:04 +01:00
THDD_TYPE_TALICE
2001-05-23 15:26:42 +02:00
#define RESTORE_THREAD_DATA THD_restore_specific();
#else
extern tgbl *gdgbl;
2001-05-23 15:26:42 +02:00
#define GET_THREAD_DATA (gdgbl)
2001-12-28 06:16:31 +01:00
#define SET_THREAD_DATA gdgbl = const_cast<tgbl*>(tdgbl); \
tdgbl->tgbl_thd_data.thdd_type = THDD_TYPE_TGBL
2001-05-23 15:26:42 +02:00
#define RESTORE_THREAD_DATA
#endif
2001-12-24 03:51:06 +01:00
#endif // ALICE_ALICE_H
2003-09-22 10:49:45 +02:00