1/*
2 * PROGRAM: JRD Access Method
3 * MODULE: gds_proto.h
4 * DESCRIPTION: Prototype header file for gds.cpp
5 *
6 * The contents of this file are subject to the Interbase Public
7 * License Version 1.0 (the "License"); you may not use this file
8 * except in compliance with the License. You may obtain a copy
9 * of the License at http://www.Inprise.com/IPL.html
10 *
11 * Software distributed under the License is distributed on an
12 * "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
13 * or implied. See the License for the specific language governing
14 * rights and limitations under the License.
15 *
16 * The Original Code was created by Inprise Corporation
17 * and its predecessors. Portions created by Inprise Corporation are
18 * Copyright (C) Inprise Corporation.
19 *
20 * All Rights Reserved.
21 * Contributor(s): ______________________________________.
22 *
23 * 2002.10.29 Sean Leyne - Removed obsolete "Netware" port
24 *
25 */
26
27#ifndef JRD_GDS_PROTO_H
28#define JRD_GDS_PROTO_H
29
30
31const SSHORT IB_PREFIX_TYPE = 0;
32const SSHORT IB_PREFIX_LOCK_TYPE = 1;
33const SSHORT IB_PREFIX_MSG_TYPE = 2;
34
35// flags for gds_alloc_report
36const ULONG ALLOC_dont_report = 1L << 0; /* Don't report this block */
37const ULONG ALLOC_silent = 1L << 1; /* Don't report new leaks */
38const ULONG ALLOC_verbose = 1L << 2; /* Report all leaks, even old */
39const ULONG ALLOC_mark_current = 1L << 3; /* Mark all current leaks */
40const ULONG ALLOC_check_each_call = 1L << 4; /* Check memory integrity on each alloc/free call */
41const ULONG ALLOC_dont_check = 1L << 5; /* Stop checking integrity on each call */
42
43#ifdef __cplusplus
44extern "C" {
45#endif
46
47typedef void* VoidPtr;
48
49VoidPtr API_ROUTINE gds__alloc_debug(SLONG, const TEXT*, ULONG);
50void API_ROUTINE gds_alloc_flag_unfreed(void*);
51void API_ROUTINE gds_alloc_report(ULONG, const char*, int);
52
53VoidPtr API_ROUTINE gds__alloc(SLONG);
54
55#ifdef DEBUG_GDS_ALLOC
56#define gds__alloc(s) gds__alloc_debug ((s), (TEXT*)__FILE__, (ULONG)__LINE__)
57#endif /* DEBUG_GDS_ALLOC */
58
59
60ISC_STATUS API_ROUTINE gds__decode(ISC_STATUS, USHORT*, USHORT*);
61void API_ROUTINE isc_decode_date(const ISC_QUAD*, void*);
62void API_ROUTINE isc_decode_sql_date(const GDS_DATE*, void*);
63void API_ROUTINE isc_decode_sql_time(const GDS_TIME*, void*);
64void API_ROUTINE isc_decode_timestamp(const GDS_TIMESTAMP*, void*);
65ISC_STATUS API_ROUTINE gds__encode(ISC_STATUS, USHORT);
66void API_ROUTINE isc_encode_date(const void*, ISC_QUAD*);
67void API_ROUTINE isc_encode_sql_date(const void*, GDS_DATE*);
68void API_ROUTINE isc_encode_sql_time(const void*, GDS_TIME*);
69void API_ROUTINE isc_encode_timestamp(const void*, GDS_TIMESTAMP*);
70ULONG API_ROUTINE gds__free(void*);
71
72/* CVC: This function was created to be used inside the engine, but I don't see
73a problem if it's used from outside, too.
74This function has been renamed and made public. */
75SLONG API_ROUTINE fb_interpret(char*, unsigned int, const ISC_STATUS**);
76/* CVC: This non-const signature is needed for compatibility, see gds.cpp. */
77SLONG API_ROUTINE gds__interprete(char*, ISC_STATUS**);
78void API_ROUTINE gds__interprete_a(SCHAR*, SSHORT*, ISC_STATUS*, SSHORT*);
79
80void API_ROUTINE gds__log(const TEXT*, ...);
81void API_ROUTINE gds__trace(const char*);
82void API_ROUTINE gds__trace_raw(const char*, unsigned int = 0);
83void API_ROUTINE gds__log_status(const TEXT*, const ISC_STATUS*);
84int API_ROUTINE gds__msg_close(void*);
85SSHORT API_ROUTINE gds__msg_format(void* handle,
86 USHORT facility,
87 USHORT msgNumber,
88 USHORT bufsize,
89 TEXT* buffer,
90 const TEXT* arg1,
91 const TEXT* arg2,
92 const TEXT* arg3,
93 const TEXT* arg4,
94 const TEXT* arg5);
95SSHORT API_ROUTINE gds__msg_lookup(void*, USHORT, USHORT, USHORT,
96 TEXT*, USHORT*);
97int API_ROUTINE gds__msg_open(void**, const TEXT*);
98void API_ROUTINE gds__msg_put(void*, USHORT, USHORT, const TEXT*,
99 const TEXT*, const TEXT*, const TEXT*, const TEXT*);
100void API_ROUTINE gds__prefix(TEXT*, const TEXT*);
101void API_ROUTINE gds__prefix_lock(TEXT*, const TEXT*);
102void API_ROUTINE gds__prefix_msg(TEXT*, const TEXT*);
103
104SLONG API_ROUTINE gds__get_prefix(SSHORT, const TEXT*);
105ISC_STATUS API_ROUTINE gds__print_status(const ISC_STATUS*);
106USHORT API_ROUTINE gds__parse_bpb(USHORT, const UCHAR*, USHORT*, USHORT*);
107USHORT API_ROUTINE gds__parse_bpb2(USHORT, const UCHAR*, SSHORT*, SSHORT*,
108 USHORT*, USHORT*, bool*, bool*, bool*, bool*);
109SLONG API_ROUTINE gds__ftof(const SCHAR*, const USHORT length1, SCHAR*, const USHORT length2);
110int API_ROUTINE fb_print_blr(const UCHAR*, ULONG, FPTR_PRINT_CALLBACK, void*, SSHORT);
111int API_ROUTINE gds__print_blr(const UCHAR*, FPTR_PRINT_CALLBACK, void*, SSHORT);
112void API_ROUTINE gds__put_error(const TEXT*);
113void API_ROUTINE gds__qtoq(const void*, void*);
114void API_ROUTINE gds__register_cleanup(FPTR_VOID_PTR, void*);
115SLONG API_ROUTINE gds__sqlcode(const ISC_STATUS*);
116void API_ROUTINE gds__sqlcode_s(const ISC_STATUS*, ULONG*);
117VoidPtr API_ROUTINE gds__temp_file(BOOLEAN, const TEXT*, TEXT*, TEXT* = NULL, BOOLEAN = FALSE);
118void API_ROUTINE gds__unregister_cleanup(FPTR_VOID_PTR, void*);
119BOOLEAN API_ROUTINE gds__validate_lib_path(const TEXT*, const TEXT*, TEXT*, SLONG);
120SLONG API_ROUTINE gds__vax_integer(const UCHAR*, SSHORT);
121void API_ROUTINE gds__vtof(const SCHAR*, SCHAR*, USHORT);
122void API_ROUTINE gds__vtov(const SCHAR*, char*, SSHORT);
123void API_ROUTINE isc_print_sqlerror(SSHORT, const ISC_STATUS*);
124void API_ROUTINE isc_sql_interprete(SSHORT, TEXT*, SSHORT);
125SINT64 API_ROUTINE isc_portable_integer(const UCHAR*, SSHORT);
126
127// 14-June-2004. Nickolay Samofatov. The routines below are not part of the
128// API and are not exported. Maybe use another prefix like GDS_ for them?
129void gds__cleanup();
130void gds__ulstr(char* buffer, FB_UINT64 value, const int minlen, const char filler);
131
132void FB_EXPORTED gds__default_printer(void*, SSHORT, const TEXT*);
133void FB_EXPORTED gds__trace_printer(void*, SSHORT, const TEXT*);
134void gds__print_pool(Firebird::MemoryPool*, const TEXT*, ...);
135void GDS_init_prefix();
136
137#ifdef __cplusplus
138} /* extern "C" */
139#endif
140
141
142#endif /* JRD_GDS_PROTO_H */
143