|
From: <di...@us...> - 2012-01-06 11:24:45
|
Revision: 53813
http://firebird.svn.sourceforge.net/firebird/?rev=53813&view=rev
Author: dimitr
Date: 2012-01-06 11:24:37 +0000 (Fri, 06 Jan 2012)
Log Message:
-----------
Removed support for the remote protocol versions prior to v10.
Modified Paths:
--------------
firebird/trunk/src/remote/client/interface.cpp
firebird/trunk/src/remote/inet.cpp
firebird/trunk/src/remote/os/win32/wnet.cpp
firebird/trunk/src/remote/os/win32/xnet.cpp
firebird/trunk/src/remote/parse_proto.h
firebird/trunk/src/remote/parser.cpp
firebird/trunk/src/remote/protocol.cpp
firebird/trunk/src/remote/protocol.h
firebird/trunk/src/remote/server/server.cpp
Modified: firebird/trunk/src/remote/client/interface.cpp
===================================================================
--- firebird/trunk/src/remote/client/interface.cpp 2012-01-05 03:22:12 UTC (rev 53812)
+++ firebird/trunk/src/remote/client/interface.cpp 2012-01-06 11:24:37 UTC (rev 53813)
@@ -46,7 +46,6 @@
#include "../jrd/ibase.h"
#include "../common/ThreadStart.h"
#include "../jrd/license.h"
-#include "../common/sdl.h"
#include "../remote/inet_proto.h"
#include "../remote/merge_proto.h"
#include "../remote/parse_proto.h"
@@ -55,7 +54,6 @@
#include "../common/cvt.h"
#include "../yvalve/gds_proto.h"
#include "../common/isc_f_proto.h"
-#include "../common/sdl_proto.h"
#include "../common/classes/ClumpletWriter.h"
#include "../common/config/config.h"
#include "../common/utils_proto.h"
@@ -70,11 +68,6 @@
#include "../auth/trusted/AuthSspi.h"
-// hvlad: following code registering plugins is temporary and should be
-// moved at appropriate places
-
-#include "../auth/trusted/AuthSspi.h"
-
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
@@ -828,13 +821,6 @@
rem_port* port = rdb->rdb_port;
RefMutexGuard portGuard(*port->port_sync);
- // Make sure protocol supports action
-
- if (port->port_protocol < PROTOCOL_VERSION6)
- {
- unsupported();
- }
-
// Tell the remote server to cancel it and delete it from the list
send_cancel_event(rvnt);
}
@@ -942,12 +928,6 @@
rem_port* port = rdb->rdb_port;
RefMutexGuard portGuard(*port->port_sync);
- // Make sure protocol support action
-
- if (rdb->rdb_port->port_protocol < PROTOCOL_VERSION4) {
- unsupported();
- }
-
release_object(status, rdb, op_commit_retaining, transaction->rtr_id);
}
catch (const Exception& ex)
@@ -1037,10 +1017,6 @@
// Parse the request in case blr_d_float must be converted to blr_double
const UCHAR* new_blr = blr;
- AutoPtr<const UCHAR> delete_blr;
- if (rdb->rdb_port->port_protocol < PROTOCOL_VERSION5) {
- delete_blr = new_blr = PARSE_prepare_messages(blr, blr_length);
- }
// Make up a packet for the remote guy
@@ -1128,23 +1104,18 @@
CHECK_HANDLE(transaction, isc_bad_trans_handle);
PACKET* packet = &rdb->rdb_packet;
- packet->p_operation = op_create_blob;
+ packet->p_operation = op_create_blob2;
P_BLOB* p_blob = &packet->p_blob;
p_blob->p_blob_transaction = transaction->rtr_id;
+ p_blob->p_blob_bpb.cstr_length = bpb_length;
+ fb_assert(!p_blob->p_blob_bpb.cstr_allocated ||
+ p_blob->p_blob_bpb.cstr_allocated < p_blob->p_blob_bpb.cstr_length);
+ // CVC: Should we ensure here that cstr_allocated < bpb_length???
+ // Otherwise, xdr_cstring() calling alloc_string() to decode would
+ // cause memory problems on the client side for SS, as the client
+ // would try to write to the application's provided R/O buffer.
+ p_blob->p_blob_bpb.cstr_address = bpb;
- if (rdb->rdb_port->port_protocol >= PROTOCOL_VERSION4)
- {
- packet->p_operation = op_create_blob2;
- p_blob->p_blob_bpb.cstr_length = bpb_length;
- fb_assert(!p_blob->p_blob_bpb.cstr_allocated ||
- p_blob->p_blob_bpb.cstr_allocated < p_blob->p_blob_bpb.cstr_length);
- // CVC: Should we ensure here that cstr_allocated < bpb_length???
- // Otherwise, xdr_cstring() calling alloc_string() to decode would
- // cause memory problems on the client side for SS, as the client
- // would try to write to the application's provided R/O buffer.
- p_blob->p_blob_bpb.cstr_address = bpb;
- }
-
try
{
send_and_receive(status, rdb, packet);
@@ -1343,10 +1314,6 @@
Rtr* transaction = remoteTransaction(apiTra);
CHECK_HANDLE(transaction, isc_bad_trans_handle);
- if (rdb->rdb_port->port_protocol < PROTOCOL_VERSION4) {
- unsupported();
- }
-
// Make up a packet for the remote guy
PACKET* packet = &rdb->rdb_packet;
@@ -1466,11 +1433,6 @@
rem_port* port = rdb->rdb_port;
RefMutexGuard portGuard(*port->port_sync);
- // Make sure protocol supports the action
-
- if (port->port_protocol < PROTOCOL_VERSION8)
- unsupported();
-
try
{
release_object(status, rdb, op_drop_database, rdb->rdb_id);
@@ -1530,11 +1492,6 @@
rem_port* port = rdb->rdb_port;
RefMutexGuard portGuard(*port->port_sync);
- // Make sure protocol support action
-
- if (rdb->rdb_port->port_protocol < PROTOCOL_VERSION7)
- unsupported();
-
Rsr* statement = NULL;
if (rdb->rdb_port->port_flags & PORT_lazy)
{
@@ -1624,14 +1581,6 @@
CHECK_HANDLE(transaction, isc_bad_trans_handle);
}
- // bag it if the protocol doesn't support it...
-
- if (port->port_protocol < PROTOCOL_VERSION7 ||
- (out_msg_length && port->port_protocol < PROTOCOL_VERSION8))
- {
- unsupported();
- }
-
// 24-Mar-2004 Nickolay Samofatov
// Unconditionally deallocate existing formats that are left from
// previous executions (possibly with different statement if
@@ -1832,22 +1781,6 @@
reset(status);
- // bag it if the protocol doesn't support it...
-
- if (port->port_protocol < PROTOCOL_VERSION7 ||
- ((in_msg_length || out_msg_length) && port->port_protocol < PROTOCOL_VERSION8))
- {
- unsupported();
- }
-
- // If the server is pre-6.0, do not send anything if the client dialect is 3 and
- // there is a SQLDA. This will cause the older server to crash
- if (port->port_protocol < PROTOCOL_VERSION10 &&
- (in_msg_length || out_msg_length) && dialect > SQL_DIALECT_V5)
- {
- unsupported();
- }
-
Rsr* statement = port->port_statement;
if (!statement) {
statement = port->port_statement = new Rsr;
@@ -2000,12 +1933,6 @@
RefMutexGuard portGuard(*port->port_sync);
- // make sure the protocol supports it
-
- if (rdb->rdb_port->port_protocol < PROTOCOL_VERSION7) {
- unsupported();
- }
-
// On first fetch, clear the end-of-stream flag & reset the message buffers
if (!statement->rsr_flags.test(Rsr::FETCHED))
@@ -2244,12 +2171,6 @@
rem_port* port = rdb->rdb_port;
RefMutexGuard portGuard(*port->port_sync);
- // make sure the protocol supports it
-
- if (rdb->rdb_port->port_protocol < PROTOCOL_VERSION7) {
- unsupported();
- }
-
fb_assert(statement->haveException() == 0);
statement->clearException();
@@ -2343,12 +2264,6 @@
RefMutexGuard portGuard(*port->port_sync);
- // make sure the protocol supports it
-
- if (rdb->rdb_port->port_protocol < PROTOCOL_VERSION8) {
- unsupported();
- }
-
// Free existing format unconditionally.
// This is also related to SF#919246
delete statement->rsr_bind_format;
@@ -2481,13 +2396,6 @@
REMOTE_reset_statement(statement);
- // if we're less than protocol 7, the remote server doesn't support
- // DSQL, so we're done...
-
- if (rdb->rdb_port->port_protocol < PROTOCOL_VERSION7) {
- unsupported();
- }
-
// set up the packet for the other guy...
PACKET* packet = &rdb->rdb_packet;
@@ -2608,12 +2516,6 @@
statement->raiseException();
- // make sure the protocol supports it
-
- if (rdb->rdb_port->port_protocol < PROTOCOL_VERSION7) {
- unsupported();
- }
-
if (!cursor)
{
// Return CURSOR unknown error
@@ -2691,11 +2593,6 @@
statement->raiseException();
- // make sure the protocol supports it
-
- if (rdb->rdb_port->port_protocol < PROTOCOL_VERSION7)
- unsupported();
-
if (!metadata.fillFromCache(itemsLength, items, bufferLength, buffer))
{
info(status, rdb, op_info_sql, statement->rsr_id, 0,
@@ -3093,17 +2990,9 @@
Rtr* transaction = remoteTransaction(apiTra);
CHECK_HANDLE(transaction, isc_bad_trans_handle);
- if (rdb->rdb_port->port_protocol < PROTOCOL_VERSION4) {
- unsupported();
- }
// Parse the sdl in case blr_d_float must be converted to blr_double
const UCHAR* new_sdl = sdl;
- AutoPtr<const UCHAR> delete_sdl; // To release memory if allocated by SDL_prepare_slice
- if (rdb->rdb_port->port_protocol < PROTOCOL_VERSION6)
- {
- delete_sdl = new_sdl = SDL_prepare_slice(sdl, sdl_length);
- }
// CVC: Modified this horrible idea: don't touch input parameters!
// The modified (perhaps) sdl is send to the remote connection. The
@@ -3176,24 +3065,19 @@
CHECK_HANDLE(transaction, isc_bad_trans_handle);
PACKET* packet = &rdb->rdb_packet;
- packet->p_operation = op_open_blob;
+ packet->p_operation = op_open_blob2;
P_BLOB* p_blob = &packet->p_blob;
p_blob->p_blob_transaction = transaction->rtr_id;
p_blob->p_blob_id = *id;
+ p_blob->p_blob_bpb.cstr_length = bpb_length;
+ fb_assert(!p_blob->p_blob_bpb.cstr_allocated ||
+ p_blob->p_blob_bpb.cstr_allocated < p_blob->p_blob_bpb.cstr_length);
+ // CVC: Should we ensure here that cstr_allocated < bpb_length???
+ // Otherwise, xdr_cstring() calling alloc_string() to decode would
+ // cause memory problems on the client side for SS, as the client
+ // would try to write to the application's provided R/O buffer.
+ p_blob->p_blob_bpb.cstr_address = bpb;
- if (rdb->rdb_port->port_protocol >= PROTOCOL_VERSION4)
- {
- packet->p_operation = op_open_blob2;
- p_blob->p_blob_bpb.cstr_length = bpb_length;
- fb_assert(!p_blob->p_blob_bpb.cstr_allocated ||
- p_blob->p_blob_bpb.cstr_allocated < p_blob->p_blob_bpb.cstr_length);
- // CVC: Should we ensure here that cstr_allocated < bpb_length???
- // Otherwise, xdr_cstring() calling alloc_string() to decode would
- // cause memory problems on the client side for SS, as the client
- // would try to write to the application's provided R/O buffer.
- p_blob->p_blob_bpb.cstr_address = bpb;
- }
-
send_and_receive(status, rdb, packet);
// CVC: It's not evident to me why these two lines that I've copied
@@ -3246,17 +3130,6 @@
rem_port* port = rdb->rdb_port;
RefMutexGuard portGuard(*port->port_sync);
- // Handle historical version
-
- if (rdb->rdb_port->port_protocol < PROTOCOL_VERSION4)
- {
- if (msg_length)
- {
- unsupported();
- }
- release_object(status, rdb, op_prepare, transaction->rtr_id);
- }
-
PACKET* packet = &rdb->rdb_packet;
packet->p_operation = op_prepare2;
packet->p_prep.p_prep_transaction = transaction->rtr_id;
@@ -3376,18 +3249,9 @@
Rtr* transaction = remoteTransaction(apiTra);
CHECK_HANDLE(transaction, isc_bad_trans_handle);
- if (rdb->rdb_port->port_protocol < PROTOCOL_VERSION4) {
- unsupported();
- }
-
// Parse the sdl in case blr_d_float must be converted to blr_double
const UCHAR* new_sdl = sdl;
- AutoPtr<const UCHAR> delete_sdl; // To release memory if allocated by SDL_prepare_slice
- if (rdb->rdb_port->port_protocol < PROTOCOL_VERSION6)
- {
- delete_sdl = new_sdl = SDL_prepare_slice(sdl, sdl_length);
- }
// CVC: Modified this horrible idea: don't touch input parameters!
// The modified (perhaps) sdl is send to the remote connection. The
@@ -3459,12 +3323,6 @@
PACKET* packet = &rdb->rdb_packet;
- // Make sure protocol support action
-
- if (rdb->rdb_port->port_protocol < PROTOCOL_VERSION4) {
- unsupported();
- }
-
// If there isn't a auxiliary asynchronous port, make one now
if (!port->port_async)
@@ -3969,10 +3827,6 @@
rem_port* port = rdb->rdb_port;
RefMutexGuard portGuard(*port->port_sync);
- if (rdb->rdb_port->port_protocol < PROTOCOL_VERSION6) {
- unsupported();
- }
-
PACKET* packet = &rdb->rdb_packet;
packet->p_operation = op_seek_blob;
P_SEEK* seek = &packet->p_seek;
@@ -4088,13 +3942,6 @@
RefMutexGuard portGuard(*port->port_sync);
Rdb* rdb = port->port_context;
- // make sure the protocol supports it
- if (port->port_protocol < PROTOCOL_VERSION8)
- {
- disconnect(port);
- unsupported();
- }
-
// The client may have set a parameter for dummy_packet_interval. Add that to the
// the SPB so the server can pay attention to it. Note: allocation code must
// ensure sufficient space has been added.
@@ -4177,12 +4024,6 @@
rem_port* port = rdb->rdb_port;
RefMutexGuard portGuard(*port->port_sync);
- // make sure the protocol supports it
-
- if (port->port_protocol < PROTOCOL_VERSION8) {
- unsupported();
- }
-
release_object(status, rdb, op_service_detach, rdb->rdb_id);
disconnect(port);
rdb = NULL;
@@ -4220,12 +4061,6 @@
rem_port* port = rdb->rdb_port;
RefMutexGuard portGuard(*port->port_sync);
- // make sure the protocol supports it
-
- if (rdb->rdb_port->port_protocol < PROTOCOL_VERSION8) {
- unsupported();
- }
-
ClntAuthBlock cBlock(NULL);
cBlock.loadServiceDataFrom(port);
@@ -4264,13 +4099,6 @@
rem_port* port = rdb->rdb_port;
RefMutexGuard portGuard(*port->port_sync);
- // make sure the protocol supports it
-
- if (rdb->rdb_port->port_protocol < PROTOCOL_VERSION8)
- {
- unsupported();
- }
-
svcstart(status, rdb, op_service_start, rdb->rdb_id, 0, spbLength, spb);
}
catch (const Exception& ex)
@@ -4326,8 +4154,7 @@
message->msg_address = const_cast<unsigned char*>(msg);
PACKET* packet = &rdb->rdb_packet;
- packet->p_operation = (rdb->rdb_port->port_protocol < PROTOCOL_VERSION8) ?
- op_start_and_send : op_start_send_and_receive;
+ packet->p_operation = op_start_send_and_receive;
P_DATA* data = &packet->p_data;
data->p_data_request = request->rrq_id;
data->p_data_transaction = transaction->rtr_id;
@@ -4348,8 +4175,7 @@
request->rrq_rtr = transaction;
- if (rdb->rdb_port->port_protocol >= PROTOCOL_VERSION8 &&
- packet->p_operation == op_response_piggyback)
+ if (packet->p_operation == op_response_piggyback)
{
receive_after_start(request, packet->p_resp.p_resp_object);
}
@@ -4398,8 +4224,7 @@
REMOTE_reset_request(request, 0);
PACKET* packet = &rdb->rdb_packet;
- packet->p_operation = (rdb->rdb_port->port_protocol < PROTOCOL_VERSION8) ?
- op_start : op_start_and_receive;
+ packet->p_operation = op_start_and_receive;
P_DATA* data = &packet->p_data;
data->p_data_request = request->rrq_id;
data->p_data_transaction = transaction->rtr_id;
@@ -4412,8 +4237,7 @@
request->rrq_rtr = transaction;
- if (rdb->rdb_port->port_protocol >= PROTOCOL_VERSION8 &&
- packet->p_operation == op_response_piggyback)
+ if (packet->p_operation == op_response_piggyback)
{
receive_after_start(request, packet->p_resp.p_resp_object);
}
@@ -4498,12 +4322,6 @@
Rtr* transaction = remoteTransaction(apiTra);
CHECK_HANDLE(transaction, isc_bad_trans_handle);
- // bag it if the protocol doesn't support it...
-
- if (port->port_protocol < PROTOCOL_VERSION8) {
- unsupported();
- }
-
Rpr* procedure = port->port_rpr;
if (!procedure) {
procedure = port->port_rpr = new Rpr;
@@ -5112,10 +4930,7 @@
// so we have to clear the wire before the response can be received
// In addtion to the above we grab all the records in case of XNET as
// we need to clear the queue
- bool clear_queue = false;
- if (id != statement->rsr_id || port->port_type == rem_port::XNET) {
- clear_queue = true;
- }
+ const bool clear_queue = (id != statement->rsr_id || port->port_type == rem_port::XNET);
statement->rsr_flags.set(Rsr::FETCHED);
while (true)
Modified: firebird/trunk/src/remote/inet.cpp
===================================================================
--- firebird/trunk/src/remote/inet.cpp 2012-01-05 03:22:12 UTC (rev 53812)
+++ firebird/trunk/src/remote/inet.cpp 2012-01-06 11:24:37 UTC (rev 53813)
@@ -434,10 +434,6 @@
static in_addr get_bind_address();
static int get_host_address(const char* name, in_addr* const host_addr_arr, const int arr_size);
-static void copy_p_cnct_repeat_array( p_cnct::p_cnct_repeat* pDest,
- const p_cnct::p_cnct_repeat* pSource,
- size_t nEntries);
-
static int inet_destroy(XDR*);
static void inet_gen_error(bool, rem_port*, const Firebird::Arg::StatusVector& v);
static bool_t inet_getbytes(XDR*, SCHAR *, u_int);
@@ -595,45 +591,24 @@
cnct->p_cnct_user_id.cstr_length = (USHORT) user_id.getBufferLength();
cnct->p_cnct_user_id.cstr_address = user_id.getBuffer();
- static const p_cnct::p_cnct_repeat protocols_to_try1[] =
+ static const p_cnct::p_cnct_repeat protocols_to_try[] =
{
- REMOTE_PROTOCOL(PROTOCOL_VERSION8, ptype_lazy_send, 1),
- REMOTE_PROTOCOL(PROTOCOL_VERSION10, ptype_lazy_send, 2),
- REMOTE_PROTOCOL(PROTOCOL_VERSION11, ptype_lazy_send, 3),
- REMOTE_PROTOCOL(PROTOCOL_VERSION12, ptype_lazy_send, 4),
- REMOTE_PROTOCOL(PROTOCOL_VERSION13, ptype_lazy_send, 5)
+ REMOTE_PROTOCOL(PROTOCOL_VERSION10, ptype_lazy_send, 1),
+ REMOTE_PROTOCOL(PROTOCOL_VERSION11, ptype_lazy_send, 2),
+ REMOTE_PROTOCOL(PROTOCOL_VERSION12, ptype_lazy_send, 3),
+ REMOTE_PROTOCOL(PROTOCOL_VERSION13, ptype_lazy_send, 4)
};
+ fb_assert(FB_NELEM(protocols_to_try) <= FB_NELEM(cnct->p_cnct_versions));
+ cnct->p_cnct_count = FB_NELEM(protocols_to_try);
- cnct->p_cnct_count = FB_NELEM(protocols_to_try1);
+ for (size_t i = 0; i < cnct->p_cnct_count; i++) {
+ cnct->p_cnct_versions[i] = protocols_to_try[i];
+ }
- copy_p_cnct_repeat_array(cnct->p_cnct_versions, protocols_to_try1, cnct->p_cnct_count);
-
// Try connection using first set of protocols
rem_port* port = inet_try_connect(packet, rdb, file_name, node_name, dpb);
- if (packet->p_operation == op_reject && !uv_flag)
- {
- disconnect(port);
-
- // try again with next set of known protocols
-
- cnct->p_cnct_user_id.cstr_length = (USHORT) user_id.getBufferLength();
- cnct->p_cnct_user_id.cstr_address = user_id.getBuffer();
-
- static const p_cnct::p_cnct_repeat protocols_to_try2[] =
- {
- REMOTE_PROTOCOL(PROTOCOL_VERSION6, ptype_batch_send, 1),
- REMOTE_PROTOCOL(PROTOCOL_VERSION7, ptype_lazy_send, 2)
- };
-
- cnct->p_cnct_count = FB_NELEM(protocols_to_try2);
-
- copy_p_cnct_repeat_array(cnct->p_cnct_versions, protocols_to_try2, cnct->p_cnct_count);
-
- port = inet_try_connect(packet, rdb, file_name, node_name, dpb);
- }
-
P_ACPT* accept = NULL;
switch (packet->p_operation)
{
@@ -1964,20 +1939,7 @@
return 0;
}
-//____________________________________________________________
-//
-// Copy an array of p_cnct::p_cnct_repeat.
-//
-static void copy_p_cnct_repeat_array( p_cnct::p_cnct_repeat* pDest,
- const p_cnct::p_cnct_repeat* pSource,
- size_t nEntries)
-{
- for (size_t i = 0; i < nEntries; ++i) {
- pDest[i] = pSource[i];
- }
-}
-
static rem_port* receive( rem_port* main_port, PACKET * packet)
{
/**************************************
@@ -2079,10 +2041,8 @@
if (port->port_dummy_timeout < 0)
{
port->port_dummy_timeout = port->port_dummy_packet_interval;
- if (port->port_flags & PORT_async || port->port_protocol < PROTOCOL_VERSION8)
- {
+ if (port->port_flags & PORT_async)
continue;
- }
*length = 0;
return true;
}
@@ -3016,7 +2976,7 @@
timeout.tv_sec = port->port_connect_timeout;
time_ptr = &timeout;
}
- else if (port->port_protocol >= PROTOCOL_VERSION8 && port->port_dummy_packet_interval > 0)
+ else if (port->port_dummy_packet_interval > 0)
{
// Set the time interval for sending dummy packets to the client
timeout.tv_sec = port->port_dummy_packet_interval;
@@ -3084,7 +3044,7 @@
return false;
}
- if (!slct_count && port->port_protocol >= PROTOCOL_VERSION8)
+ if (!slct_count)
{
#ifdef DEBUG
if (INET_trace & TRACE_operations)
Modified: firebird/trunk/src/remote/os/win32/wnet.cpp
===================================================================
--- firebird/trunk/src/remote/os/win32/wnet.cpp 2012-01-05 03:22:12 UTC (rev 53812)
+++ firebird/trunk/src/remote/os/win32/wnet.cpp 2012-01-06 11:24:37 UTC (rev 53813)
@@ -174,19 +174,18 @@
cnct->p_cnct_user_id.cstr_length = (USHORT) user_id.getBufferLength();
cnct->p_cnct_user_id.cstr_address = user_id.getBuffer();
- static const p_cnct::p_cnct_repeat protocols_to_try1[] =
+ static const p_cnct::p_cnct_repeat protocols_to_try[] =
{
- REMOTE_PROTOCOL(PROTOCOL_VERSION7, ptype_batch_send, 1),
- REMOTE_PROTOCOL(PROTOCOL_VERSION8, ptype_batch_send, 2),
- REMOTE_PROTOCOL(PROTOCOL_VERSION10, ptype_batch_send, 3),
- REMOTE_PROTOCOL(PROTOCOL_VERSION11, ptype_batch_send, 4),
- REMOTE_PROTOCOL(PROTOCOL_VERSION12, ptype_batch_send, 5),
- REMOTE_PROTOCOL(PROTOCOL_VERSION13, ptype_batch_send, 6)
+ REMOTE_PROTOCOL(PROTOCOL_VERSION10, ptype_batch_send, 1),
+ REMOTE_PROTOCOL(PROTOCOL_VERSION11, ptype_batch_send, 2),
+ REMOTE_PROTOCOL(PROTOCOL_VERSION12, ptype_batch_send, 3),
+ REMOTE_PROTOCOL(PROTOCOL_VERSION13, ptype_batch_send, 4)
};
- cnct->p_cnct_count = FB_NELEM(protocols_to_try1);
+ fb_assert(FB_NELEM(protocols_to_try) <= FB_NELEM(cnct->p_cnct_versions));
+ cnct->p_cnct_count = FB_NELEM(protocols_to_try);
for (size_t i = 0; i < cnct->p_cnct_count; i++) {
- cnct->p_cnct_versions[i] = protocols_to_try1[i];
+ cnct->p_cnct_versions[i] = protocols_to_try[i];
}
// If we can't talk to a server, punt. Let somebody else generate an error.
@@ -208,91 +207,6 @@
port->port_context = rdb;
port->receive(packet);
- if (packet->p_operation == op_reject && !uv_flag)
- {
- disconnect(port);
- packet->p_operation = op_connect;
- cnct->p_cnct_operation = op_attach;
- cnct->p_cnct_cversion = CONNECT_VERSION2;
- cnct->p_cnct_client = ARCHITECTURE;
- cnct->p_cnct_file.cstr_length = (USHORT) file_name.length();
- cnct->p_cnct_file.cstr_address = reinterpret_cast<const UCHAR*>(file_name.c_str());
-
- // try again with next set of known protocols
-
- cnct->p_cnct_user_id.cstr_length = (USHORT) user_id.getBufferLength();
- cnct->p_cnct_user_id.cstr_address = user_id.getBuffer();
-
- static const p_cnct::p_cnct_repeat protocols_to_try2[] =
- {
- REMOTE_PROTOCOL(PROTOCOL_VERSION4, ptype_batch_send, 1),
- REMOTE_PROTOCOL(PROTOCOL_VERSION6, ptype_batch_send, 2),
- };
- cnct->p_cnct_count = FB_NELEM(protocols_to_try2);
-
- for (size_t i = 0; i < cnct->p_cnct_count; i++) {
- cnct->p_cnct_versions[i] = protocols_to_try2[i];
- }
-
- try
- {
- port = WNET_connect(node_name, packet, 0);
- }
- catch (const Exception&)
- {
- delete rdb;
- throw;
- }
-
- // Get response packet from server.
-
- rdb->rdb_port = port;
- port->port_context = rdb;
- port->receive(packet);
- }
-
- if (packet->p_operation == op_reject && !uv_flag)
- {
- disconnect(port);
- packet->p_operation = op_connect;
- cnct->p_cnct_operation = op_attach;
- cnct->p_cnct_cversion = CONNECT_VERSION2;
- cnct->p_cnct_client = ARCHITECTURE;
- cnct->p_cnct_file.cstr_length = (USHORT) file_name.length();
- cnct->p_cnct_file.cstr_address = reinterpret_cast<const UCHAR*>(file_name.c_str());
-
- // try again with next set of known protocols
-
- cnct->p_cnct_user_id.cstr_length = (USHORT) user_id.getBufferLength();
- cnct->p_cnct_user_id.cstr_address = user_id.getBuffer();
-
- static const p_cnct::p_cnct_repeat protocols_to_try3[] =
- {
- REMOTE_PROTOCOL(PROTOCOL_VERSION3, ptype_batch_send, 1)
- };
- cnct->p_cnct_count = FB_NELEM(protocols_to_try3);
-
- for (size_t i = 0; i < cnct->p_cnct_count; i++) {
- cnct->p_cnct_versions[i] = protocols_to_try3[i];
- }
-
- try
- {
- port = WNET_connect(node_name, packet, 0);
- }
- catch (const Exception&)
- {
- delete rdb;
- throw;
- }
-
- // Get response packet from server.
-
- rdb->rdb_port = port;
- port->port_context = rdb;
- port->receive(packet);
- }
-
P_ACPT* accept = NULL;
switch (packet->p_operation)
{
Modified: firebird/trunk/src/remote/os/win32/xnet.cpp
===================================================================
--- firebird/trunk/src/remote/os/win32/xnet.cpp 2012-01-05 03:22:12 UTC (rev 53812)
+++ firebird/trunk/src/remote/os/win32/xnet.cpp 2012-01-06 11:24:37 UTC (rev 53813)
@@ -256,19 +256,18 @@
cnct->p_cnct_user_id.cstr_length = (USHORT) user_id.getBufferLength();
cnct->p_cnct_user_id.cstr_address = user_id.getBuffer();
- static const p_cnct::p_cnct_repeat protocols_to_try1[] =
+ static const p_cnct::p_cnct_repeat protocols_to_try[] =
{
- REMOTE_PROTOCOL(PROTOCOL_VERSION7, ptype_batch_send, 1),
- REMOTE_PROTOCOL(PROTOCOL_VERSION8, ptype_batch_send, 2),
- REMOTE_PROTOCOL(PROTOCOL_VERSION10, ptype_batch_send, 3),
- REMOTE_PROTOCOL(PROTOCOL_VERSION11, ptype_batch_send, 4),
- REMOTE_PROTOCOL(PROTOCOL_VERSION12, ptype_batch_send, 5),
- REMOTE_PROTOCOL(PROTOCOL_VERSION13, ptype_batch_send, 6)
+ REMOTE_PROTOCOL(PROTOCOL_VERSION10, ptype_batch_send, 1),
+ REMOTE_PROTOCOL(PROTOCOL_VERSION11, ptype_batch_send, 2),
+ REMOTE_PROTOCOL(PROTOCOL_VERSION12, ptype_batch_send, 3),
+ REMOTE_PROTOCOL(PROTOCOL_VERSION13, ptype_batch_send, 4)
};
- cnct->p_cnct_count = FB_NELEM(protocols_to_try1);
+ fb_assert(FB_NELEM(protocols_to_try) <= FB_NELEM(cnct->p_cnct_versions));
+ cnct->p_cnct_count = FB_NELEM(protocols_to_try);
for (size_t i = 0; i < cnct->p_cnct_count; i++) {
- cnct->p_cnct_versions[i] = protocols_to_try1[i];
+ cnct->p_cnct_versions[i] = protocols_to_try[i];
}
// If we can't talk to a server, punt. Let somebody else generate an error.
@@ -290,91 +289,6 @@
port->port_context = rdb;
port->receive(packet);
- if (packet->p_operation == op_reject && !uv_flag)
- {
- disconnect(port);
- packet->p_operation = op_connect;
- cnct->p_cnct_operation = op_attach;
- cnct->p_cnct_cversion = CONNECT_VERSION2;
- cnct->p_cnct_client = ARCHITECTURE;
- cnct->p_cnct_file.cstr_length = (USHORT) file_name.length();
- cnct->p_cnct_file.cstr_address = reinterpret_cast<const UCHAR*>(file_name.c_str());
-
- // try again with next set of known protocols
-
- cnct->p_cnct_user_id.cstr_length = (USHORT) user_id.getBufferLength();
- cnct->p_cnct_user_id.cstr_address = user_id.getBuffer();
-
- static const p_cnct::p_cnct_repeat protocols_to_try2[] =
- {
- REMOTE_PROTOCOL(PROTOCOL_VERSION4, ptype_batch_send, 1),
- REMOTE_PROTOCOL(PROTOCOL_VERSION6, ptype_batch_send, 2),
- };
- cnct->p_cnct_count = FB_NELEM(protocols_to_try2);
-
- for (size_t i = 0; i < cnct->p_cnct_count; i++) {
- cnct->p_cnct_versions[i] = protocols_to_try2[i];
- }
-
- try
- {
- port = XNET_connect(packet, 0);
- }
- catch (const Exception&)
- {
- delete rdb;
- throw;
- }
-
- // Get response packet from server
-
- rdb->rdb_port = port;
- port->port_context = rdb;
- port->receive(packet);
- }
-
- if (packet->p_operation == op_reject && !uv_flag)
- {
- disconnect(port);
- packet->p_operation = op_connect;
- cnct->p_cnct_operation = op_attach;
- cnct->p_cnct_cversion = CONNECT_VERSION2;
- cnct->p_cnct_client = ARCHITECTURE;
- cnct->p_cnct_file.cstr_length = (USHORT) file_name.length();
- cnct->p_cnct_file.cstr_address = reinterpret_cast<const UCHAR*>(file_name.c_str());
-
- // try again with next set of known protocols
-
- cnct->p_cnct_user_id.cstr_length = (USHORT) user_id.getBufferLength();
- cnct->p_cnct_user_id.cstr_address = user_id.getBuffer();
-
- static const p_cnct::p_cnct_repeat protocols_to_try3[] =
- {
- REMOTE_PROTOCOL(PROTOCOL_VERSION3, ptype_batch_send, 1)
- };
- cnct->p_cnct_count = FB_NELEM(protocols_to_try3);
-
- for (size_t i = 0; i < cnct->p_cnct_count; i++) {
- cnct->p_cnct_versions[i] = protocols_to_try3[i];
- }
-
- try
- {
- port = XNET_connect(packet, 0);
- }
- catch (const Exception&)
- {
- delete rdb;
- throw;
- }
-
- // Get response packet from server
-
- rdb->rdb_port = port;
- port->port_context = rdb;
- port->receive(packet);
- }
-
P_ACPT* accept = NULL;
switch (packet->p_operation)
{
Modified: firebird/trunk/src/remote/parse_proto.h
===================================================================
--- firebird/trunk/src/remote/parse_proto.h 2012-01-05 03:22:12 UTC (rev 53812)
+++ firebird/trunk/src/remote/parse_proto.h 2012-01-06 11:24:37 UTC (rev 53813)
@@ -25,6 +25,5 @@
#define REMOTE_PARSE_PROTO_H
struct RMessage* PARSE_messages(const UCHAR*, USHORT);
-const UCHAR* PARSE_prepare_messages(const UCHAR*, USHORT);
#endif // REMOTE_PARSE_PROTO_H
Modified: firebird/trunk/src/remote/parser.cpp
===================================================================
--- firebird/trunk/src/remote/parser.cpp 2012-01-05 03:22:12 UTC (rev 53812)
+++ firebird/trunk/src/remote/parser.cpp 2012-01-06 11:24:37 UTC (rev 53813)
@@ -65,7 +65,6 @@
if (*blr++ != blr_begin)
return 0;
-
RMessage* message = NULL;
USHORT net_length = 0;
@@ -300,90 +299,3 @@
}
return (RMessage*) -1;
}
-
-
-const UCHAR* PARSE_prepare_messages(const UCHAR* blr, USHORT blr_length)
-{
-/**************************************
- *
- * P A R S E _ p r e p a r e _ m e s s a g e s
- *
- **************************************
- *
- * Functional description
- * Parse the messages of a blr request and convert
- * each occurrence of blr_d_float to blr_double.
- *
- * This function is only called for protocol version 5 and below
- *
- **************************************/
- const UCHAR* old_blr = blr;
- const UCHAR* new_blr = blr;
-
- const SSHORT version = *blr++;
- if ((version != blr_version4 && version != blr_version5) || *blr++ != blr_begin)
- {
- return old_blr;
- }
-
- while (*blr++ == blr_message)
- {
- blr++;
- USHORT count = *blr++;
- count += (*blr++) << 8;
- for (; count; --count)
- switch (*blr++)
- {
- case blr_text2:
- case blr_varying2:
- case blr_cstring2:
- blr += 4; // SUBTYPE word & LENGTH word
- break;
- case blr_text:
- case blr_varying:
- case blr_cstring:
- blr += 2; // LENGTH word
- break;
- case blr_short:
- case blr_long:
- case blr_int64:
- case blr_quad:
- blr++; // SCALE byte
- break;
- case blr_float:
- case blr_double:
- case blr_timestamp:
- case blr_sql_date:
- case blr_sql_time:
- case blr_bool:
- break;
-
- case blr_d_float:
- if (new_blr == old_blr)
- {
- new_blr = FB_NEW(*getDefaultMemoryPool()) UCHAR[blr_length];
- // FREE: Never freed, blr_d_float is VMS specific
-#ifdef DEBUG_REMOTE_MEMORY
- printf("PARSE_prepare_messages allocate blr %x\n", new_blr);
-#endif
- // Safe const_cast, we are allocating new space for new_blr
- memcpy(const_cast<UCHAR*>(new_blr), old_blr, blr_length);
- blr = new_blr + (int) (blr - old_blr);
- }
-
- // It's safe because blr has been replaced by new space,
- // we aren't overwriting the original const parameter.
- fb_assert(new_blr != old_blr);
- const_cast<UCHAR*>(blr)[-1] = blr_double;
- break;
-
- default:
- DEV_REPORT("Unexpected BLR in PARSE_prepare_messages()");
- // This old code would return, so we will also
- return new_blr;
- }
- }
-
- return new_blr;
-}
-
Modified: firebird/trunk/src/remote/protocol.cpp
===================================================================
--- firebird/trunk/src/remote/protocol.cpp 2012-01-05 03:22:12 UTC (rev 53812)
+++ firebird/trunk/src/remote/protocol.cpp 2012-01-06 11:24:37 UTC (rev 53813)
@@ -244,7 +244,6 @@
*
**************************************/
p_cnct::p_cnct_repeat* tail;
- const rem_port* port;
P_ACPT *accept;
P_ACPD *accept_with_data;
P_ATCH *attach;
@@ -682,9 +681,7 @@
// Changes to this op's protocol must mirror in xdr_protocol_overhead
- port = (rem_port*) xdrs->x_public;
- if ((port->port_protocol > PROTOCOL_VERSION7 && sqldata->p_sqldata_messages) ||
- (port->port_protocol <= PROTOCOL_VERSION7 && !sqldata->p_sqldata_status))
+ if (sqldata->p_sqldata_messages)
{
return xdr_sql_message(xdrs, (SLONG)sqldata->p_sqldata_statement) ?
P_TRUE(xdrs, p) : P_FALSE(xdrs, p);
Modified: firebird/trunk/src/remote/protocol.h
===================================================================
--- firebird/trunk/src/remote/protocol.h 2012-01-05 03:22:12 UTC (rev 53812)
+++ firebird/trunk/src/remote/protocol.h 2012-01-06 11:24:37 UTC (rev 53813)
@@ -48,37 +48,6 @@
// p_cnct_version
const USHORT CONNECT_VERSION2 = 2;
-// Protocol 4 is protocol 3 plus server management functions
-
-const USHORT PROTOCOL_VERSION3 = 3;
-const USHORT PROTOCOL_VERSION4 = 4;
-
-// Protocol 5 includes support for a d_float data type
-
-const USHORT PROTOCOL_VERSION5 = 5;
-
-// Protocol 6 includes support for cancel remote events, blob seek,
-// and unknown message type
-
-const USHORT PROTOCOL_VERSION6 = 6;
-
-// Protocol 7 includes DSQL support
-
-const USHORT PROTOCOL_VERSION7 = 7;
-
-// Protocol 8 includes collapsing first receive into a send, drop database,
-// DSQL execute 2, DSQL execute immediate 2, DSQL insert, services, and
-// transact request
-
-const USHORT PROTOCOL_VERSION8 = 8;
-
-// 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
-
-const USHORT PROTOCOL_VERSION9 = 9;
-
// Protocol 10 includes support for warnings and removes the requirement for
// encoding and decoding status codes
@@ -364,19 +333,19 @@
{
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_min_type; // Minimum type (unused)
USHORT p_cnct_max_type; // Maximum type
USHORT p_cnct_weight; // Preference weight
} p_cnct_versions[10];
} P_CNCT;
#ifdef ASYMMETRIC_PROTOCOLS_ONLY
-#define REMOTE_PROTOCOL(version, max_type, weight) \
- {version, arch_generic, ptype_batch_send, max_type, weight * 2}
+#define REMOTE_PROTOCOL(version, type, weight) \
+ {version, arch_generic, 0, type, weight * 2}
#else
-#define REMOTE_PROTOCOL(version, max_type, weight) \
- {version, arch_generic, ptype_batch_send, max_type, weight * 2}, \
- {version, ARCHITECTURE, ptype_batch_send, max_type, weight * 2 + 1}
+#define REMOTE_PROTOCOL(version, type, weight) \
+ {version, arch_generic, 0, type, weight * 2}, \
+ {version, ARCHITECTURE, 0, type, weight * 2 + 1}
#endif
/* User identification data, if any, is of form:
Modified: firebird/trunk/src/remote/server/server.cpp
===================================================================
--- firebird/trunk/src/remote/server/server.cpp 2012-01-05 03:22:12 UTC (rev 53812)
+++ firebird/trunk/src/remote/server/server.cpp 2012-01-06 11:24:37 UTC (rev 53813)
@@ -1324,14 +1324,7 @@
for (const p_cnct::p_cnct_repeat* const end = protocol + connect->p_cnct_count;
protocol < end; protocol++)
{
- if ((protocol->p_cnct_version == PROTOCOL_VERSION3 ||
- protocol->p_cnct_version == PROTOCOL_VERSION4 ||
- protocol->p_cnct_version == PROTOCOL_VERSION5 ||
- protocol->p_cnct_version == PROTOCOL_VERSION6 ||
- protocol->p_cnct_version == PROTOCOL_VERSION7 ||
- protocol->p_cnct_version == PROTOCOL_VERSION8 ||
- protocol->p_cnct_version == PROTOCOL_VERSION9 ||
- protocol->p_cnct_version == PROTOCOL_VERSION10 ||
+ if ((protocol->p_cnct_version == PROTOCOL_VERSION10 ||
protocol->p_cnct_version == PROTOCOL_VERSION11 ||
protocol->p_cnct_version == PROTOCOL_VERSION12 ||
protocol->p_cnct_version == PROTOCOL_VERSION13) &&
@@ -2811,12 +2804,7 @@
statement->rsr_msgs_waiting--;
}
- // For compatibility with Protocol 7, we must break out of the
- // loop before sending the last record.
-
count--;
- if (this->port_protocol <= PROTOCOL_VERSION7 && count <= 0)
- break;
// There's a buffer waiting -- send it
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|