mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-23 23:23:04 +01:00
Remove csv directory
This commit is contained in:
parent
efd9204f92
commit
f67b80940b
2760
src/csv/csi.cpp
2760
src/csv/csi.cpp
File diff suppressed because it is too large
Load Diff
559
src/csv/csi.h
559
src/csv/csi.h
@ -1,559 +0,0 @@
|
||||
/*
|
||||
* PROGRAM: JRD Access Method
|
||||
* MODULE: csi.h
|
||||
* DESCRIPTION: Central Server Interface 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): ______________________________________.
|
||||
*
|
||||
* 2002.10.30 Sean Leyne - Removed support for obsolete "PC_PLATFORM" define
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _CSV_CSI_H_
|
||||
#define _CSV_CSI_H_
|
||||
|
||||
#include "../jrd/common.h"
|
||||
#include "../jrd/thd.h"
|
||||
#include "../jrd/isc.h"
|
||||
|
||||
#ifdef VMS
|
||||
#define CSI_FILE "[000000]isc_csv_gbl.%s"
|
||||
#if !(defined MULTI_THREAD) || defined (__ALPHA)
|
||||
#define CSV_SIGNAL 33
|
||||
#define EVENT_SIGNAL 3
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef UNIX
|
||||
#include <signal.h>
|
||||
#define EVENT_SIGNAL SIGUSR2
|
||||
#define CSI_FILE "/usr/interbase/isc_csv.%s"
|
||||
#endif
|
||||
|
||||
#ifdef WIN_NT
|
||||
#define CSI_FILE "/interbas/%s.csv"
|
||||
#endif
|
||||
|
||||
#ifndef CSI_DEFAULT_SIZE
|
||||
#define CSI_DEFAULT_SIZE 262144
|
||||
#endif
|
||||
|
||||
#define CSI_EXTEND_SIZE 32768
|
||||
|
||||
#ifndef MAX_ARRAY_MESSAGE
|
||||
#define MAX_ARRAY_MESSAGE 64000
|
||||
#endif
|
||||
|
||||
#ifndef BLOB_LENGTH
|
||||
#define BLOB_LENGTH 4096
|
||||
#endif
|
||||
|
||||
#define PTR SLONG
|
||||
#define BASE ((UCHAR*) CSS_header)
|
||||
#define REL_PTR(item) ((UCHAR*) item - BASE)
|
||||
#define ABS_PTR(item) (BASE + item)
|
||||
#define ACQUIRE CSS_acquire()
|
||||
#define RELEASE CSS_release()
|
||||
|
||||
#define QUE_INIT(que) {que.srq_forward = que.srq_backward = REL_PTR (&que);}
|
||||
#define QUE_EMPTY(que) (que.srq_forward == REL_PTR (&que))
|
||||
#define QUE_NEXT(que) ABS_PTR (que.srq_forward)
|
||||
|
||||
#define QUE_LOOP(header,que) for (que = (SRQ*) QUE_NEXT (header);\
|
||||
que != &header; que = (SRQ*) QUE_NEXT ((*que)))
|
||||
|
||||
|
||||
#define SIZE_SHIFT 2
|
||||
#define FAST_ALLOC 16
|
||||
|
||||
/* Self-relative que block. Offsets are from the block itself. */
|
||||
|
||||
typedef struct srq {
|
||||
PTR srq_forward; /* Forward offset */
|
||||
PTR srq_backward; /* Backward offset */
|
||||
} SRQ;
|
||||
|
||||
/* Global section header */
|
||||
|
||||
#define CSI_VERSION 3
|
||||
#define CSI_PROTOCOL_VERSION 1
|
||||
|
||||
typedef struct csh {
|
||||
SLONG csh_length; /* Current length of global section */
|
||||
UCHAR csh_version; /* Version number of global section */
|
||||
SRQ csh_processes; /* Known processes */
|
||||
PTR csh_free; /* Free blocks */
|
||||
PTR csh_current_process; /* Process "acquiring" section */
|
||||
SLONG csh_mutex[2]; /* Mutex controlling access */
|
||||
SLONG csh_semid; /* Semaphore id for UNIX */
|
||||
SLONG csh_process_number; /* Assigned sequentially */
|
||||
UCHAR csh_semaphores[16]; /* Free semaphores */
|
||||
PTR csh_free_vector[FAST_ALLOC];
|
||||
} *CSH;
|
||||
|
||||
/* Common block header */
|
||||
|
||||
typedef struct hdr {
|
||||
SLONG hdr_length; /* Length of block */
|
||||
UCHAR hdr_type; /* Type of block */
|
||||
} HDR;
|
||||
|
||||
#define type_hdr 1
|
||||
#define type_frb 2
|
||||
#define type_prb 3
|
||||
#define type_cnct 4
|
||||
#define type_msg 5
|
||||
|
||||
/* Free blocks */
|
||||
|
||||
typedef struct frb {
|
||||
HDR frb_header;
|
||||
SLONG frb_next; /* Next block */
|
||||
} *FRB;
|
||||
|
||||
/* Process blocks */
|
||||
|
||||
typedef struct prb {
|
||||
HDR prb_header;
|
||||
USHORT prb_flags; /* Misc */
|
||||
USHORT prb_protocol_version; /* Protocol version */
|
||||
ULONG prb_group_id; /* Group id for VMS */
|
||||
USHORT prb_semaphore; /* Semaphore used for event on UNIX */
|
||||
SRQ prb_processes; /* Process que ownerd by header */
|
||||
SRQ prb_connections; /* Connections to server process */
|
||||
SRQ prb_messages; /* Messages to be processed */
|
||||
SLONG prb_process_id; /* Process id */
|
||||
SLONG prb_process_number; /* Relative process number */
|
||||
EVENT_T prb_event[1]; /* Event on which to wait */
|
||||
} *PRB;
|
||||
|
||||
#define PRB_client 0 /* Process is client */
|
||||
#define PRB_server 1 /* Process is server (otherwise client) */
|
||||
#define PRB_disconnect 2 /* Some connection was broken */
|
||||
#define PRB_client_t1 4 /* Process is client type 1 */
|
||||
#define PRB_server_t1 8 /* Process is server type 1 */
|
||||
#define PRB_timeout 32 /* Process has waited too long for a message */
|
||||
#define PRB_wait 64 /* Process is awaiting acquisition */
|
||||
#define PRB_signal_me 128 /* Process is waiting for a signal */
|
||||
|
||||
/* Connection block */
|
||||
|
||||
typedef struct cnct {
|
||||
HDR cnct_header;
|
||||
PTR cnct_parent; /* Client process block */
|
||||
PTR cnct_partner; /* Server process lock */
|
||||
PTR cnct_mirror; /* Mirror of connection */
|
||||
SRQ cnct_connections; /* Que of parents connections */
|
||||
} *CNCT;
|
||||
|
||||
/* Message block */
|
||||
|
||||
typedef enum {
|
||||
MSG_attach_database,
|
||||
MSG_blob_info,
|
||||
MSG_cancel_blob,
|
||||
MSG_close_blob,
|
||||
MSG_commit,
|
||||
MSG_commit_retaining,
|
||||
MSG_compile,
|
||||
MSG_create_blob,
|
||||
MSG_create_database,
|
||||
MSG_database_info,
|
||||
MSG_detach,
|
||||
MSG_get_segment,
|
||||
MSG_open_blob,
|
||||
MSG_prepare,
|
||||
MSG_put_segment,
|
||||
MSG_reconnect,
|
||||
MSG_receive,
|
||||
MSG_release,
|
||||
MSG_request_info,
|
||||
MSG_rollback,
|
||||
MSG_send,
|
||||
MSG_start_and_send,
|
||||
MSG_start_request,
|
||||
MSG_start_transaction,
|
||||
MSG_transaction_info,
|
||||
MSG_unwind,
|
||||
MSG_disconnect,
|
||||
MSG_response,
|
||||
MSG_que_events,
|
||||
MSG_cancel_events,
|
||||
MSG_event,
|
||||
MSG_alt_connection,
|
||||
MSG_util_cmd,
|
||||
MSG_query_connect,
|
||||
MSG_mdi_attach_db,
|
||||
MSG_ping,
|
||||
MSG_get_slice,
|
||||
MSG_put_slice,
|
||||
MSG_ddl,
|
||||
MSG_seek_blob,
|
||||
MSG_get_segment_buf,
|
||||
MSG_put_segment_buf,
|
||||
MSG_allocate_stmt,
|
||||
MSG_execute,
|
||||
MSG_execute_immediate,
|
||||
MSG_fetch,
|
||||
MSG_free_stmt,
|
||||
MSG_prepare_stmt,
|
||||
MSG_set_cursor,
|
||||
MSG_sql_info,
|
||||
MSG_insert,
|
||||
MSG_execute2,
|
||||
MSG_execute_immediate2,
|
||||
MSG_transact_request,
|
||||
MSG_drop_database
|
||||
} MSG_T;
|
||||
|
||||
typedef struct csv_msg {
|
||||
HDR msg_header;
|
||||
SRQ msg_que;
|
||||
MSG_T msg_type; /* Specific message type */
|
||||
PTR msg_connection; /* Process sending message */
|
||||
} *CSV_MSG;
|
||||
|
||||
/* Miscellaneous message formats */
|
||||
|
||||
typedef struct msg_att {
|
||||
struct msg msg_att_header; /* Common message header */
|
||||
USHORT msg_att_file_length; /* Length of file name */
|
||||
USHORT msg_att_dpb_length; /* Length of database parameter block */
|
||||
USHORT msg_att_expanded_length; /* Length of expanded file name */
|
||||
USHORT msg_att_type; /* Create type */
|
||||
UCHAR msg_att_data[1]; /* File name and dpb */
|
||||
} *MSG_ATT;
|
||||
|
||||
typedef struct msg_info {
|
||||
struct msg msg_info_header;
|
||||
SLONG msg_info_handle;
|
||||
USHORT msg_info_level;
|
||||
USHORT msg_info_length; /* Item length */
|
||||
USHORT msg_info_buffer_length; /* Length of return buffer */
|
||||
UCHAR msg_info_data[1];
|
||||
} *MSG_INFO;
|
||||
|
||||
typedef struct msg_op {
|
||||
struct msg msg_op_header;
|
||||
SLONG msg_op_handle;
|
||||
SLONG msg_op_level;
|
||||
USHORT msg_op_length;
|
||||
USHORT msg_op_data[1];
|
||||
} *MSG_OP;
|
||||
|
||||
typedef struct msg_blob {
|
||||
struct msg msg_blob_header;
|
||||
SLONG msg_blob_database;
|
||||
SLONG msg_blob_transaction;
|
||||
USHORT msg_blob_bpb_length;
|
||||
SLONG msg_blob_id[2];
|
||||
UCHAR msg_blob_bpb[1];
|
||||
} *MSG_BLOB;
|
||||
|
||||
typedef struct msg_seg {
|
||||
struct msg msg_seg_header;
|
||||
SLONG msg_seg_handle;
|
||||
USHORT msg_seg_length;
|
||||
USHORT msg_seg_buffer_length;
|
||||
UCHAR msg_seg_data[1];
|
||||
} *MSG_SEG;
|
||||
|
||||
typedef struct msg_msg {
|
||||
struct msg msg_msg_header;
|
||||
SLONG msg_msg_request;
|
||||
SLONG msg_msg_transaction;
|
||||
USHORT msg_msg_level;
|
||||
USHORT msg_msg_type;
|
||||
USHORT msg_msg_length;
|
||||
UCHAR msg_msg_data[1];
|
||||
} *MSG_MSG;
|
||||
|
||||
typedef struct tdb {
|
||||
SLONG tdb_database;
|
||||
USHORT tdb_tpb_length;
|
||||
PTR tdb_tpb;
|
||||
} TDB;
|
||||
|
||||
typedef struct msg_trans {
|
||||
struct msg msg_trans_header;
|
||||
USHORT msg_trans_count;
|
||||
TDB msg_trans_tdb[1];
|
||||
} *MSG_TRANS;
|
||||
|
||||
typedef struct msg_resp {
|
||||
struct msg msg_resp_header;
|
||||
SLONG msg_resp_handle;
|
||||
STATUS msg_resp_status[ISC_STATUS_LENGTH];
|
||||
USHORT msg_resp_length;
|
||||
UCHAR msg_resp_data[1];
|
||||
} *MSG_RESP;
|
||||
|
||||
typedef struct msg_event {
|
||||
struct msg msg_event_header;
|
||||
SLONG msg_event_database;
|
||||
void (*msg_event_ast) ();
|
||||
void *msg_event_arg;
|
||||
USHORT msg_event_length;
|
||||
UCHAR msg_event_data[1];
|
||||
} *MSG_EVENT;
|
||||
|
||||
typedef struct msg_slice {
|
||||
struct msg msg_slice_header;
|
||||
SLONG msg_slice_database;
|
||||
SLONG msg_slice_transaction;
|
||||
USHORT msg_slice_sdl_length;
|
||||
USHORT msg_slice_param_length;
|
||||
SLONG msg_slice_slice_length;
|
||||
SLONG msg_slice_id[2];
|
||||
SLONG msg_slice_handle;
|
||||
UCHAR msg_slice_data[1]; /* sdl, param, and slice */
|
||||
} *MSG_SLICE;
|
||||
|
||||
typedef struct msg_ddl {
|
||||
struct msg msg_ddl_header;
|
||||
SLONG msg_ddl_database;
|
||||
SLONG msg_ddl_transaction;
|
||||
USHORT msg_ddl_length;
|
||||
USHORT msg_ddl_data[1];
|
||||
} *MSG_DDL;
|
||||
|
||||
typedef struct msg_util {
|
||||
struct msg msg_util_header;
|
||||
USHORT msg_util_cmd;
|
||||
USHORT msg_util_csn_len;
|
||||
USHORT msg_util_dbn_len;
|
||||
TEXT msg_util_data[2];
|
||||
} *MSG_UTIL;
|
||||
|
||||
typedef struct msg_seek {
|
||||
struct msg msg_seek_header;
|
||||
SLONG msg_seek_handle;
|
||||
SSHORT msg_seek_mode;
|
||||
SLONG msg_seek_offset;
|
||||
} *MSG_SEEK;
|
||||
|
||||
typedef struct msg_exnow {
|
||||
struct msg msg_exnow_header;
|
||||
SLONG msg_exnow_database;
|
||||
SLONG msg_exnow_transaction;
|
||||
USHORT msg_exnow_SQL_length;
|
||||
USHORT msg_exnow_SQL_dialect;
|
||||
USHORT msg_exnow_in_blr_length;
|
||||
USHORT msg_exnow_in_msg_type;
|
||||
USHORT msg_exnow_in_msg_length;
|
||||
USHORT msg_exnow_out_blr_length;
|
||||
USHORT msg_exnow_out_msg_type;
|
||||
USHORT msg_exnow_out_msg_length;
|
||||
UCHAR msg_exnow_data[1];
|
||||
} *MSG_EXNOW;
|
||||
|
||||
typedef struct msg_pstmt {
|
||||
struct msg msg_pstmt_header;
|
||||
SLONG msg_pstmt_transaction;
|
||||
SLONG msg_pstmt_statement;
|
||||
USHORT msg_pstmt_SQL_length;
|
||||
USHORT msg_pstmt_SQL_dialect;
|
||||
USHORT msg_pstmt_item_length;
|
||||
USHORT msg_pstmt_buffer_length;
|
||||
UCHAR msg_pstmt_data[1];
|
||||
} *MSG_PSTMT;
|
||||
|
||||
typedef struct msg_setcur {
|
||||
struct msg msg_setcur_header;
|
||||
SLONG msg_setcur_statement;
|
||||
USHORT msg_setcur_type;
|
||||
TEXT msg_setcur_cursor[1];
|
||||
} *MSG_SETCUR;
|
||||
|
||||
typedef struct msg_sqlmsg {
|
||||
struct msg msg_sqlmsg_header;
|
||||
SLONG msg_sqlmsg_transaction;
|
||||
SLONG msg_sqlmsg_statement;
|
||||
USHORT msg_sqlmsg_in_blr_length;
|
||||
USHORT msg_sqlmsg_in_msg_type;
|
||||
USHORT msg_sqlmsg_in_msg_length;
|
||||
USHORT msg_sqlmsg_out_blr_length;
|
||||
USHORT msg_sqlmsg_out_msg_type;
|
||||
USHORT msg_sqlmsg_out_msg_length;
|
||||
UCHAR msg_sqlmsg_data[1];
|
||||
} *MSG_SQLMSG;
|
||||
|
||||
typedef struct msg_trrq {
|
||||
struct msg msg_trrq_header;
|
||||
SLONG msg_trrq_database;
|
||||
SLONG msg_trrq_transaction;
|
||||
USHORT msg_trrq_blr_length;
|
||||
USHORT msg_trrq_in_msg_length;
|
||||
USHORT msg_trrq_out_msg_length;
|
||||
UCHAR msg_trrq_data[1];
|
||||
} *MSG_TRRQ;
|
||||
|
||||
#define UTIL_noop 0
|
||||
#define UTIL_list 1
|
||||
#define UTIL_disable 2
|
||||
#define UTIL_kill 3
|
||||
#define UTIL_reenable 4
|
||||
#define UTIL_enable 5
|
||||
|
||||
/* Local blocks */
|
||||
|
||||
typedef struct bid {
|
||||
ULONG bid_relation_id; /* Relation id (or null) */
|
||||
ULONG bid_number; /* Record number */
|
||||
} *BID;
|
||||
|
||||
typedef SLONG HANDLE;
|
||||
|
||||
/* Block types */
|
||||
|
||||
#ifndef INCLUDE_FB_BLK
|
||||
#include "../include/old_fb_blk.h"
|
||||
#endif
|
||||
|
||||
#define type_rdb 10
|
||||
#define type_rbl 11
|
||||
#define type_rrq 12
|
||||
#define type_rtr 13
|
||||
#define type_evnt 14
|
||||
#define type_dbn 15
|
||||
#define type_csn 16
|
||||
#define type_array 17
|
||||
#define type_rsr 18
|
||||
|
||||
/* Block types */
|
||||
|
||||
typedef struct rdb {
|
||||
struct blk rdb_header;
|
||||
PTR rdb_connection; /* Connection to partner */
|
||||
PTR rdb_connection2; /* Connection to partner for async events */
|
||||
PTR rdb_server; /* Server process */
|
||||
HANDLE rdb_handle; /* database handle */
|
||||
struct rtr *rdb_transactions; /* linked list of transactions */
|
||||
struct rrq *rdb_requests; /* compiled requests */
|
||||
struct rsr *rdb_sql_requests; /* SQL requests */
|
||||
struct rdb *rdb_next; /* next database in system */
|
||||
struct evnt *rdb_events; /* list of allocated event blocks */
|
||||
struct dbn *rdb_dbn; /* database name */
|
||||
int *rdb_status_vector;
|
||||
SCHAR *rdb_setjmp;
|
||||
} *RDB;
|
||||
|
||||
typedef struct rtr {
|
||||
struct blk rtr_header;
|
||||
struct rdb *rtr_rdb;
|
||||
struct rtr *rtr_next;
|
||||
struct rbl *rtr_blobs;
|
||||
struct array *rtr_arrays;
|
||||
HANDLE rtr_handle;
|
||||
USHORT rtr_flags;
|
||||
} *RTR;
|
||||
|
||||
#define RTR_limbo 1
|
||||
|
||||
typedef struct rbl {
|
||||
struct blk rbl_header;
|
||||
struct rdb *rbl_rdb;
|
||||
struct rtr *rbl_rtr;
|
||||
struct rbl *rbl_next;
|
||||
HANDLE rbl_handle;
|
||||
USHORT rbl_flags;
|
||||
UCHAR *rbl_ptr;
|
||||
USHORT rbl_length;
|
||||
USHORT rbl_fragment_length;
|
||||
USHORT rbl_buffer_length;
|
||||
UCHAR rbl_buffer[1];
|
||||
} *RBL;
|
||||
|
||||
#define RBL_eof 1
|
||||
#define RBL_segment 2
|
||||
#define RBL_eof_pending 4
|
||||
#define RBL_create 8
|
||||
|
||||
typedef struct rrq {
|
||||
struct blk rrq_header;
|
||||
struct rdb *rrq_rdb;
|
||||
struct rrq *rrq_next;
|
||||
struct rrq **rrq_user_handle;
|
||||
HANDLE rrq_handle;
|
||||
} *RRQ;
|
||||
|
||||
typedef struct evnt {
|
||||
struct blk evnt_header;
|
||||
struct evnt *evnt_next;
|
||||
struct rdb *evnt_rdb;
|
||||
SLONG evnt_id;
|
||||
void (*evnt_ast) ();
|
||||
void *evnt_arg;
|
||||
} *EVNT;
|
||||
|
||||
typedef struct array {
|
||||
struct blk array_header;
|
||||
struct rdb *array_rdb;
|
||||
struct rtr *array_rtr;
|
||||
struct array *array_next;
|
||||
SLONG array_length;
|
||||
UCHAR *array_slice;
|
||||
UCHAR array_data[1];
|
||||
} *ARRAY;
|
||||
|
||||
typedef struct rsr {
|
||||
struct blk rsr_header;
|
||||
struct rdb *rsr_rdb;
|
||||
struct rsr *rsr_next;
|
||||
HANDLE rsr_handle;
|
||||
} *RSR;
|
||||
|
||||
typedef struct dbn {
|
||||
struct blk dbn_header;
|
||||
USHORT dbn_attaches; /* number of attachments */
|
||||
USHORT dbn_max_attaches; /* maximum number of allowable attachments */
|
||||
USHORT dbn_flags;
|
||||
struct rdb *dbn_server; /* central server attachment */
|
||||
struct dbn *dbn_next;
|
||||
USHORT dbn_length; /* length of name string */
|
||||
TEXT dbn_name[1]; /* name string */
|
||||
} *DBN;
|
||||
|
||||
#define DBN_disable 1 /* disable new attachments */
|
||||
#define DBN_kill 2 /* kill all attachments */
|
||||
#define DBN_server_att 4 /* server has its own attachment to database */
|
||||
#define DBN_cmd_process 8 /* used by central server utility */
|
||||
#define DBN_reenable 16 /* re-enable new attachments */
|
||||
#define DBN_enable 32 /* enable a new database */
|
||||
|
||||
typedef struct csn {
|
||||
struct blk csn_header;
|
||||
USHORT csn_flags;
|
||||
struct csn *csn_next;
|
||||
USHORT csn_cs_len; /* length of server name string */
|
||||
USHORT csn_db_len; /* length of database name string */
|
||||
TEXT *csn_cs_name; /* server name string */
|
||||
TEXT *csn_db_name; /* database name string */
|
||||
TEXT csn_data[2];
|
||||
} *CSN;
|
||||
|
||||
/* Central server utility list command data */
|
||||
|
||||
typedef struct csu_list {
|
||||
USHORT csu_list_attaches;
|
||||
USHORT csu_list_flags;
|
||||
USHORT csu_list_length;
|
||||
TEXT csu_list_name[1];
|
||||
} *CSU_LIST;
|
||||
|
||||
#endif /* _CSV_CSI_H_ */
|
@ -1,108 +0,0 @@
|
||||
/*
|
||||
* PROGRAM: Central Server
|
||||
* MODULE: csi_proto.h
|
||||
* DESCRIPTION: Prototype Header file for csi.c
|
||||
*
|
||||
* 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): ______________________________________.
|
||||
*/
|
||||
|
||||
#ifndef _CSV_CSI_PROTO_H_
|
||||
#define _CSV_CSI_PROTO_H_
|
||||
|
||||
extern STATUS CSI_attach_database(STATUS *, SSHORT, SCHAR *, struct rdb **,
|
||||
SSHORT, SCHAR *, TEXT *);
|
||||
extern STATUS CSI_blob_info(STATUS *, struct rbl **, SSHORT, UCHAR *, SSHORT,
|
||||
UCHAR *);
|
||||
extern STATUS CSI_cancel_blob(STATUS *, struct rbl **);
|
||||
extern STATUS CSI_cancel_events(STATUS *, struct rdb **, SLONG *);
|
||||
extern STATUS CSI_close_blob(STATUS *, struct rbl **);
|
||||
extern STATUS CSI_commit_transaction(STATUS *, struct rtr **);
|
||||
extern STATUS CSI_commit_retaining(STATUS *, struct rtr **);
|
||||
extern STATUS CSI_compile_request(STATUS *, struct rdb **, struct rrq **,
|
||||
USHORT, UCHAR *);
|
||||
extern STATUS CSI_create_blob2(STATUS *, struct rdb **, struct rtr **,
|
||||
struct rbl **, BID, USHORT, UCHAR *);
|
||||
extern STATUS CSI_create_database(STATUS *, SSHORT, SCHAR *, struct rdb **,
|
||||
SSHORT, SCHAR *, SSHORT, TEXT *);
|
||||
extern STATUS CSI_database_info(STATUS *, struct rdb **, SSHORT, UCHAR *,
|
||||
SSHORT, UCHAR *);
|
||||
extern STATUS CSI_ddl(STATUS *, struct rdb **, struct rtr **, USHORT,
|
||||
UCHAR *);
|
||||
extern STATUS CSI_detach_database(STATUS *, struct rdb **);
|
||||
extern STATUS CSI_drop_database(STATUS *, struct rdb **);
|
||||
extern STATUS CSI_allocate_statement(STATUS *, struct rdb **, struct rsr **);
|
||||
extern STATUS CSI_execute(STATUS *, struct rtr **, struct rsr **, USHORT,
|
||||
UCHAR *, USHORT, USHORT, UCHAR *);
|
||||
extern STATUS CSI_execute2(STATUS *, struct rtr **, struct rsr **, USHORT,
|
||||
UCHAR *, USHORT, USHORT, UCHAR *, USHORT, UCHAR *,
|
||||
USHORT, USHORT, UCHAR *);
|
||||
extern STATUS CSI_execute_immediate(STATUS *, struct rdb **, struct rtr **,
|
||||
USHORT, TEXT *, USHORT, USHORT, UCHAR *,
|
||||
USHORT, USHORT, UCHAR *);
|
||||
extern STATUS CSI_execute_immediate2(STATUS *, struct rdb **, struct rtr **,
|
||||
USHORT, TEXT *, USHORT, USHORT, UCHAR *,
|
||||
USHORT, USHORT, UCHAR *, USHORT, UCHAR *,
|
||||
USHORT, USHORT, UCHAR *);
|
||||
extern STATUS CSI_fetch(STATUS *, struct rsr **, USHORT, UCHAR *, USHORT,
|
||||
USHORT, UCHAR *);
|
||||
extern STATUS CSI_free_statement(STATUS *, struct rsr **, USHORT);
|
||||
extern STATUS CSI_insert(STATUS *, struct rsr **, USHORT, UCHAR *, USHORT,
|
||||
USHORT, UCHAR *);
|
||||
extern STATUS CSI_prepare(STATUS *, struct rtr **, struct rsr **, USHORT,
|
||||
TEXT *, USHORT, USHORT, SCHAR *, USHORT, SCHAR *);
|
||||
extern STATUS CSI_set_cursor_name(STATUS *, struct rsr **, TEXT *, USHORT);
|
||||
extern STATUS CSI_sql_info(STATUS *, struct rsr **, SSHORT, SCHAR *, SSHORT,
|
||||
SCHAR *);
|
||||
extern STATUS CSI_get_segment(STATUS *, struct rbl **, USHORT *, USHORT,
|
||||
UCHAR *);
|
||||
extern STATUS CSI_get_slice(STATUS *, struct rdb **, struct rtr **, BID,
|
||||
USHORT, UCHAR *, USHORT, UCHAR *, SLONG, UCHAR *,
|
||||
SLONG *);
|
||||
extern STATUS CSI_open_blob2(STATUS *, struct rdb **, struct rtr **,
|
||||
struct rbl **, BID, USHORT, UCHAR *);
|
||||
extern STATUS CSI_prepare_transaction(STATUS *, struct rtr **, USHORT,
|
||||
UCHAR *);
|
||||
extern STATUS CSI_put_segment(STATUS *, struct rbl **, USHORT, UCHAR *);
|
||||
extern STATUS CSI_put_slice(STATUS *, struct rdb **, struct rtr **, BID,
|
||||
USHORT, UCHAR *, USHORT, UCHAR *, SLONG, UCHAR *);
|
||||
extern STATUS CSI_que_events(STATUS *, struct rdb **, SLONG *, SSHORT,
|
||||
UCHAR *, FPTR_VOID, void *);
|
||||
extern STATUS CSI_receive(STATUS *, struct rrq **, USHORT, USHORT, UCHAR *,
|
||||
SSHORT);
|
||||
extern STATUS CSI_reconnect_transaction(STATUS *, struct rdb **,
|
||||
struct rtr **, SSHORT, UCHAR *);
|
||||
extern STATUS CSI_release_request(STATUS *, struct rrq **);
|
||||
extern STATUS CSI_request_info(STATUS *, struct rrq **, USHORT, SSHORT,
|
||||
UCHAR *, SSHORT, UCHAR *);
|
||||
extern STATUS CSI_rollback_transaction(STATUS *, struct rtr **);
|
||||
extern STATUS CSI_seek_blob(STATUS *, struct rbl **, SSHORT, SLONG, SLONG *);
|
||||
extern STATUS CSI_send(STATUS *, struct rrq **, USHORT, USHORT, UCHAR *,
|
||||
SSHORT);
|
||||
extern STATUS CSI_start_and_send(STATUS *, struct rrq **, struct rtr **,
|
||||
USHORT, USHORT, UCHAR *, SSHORT);
|
||||
extern STATUS CSI_start_request(STATUS *, struct rrq **,
|
||||
struct rtr **, SSHORT);
|
||||
extern STATUS CSI_start_transaction(STATUS *, struct rtr **, SSHORT, ...);
|
||||
extern STATUS CSI_transact_request(STATUS *, struct rdb **, struct rtr **,
|
||||
USHORT, UCHAR *, USHORT, UCHAR *, USHORT,
|
||||
UCHAR *);
|
||||
extern STATUS CSI_transaction_info(STATUS *, struct rtr **, SSHORT, UCHAR *,
|
||||
SSHORT, UCHAR *);
|
||||
extern STATUS CSI_unwind_request(STATUS *, struct rrq **, SSHORT);
|
||||
|
||||
#endif /* _CSV_CSI_PROTO_H_ */
|
1442
src/csv/css.cpp
1442
src/csv/css.cpp
File diff suppressed because it is too large
Load Diff
@ -1,44 +0,0 @@
|
||||
/*
|
||||
* PROGRAM: Central Server Interface
|
||||
* MODULE: css_proto.h
|
||||
* DESCRIPTION: Prototype header file for css.c
|
||||
*
|
||||
* 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): ______________________________________.
|
||||
*/
|
||||
|
||||
#ifndef _CSV_CSS_PROTO_H_
|
||||
#define _CSV_CSS_PROTO_H_
|
||||
|
||||
extern CSH CSS_acquire(void);
|
||||
extern FRB CSS_alloc_message(USHORT, int);
|
||||
extern BLK CSS_alloc_local(USHORT, USHORT);
|
||||
extern int CSS_check_partner(PTR, USHORT);
|
||||
extern PTR CSS_connect(SLONG);
|
||||
extern PTR CSS_create_process(USHORT);
|
||||
extern void CSS_disconnect(SLONG);
|
||||
extern void CSS_free_global(FRB);
|
||||
extern void CSS_free_local(BLK);
|
||||
extern PTR CSS_find_process(SLONG);
|
||||
extern CSV_MSG CSS_get_message(PTR, CSV_MSG, SSHORT);
|
||||
extern CSH CSS_init(STATUS *, USHORT);
|
||||
extern void CSS_probe_processes(void);
|
||||
extern int CSS_put_message(PTR, CSV_MSG, CSV_MSG);
|
||||
extern void CSS_release(void);
|
||||
extern void CSS_validate(void);
|
||||
|
||||
#endif /* _CSV_CSS_PROTO_H_ */
|
571
src/csv/csu.cpp
571
src/csv/csu.cpp
@ -1,571 +0,0 @@
|
||||
/*
|
||||
* PROGRAM: Central Server
|
||||
* MODULE: csu.c
|
||||
* DESCRIPTION: Central Server Utility
|
||||
*
|
||||
* 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): ______________________________________.
|
||||
*/
|
||||
/*
|
||||
$Id: csu.cpp,v 1.4 2002-10-24 09:01:25 eku Exp $
|
||||
*/
|
||||
|
||||
#include "firebird.h"
|
||||
#include "../csv/csi.h"
|
||||
#include "../jrd/license.h"
|
||||
#include "gen/codes.h"
|
||||
#include "../jrd/thd.h"
|
||||
#include "../csv/css_proto.h"
|
||||
#include "../jrd/gds_proto.h"
|
||||
|
||||
#define ALLOC(type, length) CSS_alloc_local (type, length)
|
||||
#define FREE(block) CSS_free_local (block)
|
||||
|
||||
static void move(UCHAR *, UCHAR *, USHORT);
|
||||
static void parse_command_line(int, TEXT **, USHORT *, CSN *, CSN *);
|
||||
static void process_list_cmd(PTR, USHORT *);
|
||||
static void process_nonlist_cmd(PTR, CSN);
|
||||
static STATUS process_response(MSG_RESP, STATUS *, USHORT *);
|
||||
|
||||
static TEXT error_buffer[1024];
|
||||
static USHORT return_buffer_length;
|
||||
static UCHAR *return_buffer;
|
||||
|
||||
|
||||
int CLIB_ROUTINE main( int argc, char **argv)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* m a i n
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Run the central server utility.
|
||||
*
|
||||
**************************************/
|
||||
USHORT sw_list, listed_flag, flags;
|
||||
CSN csv_enable_names, csv_other_names, cs_name;
|
||||
STATUS status_vector[ISC_STATUS_LENGTH];
|
||||
SRQ *que;
|
||||
PRB process;
|
||||
PTR connection, server, client;
|
||||
CSH CSS_header;
|
||||
SLONG process_number, process_numbers[256], *ptr, *end;
|
||||
|
||||
#ifdef VMS
|
||||
argc = VMS_parse(&argv, argc);
|
||||
#endif
|
||||
|
||||
csv_enable_names = csv_other_names = NULL;
|
||||
sw_list = FALSE;
|
||||
|
||||
THREAD_ENTER;
|
||||
parse_command_line(argc, argv, &sw_list, &csv_enable_names,
|
||||
&csv_other_names);
|
||||
|
||||
if (!CSS_init(status_vector, FALSE)) {
|
||||
printf("It's likely that no central servers are operating.\n");
|
||||
gds__print_status(status_vector);
|
||||
exit(FINI_ERROR);
|
||||
}
|
||||
|
||||
client = CSS_create_process(PRB_client);
|
||||
|
||||
/* Start by finding all server processes */
|
||||
|
||||
CSS_header = ACQUIRE;
|
||||
CSS_probe_processes();
|
||||
|
||||
end = process_numbers;
|
||||
|
||||
QUE_LOOP(CSS_header->csh_processes, que) {
|
||||
process = (PRB) ((UCHAR *) que - OFFSET(PRB, prb_processes));
|
||||
server = REL_PTR(process);
|
||||
if (client != server &&
|
||||
(process->prb_flags & PRB_server) &&
|
||||
process->prb_protocol_version == CSI_PROTOCOL_VERSION)
|
||||
*end++ = process->prb_process_number;
|
||||
}
|
||||
|
||||
RELEASE;
|
||||
|
||||
/* Go back and talk to servers */
|
||||
|
||||
/* Initialize a flag that indicates if anything has been listed */
|
||||
|
||||
listed_flag = FALSE;
|
||||
|
||||
for (ptr = process_numbers; ptr < end; ptr++) {
|
||||
process_number = *ptr;
|
||||
if (server = CSS_find_process(process_number)) {
|
||||
connection = CSS_connect(server);
|
||||
|
||||
/* For each server name specified by the user, ask this
|
||||
server to process it. */
|
||||
|
||||
for (cs_name = csv_enable_names;
|
||||
cs_name && CSS_find_process(process_number);
|
||||
cs_name =
|
||||
cs_name->csn_next) process_nonlist_cmd(connection, cs_name);
|
||||
|
||||
/* For each database name specified by the user, ask this
|
||||
server to process it. */
|
||||
|
||||
for (cs_name = csv_other_names;
|
||||
cs_name && CSS_find_process(process_number);
|
||||
cs_name = cs_name->csn_next) if (cs_name->csn_flags)
|
||||
process_nonlist_cmd(connection, cs_name);
|
||||
|
||||
/* We may also need to do a list of this server's databases */
|
||||
|
||||
if (sw_list && CSS_find_process(process_number))
|
||||
process_list_cmd(connection, &listed_flag);
|
||||
|
||||
CSS_disconnect(connection);
|
||||
}
|
||||
}
|
||||
|
||||
if (sw_list && !listed_flag)
|
||||
printf("\nNo central servers are operating.\n\n");
|
||||
|
||||
for (cs_name = csv_other_names; cs_name; cs_name = cs_name->csn_next)
|
||||
if ((flags = cs_name->csn_flags) && !(flags & DBN_cmd_process)) {
|
||||
printf("Database \"%s\" ", cs_name->csn_db_name);
|
||||
if (cs_name->csn_cs_len)
|
||||
printf("running on server\n \"%s\" could not be ",
|
||||
cs_name->csn_cs_name);
|
||||
else
|
||||
printf("could not be\n ");
|
||||
printf("found and so it was not %sed.\n",
|
||||
(flags & DBN_reenable) ? "re-enabl" : (flags & DBN_kill) ?
|
||||
"kill" : "disabl");
|
||||
}
|
||||
|
||||
for (cs_name = csv_enable_names; cs_name; cs_name = cs_name->csn_next)
|
||||
if (!(cs_name->csn_flags & DBN_cmd_process))
|
||||
printf
|
||||
("Server \"%s\" could not be found and so database\n \"%s\" was not enabled.\n",
|
||||
cs_name->csn_cs_name, cs_name->csn_db_name);
|
||||
|
||||
exit(FINI_OK);
|
||||
}
|
||||
|
||||
|
||||
static void move( UCHAR * from_ptr, UCHAR * to_ptr, USHORT length)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* m o v e
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Move some bytes.
|
||||
*
|
||||
**************************************/
|
||||
USHORT l;
|
||||
UCHAR *from, *to;
|
||||
|
||||
from = from_ptr;
|
||||
to = to_ptr;
|
||||
|
||||
if (length)
|
||||
do
|
||||
*to++ = *from++;
|
||||
while (--length);
|
||||
}
|
||||
|
||||
|
||||
static void parse_command_line(
|
||||
int argc,
|
||||
TEXT ** argv,
|
||||
USHORT * sw_list,
|
||||
CSN * csv_enable_names, CSN * csv_other_names)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* p a r s e _ c o m m a n d _ l i n e
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Parse a Unix style command line.
|
||||
*
|
||||
**************************************/
|
||||
USHORT sw_enable, sw_name, sw_all, dbn_flag, all_flag;
|
||||
USHORT length, listed_flag, csv_name_len;
|
||||
TEXT **end, *p, c, expanded_name[256], *q, csv_name[256];
|
||||
CSN other_names, enable_names, name, *head;
|
||||
|
||||
other_names = enable_names = NULL;
|
||||
dbn_flag = all_flag = sw_enable = 0;
|
||||
sw_name = FALSE;
|
||||
|
||||
for (end = argv++ + argc; argv < end;) {
|
||||
p = *argv++;
|
||||
if (*p++ == '-') {
|
||||
/* Clear -a, -e, and -n indicators for each new switch. Clear -d,
|
||||
-k, and -r indicators except when the switch is "-a" or "-n". */
|
||||
|
||||
sw_name = sw_all = FALSE;
|
||||
if (((c = UPPER(*p)) != 'A' && c != 'N') || *(p + 1) || sw_enable)
|
||||
dbn_flag = 0;
|
||||
sw_enable = csv_name_len = 0;
|
||||
|
||||
while (c = *p++)
|
||||
switch (UPPER(c)) {
|
||||
case 'L':
|
||||
*sw_list = TRUE;
|
||||
break;
|
||||
|
||||
case 'D':
|
||||
dbn_flag |= DBN_disable;
|
||||
break;
|
||||
|
||||
case 'K':
|
||||
dbn_flag |= DBN_kill;
|
||||
break;
|
||||
|
||||
case 'R':
|
||||
dbn_flag |= DBN_reenable;
|
||||
break;
|
||||
|
||||
case 'E':
|
||||
sw_enable = 1;
|
||||
break;
|
||||
|
||||
case 'A':
|
||||
sw_all = TRUE;
|
||||
break;
|
||||
|
||||
case 'N':
|
||||
sw_name = TRUE;
|
||||
break;
|
||||
|
||||
case 'Z':
|
||||
printf("csu version %s\n", GDS_VERSION);
|
||||
break;
|
||||
}
|
||||
|
||||
if (sw_enable && (dbn_flag || sw_all || sw_name)) {
|
||||
printf
|
||||
("The -e switch may only be used in conjunction with\nthe -l and -z switches.\n");
|
||||
exit(FINI_ERROR);
|
||||
}
|
||||
else if (sw_all)
|
||||
if (!dbn_flag)
|
||||
printf
|
||||
("No command indicated with the -a switch. It will be ignored.\n");
|
||||
else {
|
||||
all_flag |= dbn_flag;
|
||||
dbn_flag = 0;
|
||||
}
|
||||
}
|
||||
else if (!dbn_flag && !sw_enable && !sw_name)
|
||||
printf
|
||||
("No command indicated for database \"%s\".\nThe name will be ignored.\n",
|
||||
p - 1);
|
||||
else {
|
||||
if (sw_enable == 1 || sw_name) {
|
||||
if ((length = strlen(--p)) >= sizeof(csv_name))
|
||||
length = sizeof(csv_name) - 1;
|
||||
csv_name_len = length;
|
||||
for (q = csv_name; length--;) {
|
||||
c = *p++;
|
||||
*q++ = UPPER(c);
|
||||
}
|
||||
if (sw_name)
|
||||
sw_name = FALSE;
|
||||
else
|
||||
sw_enable++;
|
||||
continue;
|
||||
}
|
||||
|
||||
length = ISC_expand_filename(p - 1, 0, expanded_name);
|
||||
|
||||
#ifdef VMS
|
||||
/* The next expansion is Gateway specific but we'll do it
|
||||
for everyone. Since '@' isn't valid in a VMS filename,
|
||||
this is ok. */
|
||||
|
||||
/* Look for an '@' after the first SCHARacter in expanded_name.
|
||||
If one is found, try to expand the remainder of the string. */
|
||||
|
||||
if (*(p = expanded_name) != '@')
|
||||
while (*p)
|
||||
if (*p++ == '@' && *p) {
|
||||
length =
|
||||
ISC_expand_logical(p,
|
||||
length - (p - expanded_name),
|
||||
p) + (p - expanded_name);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
csv_name[csv_name_len] = 0;
|
||||
|
||||
head = (sw_enable) ? &enable_names : &other_names;
|
||||
for (name = *head; name; name = name->csn_next)
|
||||
if (!strcmp(name->csn_db_name, expanded_name) &&
|
||||
!strcmp(name->csn_cs_name, csv_name))
|
||||
break;
|
||||
|
||||
if (!name) {
|
||||
name =
|
||||
(CSN) ALLOC(type_csn,
|
||||
sizeof(struct csn) + length + csv_name_len);
|
||||
name->csn_next = *head;
|
||||
*head = name;
|
||||
name->csn_cs_name = name->csn_data;
|
||||
name->csn_db_name = name->csn_data + csv_name_len + 1;
|
||||
move(csv_name, name->csn_cs_name, csv_name_len + 1);
|
||||
move(expanded_name, name->csn_db_name, length + 1);
|
||||
name->csn_cs_len = csv_name_len;
|
||||
name->csn_db_len = length;
|
||||
}
|
||||
|
||||
name->csn_flags |= (sw_enable) ? DBN_enable : dbn_flag;
|
||||
}
|
||||
}
|
||||
|
||||
if (all_flag) {
|
||||
/* We're to do something to all central server databases.
|
||||
But first, make sure we won't try to do the same thing
|
||||
or something similar to a specific database. Reenable
|
||||
takes precedence over kill and disable. Kill takes
|
||||
precedence over disable. */
|
||||
|
||||
if (all_flag & DBN_reenable)
|
||||
all_flag |= DBN_kill | DBN_disable;
|
||||
else if (all_flag & DBN_kill)
|
||||
all_flag |= DBN_disable;
|
||||
|
||||
for (name = other_names; name; name = name->csn_next)
|
||||
name->csn_flags &= ~all_flag;
|
||||
|
||||
/* The -a switch gets saved as a name with a zero length */
|
||||
|
||||
name = (CSN) ALLOC(type_csn, sizeof(struct csn));
|
||||
name->csn_next = other_names;
|
||||
other_names = name;
|
||||
name->csn_cs_name = name->csn_db_name = name->csn_data;
|
||||
name->csn_cs_len = name->csn_db_len = 0;
|
||||
name->csn_flags = all_flag;
|
||||
}
|
||||
|
||||
*csv_other_names = other_names;
|
||||
*csv_enable_names = enable_names;
|
||||
}
|
||||
|
||||
|
||||
static void process_list_cmd( PTR connection, USHORT * listed_flag)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* p r o c e s s _ l i s t _ c m d
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Process a list command for a server.
|
||||
*
|
||||
**************************************/
|
||||
MSG_UTIL message;
|
||||
MSG_RESP response;
|
||||
STATUS status_vector[ISC_STATUS_LENGTH];
|
||||
USHORT l;
|
||||
CSU_LIST list_msg;
|
||||
|
||||
message = (MSG_UTIL) CSS_alloc_message(type_msg, sizeof(struct msg_util));
|
||||
message->msg_util_header.msg_type = MSG_util_cmd;
|
||||
message->msg_util_cmd = UTIL_list;
|
||||
message->msg_util_csn_len = message->msg_util_dbn_len = 0;
|
||||
|
||||
if (!CSS_put_message(connection, message, 0) ||
|
||||
!(response = CSS_get_message(connection, 0, 0)))
|
||||
return;
|
||||
|
||||
if (!process_response(response, status_vector, 0)) {
|
||||
list_msg = (CSU_LIST) return_buffer;
|
||||
|
||||
/* Print a header before the first name listed */
|
||||
|
||||
if (!*listed_flag) {
|
||||
printf("\nServer\n\tAttaches Flags Database Name\n\n");
|
||||
*listed_flag = TRUE;
|
||||
}
|
||||
|
||||
/* Print the server name */
|
||||
|
||||
printf("%s\n", list_msg->csu_list_name);
|
||||
list_msg =
|
||||
(CSU_LIST) (list_msg->csu_list_name +
|
||||
FB_ALIGN(list_msg->csu_list_length + 1, 2));
|
||||
|
||||
/* Loop over returned database name info */
|
||||
|
||||
while (l = list_msg->csu_list_length) {
|
||||
printf("\t%7d%s %c %c %s\n", list_msg->csu_list_attaches,
|
||||
(list_msg->csu_list_flags & DBN_server_att) ? "+s" : " ",
|
||||
(list_msg->csu_list_flags & DBN_disable) ? 'D' : ' ',
|
||||
(list_msg->csu_list_flags & DBN_kill) ? 'K' : ' ',
|
||||
list_msg->csu_list_name);
|
||||
list_msg =
|
||||
(CSU_LIST) (list_msg->csu_list_name + FB_ALIGN(l + 1, 2));
|
||||
}
|
||||
}
|
||||
else if (status_vector[1] != gds__unavailable) {
|
||||
/**** DO SOMETHING MORE INTELLIGENT ****/
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void process_nonlist_cmd( PTR connection, CSN cs_name)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* p r o c e s s _ n o n l i s t _ c m d
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Process a disable, enable, kill, or re-enable command
|
||||
* for a server.
|
||||
*
|
||||
**************************************/
|
||||
SLONG length;
|
||||
MSG_UTIL message;
|
||||
MSG_RESP response;
|
||||
USHORT l, cmd;
|
||||
STATUS status_vector[ISC_STATUS_LENGTH];
|
||||
|
||||
l = cs_name->csn_cs_len + cs_name->csn_db_len;
|
||||
length = sizeof(struct msg_util) + l;
|
||||
message = (MSG_UTIL) CSS_alloc_message(type_msg, (int) length);
|
||||
message->msg_util_header.msg_type = MSG_util_cmd;
|
||||
if (cs_name->csn_flags & DBN_enable)
|
||||
cmd = UTIL_enable;
|
||||
else if (cs_name->csn_flags & DBN_reenable)
|
||||
cmd = UTIL_reenable;
|
||||
else if (cs_name->csn_flags & DBN_kill)
|
||||
cmd = UTIL_kill;
|
||||
else
|
||||
cmd = UTIL_disable;
|
||||
message->msg_util_cmd = cmd;
|
||||
message->msg_util_csn_len = cs_name->csn_cs_len;
|
||||
message->msg_util_dbn_len = cs_name->csn_db_len;
|
||||
move(cs_name->csn_data, message->msg_util_data, l + 2);
|
||||
|
||||
if (!CSS_put_message(connection, message, 0) ||
|
||||
!(response = CSS_get_message(connection, 0, 0)))
|
||||
return;
|
||||
|
||||
if (!process_response(response, status_vector, 0)) {
|
||||
/* Set a flag to indicate that a central server has processed
|
||||
the command relating to this server and database name */
|
||||
|
||||
cs_name->csn_flags |= DBN_cmd_process;
|
||||
}
|
||||
else if (status_vector[1] != gds__unavailable)
|
||||
if (cs_name->csn_flags & DBN_enable) {
|
||||
printf
|
||||
("Server \"%s\" could not enable database \"%s\" because:\n",
|
||||
cs_name->csn_cs_name, cs_name->csn_db_name);
|
||||
gds__print_status(status_vector);
|
||||
cs_name->csn_flags |= DBN_cmd_process;
|
||||
}
|
||||
else {
|
||||
/**** DO SOMETHING MORE INTELLIGENT ****/
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static STATUS process_response(
|
||||
MSG_RESP message,
|
||||
STATUS * user_status, USHORT * return_length)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* p r o c e s s _ r e s p o n s e
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Process a response packet from server.
|
||||
*
|
||||
**************************************/
|
||||
TEXT *p, *q;
|
||||
STATUS *status, *stuff, *end;
|
||||
USHORT l;
|
||||
|
||||
/* If there isn't a message, the server has disappeared */
|
||||
|
||||
if (!message || message->msg_resp_header.msg_type != MSG_response) {
|
||||
status = user_status;
|
||||
*status++ = gds_arg_gds;
|
||||
*status++ = gds__random;
|
||||
*status++ = gds_arg_string;
|
||||
*status++ = (STATUS) "connection lost to central server";
|
||||
*status = gds_arg_end;
|
||||
return user_status[1];
|
||||
}
|
||||
|
||||
/* Well, at least we got something -- eat it up */
|
||||
|
||||
p = error_buffer;
|
||||
|
||||
for (status = user_status, end = status + 20, stuff =
|
||||
message->msg_resp_status; (*status = *stuff++) && status < end;)
|
||||
switch (*status++) {
|
||||
case gds_arg_interpreted:
|
||||
case gds_arg_string:
|
||||
q = (TEXT *) message + *stuff++;
|
||||
*status++ = (STATUS) p;
|
||||
while (*p++ = *q++);
|
||||
break;
|
||||
|
||||
case gds_arg_cstring:
|
||||
l = *status++ = *stuff++;
|
||||
q = (TEXT *) message + *stuff++;
|
||||
*status++ = (STATUS) p;
|
||||
if (l)
|
||||
do
|
||||
*p++ = *q++;
|
||||
while (--l);
|
||||
break;
|
||||
|
||||
default:
|
||||
*status++ = *stuff++;
|
||||
}
|
||||
|
||||
if (!user_status[1] || user_status[1] == gds__segment) {
|
||||
if (return_buffer_length < (l = message->msg_resp_length)) {
|
||||
if (return_buffer)
|
||||
FREE(return_buffer);
|
||||
return_buffer = (UCHAR *) ALLOC(0, l);
|
||||
return_buffer_length = l;
|
||||
}
|
||||
if (l)
|
||||
move(message->msg_resp_data, return_buffer, l);
|
||||
if (return_length)
|
||||
*return_length = l;
|
||||
}
|
||||
|
||||
CSS_free_global(message);
|
||||
|
||||
return user_status[1];
|
||||
}
|
2972
src/csv/csv.cpp
2972
src/csv/csv.cpp
File diff suppressed because it is too large
Load Diff
@ -1,75 +0,0 @@
|
||||
# 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): ______________________________________.
|
||||
# depends.mak - csv
|
||||
# Created by 'make depends.mak'
|
||||
# Created on 1998-11-17
|
||||
csi.o: csi.c
|
||||
csi.o: csi.h
|
||||
csi.o: csi_proto.h
|
||||
csi.o: css_proto.h
|
||||
csi.o: source/jrd/build_no.h
|
||||
csi.o: source/jrd/codes.h
|
||||
csi.o: source/jrd/common.h
|
||||
csi.o: source/jrd/fil.h
|
||||
csi.o: source/jrd/gds_proto.h
|
||||
csi.o: source/jrd/inf.h
|
||||
csi.o: source/jrd/isc.h
|
||||
csi.o: source/jrd/license.h
|
||||
csi.o: source/jrd/thd.h
|
||||
csi.o: source/remote/merge_proto.h
|
||||
css.o: csi.h
|
||||
css.o: css.c
|
||||
css.o: css_proto.h
|
||||
css.o: source/jrd/codes.h
|
||||
css.o: source/jrd/common.h
|
||||
css.o: source/jrd/fil.h
|
||||
css.o: source/jrd/gds_proto.h
|
||||
css.o: source/jrd/isc.h
|
||||
css.o: source/jrd/isc_proto.h
|
||||
css.o: source/jrd/thd.h
|
||||
csu.o: csi.h
|
||||
csu.o: css_proto.h
|
||||
csu.o: csu.c
|
||||
csu.o: source/jrd/build_no.h
|
||||
csu.o: source/jrd/codes.h
|
||||
csu.o: source/jrd/common.h
|
||||
csu.o: source/jrd/fil.h
|
||||
csu.o: source/jrd/gds_proto.h
|
||||
csu.o: source/jrd/isc.h
|
||||
csu.o: source/jrd/license.h
|
||||
csu.o: source/jrd/thd.h
|
||||
csv.o: csi.h
|
||||
csv.o: css_proto.h
|
||||
csv.o: csv.c
|
||||
csv.o: source/interbase/include/iberror.h
|
||||
csv.o: source/jrd/build_no.h
|
||||
csv.o: source/jrd/common.h
|
||||
csv.o: source/jrd/fil.h
|
||||
csv.o: source/jrd/gds.h
|
||||
csv.o: source/jrd/gds_proto.h
|
||||
csv.o: source/jrd/isc.h
|
||||
csv.o: source/jrd/license.h
|
||||
csv.o: source/jrd/thd.h
|
||||
csv.o: source/remote/merge_proto.h
|
||||
print.o: csi.h
|
||||
print.o: css_proto.h
|
||||
print.o: print.c
|
||||
print.o: source/jrd/common.h
|
||||
print.o: source/jrd/fil.h
|
||||
print.o: source/jrd/gds_proto.h
|
||||
print.o: source/jrd/isc.h
|
||||
print.o: source/jrd/thd.h
|
@ -1,142 +0,0 @@
|
||||
/*
|
||||
* PROGRAM: Central Server
|
||||
* MODULE: print.c
|
||||
* DESCRIPTION: Global region print utility
|
||||
*
|
||||
* 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): ______________________________________.
|
||||
*/
|
||||
|
||||
#include "firebird.h"
|
||||
#include "../csv/csi.h"
|
||||
#include "../csv/css_proto.h"
|
||||
#include "../jrd/gds_proto.h"
|
||||
|
||||
static void prt_que(UCHAR *, SRQ *);
|
||||
|
||||
static CSH CSS_header;
|
||||
|
||||
|
||||
void main( int argc, char **argv)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* m a i n
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
*
|
||||
**************************************/
|
||||
SRQ *que;
|
||||
HDR *block;
|
||||
PRB process;
|
||||
CSV_MSG message;
|
||||
FRB free;
|
||||
CNCT connection;
|
||||
SLONG offset;
|
||||
STATUS status_vector[ISC_STATUS_LENGTH];
|
||||
|
||||
if (!(CSS_header = CSS_init(status_vector, TRUE))) {
|
||||
printf("Can't access global region\n");
|
||||
gds__print_status(status_vector);
|
||||
exit(FINI_ERROR);
|
||||
}
|
||||
|
||||
printf("%.5d GLOBAL REGION HEADER\n", 0);
|
||||
printf("\tLength: %ld, version: %d, free: %ld\n", CSS_header->csh_length,
|
||||
CSS_header->csh_version, CSS_header->csh_free);
|
||||
printf("\tSemid: %ld, current process: %ld\n",
|
||||
CSS_header->csh_semid, CSS_header->csh_current_process);
|
||||
prt_que("\tProcesses", &CSS_header->csh_processes);
|
||||
|
||||
for (offset = sizeof(struct csh); offset < CSS_header->csh_length;
|
||||
offset += block->hdr_length) {
|
||||
printf("\n%.5ld ", offset);
|
||||
block = (HDR *) ABS_PTR(offset);
|
||||
switch (block->hdr_type) {
|
||||
case type_prb:
|
||||
printf("PROCESS_BLOCK (%ld)\n", block->hdr_length);
|
||||
process = (PRB) block;
|
||||
printf("\tProcess_id: %ld, flags: %d, protocol: %d\n",
|
||||
process->prb_process_id, process->prb_flags,
|
||||
process->prb_protocol_version);
|
||||
printf("\tSemaphore: %d, group_id: %ld, number: %ld\n",
|
||||
process->prb_semaphore, process->prb_group_id,
|
||||
process->prb_process_number);
|
||||
prt_que("\tProcesses", &process->prb_processes);
|
||||
prt_que("\tConnections", &process->prb_connections);
|
||||
prt_que("\tMessages", &process->prb_messages);
|
||||
break;
|
||||
|
||||
case type_frb:
|
||||
printf("FREE BLOCK (%ld)\n", block->hdr_length);
|
||||
free = (FRB) block;
|
||||
printf("\tNext: %ld\n", free->frb_next);
|
||||
break;
|
||||
|
||||
case type_msg:
|
||||
printf("CSV_MSG (%ld)\n", block->hdr_length);
|
||||
message = (CSV_MSG) block;
|
||||
printf("\tType: %d, connection: %ld\n", message->msg_type,
|
||||
message->msg_connection);
|
||||
prt_que("\tMsg que", &message->msg_que);
|
||||
break;
|
||||
|
||||
case type_cnct:
|
||||
printf("CONNECTION (%ld)\n", block->hdr_length);
|
||||
connection = (CNCT) block;
|
||||
printf("\tParent: %ld, partner: %ld, mirror: %ld\n",
|
||||
connection->cnct_parent, connection->cnct_partner,
|
||||
connection->cnct_mirror);
|
||||
prt_que("\tConnections", &connection->cnct_connections);
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("*** UNKNOWN *** (%ld)\n", block->hdr_length);
|
||||
break;
|
||||
}
|
||||
if (!block->hdr_length)
|
||||
break;
|
||||
}
|
||||
|
||||
exit(FINI_OK);
|
||||
}
|
||||
|
||||
|
||||
static void prt_que( UCHAR * string, SRQ * que)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* p r t _ q u e
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Print the contents of a self-relative que.
|
||||
*
|
||||
**************************************/
|
||||
SLONG offset;
|
||||
|
||||
offset = REL_PTR(que);
|
||||
|
||||
if (offset == que->srq_forward && offset == que->srq_backward)
|
||||
printf("%s: *empty*\n", string);
|
||||
else
|
||||
printf("%s: forward: %d, backward: %d\n",
|
||||
string, que->srq_forward, que->srq_backward);
|
||||
}
|
Loading…
Reference in New Issue
Block a user