8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-31 04:03:03 +01:00
firebird-mirror/src/remote/protocol.h

687 lines
19 KiB
C
Raw Normal View History

2001-05-23 15:26:42 +02:00
/*
* PROGRAM: JRD Remote Interface/Server
* MODULE: protocol.h
* DESCRIPTION: Protocol Definition
*
* 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-02-16 03:21:35 +01:00
*
* 2002.02.15 Sean Leyne - This module needs to be cleanedup to remove obsolete ports/defines:
2002-02-16 05:04:45 +01:00
* - "EPSON", "XENIX" +++
2002-02-16 03:21:35 +01:00
*
* 2002.10.27 Sean Leyne - Code Cleanup, removed obsolete "Ultrix/MIPS" port
*
* 2002.10.28 Sean Leyne - Code cleanup, removed obsolete "MPEXL" port
* 2002.10.28 Sean Leyne - Code cleanup, removed obsolete "DecOSF" port
*
2001-05-23 15:26:42 +02:00
*/
2004-12-28 06:21:00 +01:00
#ifndef REMOTE_PROTOCOL_H
#define REMOTE_PROTOCOL_H
2001-05-23 15:26:42 +02:00
// dimitr: ask for asymmetric protocols only.
// Comment it out to return back to FB 1.0 behaviour.
2003-06-08 20:12:13 +02:00
#define ASYMMETRIC_PROTOCOLS_ONLY
2009-08-14 11:44:49 +02:00
// The protocol is defined blocks, rather than messages, to
// separate the protocol from the transport layer.
2001-05-23 15:26:42 +02:00
2004-05-17 12:22:34 +02:00
// p_cnct_version
const USHORT CONNECT_VERSION2 = 2;
2001-05-23 15:26:42 +02:00
2009-08-14 11:44:49 +02:00
// Protocol 4 is protocol 3 plus server management functions
2001-05-23 15:26:42 +02:00
2004-05-17 12:22:34 +02:00
const USHORT PROTOCOL_VERSION3 = 3;
const USHORT PROTOCOL_VERSION4 = 4;
2001-05-23 15:26:42 +02:00
2009-08-14 11:44:49 +02:00
// Protocol 5 includes support for a d_float data type
2001-05-23 15:26:42 +02:00
2004-05-17 12:22:34 +02:00
const USHORT PROTOCOL_VERSION5 = 5;
2001-05-23 15:26:42 +02:00
2009-08-14 11:44:49 +02:00
// Protocol 6 includes support for cancel remote events, blob seek,
// and unknown message type
2001-05-23 15:26:42 +02:00
2004-05-17 12:22:34 +02:00
const USHORT PROTOCOL_VERSION6 = 6;
2001-05-23 15:26:42 +02:00
2009-08-14 11:44:49 +02:00
// Protocol 7 includes DSQL support
2001-05-23 15:26:42 +02:00
2004-05-17 12:22:34 +02:00
const USHORT PROTOCOL_VERSION7 = 7;
2001-05-23 15:26:42 +02:00
2009-08-14 11:44:49 +02:00
// Protocol 8 includes collapsing first receive into a send, drop database,
// DSQL execute 2, DSQL execute immediate 2, DSQL insert, services, and
// transact request
2001-05-23 15:26:42 +02:00
2004-05-17 12:22:34 +02:00
const USHORT PROTOCOL_VERSION8 = 8;
2001-05-23 15:26:42 +02:00
2009-08-14 11:44:49 +02:00
// Protocol 9 includes support for SPX32
// SPX32 uses WINSOCK instead of Novell SDK
// In order to differentiate between the old implementation
// of SPX and this one, different PROTOCOL VERSIONS are used
2001-05-23 15:26:42 +02:00
2004-05-17 12:22:34 +02:00
const USHORT PROTOCOL_VERSION9 = 9;
2001-05-23 15:26:42 +02:00
2009-08-14 11:44:49 +02:00
// Protocol 10 includes support for warnings and removes the requirement for
// encoding and decoding status codes
2001-05-23 15:26:42 +02:00
2004-05-17 12:22:34 +02:00
const USHORT PROTOCOL_VERSION10 = 10;
2001-05-23 15:26:42 +02:00
2006-12-09 02:23:17 +01:00
// Since protocol 11 we must be separated from Borland Interbase.
// Therefore always set highmost bit in protocol version to 1.
// For unsigned protocol version this does not break version's compare.
2006-12-08 19:38:15 +01:00
const USHORT FB_PROTOCOL_FLAG = 0x8000;
2008-11-24 18:04:29 +01:00
const USHORT FB_PROTOCOL_MASK = static_cast<USHORT>(~FB_PROTOCOL_FLAG);
2006-12-08 19:38:15 +01:00
2008-12-05 01:56:15 +01:00
// Protocol 11 has support for user authentication related
// operations (op_update_account_info, op_authenticate_user and
2006-12-09 02:23:17 +01:00
// op_trusted_auth). When specific operation is not supported,
// we say "sorry".
2006-12-08 19:38:15 +01:00
const USHORT PROTOCOL_VERSION11 = (FB_PROTOCOL_FLAG | 11);
2008-12-05 01:56:15 +01:00
// Protocol 12 has support for asynchronous call op_cancel.
// Currently implemented asynchronously only for TCP/IP
// on superserver and superclassic.
const USHORT PROTOCOL_VERSION12 = (FB_PROTOCOL_FLAG | 12);
2009-08-14 11:44:49 +02:00
// Architecture types
2001-05-23 15:26:42 +02:00
2009-01-16 10:55:38 +01:00
enum P_ARCH
2001-05-23 15:26:42 +02:00
{
2009-08-14 11:44:49 +02:00
arch_generic = 1, // Generic -- always use canonical forms
2009-08-18 14:56:00 +02:00
//arch_apollo = 2,
2009-08-14 11:44:49 +02:00
arch_sun = 3,
2009-08-18 14:56:00 +02:00
//arch_vms = 4,
//arch_ultrix = 5,
//arch_alliant = 6,
//arch_msdos = 7,
2009-08-14 11:44:49 +02:00
arch_sun4 = 8,
arch_sunx86 = 9,
arch_hpux = 10,
2009-08-18 14:56:00 +02:00
//arch_hpmpexl = 11,
//arch_mac = 12,
//arch_macaux = 13,
2009-08-14 11:44:49 +02:00
arch_rt = 14,
2009-08-18 14:56:00 +02:00
//arch_mips_ultrix = 15,
//arch_hpux_68k = 16,
//arch_xenix = 17,
//arch_aviion = 18,
//arch_sgi = 19,
//arch_apollo_dn10k = 20,
//arch_cray = 21,
//arch_imp = 22,
//arch_delta = 23,
//arch_sco = 24,
//arch_next = 25,
//arch_next_386 = 26,
//arch_m88k = 27,
//arch_unixware = 28,
2009-08-14 11:44:49 +02:00
arch_intel_32 = 29, // generic Intel chip w/32-bit compilation
2009-08-18 14:56:00 +02:00
//arch_epson = 30,
//arch_decosf = 31,
//arch_ncr3000 = 32,
//arch_nt_ppc = 33,
//arch_dg_x86 = 34,
//arch_sco_ev = 35,
2009-08-14 11:44:49 +02:00
arch_linux = 36,
arch_freebsd = 37,
arch_netbsd = 38,
arch_darwin_ppc = 39,
arch_winnt_64 = 40,
2008-06-09 14:02:59 +02:00
arch_darwin_x64 = 41,
arch_darwin_ppc64 = 42,
2009-08-14 11:44:49 +02:00
arch_max = 43 // Keep this at the end
2009-01-16 10:55:38 +01:00
};
2001-05-23 15:26:42 +02:00
2009-04-15 08:40:17 +02:00
// Protocol Types
2004-05-17 12:22:34 +02:00
// p_acpt_type
2009-04-16 03:09:12 +02:00
//const USHORT ptype_page = 1; // Page server protocol
2009-04-15 08:40:17 +02:00
const USHORT ptype_rpc = 2; // Simple remote procedure call
const USHORT ptype_batch_send = 3; // Batch sends, no asynchrony
const USHORT ptype_out_of_band = 4; // Batch sends w/ out of band notification
const USHORT ptype_lazy_send = 5; // Deferred packets delivery
2001-05-23 15:26:42 +02:00
2009-04-15 08:40:17 +02:00
// Generic object id
2001-05-23 15:26:42 +02:00
typedef USHORT OBJCT;
2004-05-17 12:22:34 +02:00
const int MAX_OBJCT_HANDLES = 65000;
2006-02-04 11:37:15 +01:00
const int INVALID_OBJECT = MAX_USHORT;
2009-04-15 08:40:17 +02:00
// Statement flags
const USHORT STMT_BLOB = 1;
const USHORT STMT_NO_BATCH = 2;
const USHORT STMT_DEFER_EXECUTE = 4;
2009-04-15 08:40:17 +02:00
// Operation (packet) types
2001-05-23 15:26:42 +02:00
enum P_OP
2001-05-23 15:26:42 +02:00
{
2009-08-14 11:44:49 +02:00
op_void = 0, // Packet has been voided
op_connect = 1, // Connect to remote server
op_exit = 2, // Remote end has exitted
op_accept = 3, // Server accepts connection
op_reject = 4, // Server rejects connection
//op_protocol = 5, // Protocol selection
op_disconnect = 6, // Connect is going away
//op_credit = 7, // Grant (buffer) credits
//op_continuation = 8, // Continuation packet
op_response = 9, // Generic response block
// Page server operations
//op_open_file = 10, // Open file for page service
//op_create_file = 11, // Create file for page service
//op_close_file = 12, // Close file for page service
//op_read_page = 13, // optionally lock and read page
//op_write_page = 14, // write page and optionally release lock
//op_lock = 15, // seize lock
//op_convert_lock = 16, // convert existing lock
//op_release_lock = 17, // release existing lock
//op_blocking = 18, // blocking lock message
// Full context server operations
op_attach = 19, // Attach database
op_create = 20, // Create database
op_detach = 21, // Detach database
op_compile = 22, // Request based operations
2001-05-23 15:26:42 +02:00
op_start = 23,
2002-02-16 03:21:35 +01:00
op_start_and_send = 24,
2001-05-23 15:26:42 +02:00
op_send = 25,
op_receive = 26,
2009-08-14 11:44:49 +02:00
op_unwind = 27, // apparently unused, see protocol.cpp's case op_unwind
2001-05-23 15:26:42 +02:00
op_release = 28,
2009-08-14 11:44:49 +02:00
op_transaction = 29, // Transaction operations
2001-05-23 15:26:42 +02:00
op_commit = 30,
op_rollback = 31,
op_prepare = 32,
op_reconnect = 33,
2009-08-14 11:44:49 +02:00
op_create_blob = 34, // Blob operations
2001-05-23 15:26:42 +02:00
op_open_blob = 35,
op_get_segment = 36,
op_put_segment = 37,
op_cancel_blob = 38,
op_close_blob = 39,
2009-08-14 11:44:49 +02:00
op_info_database = 40, // Information services
2001-05-23 15:26:42 +02:00
op_info_request = 41,
op_info_transaction = 42,
op_info_blob = 43,
2009-08-14 11:44:49 +02:00
op_batch_segments = 44, // Put a bunch of blob segments
2001-05-23 15:26:42 +02:00
2009-08-14 11:44:49 +02:00
//op_mgr_set_affinity = 45, // Establish server affinity
//op_mgr_clear_affinity = 46, // Break server affinity
//op_mgr_report = 47, // Report on server
2001-05-23 15:26:42 +02:00
2009-08-14 11:44:49 +02:00
op_que_events = 48, // Que event notification request
op_cancel_events = 49, // Cancel event notification request
op_commit_retaining = 50, // Commit retaining (what else)
op_prepare2 = 51, // Message form of prepare
op_event = 52, // Completed event request (asynchronous)
op_connect_request = 53, // Request to establish connection
op_aux_connect = 54, // Establish auxiliary connection
op_ddl = 55, // DDL call
2001-05-23 15:26:42 +02:00
op_open_blob2 = 56,
op_create_blob2 = 57,
op_get_slice = 58,
op_put_slice = 59,
2009-08-14 11:44:49 +02:00
op_slice = 60, // Successful response to op_get_slice
op_seek_blob = 61, // Blob seek operation
// DSQL operations
op_allocate_statement = 62, // allocate a statment handle
op_execute = 63, // execute a prepared statement
op_exec_immediate = 64, // execute a statement
op_fetch = 65, // fetch a record
op_fetch_response = 66, // response for record fetch
op_free_statement = 67, // free a statement
op_prepare_statement = 68, // prepare a statement
op_set_cursor = 69, // set a cursor name
2001-05-23 15:26:42 +02:00
op_info_sql = 70,
2009-08-14 11:44:49 +02:00
op_dummy = 71, // dummy packet to detect loss of client
2001-05-23 15:26:42 +02:00
2009-08-14 11:44:49 +02:00
op_response_piggyback = 72, // response block for piggybacked messages
2001-05-23 15:26:42 +02:00
op_start_and_receive = 73,
op_start_send_and_receive = 74,
2009-08-14 11:44:49 +02:00
op_exec_immediate2 = 75, // execute an immediate statement with msgs
op_execute2 = 76, // execute a statement with msgs
2001-05-23 15:26:42 +02:00
op_insert = 77,
2009-08-14 11:44:49 +02:00
op_sql_response = 78, // response from execute, exec immed, insert
2001-05-23 15:26:42 +02:00
op_transact = 79,
op_transact_response = 80,
op_drop_database = 81,
op_service_attach = 82,
op_service_detach = 83,
op_service_info = 84,
op_service_start = 85,
op_rollback_retaining = 86,
2006-12-08 19:38:15 +01:00
2006-12-09 02:23:17 +01:00
// Two following opcode are used in vulcan.
2008-12-05 01:56:15 +01:00
// No plans to implement them completely for a while, but to
2006-12-09 02:23:17 +01:00
// support protocol 11, where they are used, have them here.
2006-12-08 19:38:15 +01:00
op_update_account_info = 87,
op_authenticate_user = 88,
2006-03-03 17:20:42 +01:00
op_partial = 89, // packet is not complete - delay processing
2006-12-08 19:38:15 +01:00
op_trusted_auth = 90,
2008-12-05 01:56:15 +01:00
op_cancel = 91,
2001-05-23 15:26:42 +02:00
op_max
};
2001-05-23 15:26:42 +02:00
2009-08-14 11:44:49 +02:00
// Count String Structure
2001-05-23 15:26:42 +02:00
2004-06-09 20:23:27 +02:00
typedef struct cstring
2001-05-23 15:26:42 +02:00
{
USHORT cstr_length;
USHORT cstr_allocated;
UCHAR* cstr_address;
2004-06-09 20:23:27 +02:00
} CSTRING;
2001-05-23 15:26:42 +02:00
// CVC: Only used in p_blob, p_sgmt & p_ddl, to validate constness.
// We want to ensure our original bpb is not overwritten.
// In turn, p_blob is used only to create and open a blob, so it's correct
// to demand that those functions do not change the bpb.
// We want to ensure our incoming segment to be stored isn't overwritten,
// in the case of send/batch commands.
2004-06-09 20:23:27 +02:00
typedef struct cstring_const
{
USHORT cstr_length;
USHORT cstr_allocated;
const UCHAR* cstr_address;
2004-06-09 20:23:27 +02:00
} CSTRING_CONST;
2001-05-23 15:26:42 +02:00
#ifdef DEBUG_XDR_MEMORY
2009-08-14 11:44:49 +02:00
// Debug xdr memory allocations
2001-05-23 15:26:42 +02:00
2009-08-14 11:44:49 +02:00
const USHORT P_MALLOC_SIZE = 64; // Xdr memory allocations per packet
2001-05-23 15:26:42 +02:00
2004-06-09 20:23:27 +02:00
typedef struct p_malloc
2001-05-23 15:26:42 +02:00
{
2009-08-14 11:44:49 +02:00
P_OP p_operation; // Operation/packet type
ULONG p_allocated; // Memory length
UCHAR* p_address; // Memory address
// UCHAR* p_xdrvar; // XDR variable
2004-06-09 20:23:27 +02:00
} P_MALLOC;
2001-05-23 15:26:42 +02:00
2009-08-14 11:44:49 +02:00
#endif // DEBUG_XDR_MEMORY
2001-05-23 15:26:42 +02:00
2009-08-14 11:44:49 +02:00
// Connect Block (Client to server)
2001-05-23 15:26:42 +02:00
2004-06-09 20:23:27 +02:00
typedef struct p_cnct
2001-05-23 15:26:42 +02:00
{
2009-08-14 11:44:49 +02:00
P_OP p_cnct_operation; // OP_CREATE or OP_OPEN
USHORT p_cnct_cversion; // Version of connect protocol
P_ARCH p_cnct_client; // Architecture of client
CSTRING_CONST p_cnct_file; // File name
USHORT p_cnct_count; // Protocol versions understood
CSTRING_CONST p_cnct_user_id; // User identification stuff
2001-05-23 15:26:42 +02:00
struct p_cnct_repeat
{
2009-08-14 11:44:49 +02:00
USHORT p_cnct_version; // Protocol version number
P_ARCH p_cnct_architecture; // Architecture of client
USHORT p_cnct_min_type; // Minimum type
USHORT p_cnct_max_type; // Maximum type
USHORT p_cnct_weight; // Preference weight
2001-05-23 15:26:42 +02:00
} p_cnct_versions[10];
2004-06-09 20:23:27 +02:00
} P_CNCT;
2001-05-23 15:26:42 +02:00
#ifdef ASYMMETRIC_PROTOCOLS_ONLY
#define REMOTE_PROTOCOL(version, min_type, max_type, weight) \
{version, arch_generic, min_type, max_type, weight * 2}
#else
#define REMOTE_PROTOCOL(version, min_type, max_type, weight) \
{version, arch_generic, min_type, max_type, weight * 2}, \
{version, ARCHITECTURE, min_type, max_type, weight * 2 + 1}
#endif
2001-05-23 15:26:42 +02:00
/* User identification data, if any, is of form:
<type> <length> <data>
where
type is a byte code
length is an unsigned byte containing length of data
data is 'type' specific
*/
2009-08-14 11:44:49 +02:00
const UCHAR CNCT_user = 1; // User name
2004-12-26 14:48:01 +01:00
const UCHAR CNCT_passwd = 2;
2009-08-14 11:44:49 +02:00
//const UCHAR CNCT_ppo = 3; // Apollo person, project, organization. OBSOLETE.
2004-12-26 14:48:01 +01:00
const UCHAR CNCT_host = 4;
2009-08-14 11:44:49 +02:00
const UCHAR CNCT_group = 5; // Effective Unix group id
const UCHAR CNCT_user_verification = 6; // Attach/create using this connection
// will use user verification
2001-05-23 15:26:42 +02:00
2009-08-14 11:44:49 +02:00
typedef struct bid // BLOB ID
2001-05-23 15:26:42 +02:00
{
ULONG bid_quad_high;
ULONG bid_quad_low;
2004-06-09 20:23:27 +02:00
} *BID;
2001-05-23 15:26:42 +02:00
2009-08-14 11:44:49 +02:00
// Accept Block (Server response to connect block)
2001-05-23 15:26:42 +02:00
2004-06-09 20:23:27 +02:00
typedef struct p_acpt
2001-05-23 15:26:42 +02:00
{
2009-08-14 11:44:49 +02:00
USHORT p_acpt_version; // Protocol version number
P_ARCH p_acpt_architecture; // Architecture for protocol
USHORT p_acpt_type; // Minimum type
2004-06-09 20:23:27 +02:00
} P_ACPT;
2001-05-23 15:26:42 +02:00
2009-08-14 11:44:49 +02:00
// Generic Response block
2001-05-23 15:26:42 +02:00
2004-06-09 20:23:27 +02:00
typedef struct p_resp
2001-05-23 15:26:42 +02:00
{
2009-08-14 11:44:49 +02:00
OBJCT p_resp_object; // Object id
struct bid p_resp_blob_id; // Blob id
CSTRING p_resp_data; // Data
2003-04-10 12:31:28 +02:00
ISC_STATUS* p_resp_status_vector;
2004-06-09 20:23:27 +02:00
} P_RESP;
2001-05-23 15:26:42 +02:00
#define p_resp_partner p_resp_blob_id.bid_number
2009-08-14 11:44:49 +02:00
// Attach and create database
2001-05-23 15:26:42 +02:00
2004-06-09 20:23:27 +02:00
typedef struct p_atch
2001-05-23 15:26:42 +02:00
{
2009-08-14 11:44:49 +02:00
OBJCT p_atch_database; // Database object id
CSTRING_CONST p_atch_file; // File name
CSTRING_CONST p_atch_dpb; // Database parameter block
2004-06-09 20:23:27 +02:00
} P_ATCH;
2001-05-23 15:26:42 +02:00
2009-08-14 11:44:49 +02:00
// Compile request
2001-05-23 15:26:42 +02:00
2004-06-09 20:23:27 +02:00
typedef struct p_cmpl
2001-05-23 15:26:42 +02:00
{
2009-08-14 11:44:49 +02:00
OBJCT p_cmpl_database; // Database object id
CSTRING_CONST p_cmpl_blr; // Request blr
2004-06-09 20:23:27 +02:00
} P_CMPL;
2001-05-23 15:26:42 +02:00
2009-08-14 11:44:49 +02:00
// Start Transaction
2001-05-23 15:26:42 +02:00
2004-06-09 20:23:27 +02:00
typedef struct p_sttr
2001-05-23 15:26:42 +02:00
{
2009-08-14 11:44:49 +02:00
OBJCT p_sttr_database; // Database object id
CSTRING_CONST p_sttr_tpb; // Transaction parameter block
2004-06-09 20:23:27 +02:00
} P_STTR;
2001-05-23 15:26:42 +02:00
2009-08-14 11:44:49 +02:00
// Generic release block
2001-05-23 15:26:42 +02:00
2004-06-09 20:23:27 +02:00
typedef struct p_rlse
2001-05-23 15:26:42 +02:00
{
2009-08-14 11:44:49 +02:00
OBJCT p_rlse_object; // Object to be released
2004-06-09 20:23:27 +02:00
} P_RLSE;
2001-05-23 15:26:42 +02:00
2009-08-14 11:44:49 +02:00
// Data block (start, start and send, send, receive)
2001-05-23 15:26:42 +02:00
2008-04-19 13:33:37 +02:00
typedef struct p_data
{
2009-08-14 11:44:49 +02:00
OBJCT p_data_request; // Request object id
USHORT p_data_incarnation; // Incarnation of request
OBJCT p_data_transaction; // Transaction object id
USHORT p_data_message_number; // Message number in request
USHORT p_data_messages; // Number of messages
2004-06-09 20:23:27 +02:00
} P_DATA;
2001-05-23 15:26:42 +02:00
2009-08-14 11:44:49 +02:00
// Execute stored procedure block
2001-05-23 15:26:42 +02:00
2008-04-19 13:33:37 +02:00
typedef struct p_trrq
{
2009-08-14 11:44:49 +02:00
OBJCT p_trrq_database; // Database object id
OBJCT p_trrq_transaction; // Transaction object id
CSTRING p_trrq_blr; // Message blr
2001-05-23 15:26:42 +02:00
USHORT p_trrq_in_msg_length;
USHORT p_trrq_out_msg_length;
2009-08-14 11:44:49 +02:00
USHORT p_trrq_messages; // Number of messages
2004-06-09 20:23:27 +02:00
} P_TRRQ;
2001-05-23 15:26:42 +02:00
2009-08-14 11:44:49 +02:00
// Blob (create/open) and segment blocks
2001-05-23 15:26:42 +02:00
2008-04-19 13:33:37 +02:00
typedef struct p_blob
{
2009-08-14 11:44:49 +02:00
OBJCT p_blob_transaction; // Transaction
struct bid p_blob_id; // Blob id for open
CSTRING_CONST p_blob_bpb; // Blob parameter block
2004-06-09 20:23:27 +02:00
} P_BLOB;
2001-05-23 15:26:42 +02:00
2008-04-19 13:33:37 +02:00
typedef struct p_sgmt
{
2009-08-14 11:44:49 +02:00
OBJCT p_sgmt_blob; // Blob handle id
USHORT p_sgmt_length; // Length of segment
CSTRING_CONST p_sgmt_segment; // Data segment
2004-06-09 20:23:27 +02:00
} P_SGMT;
2001-05-23 15:26:42 +02:00
2008-04-19 13:33:37 +02:00
typedef struct p_seek
{
2009-08-14 11:44:49 +02:00
OBJCT p_seek_blob; // Blob handle id
SSHORT p_seek_mode; // mode of seek
SLONG p_seek_offset; // Offset of seek
2004-06-09 20:23:27 +02:00
} P_SEEK;
2001-05-23 15:26:42 +02:00
2009-08-14 11:44:49 +02:00
// Information request blocks
2001-05-23 15:26:42 +02:00
2008-04-19 13:33:37 +02:00
typedef struct p_info
{
2009-08-14 11:44:49 +02:00
OBJCT p_info_object; // Object of information
USHORT p_info_incarnation; // Incarnation of object
CSTRING_CONST p_info_items; // Information
CSTRING_CONST p_info_recv_items; // Receive information
USHORT p_info_buffer_length; // Target buffer length
2004-06-09 20:23:27 +02:00
} P_INFO;
2001-05-23 15:26:42 +02:00
2009-08-14 11:44:49 +02:00
// Event request block
2001-05-23 15:26:42 +02:00
2008-04-19 13:33:37 +02:00
typedef struct p_event
{
2009-08-14 11:44:49 +02:00
OBJCT p_event_database; // Database object id
CSTRING_CONST p_event_items; // Event description block
FPTR_EVENT_CALLBACK p_event_ast; // Address of ast routine
SLONG p_event_arg; // Argument to ast routine
SLONG p_event_rid; // Client side id of remote event
2004-06-09 20:23:27 +02:00
} P_EVENT;
2001-05-23 15:26:42 +02:00
2009-08-14 11:44:49 +02:00
// Prepare block
2001-05-23 15:26:42 +02:00
2008-04-19 13:33:37 +02:00
typedef struct p_prep
{
2001-05-23 15:26:42 +02:00
OBJCT p_prep_transaction;
CSTRING_CONST p_prep_data;
2004-06-09 20:23:27 +02:00
} P_PREP;
2001-05-23 15:26:42 +02:00
2009-08-14 11:44:49 +02:00
// Connect request block
2001-05-23 15:26:42 +02:00
2008-04-19 13:33:37 +02:00
typedef struct p_req
{
2009-08-14 11:44:49 +02:00
USHORT p_req_type; // Connection type
OBJCT p_req_object; // Related object
ULONG p_req_partner; // Partner identification
2004-06-09 20:23:27 +02:00
} P_REQ;
2001-05-23 15:26:42 +02:00
2004-05-17 12:22:34 +02:00
// p_req_type
2009-08-14 11:44:49 +02:00
const USHORT P_REQ_async = 1; // Auxiliary asynchronous port
2001-05-23 15:26:42 +02:00
2009-08-14 11:44:49 +02:00
// DDL request
2001-05-23 15:26:42 +02:00
2008-04-19 13:33:37 +02:00
typedef struct p_ddl
{
2009-08-14 11:44:49 +02:00
OBJCT p_ddl_database; // Database object id
OBJCT p_ddl_transaction; // Transaction
CSTRING_CONST p_ddl_blr; // Request blr
2004-06-09 20:23:27 +02:00
} P_DDL;
2001-05-23 15:26:42 +02:00
2009-08-14 11:44:49 +02:00
// Slice Operation
2001-05-23 15:26:42 +02:00
2008-04-19 13:33:37 +02:00
typedef struct p_slc
{
2009-08-14 11:44:49 +02:00
OBJCT p_slc_transaction; // Transaction
struct bid p_slc_id; // Slice id
CSTRING p_slc_sdl; // Slice description language
CSTRING p_slc_parameters; // Slice parameters
lstring p_slc_slice; // Slice proper
ULONG p_slc_length; // Number of elements
2004-06-09 20:23:27 +02:00
} P_SLC;
2001-05-23 15:26:42 +02:00
2009-08-14 11:44:49 +02:00
// Response to get_slice
2001-05-23 15:26:42 +02:00
2008-04-19 13:33:37 +02:00
typedef struct p_slr
{
2009-08-14 11:44:49 +02:00
lstring p_slr_slice; // Slice proper
ULONG p_slr_length; // Total length of slice
UCHAR* p_slr_sdl; // *** not transfered ***
USHORT p_slr_sdl_length; // *** not transfered ***
2004-06-09 20:23:27 +02:00
} P_SLR;
2008-12-05 01:56:15 +01:00
2009-08-14 11:44:49 +02:00
// DSQL structure definitions
2001-05-23 15:26:42 +02:00
2008-04-19 13:33:37 +02:00
typedef struct p_sqlst
{
2009-08-14 11:44:49 +02:00
OBJCT p_sqlst_transaction; // transaction object
OBJCT p_sqlst_statement; // statement object
USHORT p_sqlst_SQL_dialect; // the SQL dialect
CSTRING_CONST p_sqlst_SQL_str; // statement to be prepared
USHORT p_sqlst_buffer_length; // Target buffer length
CSTRING_CONST p_sqlst_items; // Information
// This should be CSTRING_CONST
2009-08-14 11:44:49 +02:00
CSTRING p_sqlst_blr; // blr describing message
2001-05-23 15:26:42 +02:00
USHORT p_sqlst_message_number;
2009-08-14 11:44:49 +02:00
USHORT p_sqlst_messages; // Number of messages
CSTRING p_sqlst_out_blr; // blr describing output message
2001-05-23 15:26:42 +02:00
USHORT p_sqlst_out_message_number;
2004-06-09 20:23:27 +02:00
} P_SQLST;
2001-05-23 15:26:42 +02:00
2008-04-19 13:33:37 +02:00
typedef struct p_sqldata
{
2009-08-14 11:44:49 +02:00
OBJCT p_sqldata_statement; // statement object
OBJCT p_sqldata_transaction; // transaction object
// This should be CSTRING_CONST, but fetch() has strange behavior.
2009-08-14 11:44:49 +02:00
CSTRING p_sqldata_blr; // blr describing message
2001-05-23 15:26:42 +02:00
USHORT p_sqldata_message_number;
2009-08-14 11:44:49 +02:00
USHORT p_sqldata_messages; // Number of messages
CSTRING p_sqldata_out_blr; // blr describing output message
2001-05-23 15:26:42 +02:00
USHORT p_sqldata_out_message_number;
2009-08-14 11:44:49 +02:00
ULONG p_sqldata_status; // final eof status
2004-06-09 20:23:27 +02:00
} P_SQLDATA;
2001-05-23 15:26:42 +02:00
2008-04-19 13:33:37 +02:00
typedef struct p_sqlfree
{
2009-08-14 11:44:49 +02:00
OBJCT p_sqlfree_statement; // statement object
USHORT p_sqlfree_option; // option
2004-06-09 20:23:27 +02:00
} P_SQLFREE;
2001-05-23 15:26:42 +02:00
2008-04-19 13:33:37 +02:00
typedef struct p_sqlcur
{
2009-08-14 11:44:49 +02:00
OBJCT p_sqlcur_statement; // statement object
CSTRING_CONST p_sqlcur_cursor_name; // cursor name
USHORT p_sqlcur_type; // type of cursor
2004-06-09 20:23:27 +02:00
} P_SQLCUR;
2006-12-08 19:38:15 +01:00
typedef struct p_trau
{
CSTRING p_trau_data; // Context
} P_TRAU;
2008-04-19 13:33:37 +02:00
struct p_update_account
{
2006-12-09 02:23:17 +01:00
OBJCT p_account_database; // Database object id
CSTRING_CONST p_account_apb; // Account parameter block (apb)
2006-12-08 19:38:15 +01:00
};
2008-04-19 13:33:37 +02:00
struct p_authenticate
{
2006-12-09 02:23:17 +01:00
OBJCT p_auth_database; // Database object id
CSTRING_CONST p_auth_dpb; // Database parameter block w/ user credentials
CSTRING p_auth_items; // Information
CSTRING p_auth_recv_items; // Receive information
USHORT p_auth_buffer_length; // Target buffer length
2006-12-08 19:38:15 +01:00
};
2008-04-19 13:33:37 +02:00
typedef struct p_cancel_op
{
USHORT p_co_kind; // Kind of cancelation
} P_CANCEL_OP;
2006-12-08 19:38:15 +01:00
2009-08-14 11:44:49 +02:00
// Generalize packet (sic!)
2001-05-23 15:26:42 +02:00
2008-04-19 13:33:37 +02:00
typedef struct packet
{
2001-05-23 15:26:42 +02:00
#ifdef DEBUG_XDR_MEMORY
2009-08-14 11:44:49 +02:00
// When XDR memory debugging is enabled, p_malloc must be
// the first subpacket and be followed by p_operation (see
// server.c/zap_packet())
2001-05-23 15:26:42 +02:00
2009-08-14 11:44:49 +02:00
P_MALLOC p_malloc [P_MALLOC_SIZE]; // Debug xdr memory allocations
2001-05-23 15:26:42 +02:00
#endif
2009-08-14 11:44:49 +02:00
P_OP p_operation; // Operation/packet type
P_CNCT p_cnct; // Connect block
P_ACPT p_acpt; // Accept connection
P_RESP p_resp; // Generic response to a call
P_ATCH p_atch; // Attach or create database
P_RLSE p_rlse; // Release object
P_DATA p_data; // Data packet
P_CMPL p_cmpl; // Compile request
P_STTR p_sttr; // Start transactions
P_BLOB p_blob; // Create/Open blob
P_SGMT p_sgmt; // Put_segment
P_INFO p_info; // Information
P_EVENT p_event; // Que event
P_PREP p_prep; // New improved prepare
P_REQ p_req; // Connection request
P_DDL p_ddl; // Data definition call
P_SLC p_slc; // Slice operator
P_SLR p_slr; // Slice response
P_SEEK p_seek; // Blob seek
P_SQLST p_sqlst; // DSQL Prepare & Execute immediate
P_SQLDATA p_sqldata; // DSQL Open Cursor, Execute, Fetch
P_SQLCUR p_sqlcur; // DSQL Set cursor name
P_SQLFREE p_sqlfree; // DSQL Free statement
P_TRRQ p_trrq; // Transact request packet
P_TRAU p_trau; // Trusted authentication
2006-12-08 19:38:15 +01:00
p_update_account p_account_update;
p_authenticate p_authenticate_user;
2009-08-14 11:44:49 +02:00
P_CANCEL_OP p_cancel_op; // cancel operation
public:
packet()
{
memset(this, 0, sizeof(*this));
}
2004-06-09 20:23:27 +02:00
} PACKET;
2001-05-23 15:26:42 +02:00
#endif // REMOTE_PROTOCOL_H