8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-22 21:23:04 +01:00

Simplify 'Firebird' namespace usage in remote.

This commit is contained in:
Vlad Khorsun 2024-11-07 14:28:41 +02:00
parent e78b721256
commit 216fb3e164
9 changed files with 256 additions and 250 deletions

View File

@ -201,8 +201,8 @@ public:
void cancel(CheckStatusWrapper* status) override; void cancel(CheckStatusWrapper* status) override;
void close(CheckStatusWrapper* status) override; void close(CheckStatusWrapper* status) override;
int seek(CheckStatusWrapper* status, int mode, int offset) override; // returns position int seek(CheckStatusWrapper* status, int mode, int offset) override; // returns position
void deprecatedCancel(Firebird::CheckStatusWrapper* status) override; void deprecatedCancel(CheckStatusWrapper* status) override;
void deprecatedClose(Firebird::CheckStatusWrapper* status) override; void deprecatedClose(CheckStatusWrapper* status) override;
public: public:
explicit Blob(Rbl* handle) explicit Blob(Rbl* handle)
@ -213,8 +213,8 @@ public:
private: private:
void freeClientData(CheckStatusWrapper* status, bool force = false); void freeClientData(CheckStatusWrapper* status, bool force = false);
void internalCancel(Firebird::CheckStatusWrapper* status); void internalCancel(CheckStatusWrapper* status);
void internalClose(Firebird::CheckStatusWrapper* status); void internalClose(CheckStatusWrapper* status);
Rbl* blob; Rbl* blob;
}; };
@ -255,9 +255,9 @@ public:
ITransaction* join(CheckStatusWrapper* status, ITransaction* tra) override; ITransaction* join(CheckStatusWrapper* status, ITransaction* tra) override;
Transaction* validate(CheckStatusWrapper* status, IAttachment* attachment) override; Transaction* validate(CheckStatusWrapper* status, IAttachment* attachment) override;
Transaction* enterDtc(CheckStatusWrapper* status) override; Transaction* enterDtc(CheckStatusWrapper* status) override;
void deprecatedCommit(Firebird::CheckStatusWrapper* status) override; void deprecatedCommit(CheckStatusWrapper* status) override;
void deprecatedRollback(Firebird::CheckStatusWrapper* status) override; void deprecatedRollback(CheckStatusWrapper* status) override;
void deprecatedDisconnect(Firebird::CheckStatusWrapper* status) override; void deprecatedDisconnect(CheckStatusWrapper* status) override;
public: public:
Transaction(Rtr* handle, Attachment* a) Transaction(Rtr* handle, Attachment* a)
@ -284,9 +284,9 @@ private:
{ } { }
void freeClientData(CheckStatusWrapper* status, bool force = false); void freeClientData(CheckStatusWrapper* status, bool force = false);
void internalCommit(Firebird::CheckStatusWrapper* status); void internalCommit(CheckStatusWrapper* status);
void internalRollback(Firebird::CheckStatusWrapper* status); void internalRollback(CheckStatusWrapper* status);
void internalDisconnect(Firebird::CheckStatusWrapper* status); void internalDisconnect(CheckStatusWrapper* status);
Attachment* remAtt; Attachment* remAtt;
Rtr* transaction; Rtr* transaction;
@ -375,26 +375,26 @@ public:
// IBatch implementation // IBatch implementation
int release() override; int release() override;
void add(Firebird::CheckStatusWrapper* status, unsigned count, const void* inBuffer) override; void add(CheckStatusWrapper* status, unsigned count, const void* inBuffer) override;
void addBlob(Firebird::CheckStatusWrapper* status, unsigned length, const void* inBuffer, ISC_QUAD* blobId, void addBlob(CheckStatusWrapper* status, unsigned length, const void* inBuffer, ISC_QUAD* blobId,
unsigned parLength, const unsigned char* par) override; unsigned parLength, const unsigned char* par) override;
void appendBlobData(Firebird::CheckStatusWrapper* status, unsigned length, const void* inBuffer) override; void appendBlobData(CheckStatusWrapper* status, unsigned length, const void* inBuffer) override;
void addBlobStream(Firebird::CheckStatusWrapper* status, unsigned length, const void* inBuffer) override; void addBlobStream(CheckStatusWrapper* status, unsigned length, const void* inBuffer) override;
void registerBlob(Firebird::CheckStatusWrapper* status, const ISC_QUAD* existingBlob, ISC_QUAD* blobId) override; void registerBlob(CheckStatusWrapper* status, const ISC_QUAD* existingBlob, ISC_QUAD* blobId) override;
Firebird::IBatchCompletionState* execute(Firebird::CheckStatusWrapper* status, Firebird::ITransaction* transaction) override; IBatchCompletionState* execute(CheckStatusWrapper* status, ITransaction* transaction) override;
void cancel(Firebird::CheckStatusWrapper* status) override; void cancel(CheckStatusWrapper* status) override;
unsigned getBlobAlignment(Firebird::CheckStatusWrapper* status) override; unsigned getBlobAlignment(CheckStatusWrapper* status) override;
void setDefaultBpb(Firebird::CheckStatusWrapper* status, unsigned parLength, const unsigned char* par) override; void setDefaultBpb(CheckStatusWrapper* status, unsigned parLength, const unsigned char* par) override;
Firebird::IMessageMetadata* getMetadata(Firebird::CheckStatusWrapper* status) override; IMessageMetadata* getMetadata(CheckStatusWrapper* status) override;
void close(Firebird::CheckStatusWrapper* status) override; void close(CheckStatusWrapper* status) override;
void deprecatedClose(Firebird::CheckStatusWrapper* status) override; void deprecatedClose(CheckStatusWrapper* status) override;
void getInfo(CheckStatusWrapper* status, void getInfo(CheckStatusWrapper* status,
unsigned int itemsLength, const unsigned char* items, unsigned int itemsLength, const unsigned char* items,
unsigned int bufferLength, unsigned char* buffer) override; unsigned int bufferLength, unsigned char* buffer) override;
private: private:
void freeClientData(CheckStatusWrapper* status, bool force = false); void freeClientData(CheckStatusWrapper* status, bool force = false);
void internalClose(Firebird::CheckStatusWrapper* status); void internalClose(CheckStatusWrapper* status);
void releaseStatement(); void releaseStatement();
void setServerInfo(); void setServerInfo();
@ -580,7 +580,7 @@ private:
void sendMessagePacket(unsigned size, const UCHAR* ptr, bool flash); void sendMessagePacket(unsigned size, const UCHAR* ptr, bool flash);
void sendDeferredPacket(IStatus* status, rem_port* port, PACKET* packet, bool flash); void sendDeferredPacket(IStatus* status, rem_port* port, PACKET* packet, bool flash);
Firebird::AutoPtr<UCHAR, Firebird::ArrayDelete> messageStreamBuffer, blobStreamBuffer; AutoPtr<UCHAR, ArrayDelete> messageStreamBuffer, blobStreamBuffer;
ULONG messageStream; ULONG messageStream;
UCHAR* blobStream; UCHAR* blobStream;
ULONG* sizePointer; ULONG* sizePointer;
@ -660,8 +660,8 @@ public:
unsigned int bufferLength, unsigned char* buffer) override; unsigned int bufferLength, unsigned char* buffer) override;
unsigned getType(CheckStatusWrapper* status) override; unsigned getType(CheckStatusWrapper* status) override;
const char* getPlan(CheckStatusWrapper* status, FB_BOOLEAN detailed) override; const char* getPlan(CheckStatusWrapper* status, FB_BOOLEAN detailed) override;
Firebird::IMessageMetadata* getInputMetadata(CheckStatusWrapper* status) override; IMessageMetadata* getInputMetadata(CheckStatusWrapper* status) override;
Firebird::IMessageMetadata* getOutputMetadata(CheckStatusWrapper* status) override; IMessageMetadata* getOutputMetadata(CheckStatusWrapper* status) override;
ISC_UINT64 getAffectedRecords(CheckStatusWrapper* status) override; ISC_UINT64 getAffectedRecords(CheckStatusWrapper* status) override;
ITransaction* execute(CheckStatusWrapper* status, ITransaction* tra, ITransaction* execute(CheckStatusWrapper* status, ITransaction* tra,
IMessageMetadata* inMetadata, void* inBuffer, IMessageMetadata* inMetadata, void* inBuffer,
@ -768,8 +768,8 @@ public:
void getInfo(CheckStatusWrapper* status, int level, void getInfo(CheckStatusWrapper* status, int level,
unsigned int itemsLength, const unsigned char* items, unsigned int itemsLength, const unsigned char* items,
unsigned int bufferLength, unsigned char* buffer) override; unsigned int bufferLength, unsigned char* buffer) override;
void start(CheckStatusWrapper* status, Firebird::ITransaction* tra, int level) override; void start(CheckStatusWrapper* status, ITransaction* tra, int level) override;
void startAndSend(CheckStatusWrapper* status, Firebird::ITransaction* tra, int level, unsigned int msg_type, void startAndSend(CheckStatusWrapper* status, ITransaction* tra, int level, unsigned int msg_type,
unsigned int length, const void* message) override; unsigned int length, const void* message) override;
void unwind(CheckStatusWrapper* status, int level) override; void unwind(CheckStatusWrapper* status, int level) override;
void free(CheckStatusWrapper* status) override; void free(CheckStatusWrapper* status) override;
@ -858,17 +858,17 @@ public:
void getInfo(CheckStatusWrapper* status, void getInfo(CheckStatusWrapper* status,
unsigned int itemsLength, const unsigned char* items, unsigned int itemsLength, const unsigned char* items,
unsigned int bufferLength, unsigned char* buffer) override; unsigned int bufferLength, unsigned char* buffer) override;
Firebird::ITransaction* startTransaction(CheckStatusWrapper* status, ITransaction* startTransaction(CheckStatusWrapper* status,
unsigned int tpbLength, const unsigned char* tpb) override; unsigned int tpbLength, const unsigned char* tpb) override;
Firebird::ITransaction* reconnectTransaction(CheckStatusWrapper* status, unsigned int length, const unsigned char* id) override; ITransaction* reconnectTransaction(CheckStatusWrapper* status, unsigned int length, const unsigned char* id) override;
Firebird::IRequest* compileRequest(CheckStatusWrapper* status, unsigned int blr_length, const unsigned char* blr) override; IRequest* compileRequest(CheckStatusWrapper* status, unsigned int blr_length, const unsigned char* blr) override;
void transactRequest(CheckStatusWrapper* status, ITransaction* transaction, void transactRequest(CheckStatusWrapper* status, ITransaction* transaction,
unsigned int blr_length, const unsigned char* blr, unsigned int blr_length, const unsigned char* blr,
unsigned int in_msg_length, const unsigned char* in_msg, unsigned int in_msg_length, const unsigned char* in_msg,
unsigned int out_msg_length, unsigned char* out_msg) override; unsigned int out_msg_length, unsigned char* out_msg) override;
Firebird::IBlob* createBlob(CheckStatusWrapper* status, ITransaction* transaction, IBlob* createBlob(CheckStatusWrapper* status, ITransaction* transaction,
ISC_QUAD* id, unsigned int bpbLength = 0, const unsigned char* bpb = 0) override; ISC_QUAD* id, unsigned int bpbLength = 0, const unsigned char* bpb = 0) override;
Firebird::IBlob* openBlob(CheckStatusWrapper* status, ITransaction* transaction, IBlob* openBlob(CheckStatusWrapper* status, ITransaction* transaction,
ISC_QUAD* id, unsigned int bpbLength = 0, const unsigned char* bpb = 0) override; ISC_QUAD* id, unsigned int bpbLength = 0, const unsigned char* bpb = 0) override;
int getSlice(CheckStatusWrapper* status, ITransaction* transaction, ISC_QUAD* id, int getSlice(CheckStatusWrapper* status, ITransaction* transaction, ISC_QUAD* id,
unsigned int sdl_length, const unsigned char* sdl, unsigned int sdl_length, const unsigned char* sdl,
@ -882,32 +882,32 @@ public:
const unsigned char* dyn) override; const unsigned char* dyn) override;
Statement* prepare(CheckStatusWrapper* status, ITransaction* transaction, Statement* prepare(CheckStatusWrapper* status, ITransaction* transaction,
unsigned int stmtLength, const char* sqlStmt, unsigned dialect, unsigned int flags) override; unsigned int stmtLength, const char* sqlStmt, unsigned dialect, unsigned int flags) override;
Firebird::ITransaction* execute(CheckStatusWrapper* status, ITransaction* transaction, ITransaction* execute(CheckStatusWrapper* status, ITransaction* transaction,
unsigned int stmtLength, const char* sqlStmt, unsigned dialect, unsigned int stmtLength, const char* sqlStmt, unsigned dialect,
IMessageMetadata* inMetadata, void* inBuffer, IMessageMetadata* outMetadata, void* outBuffer) override; IMessageMetadata* inMetadata, void* inBuffer, IMessageMetadata* outMetadata, void* outBuffer) override;
Firebird::IResultSet* openCursor(CheckStatusWrapper* status, ITransaction* transaction, IResultSet* openCursor(CheckStatusWrapper* status, ITransaction* transaction,
unsigned int stmtLength, const char* sqlStmt, unsigned dialect, unsigned int stmtLength, const char* sqlStmt, unsigned dialect,
IMessageMetadata* inMetadata, void* inBuffer, Firebird::IMessageMetadata* outMetadata, IMessageMetadata* inMetadata, void* inBuffer, IMessageMetadata* outMetadata,
const char* cursorName, unsigned int cursorFlags) override; const char* cursorName, unsigned int cursorFlags) override;
Firebird::IEvents* queEvents(CheckStatusWrapper* status, Firebird::IEventCallback* callback, IEvents* queEvents(CheckStatusWrapper* status, IEventCallback* callback,
unsigned int length, const unsigned char* events) override; unsigned int length, const unsigned char* events) override;
void cancelOperation(CheckStatusWrapper* status, int option) override; void cancelOperation(CheckStatusWrapper* status, int option) override;
void ping(CheckStatusWrapper* status) override; void ping(CheckStatusWrapper* status) override;
void detach(CheckStatusWrapper* status) override; void detach(CheckStatusWrapper* status) override;
void dropDatabase(CheckStatusWrapper* status) override; void dropDatabase(CheckStatusWrapper* status) override;
void deprecatedDetach(Firebird::CheckStatusWrapper* status) override; void deprecatedDetach(CheckStatusWrapper* status) override;
void deprecatedDropDatabase(Firebird::CheckStatusWrapper* status) override; void deprecatedDropDatabase(CheckStatusWrapper* status) override;
unsigned int getIdleTimeout(CheckStatusWrapper* status) override; unsigned int getIdleTimeout(CheckStatusWrapper* status) override;
void setIdleTimeout(CheckStatusWrapper* status, unsigned int timeOut) override; void setIdleTimeout(CheckStatusWrapper* status, unsigned int timeOut) override;
unsigned int getStatementTimeout(CheckStatusWrapper* status) override; unsigned int getStatementTimeout(CheckStatusWrapper* status) override;
void setStatementTimeout(CheckStatusWrapper* status, unsigned int timeOut) override; void setStatementTimeout(CheckStatusWrapper* status, unsigned int timeOut) override;
Batch* createBatch(Firebird::CheckStatusWrapper* status, ITransaction* transaction, Batch* createBatch(CheckStatusWrapper* status, ITransaction* transaction,
unsigned stmtLength, const char* sqlStmt, unsigned dialect, unsigned stmtLength, const char* sqlStmt, unsigned dialect,
IMessageMetadata* inMetadata, unsigned parLength, const unsigned char* par) override; IMessageMetadata* inMetadata, unsigned parLength, const unsigned char* par) override;
Replicator* createReplicator(Firebird::CheckStatusWrapper* status) override; Replicator* createReplicator(CheckStatusWrapper* status) override;
public: public:
Attachment(Rdb* handle, const PathName& path) Attachment(Rdb* handle, const PathName& path)
@ -933,8 +933,8 @@ public:
private: private:
void execWithCheck(CheckStatusWrapper* status, const string& stmt); void execWithCheck(CheckStatusWrapper* status, const string& stmt);
void freeClientData(CheckStatusWrapper* status, bool force = false); void freeClientData(CheckStatusWrapper* status, bool force = false);
void internalDetach(Firebird::CheckStatusWrapper* status); void internalDetach(CheckStatusWrapper* status);
void internalDropDatabase(Firebird::CheckStatusWrapper* status); void internalDropDatabase(CheckStatusWrapper* status);
SLONG getSingleInfo(CheckStatusWrapper* status, UCHAR infoItem); SLONG getSingleInfo(CheckStatusWrapper* status, UCHAR infoItem);
Rdb* rdb; Rdb* rdb;
@ -1026,7 +1026,7 @@ protected:
const unsigned char* spb, bool loopback); const unsigned char* spb, bool loopback);
private: private:
Firebird::ICryptKeyCallback* cryptCallback; ICryptKeyCallback* cryptCallback;
}; };
void RProvider::shutdown(CheckStatusWrapper* status, unsigned int /*timeout*/, const int /*reason*/) void RProvider::shutdown(CheckStatusWrapper* status, unsigned int /*timeout*/, const int /*reason*/)
@ -1069,7 +1069,7 @@ namespace {
SimpleFactory<Loopback> loopbackFactory; SimpleFactory<Loopback> loopbackFactory;
} }
void registerRedirector(Firebird::IPluginManager* iPlugin) void registerRedirector(IPluginManager* iPlugin)
{ {
iPlugin->registerPluginFactory(IPluginManager::TYPE_PROVIDER, "Remote", &remoteFactory); iPlugin->registerPluginFactory(IPluginManager::TYPE_PROVIDER, "Remote", &remoteFactory);
iPlugin->registerPluginFactory(IPluginManager::TYPE_PROVIDER, "Loopback", &loopbackFactory); iPlugin->registerPluginFactory(IPluginManager::TYPE_PROVIDER, "Loopback", &loopbackFactory);
@ -1101,7 +1101,7 @@ static void add_other_params(rem_port*, ClumpletWriter&, const ParametersSet&);
static void add_working_directory(ClumpletWriter&, const PathName&); static void add_working_directory(ClumpletWriter&, const PathName&);
static rem_port* analyze(ClntAuthBlock& cBlock, PathName& attach_name, unsigned flags, static rem_port* analyze(ClntAuthBlock& cBlock, PathName& attach_name, unsigned flags,
ClumpletWriter& pb, const ParametersSet& parSet, PathName& node_name, PathName* ref_db_name, ClumpletWriter& pb, const ParametersSet& parSet, PathName& node_name, PathName* ref_db_name,
Firebird::ICryptKeyCallback* cryptCb); ICryptKeyCallback* cryptCb);
static void batch_gds_receive(rem_port*, struct rmtque *, USHORT); static void batch_gds_receive(rem_port*, struct rmtque *, USHORT);
static void batch_dsql_fetch(rem_port*, struct rmtque *, USHORT); static void batch_dsql_fetch(rem_port*, struct rmtque *, USHORT);
static void clear_queue(rem_port*); static void clear_queue(rem_port*);
@ -1140,7 +1140,7 @@ static void server_death(rem_port*);
static void svcstart(CheckStatusWrapper*, Rdb*, P_OP, USHORT, USHORT, USHORT, const UCHAR*); static void svcstart(CheckStatusWrapper*, Rdb*, P_OP, USHORT, USHORT, USHORT, const UCHAR*);
static void unsupported(); static void unsupported();
static void zap_packet(PACKET *); static void zap_packet(PACKET *);
static void cleanDpb(Firebird::ClumpletWriter&, const ParametersSet*); static void cleanDpb(ClumpletWriter&, const ParametersSet*);
static void authFillParametersBlock(ClntAuthBlock& authItr, ClumpletWriter& dpb, static void authFillParametersBlock(ClntAuthBlock& authItr, ClumpletWriter& dpb,
const ParametersSet* tags, rem_port* port); const ParametersSet* tags, rem_port* port);
static void authReceiveResponse(bool havePacket, ClntAuthBlock& authItr, rem_port* port, static void authReceiveResponse(bool havePacket, ClntAuthBlock& authItr, rem_port* port,
@ -1694,7 +1694,7 @@ Transaction* Transaction::enterDtc(CheckStatusWrapper* status)
} }
Firebird::IRequest* Attachment::compileRequest(CheckStatusWrapper* status, IRequest* Attachment::compileRequest(CheckStatusWrapper* status,
unsigned int blr_length, const unsigned char* blr) unsigned int blr_length, const unsigned char* blr)
{ {
/************************************** /**************************************
@ -1772,7 +1772,7 @@ Firebird::IRequest* Attachment::compileRequest(CheckStatusWrapper* status,
message->msg_address = NULL; message->msg_address = NULL;
} }
Firebird::IRequest* r = FB_NEW Request(request, this); IRequest* r = FB_NEW Request(request, this);
r->addRef(); r->addRef();
return r; return r;
} }
@ -1851,7 +1851,7 @@ IBlob* Attachment::createBlob(CheckStatusWrapper* status, ITransaction* apiTra,
blob->rbl_next = transaction->rtr_blobs; blob->rbl_next = transaction->rtr_blobs;
transaction->rtr_blobs = blob; transaction->rtr_blobs = blob;
Firebird::IBlob* b = FB_NEW Blob(blob); IBlob* b = FB_NEW Blob(blob);
b->addRef(); b->addRef();
return b; return b;
} }
@ -1863,7 +1863,7 @@ IBlob* Attachment::createBlob(CheckStatusWrapper* status, ITransaction* apiTra,
} }
Firebird::IAttachment* RProvider::create(CheckStatusWrapper* status, const char* filename, IAttachment* RProvider::create(CheckStatusWrapper* status, const char* filename,
unsigned int dpb_length, const unsigned char* dpb, bool loopback) unsigned int dpb_length, const unsigned char* dpb, bool loopback)
{ {
/************************************** /**************************************
@ -1918,7 +1918,7 @@ Firebird::IAttachment* RProvider::create(CheckStatusWrapper* status, const char*
if (!init(status, cBlock, port, op_create, expanded_name, newDpb, intl, cryptCallback)) if (!init(status, cBlock, port, op_create, expanded_name, newDpb, intl, cryptCallback))
return NULL; return NULL;
Firebird::IAttachment* a = FB_NEW Attachment(rdb, filename); IAttachment* a = FB_NEW Attachment(rdb, filename);
a->addRef(); a->addRef();
return a; return a;
} }
@ -2120,7 +2120,7 @@ void Attachment::freeClientData(CheckStatusWrapper* status, bool force)
// free the packet and disconnect the port. Put something into firebird.log // free the packet and disconnect the port. Put something into firebird.log
// informing the user of the following. // informing the user of the following.
if (status->getState() & Firebird::IStatus::STATE_ERRORS) if (status->getState() & IStatus::STATE_ERRORS)
{ {
iscLogStatus("REMOTE INTERFACE/gds__detach: Unsuccessful detach from " iscLogStatus("REMOTE INTERFACE/gds__detach: Unsuccessful detach from "
"database.\n\tUncommitted work may have been lost.", status); "database.\n\tUncommitted work may have been lost.", status);
@ -2352,13 +2352,13 @@ Batch* Attachment::createBatch(CheckStatusWrapper* status, ITransaction* transac
* *
**************************************/ **************************************/
Statement* stmt = prepare(status, transaction, stmtLength, sqlStmt, dialect, 0); Statement* stmt = prepare(status, transaction, stmtLength, sqlStmt, dialect, 0);
if (status->getState() & Firebird::IStatus::STATE_ERRORS) if (status->getState() & IStatus::STATE_ERRORS)
{ {
return NULL; return NULL;
} }
Batch* rc = stmt->createBatch(status, inMetadata, parLength, par); Batch* rc = stmt->createBatch(status, inMetadata, parLength, par);
if (status->getState() & Firebird::IStatus::STATE_ERRORS) if (status->getState() & IStatus::STATE_ERRORS)
{ {
stmt->release(); stmt->release();
return NULL; return NULL;
@ -3543,7 +3543,7 @@ ITransaction* Statement::execute(CheckStatusWrapper* status, ITransaction* apiTr
} }
ResultSet* Statement::openCursor(CheckStatusWrapper* status, Firebird::ITransaction* apiTra, ResultSet* Statement::openCursor(CheckStatusWrapper* status, ITransaction* apiTra,
IMessageMetadata* inMetadata, void* inBuffer, IMessageMetadata* outFormat, unsigned int flags) IMessageMetadata* inMetadata, void* inBuffer, IMessageMetadata* outFormat, unsigned int flags)
{ {
/************************************** /**************************************
@ -3580,7 +3580,7 @@ ResultSet* Statement::openCursor(CheckStatusWrapper* status, Firebird::ITransact
if (!outFormat) if (!outFormat)
{ {
defaultOutputFormat.assignRefNoIncr(this->getOutputMetadata(status)); defaultOutputFormat.assignRefNoIncr(this->getOutputMetadata(status));
if (status->getState() & Firebird::IStatus::STATE_ERRORS) if (status->getState() & IStatus::STATE_ERRORS)
{ {
return NULL; return NULL;
} }
@ -3665,7 +3665,7 @@ ResultSet* Statement::openCursor(CheckStatusWrapper* status, Firebird::ITransact
sqldata->p_sqldata_cursor_flags = flags; sqldata->p_sqldata_cursor_flags = flags;
{ {
Firebird::Cleanup msgClean([&message] { Cleanup msgClean([&message] {
message->msg_address = NULL; message->msg_address = NULL;
}); });
@ -3699,13 +3699,13 @@ IResultSet* Attachment::openCursor(CheckStatusWrapper* status, ITransaction* tra
{ {
Statement* stmt = prepare(status, transaction, stmtLength, sqlStmt, dialect, Statement* stmt = prepare(status, transaction, stmtLength, sqlStmt, dialect,
(outMetadata ? 0 : IStatement::PREPARE_PREFETCH_OUTPUT_PARAMETERS)); (outMetadata ? 0 : IStatement::PREPARE_PREFETCH_OUTPUT_PARAMETERS));
if (status->getState() & Firebird::IStatus::STATE_ERRORS) if (status->getState() & IStatus::STATE_ERRORS)
{ {
return NULL; return NULL;
} }
ResultSet* rc = stmt->openCursor(status, transaction, inMetadata, inBuffer, outMetadata, cursorFlags); ResultSet* rc = stmt->openCursor(status, transaction, inMetadata, inBuffer, outMetadata, cursorFlags);
if (status->getState() & Firebird::IStatus::STATE_ERRORS) if (status->getState() & IStatus::STATE_ERRORS)
{ {
stmt->release(); stmt->release();
return NULL; return NULL;
@ -3714,7 +3714,7 @@ IResultSet* Attachment::openCursor(CheckStatusWrapper* status, ITransaction* tra
if (cursorName) if (cursorName)
{ {
stmt->setCursorName(status, cursorName); stmt->setCursorName(status, cursorName);
if (status->getState() & Firebird::IStatus::STATE_ERRORS) if (status->getState() & IStatus::STATE_ERRORS)
{ {
rc->release(); rc->release();
stmt->release(); stmt->release();
@ -3890,7 +3890,7 @@ ITransaction* Attachment::execute(CheckStatusWrapper* status, ITransaction* apiT
else if (!transaction && packet->p_resp.p_resp_object) else if (!transaction && packet->p_resp.p_resp_object)
{ {
transaction = make_transaction(rdb, packet->p_resp.p_resp_object); transaction = make_transaction(rdb, packet->p_resp.p_resp_object);
Firebird::ITransaction* newTrans = FB_NEW Transaction(transaction, this); ITransaction* newTrans = FB_NEW Transaction(transaction, this);
newTrans->addRef(); newTrans->addRef();
return newTrans; return newTrans;
} }
@ -4192,7 +4192,7 @@ Statement* Attachment::prepare(CheckStatusWrapper* status, ITransaction* apiTra,
response->p_resp_object = 0; response->p_resp_object = 0;
} }
if (!(status->getState() & Firebird::IStatus::STATE_ERRORS)) if (!(status->getState() & IStatus::STATE_ERRORS))
{ {
return stmt; return stmt;
} }
@ -5946,7 +5946,7 @@ void Attachment::putSlice(CheckStatusWrapper* status, ITransaction* apiTra, ISC_
} }
Firebird::IEvents* Attachment::queEvents(CheckStatusWrapper* status, Firebird::IEventCallback* callback, IEvents* Attachment::queEvents(CheckStatusWrapper* status, IEventCallback* callback,
unsigned int length, const unsigned char* events) unsigned int length, const unsigned char* events)
{ {
/************************************** /**************************************
@ -6017,7 +6017,7 @@ Firebird::IEvents* Attachment::queEvents(CheckStatusWrapper* status, Firebird::I
send_packet(port, packet); send_packet(port, packet);
receive_response(status, rdb, packet); receive_response(status, rdb, packet);
Firebird::IEvents* rc = FB_NEW Events(rem_event); IEvents* rc = FB_NEW Events(rem_event);
rc->addRef(); rc->addRef();
return rc; return rc;
} }
@ -6182,7 +6182,7 @@ void Request::receive(CheckStatusWrapper* status, int level, unsigned int msg_ty
} }
Firebird::ITransaction* Attachment::reconnectTransaction(CheckStatusWrapper* status, ITransaction* Attachment::reconnectTransaction(CheckStatusWrapper* status,
unsigned int length, const unsigned char* id) unsigned int length, const unsigned char* id)
{ {
/************************************** /**************************************
@ -6215,7 +6215,7 @@ Firebird::ITransaction* Attachment::reconnectTransaction(CheckStatusWrapper* sta
send_and_receive(status, rdb, packet); send_and_receive(status, rdb, packet);
Firebird::ITransaction* t = FB_NEW Transaction(make_transaction(rdb, packet->p_resp.p_resp_object), this); ITransaction* t = FB_NEW Transaction(make_transaction(rdb, packet->p_resp.p_resp_object), this);
t->addRef(); t->addRef();
return t; return t;
} }
@ -6641,7 +6641,7 @@ void Request::send(CheckStatusWrapper* status, int level, unsigned int msg_type,
} }
Firebird::IService* RProvider::attachSvc(CheckStatusWrapper* status, const char* service, IService* RProvider::attachSvc(CheckStatusWrapper* status, const char* service,
unsigned int spbLength, const unsigned char* spb, bool loopback) unsigned int spbLength, const unsigned char* spb, bool loopback)
{ {
/************************************** /**************************************
@ -6693,7 +6693,7 @@ Firebird::IService* RProvider::attachSvc(CheckStatusWrapper* status, const char*
if (!init(status, cBlock, port, op_service_attach, expanded_name, newSpb, intl, cryptCallback)) if (!init(status, cBlock, port, op_service_attach, expanded_name, newSpb, intl, cryptCallback))
return NULL; return NULL;
Firebird::IService* s = FB_NEW Service(rdb); IService* s = FB_NEW Service(rdb);
s->addRef(); s->addRef();
return s; return s;
} }
@ -6705,7 +6705,7 @@ Firebird::IService* RProvider::attachSvc(CheckStatusWrapper* status, const char*
} }
Firebird::IService* RProvider::attachServiceManager(CheckStatusWrapper* status, const char* service, IService* RProvider::attachServiceManager(CheckStatusWrapper* status, const char* service,
unsigned int spbLength, const unsigned char* spb) unsigned int spbLength, const unsigned char* spb)
{ {
/************************************** /**************************************
@ -6723,7 +6723,7 @@ Firebird::IService* RProvider::attachServiceManager(CheckStatusWrapper* status,
} }
Firebird::IService* Loopback::attachServiceManager(CheckStatusWrapper* status, const char* service, IService* Loopback::attachServiceManager(CheckStatusWrapper* status, const char* service,
unsigned int spbLength, const unsigned char* spb) unsigned int spbLength, const unsigned char* spb)
{ {
/************************************** /**************************************
@ -6907,7 +6907,7 @@ void Service::start(CheckStatusWrapper* status,
} }
void Request::startAndSend(CheckStatusWrapper* status, Firebird::ITransaction* apiTra, int level, void Request::startAndSend(CheckStatusWrapper* status, ITransaction* apiTra, int level,
unsigned int msg_type, unsigned int /*length*/, const void* msg) unsigned int msg_type, unsigned int /*length*/, const void* msg)
{ {
/************************************** /**************************************
@ -6986,7 +6986,7 @@ void Request::startAndSend(CheckStatusWrapper* status, Firebird::ITransaction* a
} }
void Request::start(CheckStatusWrapper* status, Firebird::ITransaction* apiTra, int level) void Request::start(CheckStatusWrapper* status, ITransaction* apiTra, int level)
{ {
/************************************** /**************************************
* *
@ -7048,7 +7048,7 @@ void Request::start(CheckStatusWrapper* status, Firebird::ITransaction* apiTra,
} }
Firebird::ITransaction* Attachment::startTransaction(CheckStatusWrapper* status, unsigned int tpbLength, ITransaction* Attachment::startTransaction(CheckStatusWrapper* status, unsigned int tpbLength,
const unsigned char* tpb) const unsigned char* tpb)
{ {
/************************************** /**************************************
@ -7087,7 +7087,7 @@ Firebird::ITransaction* Attachment::startTransaction(CheckStatusWrapper* status,
send_and_receive(status, rdb, packet); send_and_receive(status, rdb, packet);
Firebird::ITransaction* t = FB_NEW Transaction(make_transaction(rdb, packet->p_resp.p_resp_object), this); ITransaction* t = FB_NEW Transaction(make_transaction(rdb, packet->p_resp.p_resp_object), this);
t->addRef(); t->addRef();
return t; return t;
} }
@ -7446,7 +7446,7 @@ static void authenticateStep0(ClntAuthBlock& cBlock)
case IAuth::AUTH_MORE_DATA: case IAuth::AUTH_MORE_DATA:
return; return;
case IAuth::AUTH_FAILED: case IAuth::AUTH_FAILED:
if (s.getState() & Firebird::IStatus::STATE_ERRORS) if (s.getState() & IStatus::STATE_ERRORS)
{ {
iscLogStatus("Authentication, client plugin:", &s); iscLogStatus("Authentication, client plugin:", &s);
} }
@ -7480,7 +7480,7 @@ static void secureAuthentication(ClntAuthBlock& cBlock, rem_port* port)
CheckStatusWrapper st(&ls); CheckStatusWrapper st(&ls);
authReceiveResponse(true, cBlock, port, rdb, &st, packet, true); authReceiveResponse(true, cBlock, port, rdb, &st, packet, true);
if (st.getState() & Firebird::IStatus::STATE_ERRORS) if (st.getState() & IStatus::STATE_ERRORS)
status_exception::raise(&st); status_exception::raise(&st);
} }
else else
@ -7493,7 +7493,7 @@ static void secureAuthentication(ClntAuthBlock& cBlock, rem_port* port)
static rem_port* analyze(ClntAuthBlock& cBlock, PathName& attach_name, unsigned flags, static rem_port* analyze(ClntAuthBlock& cBlock, PathName& attach_name, unsigned flags,
ClumpletWriter& pb, const ParametersSet& parSet, PathName& node_name, PathName* ref_db_name, ClumpletWriter& pb, const ParametersSet& parSet, PathName& node_name, PathName* ref_db_name,
Firebird::ICryptKeyCallback* cryptCb) ICryptKeyCallback* cryptCb)
{ {
/************************************** /**************************************
* *
@ -9691,7 +9691,7 @@ Transaction* Attachment::remoteTransactionInterface(ITransaction* apiTra)
return static_cast<Transaction*>(valid); return static_cast<Transaction*>(valid);
} }
static void cleanDpb(Firebird::ClumpletWriter& dpb, const ParametersSet* tags) static void cleanDpb(ClumpletWriter& dpb, const ParametersSet* tags)
{ {
dpb.deleteWithTag(tags->password); dpb.deleteWithTag(tags->password);
dpb.deleteWithTag(tags->password_enc); dpb.deleteWithTag(tags->password_enc);
@ -9715,7 +9715,7 @@ void ClientPortsCleanup::closePort(rem_port* port)
} }
RmtAuthBlock::RmtAuthBlock(const Firebird::AuthReader::AuthBlock& aBlock) RmtAuthBlock::RmtAuthBlock(const AuthReader::AuthBlock& aBlock)
: buffer(*getDefaultMemoryPool(), aBlock), : buffer(*getDefaultMemoryPool(), aBlock),
rdr(*getDefaultMemoryPool(), buffer), rdr(*getDefaultMemoryPool(), buffer),
info(*getDefaultMemoryPool()) info(*getDefaultMemoryPool())
@ -9750,7 +9750,7 @@ const char* RmtAuthBlock::getOriginalPlugin()
return info.origPlug.nullStr(); return info.origPlug.nullStr();
} }
FB_BOOLEAN RmtAuthBlock::next(Firebird::CheckStatusWrapper* status) FB_BOOLEAN RmtAuthBlock::next(CheckStatusWrapper* status)
{ {
try try
{ {
@ -9764,7 +9764,7 @@ FB_BOOLEAN RmtAuthBlock::next(Firebird::CheckStatusWrapper* status)
return FB_FALSE; return FB_FALSE;
} }
FB_BOOLEAN RmtAuthBlock::first(Firebird::CheckStatusWrapper* status) FB_BOOLEAN RmtAuthBlock::first(CheckStatusWrapper* status)
{ {
try try
{ {
@ -9787,7 +9787,7 @@ FB_BOOLEAN RmtAuthBlock::loadInfo()
} }
ClntAuthBlock::ClntAuthBlock(const Firebird::PathName* fileName, Firebird::ClumpletReader* dpb, ClntAuthBlock::ClntAuthBlock(const PathName* fileName, ClumpletReader* dpb,
const ParametersSet* tags) const ParametersSet* tags)
: pluginList(getPool()), serverPluginList(getPool()), : pluginList(getPool()), serverPluginList(getPool()),
cliUserName(getPool()), cliPassword(getPool()), cliOrigUserName(getPool()), cliUserName(getPool()), cliPassword(getPool()), cliOrigUserName(getPool()),
@ -9820,7 +9820,7 @@ void ClntAuthBlock::resetDataFromPlugin()
dataFromPlugin.clear(); dataFromPlugin.clear();
} }
void ClntAuthBlock::extractDataFromPluginTo(Firebird::ClumpletWriter& dpb, void ClntAuthBlock::extractDataFromPluginTo(ClumpletWriter& dpb,
const ParametersSet* tags, const ParametersSet* tags,
int protocol) int protocol)
{ {
@ -9867,7 +9867,7 @@ void ClntAuthBlock::extractDataFromPluginTo(Firebird::ClumpletWriter& dpb,
dpb.insertBytes(tags->trusted_auth, dataFromPlugin.begin(), dataFromPlugin.getCount()); dpb.insertBytes(tags->trusted_auth, dataFromPlugin.begin(), dataFromPlugin.getCount());
} }
static inline void makeUtfString(bool uft8Convert, Firebird::string& s) static inline void makeUtfString(bool uft8Convert, string& s)
{ {
if (uft8Convert) if (uft8Convert)
{ {
@ -9876,7 +9876,7 @@ static inline void makeUtfString(bool uft8Convert, Firebird::string& s)
ISC_unescape(s); ISC_unescape(s);
} }
void ClntAuthBlock::loadClnt(Firebird::ClumpletWriter& dpb, const ParametersSet* tags) void ClntAuthBlock::loadClnt(ClumpletWriter& dpb, const ParametersSet* tags)
{ {
bool uft8Convert = !dpb.find(tags->utf8_filename); bool uft8Convert = !dpb.find(tags->utf8_filename);
@ -9979,9 +9979,9 @@ void ClntAuthBlock::putData(CheckStatusWrapper* status, unsigned int length, con
} }
} }
bool ClntAuthBlock::checkPluginName(Firebird::PathName& nameToCheck) bool ClntAuthBlock::checkPluginName(PathName& nameToCheck)
{ {
Firebird::ParsedList parsed(pluginList); ParsedList parsed(pluginList);
for (unsigned i = 0; i < parsed.getCount(); ++i) for (unsigned i = 0; i < parsed.getCount(); ++i)
{ {
if (parsed[i] == nameToCheck) if (parsed[i] == nameToCheck)
@ -9992,7 +9992,7 @@ bool ClntAuthBlock::checkPluginName(Firebird::PathName& nameToCheck)
return false; return false;
} }
Firebird::ICryptKey* ClntAuthBlock::newKey(CheckStatusWrapper* status) ICryptKey* ClntAuthBlock::newKey(CheckStatusWrapper* status)
{ {
status->init(); status->init();
try try
@ -10036,7 +10036,7 @@ void ClntAuthBlock::releaseKeys(unsigned from)
} }
} }
void ClntAuthBlock::createCryptCallback(Firebird::ICryptKeyCallback** callback) void ClntAuthBlock::createCryptCallback(ICryptKeyCallback** callback)
{ {
if (*callback) if (*callback)
return; return;
@ -10046,7 +10046,7 @@ void ClntAuthBlock::createCryptCallback(Firebird::ICryptKeyCallback** callback)
createdInterface = callback; createdInterface = callback;
} }
Firebird::ICryptKeyCallback* ClntAuthBlock::ClientCrypt::create(const Config* conf) ICryptKeyCallback* ClntAuthBlock::ClientCrypt::create(const Config* conf)
{ {
pluginItr.set(conf); pluginItr.set(conf);

View File

@ -256,7 +256,7 @@ public:
slct_ready(*getDefaultMemoryPool()) slct_ready(*getDefaultMemoryPool())
{ } { }
explicit Select(Firebird::MemoryPool& pool) explicit Select(MemoryPool& pool)
: slct_time(0), slct_count(0), slct_poll(pool), slct_ready(pool) : slct_time(0), slct_count(0), slct_poll(pool), slct_ready(pool)
{ } { }
#else #else
@ -266,7 +266,7 @@ public:
memset(&slct_fdset, 0, sizeof slct_fdset); memset(&slct_fdset, 0, sizeof slct_fdset);
} }
explicit Select(Firebird::MemoryPool& /*pool*/) explicit Select(MemoryPool& /*pool*/)
: slct_time(0), slct_count(0), slct_width(0) : slct_time(0), slct_count(0), slct_width(0)
{ {
memset(&slct_fdset, 0, sizeof slct_fdset); memset(&slct_fdset, 0, sizeof slct_fdset);
@ -616,7 +616,7 @@ ULONG INET_remote_buffer;
static GlobalPtr<Mutex> init_mutex; static GlobalPtr<Mutex> init_mutex;
static volatile bool INET_initialized = false; static volatile bool INET_initialized = false;
static volatile bool INET_shutting_down = false; static volatile bool INET_shutting_down = false;
static Firebird::GlobalPtr<Select> INET_select; static GlobalPtr<Select> INET_select;
static rem_port* inet_async_receive = NULL; static rem_port* inet_async_receive = NULL;
@ -632,7 +632,7 @@ rem_port* INET_analyze(ClntAuthBlock* cBlock,
ClumpletReader &dpb, ClumpletReader &dpb,
RefPtr<const Config>* config, RefPtr<const Config>* config,
const PathName* ref_db_name, const PathName* ref_db_name,
Firebird::ICryptKeyCallback* cryptCb, ICryptKeyCallback* cryptCb,
int af) int af)
{ {
/************************************** /**************************************
@ -3080,7 +3080,7 @@ static bool packet_receive(rem_port* port, UCHAR* buffer, SSHORT buffer_length,
if (n > 0 && port->port_crypt_plugin) if (n > 0 && port->port_crypt_plugin)
{ {
port->port_crypt_plugin->decrypt(&st, n, buffer, buffer); port->port_crypt_plugin->decrypt(&st, n, buffer, buffer);
if (st.getState() & Firebird::IStatus::STATE_ERRORS) if (st.getState() & IStatus::STATE_ERRORS)
{ {
status_exception::raise(&st); status_exception::raise(&st);
} }
@ -3164,7 +3164,7 @@ static bool packet_send( rem_port* port, const SCHAR* buffer, SSHORT buffer_leng
char* d = b.getBuffer(buffer_length); char* d = b.getBuffer(buffer_length);
port->port_crypt_plugin->encrypt(&st, buffer_length, data, d); port->port_crypt_plugin->encrypt(&st, buffer_length, data, d);
if (st.getState() & Firebird::IStatus::STATE_ERRORS) if (st.getState() & IStatus::STATE_ERRORS)
{ {
status_exception::raise(&st); status_exception::raise(&st);
} }

View File

@ -29,6 +29,8 @@
#include "../yvalve/gds_proto.h" #include "../yvalve/gds_proto.h"
#include "../common/classes/DbImplementation.h" #include "../common/classes/DbImplementation.h"
using namespace Firebird;
inline void PUT_WORD(UCHAR*& ptr, USHORT value) inline void PUT_WORD(UCHAR*& ptr, USHORT value)
{ {
*ptr++ = static_cast<UCHAR>(value); *ptr++ = static_cast<UCHAR>(value);
@ -37,7 +39,7 @@ inline void PUT_WORD(UCHAR*& ptr, USHORT value)
#define PUT(ptr, value) *(ptr)++ = value; #define PUT(ptr, value) *(ptr)++ = value;
static ISC_STATUS merge_setup(const Firebird::ClumpletReader&, UCHAR**, const UCHAR* const, FB_SIZE_T); static ISC_STATUS merge_setup(const ClumpletReader&, UCHAR**, const UCHAR* const, FB_SIZE_T);
USHORT MERGE_database_info(const UCHAR* const in, USHORT MERGE_database_info(const UCHAR* const in,
@ -69,7 +71,7 @@ USHORT MERGE_database_info(const UCHAR* const in,
const UCHAR* const end = out + buf_length; const UCHAR* const end = out + buf_length;
UCHAR mergeLevel = 0; UCHAR mergeLevel = 0;
Firebird::ClumpletReader input(Firebird::ClumpletReader::InfoResponse, in, buf_length); ClumpletReader input(ClumpletReader::InfoResponse, in, buf_length);
while (!input.isEof()) while (!input.isEof())
{ {
bool flStop = true; bool flStop = true;
@ -149,7 +151,7 @@ USHORT MERGE_database_info(const UCHAR* const in,
case fb_info_implementation: case fb_info_implementation:
if (merge_setup(input, &out, end, 6)) if (merge_setup(input, &out, end, 6))
return 0; return 0;
Firebird::DbImplementation::current.stuff(&out); DbImplementation::current.stuff(&out);
PUT(out, (UCHAR) class_); PUT(out, (UCHAR) class_);
PUT(out, mergeLevel); PUT(out, mergeLevel);
break; break;
@ -183,7 +185,7 @@ USHORT MERGE_database_info(const UCHAR* const in,
return 0; // error - missing isc_info_end item return 0; // error - missing isc_info_end item
} }
static ISC_STATUS merge_setup(const Firebird::ClumpletReader& input, UCHAR** out, const UCHAR* const end, static ISC_STATUS merge_setup(const ClumpletReader& input, UCHAR** out, const UCHAR* const end,
FB_SIZE_T delta_length) FB_SIZE_T delta_length)
{ {
/************************************** /**************************************

View File

@ -237,7 +237,7 @@ rem_port* XNET_analyze(ClntAuthBlock* cBlock,
const PathName& file_name, const PathName& file_name,
bool uv_flag, bool uv_flag,
RefPtr<const Config>* config, RefPtr<const Config>* config,
const Firebird::PathName* ref_db_name) const PathName* ref_db_name)
{ {
/************************************** /**************************************
* *
@ -362,10 +362,10 @@ rem_port* XNET_analyze(ClntAuthBlock* cBlock,
case op_response: case op_response:
try try
{ {
Firebird::LocalStatus warning; // Ignore connect warnings for a while LocalStatus warning; // Ignore connect warnings for a while
REMOTE_check_response(&warning, rdb, packet); REMOTE_check_response(&warning, rdb, packet);
} }
catch (const Firebird::Exception&) catch (const Exception&)
{ {
disconnect(port); disconnect(port);
delete rdb; delete rdb;
@ -406,7 +406,7 @@ rem_port* XNET_analyze(ClntAuthBlock* cBlock,
rem_port* XNET_connect(PACKET* packet, rem_port* XNET_connect(PACKET* packet,
USHORT flag, USHORT flag,
Firebird::RefPtr<const Config>* config) RefPtr<const Config>* config)
{ {
/************************************** /**************************************
* *
@ -1109,7 +1109,7 @@ rem_port* XnetClientEndPoint::connect_client(PACKET* packet, const RefPtr<const
* *
**************************************/ **************************************/
const Firebird::RefPtr<const Config>& conf(config ? *config : Config::getDefaultConfig()); const RefPtr<const Config>& conf(config ? *config : Config::getDefaultConfig());
if (!xnet_initialized) if (!xnet_initialized)
{ {

View File

@ -1031,7 +1031,7 @@ bool_t xdr_protocol(RemoteXdr* xdrs, PACKET* p)
if (xdrs->x_op == XDR_DECODE) if (xdrs->x_op == XDR_DECODE)
{ {
Firebird::Arg::StatusVector sv(ptr->value()); Arg::StatusVector sv(ptr->value());
LocalStatus to; LocalStatus to;
sv.copyTo(&to); sv.copyTo(&to);
delete ptr; delete ptr;
@ -1812,8 +1812,8 @@ static bool_t xdr_slice(RemoteXdr* xdrs, lstring* slice, /*USHORT sdl_length,*/
struct sdl_info info; struct sdl_info info;
{ {
Firebird::LocalStatus ls; LocalStatus ls;
Firebird::CheckStatusWrapper s(&ls); CheckStatusWrapper s(&ls);
if (SDL_info(&s, sdl, &info, 0)) if (SDL_info(&s, sdl, &info, 0))
return FALSE; return FALSE;
} }

View File

@ -40,8 +40,10 @@
#include "../common/classes/ImplementHelper.h" #include "../common/classes/ImplementHelper.h"
#include "../common/utils_proto.h" #include "../common/utils_proto.h"
using namespace Firebird;
#ifdef DEV_BUILD #ifdef DEV_BUILD
Firebird::AtomicCounter rem_port::portCounter; AtomicCounter rem_port::portCounter;
#endif #endif
#ifdef REMOTE_DEBUG #ifdef REMOTE_DEBUG
@ -351,7 +353,7 @@ void REMOTE_free_packet( rem_port* port, PACKET * packet, bool partial)
} }
void REMOTE_get_timeout_params(rem_port* port, Firebird::ClumpletReader* pb) void REMOTE_get_timeout_params(rem_port* port, ClumpletReader* pb)
{ {
/************************************** /**************************************
* *
@ -601,14 +603,14 @@ void rem_port::linkParent(rem_port* const parent)
parent->port_clients = parent->port_next = this; parent->port_clients = parent->port_next = this;
} }
const Firebird::RefPtr<const Firebird::Config>& rem_port::getPortConfig() const const RefPtr<const Config>& rem_port::getPortConfig() const
{ {
return port_config.hasData() ? port_config : Firebird::Config::getDefaultConfig(); return port_config.hasData() ? port_config : Config::getDefaultConfig();
} }
Firebird::RefPtr<const Firebird::Config> rem_port::getPortConfig() RefPtr<const Config> rem_port::getPortConfig()
{ {
return port_config.hasData() ? port_config : Firebird::Config::getDefaultConfig(); return port_config.hasData() ? port_config : Config::getDefaultConfig();
} }
void rem_port::unlinkParent() void rem_port::unlinkParent()
@ -741,7 +743,7 @@ bool_t REMOTE_getbytes (RemoteXdr* xdrs, SCHAR* buff, unsigned bytecount)
} }
rem_port* port = xdrs->x_public; rem_port* port = xdrs->x_public;
Firebird::RefMutexEnsureUnlock queGuard(*port->port_que_sync, FB_FUNCTION); RefMutexEnsureUnlock queGuard(*port->port_que_sync, FB_FUNCTION);
queGuard.enter(); queGuard.enter();
if (port->port_qoffset >= port->port_queue.getCount()) if (port->port_qoffset >= port->port_queue.getCount())
{ {
@ -763,14 +765,14 @@ bool_t REMOTE_getbytes (RemoteXdr* xdrs, SCHAR* buff, unsigned bytecount)
void PortsCleanup::registerPort(rem_port* port) void PortsCleanup::registerPort(rem_port* port)
{ {
Firebird::MutexLockGuard guard(m_mutex, FB_FUNCTION); MutexLockGuard guard(m_mutex, FB_FUNCTION);
if (closing) if (closing)
return; return;
if (!m_ports) if (!m_ports)
{ {
Firebird::MemoryPool& pool = *getDefaultMemoryPool(); MemoryPool& pool = *getDefaultMemoryPool();
m_ports = FB_NEW_POOL (pool) PortsArray(pool); m_ports = FB_NEW_POOL (pool) PortsArray(pool);
} }
@ -779,7 +781,7 @@ void PortsCleanup::registerPort(rem_port* port)
void PortsCleanup::unRegisterPort(rem_port* port) void PortsCleanup::unRegisterPort(rem_port* port)
{ {
Firebird::MutexLockGuard guard(m_mutex, FB_FUNCTION); MutexLockGuard guard(m_mutex, FB_FUNCTION);
if (closing) if (closing)
return; return;
@ -799,11 +801,11 @@ void PortsCleanup::closePorts()
if (m_ports) if (m_ports)
delay(); delay();
Firebird::MutexLockGuard guard(m_mutex, FB_FUNCTION); MutexLockGuard guard(m_mutex, FB_FUNCTION);
Firebird::AutoSetRestore cl(&closing, true); AutoSetRestore cl(&closing, true);
{ // scope { // scope
Firebird::MutexUnlockGuard g2(m_mutex, FB_FUNCTION); MutexUnlockGuard g2(m_mutex, FB_FUNCTION);
Thread::yield(); Thread::yield();
} }
@ -906,7 +908,7 @@ void RBlobInfo::parseInfo(unsigned int bufferLength, const unsigned char* buffer
int c = 0; int c = 0;
valid = false; valid = false;
Firebird::ClumpletReader p(Firebird::ClumpletReader::InfoResponse, buffer, bufferLength); ClumpletReader p(ClumpletReader::InfoResponse, buffer, bufferLength);
for (; !p.isEof(); p.moveNext()) for (; !p.isEof(); p.moveNext())
{ {
switch (p.getClumpTag()) switch (p.getClumpTag())
@ -937,18 +939,18 @@ void RBlobInfo::parseInfo(unsigned int bufferLength, const unsigned char* buffer
valid = (c == 4); valid = (c == 4);
} }
void Rrq::saveStatus(const Firebird::Exception& ex) noexcept void Rrq::saveStatus(const Exception& ex) noexcept
{ {
if (rrqStatus.isSuccess()) if (rrqStatus.isSuccess())
{ {
Firebird::LocalStatus ls; LocalStatus ls;
Firebird::CheckStatusWrapper tmp(&ls); CheckStatusWrapper tmp(&ls);
ex.stuffException(&tmp); ex.stuffException(&tmp);
rrqStatus.save(&tmp); rrqStatus.save(&tmp);
} }
} }
void Rrq::saveStatus(Firebird::IStatus* v) noexcept void Rrq::saveStatus(IStatus* v) noexcept
{ {
if (rrqStatus.isSuccess()) if (rrqStatus.isSuccess())
{ {
@ -956,28 +958,28 @@ void Rrq::saveStatus(Firebird::IStatus* v) noexcept
} }
} }
void Rsr::saveException(const Firebird::Exception& ex, bool overwrite) void Rsr::saveException(const Exception& ex, bool overwrite)
{ {
if (!rsr_status) { if (!rsr_status) {
rsr_status = FB_NEW Firebird::StatusHolder(); rsr_status = FB_NEW StatusHolder();
} }
if (overwrite || !rsr_status->getError()) if (overwrite || !rsr_status->getError())
{ {
Firebird::LocalStatus ls; LocalStatus ls;
Firebird::CheckStatusWrapper temp(&ls); CheckStatusWrapper temp(&ls);
ex.stuffException(&temp); ex.stuffException(&temp);
rsr_status->save(&temp); rsr_status->save(&temp);
} }
} }
Firebird::string rem_port::getRemoteId() const string rem_port::getRemoteId() const
{ {
fb_assert(port_protocol_id.hasData()); fb_assert(port_protocol_id.hasData());
Firebird::string id = port_protocol_id; string id = port_protocol_id;
if (port_address.hasData()) if (port_address.hasData())
id += Firebird::string("/") + port_address; id += string("/") + port_address;
return id; return id;
} }
@ -1000,14 +1002,14 @@ LegacyPlugin REMOTE_legacy_auth(const char* nm, int p)
return PLUGIN_NEW; return PLUGIN_NEW;
} }
Firebird::PathName ClntAuthBlock::getPluginName() PathName ClntAuthBlock::getPluginName()
{ {
return plugins.hasData() ? plugins.name() : ""; return plugins.hasData() ? plugins.name() : "";
} }
template <typename T> template <typename T>
static void addMultiPartConnectParameter(const T& dataToAdd, static void addMultiPartConnectParameter(const T& dataToAdd,
Firebird::ClumpletWriter& user_id, UCHAR param) ClumpletWriter& user_id, UCHAR param)
{ {
FB_SIZE_T remaining = dataToAdd.getCount(); FB_SIZE_T remaining = dataToAdd.getCount();
fb_assert(remaining <= 254u * 256u); // paranoid check => 65024 fb_assert(remaining <= 254u * 256u); // paranoid check => 65024
@ -1033,7 +1035,7 @@ static void addMultiPartConnectParameter(const T& dataToAdd,
} }
} }
void ClntAuthBlock::extractDataFromPluginTo(Firebird::ClumpletWriter& user_id) void ClntAuthBlock::extractDataFromPluginTo(ClumpletWriter& user_id)
{ {
// Add user login name // Add user login name
if (cliOrigUserName.hasData()) if (cliOrigUserName.hasData())
@ -1044,7 +1046,7 @@ void ClntAuthBlock::extractDataFromPluginTo(Firebird::ClumpletWriter& user_id)
} }
// Add plugin name // Add plugin name
Firebird::PathName pluginName = getPluginName(); PathName pluginName = getPluginName();
if (pluginName.hasData()) if (pluginName.hasData())
{ {
HANDSHAKE_DEBUG(fprintf(stderr, "Cli: extractDataFromPluginTo: pluginName=%s\n", pluginName.c_str())); HANDSHAKE_DEBUG(fprintf(stderr, "Cli: extractDataFromPluginTo: pluginName=%s\n", pluginName.c_str()));
@ -1064,7 +1066,7 @@ void ClntAuthBlock::extractDataFromPluginTo(Firebird::ClumpletWriter& user_id)
addMultiPartConnectParameter(dataFromPlugin, user_id, CNCT_specific_data); addMultiPartConnectParameter(dataFromPlugin, user_id, CNCT_specific_data);
// Client's wirecrypt requested level // Client's wirecrypt requested level
user_id.insertInt(CNCT_client_crypt, clntConfig->getWireCrypt(Firebird::WC_CLIENT)); user_id.insertInt(CNCT_client_crypt, clntConfig->getWireCrypt(WC_CLIENT));
} }
void ClntAuthBlock::resetClnt(const CSTRING* listStr) void ClntAuthBlock::resetClnt(const CSTRING* listStr)
@ -1077,7 +1079,7 @@ void ClntAuthBlock::resetClnt(const CSTRING* listStr)
return; return;
} }
Firebird::ClumpletReader srvList(Firebird::ClumpletReader::UnTagged, ClumpletReader srvList(ClumpletReader::UnTagged,
listStr->cstr_address, listStr->cstr_length); listStr->cstr_address, listStr->cstr_length);
if (srvList.find(TAG_KNOWN_PLUGINS)) if (srvList.find(TAG_KNOWN_PLUGINS))
@ -1091,18 +1093,18 @@ void ClntAuthBlock::resetClnt(const CSTRING* listStr)
firstTime = true; firstTime = true;
pluginList = dpbPlugins.hasData() ? dpbPlugins : pluginList = dpbPlugins.hasData() ? dpbPlugins :
clntConfig->getPlugins(Firebird::IPluginManager::TYPE_AUTH_CLIENT); clntConfig->getPlugins(IPluginManager::TYPE_AUTH_CLIENT);
Firebird::PathName final; PathName final;
if (serverPluginList.hasData()) if (serverPluginList.hasData())
{ {
Firebird::ParsedList::mergeLists(final, serverPluginList, pluginList); ParsedList::mergeLists(final, serverPluginList, pluginList);
if (final.length() == 0) if (final.length() == 0)
{ {
HANDSHAKE_DEBUG(fprintf(stderr, "Cli: No matching plugins on client\n")); HANDSHAKE_DEBUG(fprintf(stderr, "Cli: No matching plugins on client\n"));
(Firebird::Arg::Gds(isc_login) (Arg::Gds(isc_login)
#ifdef DEV_BUILD #ifdef DEV_BUILD
<< Firebird::Arg::Gds(isc_random) << "No matching plugins on client" << Arg::Gds(isc_random) << "No matching plugins on client"
#endif #endif
).raise(); ).raise();
} }
@ -1115,7 +1117,7 @@ void ClntAuthBlock::resetClnt(const CSTRING* listStr)
plugins.set(final.c_str()); plugins.set(final.c_str());
} }
Firebird::RefPtr<const Firebird::Config>* ClntAuthBlock::getConfig() RefPtr<const Config>* ClntAuthBlock::getConfig()
{ {
return clntConfig.hasData() ? &clntConfig : NULL; return clntConfig.hasData() ? &clntConfig : NULL;
} }
@ -1126,25 +1128,25 @@ void ClntAuthBlock::storeDataForPlugin(unsigned int length, const unsigned char*
HANDSHAKE_DEBUG(fprintf(stderr, "Cli: accepted data for plugin length=%d\n", length)); HANDSHAKE_DEBUG(fprintf(stderr, "Cli: accepted data for plugin length=%d\n", length));
} }
Firebird::RefPtr<const Firebird::Config> REMOTE_get_config(const Firebird::PathName* dbName, RefPtr<const Config> REMOTE_get_config(const PathName* dbName,
const Firebird::string* dpb_config) const string* dpb_config)
{ {
Firebird::RefPtr<const Firebird::Config> config; RefPtr<const Config> config;
if (dbName && dbName->hasData()) if (dbName && dbName->hasData())
{ {
Firebird::PathName dummy; PathName dummy;
expandDatabaseName(*dbName, dummy, &config); expandDatabaseName(*dbName, dummy, &config);
} }
else else
config = Firebird::Config::getDefaultConfig(); config = Config::getDefaultConfig();
Firebird::Config::merge(config, dpb_config); Config::merge(config, dpb_config);
return config; return config;
} }
void REMOTE_check_response(Firebird::IStatus* warning, Rdb* rdb, PACKET* packet, bool checkKeys) void REMOTE_check_response(IStatus* warning, Rdb* rdb, PACKET* packet, bool checkKeys)
{ {
/************************************** /**************************************
* *
@ -1160,7 +1162,7 @@ void REMOTE_check_response(Firebird::IStatus* warning, Rdb* rdb, PACKET* packet,
rdb->rdb_port->checkResponse(warning, packet, checkKeys); rdb->rdb_port->checkResponse(warning, packet, checkKeys);
} }
void rem_port::checkResponse(Firebird::IStatus* warning, PACKET* packet, bool checkKeys) void rem_port::checkResponse(IStatus* warning, PACKET* packet, bool checkKeys)
{ {
/************************************** /**************************************
* *
@ -1184,7 +1186,7 @@ void rem_port::checkResponse(Firebird::IStatus* warning, PACKET* packet, bool ch
// Translate any gds codes into local operating specific codes // Translate any gds codes into local operating specific codes
Firebird::StaticStatusVector newVector; StaticStatusVector newVector;
while (*vector != isc_arg_end) while (*vector != isc_arg_end)
{ {
@ -1224,7 +1226,7 @@ void rem_port::checkResponse(Firebird::IStatus* warning, PACKET* packet, bool ch
if ((packet->p_operation == op_response || packet->p_operation == op_response_piggyback) && if ((packet->p_operation == op_response || packet->p_operation == op_response_piggyback) &&
!vector[1]) !vector[1])
{ {
Firebird::Arg::StatusVector s(vector); Arg::StatusVector s(vector);
s.copyTo(warning); s.copyTo(warning);
return; return;
} }
@ -1233,10 +1235,10 @@ void rem_port::checkResponse(Firebird::IStatus* warning, PACKET* packet, bool ch
if (!vector[1]) if (!vector[1])
{ {
Firebird::Arg::Gds(isc_net_read_err).raise(); Arg::Gds(isc_net_read_err).raise();
} }
Firebird::status_exception::raise(vector); status_exception::raise(vector);
} }
static void setCStr(CSTRING& to, const char* from) static void setCStr(CSTRING& to, const char* from)
@ -1248,10 +1250,10 @@ static void setCStr(CSTRING& to, const char* from)
void rem_port::addServerKeys(const CSTRING* passedStr) void rem_port::addServerKeys(const CSTRING* passedStr)
{ {
Firebird::ClumpletReader newKeys(Firebird::ClumpletReader::UnTagged, ClumpletReader newKeys(ClumpletReader::UnTagged,
passedStr->cstr_address, passedStr->cstr_length); passedStr->cstr_address, passedStr->cstr_length);
Firebird::PathName type, plugins, plugin; PathName type, plugins, plugin;
unsigned len; unsigned len;
KnownServerKey* currentKey = nullptr; KnownServerKey* currentKey = nullptr;
for (newKeys.rewind(); !newKeys.isEof(); newKeys.moveNext()) for (newKeys.rewind(); !newKeys.isEof(); newKeys.moveNext())
@ -1310,7 +1312,7 @@ bool rem_port::tryKeyType(const KnownServerKey& srvKey, InternalCryptKey* cryptK
return false; return false;
} }
if (getPortConfig()->getWireCrypt(Firebird::WC_CLIENT) == Firebird::WIRE_CRYPT_DISABLED) if (getPortConfig()->getWireCrypt(WC_CLIENT) == WIRE_CRYPT_DISABLED)
{ {
port_crypt_complete = true; port_crypt_complete = true;
return true; return true;
@ -1318,24 +1320,24 @@ bool rem_port::tryKeyType(const KnownServerKey& srvKey, InternalCryptKey* cryptK
// we got correct key's type pair // we got correct key's type pair
// check what about crypt plugin for it // check what about crypt plugin for it
Firebird::ParsedList clientPlugins(getPortConfig()->getPlugins(Firebird::IPluginManager::TYPE_WIRE_CRYPT)); ParsedList clientPlugins(getPortConfig()->getPlugins(IPluginManager::TYPE_WIRE_CRYPT));
for (unsigned n = 0; n < clientPlugins.getCount(); ++n) for (unsigned n = 0; n < clientPlugins.getCount(); ++n)
{ {
Firebird::PathName p(clientPlugins[n]); PathName p(clientPlugins[n]);
WIRECRYPT_DEBUG(fprintf(stderr, "tryKeyType, client plugin %s\n", p.c_str())); WIRECRYPT_DEBUG(fprintf(stderr, "tryKeyType, client plugin %s\n", p.c_str()));
if (srvKey.plugins.find(" " + p + " ") != Firebird::PathName::npos) if (srvKey.plugins.find(" " + p + " ") != PathName::npos)
{ {
WIRECRYPT_DEBUG(fprintf(stderr, "tryKeyType, server listed plugin %s\n", p.c_str())); WIRECRYPT_DEBUG(fprintf(stderr, "tryKeyType, server listed plugin %s\n", p.c_str()));
Firebird::GetPlugins<Firebird::IWireCryptPlugin> GetPlugins<IWireCryptPlugin>
cp(Firebird::IPluginManager::TYPE_WIRE_CRYPT, p.c_str()); cp(IPluginManager::TYPE_WIRE_CRYPT, p.c_str());
if (cp.hasData()) if (cp.hasData())
{ {
WIRECRYPT_DEBUG(fprintf(stderr, "tryKeyType, client loaded plugin %s\n", p.c_str())); WIRECRYPT_DEBUG(fprintf(stderr, "tryKeyType, client loaded plugin %s\n", p.c_str()));
Firebird::LocalStatus st; LocalStatus st;
Firebird::CheckStatusWrapper statusWrapper(&st); CheckStatusWrapper statusWrapper(&st);
// Pass IV to plugin // Pass IV to plugin
//const Firebird::UCharBuffer* specificData = srvKey.findSpecificData(p); //const UCharBuffer* specificData = srvKey.findSpecificData(p);
auto* specificData = srvKey.findSpecificData(p); auto* specificData = srvKey.findSpecificData(p);
if (specificData) if (specificData)
{ {
@ -1346,9 +1348,9 @@ bool rem_port::tryKeyType(const KnownServerKey& srvKey, InternalCryptKey* cryptK
// Pass key to plugin // Pass key to plugin
cp.plugin()->setKey(&statusWrapper, cryptKey); cp.plugin()->setKey(&statusWrapper, cryptKey);
if (st.getState() & Firebird::IStatus::STATE_ERRORS) if (st.getState() & IStatus::STATE_ERRORS)
{ {
Firebird::status_exception::raise(&st); status_exception::raise(&st);
} }
// Looks like we've found correct crypt plugin and key for it // Looks like we've found correct crypt plugin and key for it
@ -1397,20 +1399,20 @@ const unsigned char* SrvAuthBlock::getData(unsigned int* length)
return *length ? dataForPlugin.begin() : NULL; return *length ? dataForPlugin.begin() : NULL;
} }
void SrvAuthBlock::putData(Firebird::CheckStatusWrapper* status, unsigned int length, const void* data) void SrvAuthBlock::putData(CheckStatusWrapper* status, unsigned int length, const void* data)
{ {
status->init(); status->init();
try try
{ {
memcpy(dataFromPlugin.getBuffer(length), data, length); memcpy(dataFromPlugin.getBuffer(length), data, length);
} }
catch (const Firebird::Exception& ex) catch (const Exception& ex)
{ {
ex.stuffException(status); ex.stuffException(status);
} }
} }
Firebird::ICryptKey* SrvAuthBlock::newKey(Firebird::CheckStatusWrapper* status) ICryptKey* SrvAuthBlock::newKey(CheckStatusWrapper* status)
{ {
status->init(); status->init();
try try
@ -1424,14 +1426,14 @@ Firebird::ICryptKey* SrvAuthBlock::newKey(Firebird::CheckStatusWrapper* status)
return k; return k;
} }
catch (const Firebird::Exception& ex) catch (const Exception& ex)
{ {
ex.stuffException(status); ex.stuffException(status);
} }
return NULL; return NULL;
} }
void rem_port::versionInfo(Firebird::string& version) const void rem_port::versionInfo(string& version) const
{ {
version.printf("%s/%s", FB_VERSION, port_version->str_data); version.printf("%s/%s", FB_VERSION, port_version->str_data);
#ifndef WIRE_COMPRESS_SUPPORT #ifndef WIRE_COMPRESS_SUPPORT
@ -1449,7 +1451,7 @@ void rem_port::versionInfo(Firebird::string& version) const
#ifdef WIRE_COMPRESS_SUPPORT #ifdef WIRE_COMPRESS_SUPPORT
static Firebird::InitInstance<Firebird::ZLib> zlib; static InitInstance<ZLib> zlib;
#endif // WIRE_COMPRESS_SUPPORT #endif // WIRE_COMPRESS_SUPPORT
rem_port::~rem_port() rem_port::~rem_port()
@ -1471,7 +1473,7 @@ rem_port::~rem_port()
} }
if (port_crypt_plugin) if (port_crypt_plugin)
Firebird::PluginManagerInterfacePtr()->releasePlugin(port_crypt_plugin); PluginManagerInterfacePtr()->releasePlugin(port_crypt_plugin);
#ifdef DEV_BUILD #ifdef DEV_BUILD
--portCounter; --portCounter;
@ -1657,16 +1659,16 @@ void rem_port::initCompression()
#ifdef WIRE_COMPRESS_SUPPORT #ifdef WIRE_COMPRESS_SUPPORT
if (port_protocol >= PROTOCOL_VERSION13 && !port_compressed && zlib()) if (port_protocol >= PROTOCOL_VERSION13 && !port_compressed && zlib())
{ {
port_send_stream.zalloc = Firebird::ZLib::allocFunc; port_send_stream.zalloc = ZLib::allocFunc;
port_send_stream.zfree = Firebird::ZLib::freeFunc; port_send_stream.zfree = ZLib::freeFunc;
port_send_stream.opaque = Z_NULL; port_send_stream.opaque = Z_NULL;
int ret = zlib().deflateInit(&port_send_stream, Z_DEFAULT_COMPRESSION); int ret = zlib().deflateInit(&port_send_stream, Z_DEFAULT_COMPRESSION);
if (ret != Z_OK) if (ret != Z_OK)
(Firebird::Arg::Gds(isc_deflate_init) << Firebird::Arg::Num(ret)).raise(); (Arg::Gds(isc_deflate_init) << Arg::Num(ret)).raise();
port_send_stream.next_out = NULL; port_send_stream.next_out = NULL;
port_recv_stream.zalloc = Firebird::ZLib::allocFunc; port_recv_stream.zalloc = ZLib::allocFunc;
port_recv_stream.zfree = Firebird::ZLib::freeFunc; port_recv_stream.zfree = ZLib::freeFunc;
port_recv_stream.opaque = Z_NULL; port_recv_stream.opaque = Z_NULL;
port_recv_stream.avail_in = 0; port_recv_stream.avail_in = 0;
port_recv_stream.next_in = Z_NULL; port_recv_stream.next_in = Z_NULL;
@ -1674,14 +1676,14 @@ void rem_port::initCompression()
if (ret != Z_OK) if (ret != Z_OK)
{ {
zlib().deflateEnd(&port_send_stream); zlib().deflateEnd(&port_send_stream);
(Firebird::Arg::Gds(isc_inflate_init) << Firebird::Arg::Num(ret)).raise(); (Arg::Gds(isc_inflate_init) << Arg::Num(ret)).raise();
} }
try try
{ {
port_compressed.reset(FB_NEW_POOL(getPool()) UCHAR[port_buff_size * 2]); port_compressed.reset(FB_NEW_POOL(getPool()) UCHAR[port_buff_size * 2]);
} }
catch (const Firebird::Exception&) catch (const Exception&)
{ {
zlib().deflateEnd(&port_send_stream); zlib().deflateEnd(&port_send_stream);
zlib().inflateEnd(&port_recv_stream); zlib().inflateEnd(&port_recv_stream);
@ -1699,7 +1701,7 @@ void rem_port::initCompression()
} }
void InternalCryptKey::setSymmetric(Firebird::CheckStatusWrapper* status, const char* type, void InternalCryptKey::setSymmetric(CheckStatusWrapper* status, const char* type,
unsigned keyLength, const void* key) unsigned keyLength, const void* key)
{ {
try try
@ -1709,13 +1711,13 @@ void InternalCryptKey::setSymmetric(Firebird::CheckStatusWrapper* status, const
encrypt.set(keyLength, key); encrypt.set(keyLength, key);
decrypt.clear(); decrypt.clear();
} }
catch (const Firebird::Exception& ex) catch (const Exception& ex)
{ {
ex.stuffException(status); ex.stuffException(status);
} }
} }
void InternalCryptKey::setAsymmetric(Firebird::CheckStatusWrapper* status, const char* type, void InternalCryptKey::setAsymmetric(CheckStatusWrapper* status, const char* type,
unsigned encryptKeyLength, const void* encryptKey, unsigned decryptKeyLength, unsigned encryptKeyLength, const void* encryptKey, unsigned decryptKeyLength,
const void* decryptKey) const void* decryptKey)
{ {
@ -1726,7 +1728,7 @@ void InternalCryptKey::setAsymmetric(Firebird::CheckStatusWrapper* status, const
encrypt.set(encryptKeyLength, encryptKey); encrypt.set(encryptKeyLength, encryptKey);
decrypt.set(decryptKeyLength, decryptKey); decrypt.set(decryptKeyLength, decryptKey);
} }
catch (const Firebird::Exception& ex) catch (const Exception& ex)
{ {
ex.stuffException(status); ex.stuffException(status);
} }

View File

@ -36,6 +36,8 @@
#include <windows.h> #include <windows.h>
using namespace Firebird;
const unsigned int SHUTDOWN_TIMEOUT = 10 * 1000; // 10 seconds const unsigned int SHUTDOWN_TIMEOUT = 10 * 1000; // 10 seconds
static void WINAPI control_thread(DWORD); static void WINAPI control_thread(DWORD);
@ -44,8 +46,8 @@ static USHORT report_status(DWORD, DWORD, DWORD, DWORD);
static ThreadEntryPoint* main_handler; static ThreadEntryPoint* main_handler;
static SERVICE_STATUS_HANDLE service_handle; static SERVICE_STATUS_HANDLE service_handle;
static Firebird::GlobalPtr<Firebird::string> service_name; static GlobalPtr<string> service_name;
static Firebird::GlobalPtr<Firebird::string> mutex_name; static GlobalPtr<string> mutex_name;
static HANDLE stop_event_handle; static HANDLE stop_event_handle;
static HANDLE hMutex = NULL; static HANDLE hMutex = NULL;
@ -99,7 +101,7 @@ void WINAPI CNTL_main_thread( DWORD /*argc*/, char* /*argv*/[])
temp = WaitForSingleObject(stop_event_handle, INFINITE); temp = WaitForSingleObject(stop_event_handle, INFINITE);
} }
} }
catch (const Firebird::Exception& ex) catch (const Exception& ex)
{ {
iscLogException("CNTL: cannot start service handler thread", ex); iscLogException("CNTL: cannot start service handler thread", ex);
} }

View File

@ -249,7 +249,7 @@ int WINAPI WinMain(HINSTANCE hThisInst, HINSTANCE /*hPrevInst*/, LPSTR lpszArgs,
} }
{ {
Firebird::MasterInterfacePtr master; MasterInterfacePtr master;
master->serverMode(server_flag & SRVR_multi_client ? 1 : 0); master->serverMode(server_flag & SRVR_multi_client ? 1 : 0);
} }

View File

@ -259,8 +259,8 @@ public:
return rc; return rc;
} }
unsigned afterAttach(Firebird::CheckStatusWrapper* st, const char* dbName, unsigned afterAttach(CheckStatusWrapper* st, const char* dbName,
const Firebird::IStatus* attStatus) override const IStatus* attStatus) override
{ {
return NO_RETRY; return NO_RETRY;
} }
@ -456,7 +456,7 @@ void loginSuccess(const string& login, const string& remId)
template <typename T> template <typename T>
static void getMultiPartConnectParameter(T& putTo, Firebird::ClumpletReader& id, UCHAR param) static void getMultiPartConnectParameter(T& putTo, ClumpletReader& id, UCHAR param)
{ {
// This array is needed only to make sure that all parts of specific data are present // This array is needed only to make sure that all parts of specific data are present
UCHAR checkBytes[256]; UCHAR checkBytes[256];
@ -1236,7 +1236,7 @@ static void release_sql_request(Rsr*);
static void release_transaction(Rtr*); static void release_transaction(Rtr*);
static void send_error(rem_port* port, PACKET* apacket, ISC_STATUS errcode); static void send_error(rem_port* port, PACKET* apacket, ISC_STATUS errcode);
static void send_error(rem_port* port, PACKET* apacket, const Firebird::Arg::StatusVector&); static void send_error(rem_port* port, PACKET* apacket, const Arg::StatusVector&);
static void set_server(rem_port*, USHORT); static void set_server(rem_port*, USHORT);
static int shut_server(const int, const int, void*); static int shut_server(const int, const int, void*);
static int pre_shutdown(const int, const int, void*); static int pre_shutdown(const int, const int, void*);
@ -1392,7 +1392,7 @@ void SRVR_enum_attachments(ULONG& att_cnt, ULONG& dbs_cnt, ULONG& svc_cnt)
iface->query(&status, 0, NULL, sizeof(spb_query), spb_query, sizeof(buffer), buffer); iface->query(&status, 0, NULL, sizeof(spb_query), spb_query, sizeof(buffer), buffer);
const UCHAR* p = buffer; const UCHAR* p = buffer;
if ((!(status.getState() & Firebird::IStatus::STATE_ERRORS)) && *p++ == isc_info_svc_svr_db_info) if ((!(status.getState() & IStatus::STATE_ERRORS)) && *p++ == isc_info_svc_svr_db_info)
{ {
while (*p != isc_info_flag_end) while (*p != isc_info_flag_end)
{ {
@ -2009,7 +2009,7 @@ static bool accept_connection(rem_port* port, P_CNCT* connect, PACKET* send)
port->port_client_arch = connect->p_cnct_client; port->port_client_arch = connect->p_cnct_client;
Firebird::ClumpletReader id(Firebird::ClumpletReader::UnTagged, ClumpletReader id(ClumpletReader::UnTagged,
connect->p_cnct_user_id.cstr_address, connect->p_cnct_user_id.cstr_address,
connect->p_cnct_user_id.cstr_length); connect->p_cnct_user_id.cstr_length);
@ -2148,7 +2148,7 @@ static bool accept_connection(rem_port* port, P_CNCT* connect, PACKET* send)
if (!accepted) if (!accepted)
{ {
HANDSHAKE_DEBUG(fprintf(stderr, "!accepted, sending reject\n")); HANDSHAKE_DEBUG(fprintf(stderr, "!accepted, sending reject\n"));
if (status.getState() & Firebird::IStatus::STATE_ERRORS) if (status.getState() & IStatus::STATE_ERRORS)
{ {
switch (status.getErrors()[1]) switch (status.getErrors()[1])
{ {
@ -2542,13 +2542,13 @@ void DatabaseAuth::accept(PACKET* send, Auth::WriterImplementation* authBlock)
authPort->port_server_crypt_callback->destroy(); authPort->port_server_crypt_callback->destroy();
provider->setDbCryptCallback(&status_vector, authPort->port_server_crypt_callback->getInterface()); provider->setDbCryptCallback(&status_vector, authPort->port_server_crypt_callback->getInterface());
if (!(status_vector.getState() & Firebird::IStatus::STATE_ERRORS)) if (!(status_vector.getState() & IStatus::STATE_ERRORS))
{ {
ServAttachment iface(operation == op_attach ? ServAttachment iface(operation == op_attach ?
provider->attachDatabase(&status_vector, dbName.c_str(), dl, dpb) : provider->attachDatabase(&status_vector, dbName.c_str(), dl, dpb) :
provider->createDatabase(&status_vector, dbName.c_str(), dl, dpb)); provider->createDatabase(&status_vector, dbName.c_str(), dl, dpb));
if (!(status_vector.getState() & Firebird::IStatus::STATE_ERRORS)) if (!(status_vector.getState() & IStatus::STATE_ERRORS))
{ {
Rdb* rdb = FB_NEW Rdb; Rdb* rdb = FB_NEW Rdb;
@ -2610,7 +2610,7 @@ static void aux_request( rem_port* port, /*P_REQ* request,*/ PACKET* send)
port->send_response(send, rdb->rdb_id, send->p_resp.p_resp_data.cstr_length, port->send_response(send, rdb->rdb_id, send->p_resp.p_resp_data.cstr_length,
&status_vector, false); &status_vector, false);
if (status_vector.getState() & Firebird::IStatus::STATE_ERRORS) if (status_vector.getState() & IStatus::STATE_ERRORS)
{ {
return; return;
} }
@ -2810,7 +2810,7 @@ static USHORT check_statement_type( Rsr* statement)
statement->rsr_iface->getInfo(&local_status, sizeof(sql_info), sql_info, sizeof(buffer), buffer); statement->rsr_iface->getInfo(&local_status, sizeof(sql_info), sql_info, sizeof(buffer), buffer);
if (!(local_status.getState() & Firebird::IStatus::STATE_ERRORS)) if (!(local_status.getState() & IStatus::STATE_ERRORS))
{ {
for (ClumpletReader p(ClumpletReader::InfoResponse, buffer, sizeof(buffer)); !p.isEof(); p.moveNext()) for (ClumpletReader p(ClumpletReader::InfoResponse, buffer, sizeof(buffer)); !p.isEof(); p.moveNext())
{ {
@ -2870,7 +2870,7 @@ ISC_STATUS rem_port::compile(P_CMPL* compileL, PACKET* sendL)
ServRequest iface(rdb->rdb_iface->compileRequest(&status_vector, blr_length, blr)); ServRequest iface(rdb->rdb_iface->compileRequest(&status_vector, blr_length, blr));
if (status_vector.getState() & Firebird::IStatus::STATE_ERRORS) if (status_vector.getState() & IStatus::STATE_ERRORS)
return this->send_response(sendL, 0, 0, &status_vector, false); return this->send_response(sendL, 0, 0, &status_vector, false);
// Parse the request to find the messages // Parse the request to find the messages
@ -3130,7 +3130,7 @@ void rem_port::drop_database(P_RLSE* /*release*/, PACKET* sendL)
rdb->rdb_iface->dropDatabase(&status_vector); rdb->rdb_iface->dropDatabase(&status_vector);
if ((status_vector.getState() & Firebird::IStatus::STATE_ERRORS) && if ((status_vector.getState() & IStatus::STATE_ERRORS) &&
(status_vector.getErrors()[1] != isc_drdb_completed_with_errs)) (status_vector.getErrors()[1] != isc_drdb_completed_with_errs))
{ {
this->send_response(sendL, 0, 0, &status_vector, false); this->send_response(sendL, 0, 0, &status_vector, false);
@ -3189,7 +3189,7 @@ ISC_STATUS rem_port::end_blob(P_OP operation, P_RLSE * release, PACKET* sendL)
else else
blob->rbl_iface->cancel(&status_vector); blob->rbl_iface->cancel(&status_vector);
if (!(status_vector.getState() & Firebird::IStatus::STATE_ERRORS)) if (!(status_vector.getState() & IStatus::STATE_ERRORS))
{ {
blob->rbl_iface = NULL; blob->rbl_iface = NULL;
release_blob(blob); release_blob(blob);
@ -3220,7 +3220,7 @@ ISC_STATUS rem_port::end_database(P_RLSE* /*release*/, PACKET* sendL)
rdb->rdb_iface->detach(&status_vector); rdb->rdb_iface->detach(&status_vector);
if (status_vector.getState() & Firebird::IStatus::STATE_ERRORS) if (status_vector.getState() & IStatus::STATE_ERRORS)
return this->send_response(sendL, 0, 0, &status_vector, false); return this->send_response(sendL, 0, 0, &status_vector, false);
port_flags |= PORT_detached; port_flags |= PORT_detached;
@ -3274,7 +3274,7 @@ ISC_STATUS rem_port::end_request(P_RLSE * release, PACKET* sendL)
requestL->rrq_iface->free(&status_vector); requestL->rrq_iface->free(&status_vector);
if (!(status_vector.getState() & Firebird::IStatus::STATE_ERRORS)) if (!(status_vector.getState() & IStatus::STATE_ERRORS))
{ {
requestL->rrq_iface = NULL; requestL->rrq_iface = NULL;
release_request(requestL); release_request(requestL);
@ -3312,7 +3312,7 @@ ISC_STATUS rem_port::end_statement(P_SQLFREE* free_stmt, PACKET* sendL)
else if (statement->rsr_cursor) else if (statement->rsr_cursor)
{ {
statement->rsr_cursor->close(&status_vector); statement->rsr_cursor->close(&status_vector);
if (status_vector.getState() & Firebird::IStatus::STATE_ERRORS) if (status_vector.getState() & IStatus::STATE_ERRORS)
{ {
return this->send_response(sendL, 0, 0, &status_vector, true); return this->send_response(sendL, 0, 0, &status_vector, true);
} }
@ -3335,7 +3335,7 @@ ISC_STATUS rem_port::end_statement(P_SQLFREE* free_stmt, PACKET* sendL)
if (statement->rsr_iface) if (statement->rsr_iface)
{ {
statement->rsr_iface->free(&status_vector); statement->rsr_iface->free(&status_vector);
if (status_vector.getState() & Firebird::IStatus::STATE_ERRORS) if (status_vector.getState() & IStatus::STATE_ERRORS)
{ {
return this->send_response(sendL, 0, 0, &status_vector, true); return this->send_response(sendL, 0, 0, &status_vector, true);
} }
@ -3399,12 +3399,12 @@ ISC_STATUS rem_port::end_transaction(P_OP operation, P_RLSE * release, PACKET* s
case op_prepare: case op_prepare:
transaction->rtr_iface->prepare(&status_vector, 0, NULL); transaction->rtr_iface->prepare(&status_vector, 0, NULL);
if (!(status_vector.getState() & Firebird::IStatus::STATE_ERRORS)) if (!(status_vector.getState() & IStatus::STATE_ERRORS))
transaction->rtr_limbo = true; transaction->rtr_limbo = true;
break; break;
} }
if (!(status_vector.getState() & Firebird::IStatus::STATE_ERRORS)) if (!(status_vector.getState() & IStatus::STATE_ERRORS))
{ {
if (operation == op_commit || operation == op_rollback) if (operation == op_commit || operation == op_rollback)
{ {
@ -3513,11 +3513,11 @@ ISC_STATUS rem_port::execute_immediate(P_OP op, P_SQLST * exnow, PACKET* sendL)
sendL->p_operation = op_sql_response; sendL->p_operation = op_sql_response;
sendL->p_sqldata.p_sqldata_messages = sendL->p_sqldata.p_sqldata_messages =
((status_vector.getState() & Firebird::IStatus::STATE_ERRORS) || !out_msg) ? 0 : 1; ((status_vector.getState() & IStatus::STATE_ERRORS) || !out_msg) ? 0 : 1;
this->send_partial(sendL); this->send_partial(sendL);
} }
if (!(status_vector.getState() & Firebird::IStatus::STATE_ERRORS)) if (!(status_vector.getState() & IStatus::STATE_ERRORS))
{ {
if (transaction && !newTra) if (transaction && !newTra)
{ {
@ -3607,7 +3607,7 @@ void rem_port::batch_create(P_BATCH_CREATE* batch, PACKET* sendL)
statement->rsr_batch_size = 0; statement->rsr_batch_size = 0;
statement->rsr_batch_stream.blobRemaining = 0; statement->rsr_batch_stream.blobRemaining = 0;
if (!(status_vector.getState() & Firebird::IStatus::STATE_ERRORS)) if (!(status_vector.getState() & IStatus::STATE_ERRORS))
{ {
if (msgBuffer.metadata) if (msgBuffer.metadata)
{ {
@ -3934,7 +3934,7 @@ ISC_STATUS rem_port::execute_statement(P_OP op, P_SQLDATA* sqldata, PACKET* send
(out_blr_length ? oMsgBuffer.metadata : DELAYED_OUT_FORMAT), (out_blr_length ? oMsgBuffer.metadata : DELAYED_OUT_FORMAT),
cursorFlags); cursorFlags);
if (!(status_vector.getState() & Firebird::IStatus::STATE_ERRORS)) if (!(status_vector.getState() & IStatus::STATE_ERRORS))
{ {
transaction->rtr_cursors.add(statement); transaction->rtr_cursors.add(statement);
statement->rsr_delayed_format = !out_blr_length; statement->rsr_delayed_format = !out_blr_length;
@ -3952,12 +3952,12 @@ ISC_STATUS rem_port::execute_statement(P_OP op, P_SQLDATA* sqldata, PACKET* send
sendL->p_operation = op_sql_response; sendL->p_operation = op_sql_response;
sendL->p_sqldata.p_sqldata_messages = sendL->p_sqldata.p_sqldata_messages =
((status_vector.getState() & Firebird::IStatus::STATE_ERRORS) || !out_msg) ? 0 : 1; ((status_vector.getState() & IStatus::STATE_ERRORS) || !out_msg) ? 0 : 1;
this->send_partial(sendL); this->send_partial(sendL);
} }
if (!(status_vector.getState() & Firebird::IStatus::STATE_ERRORS)) if (!(status_vector.getState() & IStatus::STATE_ERRORS))
{ {
if (transaction && !newTra) if (transaction && !newTra)
{ {
@ -4110,7 +4110,7 @@ ISC_STATUS rem_port::fetch(P_SQLDATA * sqldata, PACKET* sendL, bool scroll)
const auto message = statement->rsr_buffer; const auto message = statement->rsr_buffer;
const int rc = cursor->fetchRelative(&status_vector, adjustment, message->msg_buffer); const int rc = cursor->fetchRelative(&status_vector, adjustment, message->msg_buffer);
if (status_vector.getState() & Firebird::IStatus::STATE_ERRORS) if (status_vector.getState() & IStatus::STATE_ERRORS)
return this->send_response(sendL, 0, 0, &status_vector, false); return this->send_response(sendL, 0, 0, &status_vector, false);
// Re-positioning should never fail // Re-positioning should never fail
@ -4231,7 +4231,7 @@ ISC_STATUS rem_port::fetch(P_SQLDATA * sqldata, PACKET* sendL, bool scroll)
statement->rsr_flags.set(Rsr::FETCHED); statement->rsr_flags.set(Rsr::FETCHED);
if (status_vector.getState() & Firebird::IStatus::STATE_ERRORS) if (status_vector.getState() & IStatus::STATE_ERRORS)
return this->send_response(sendL, 0, 0, &status_vector, false); return this->send_response(sendL, 0, 0, &status_vector, false);
success = (rc == IStatus::RESULT_OK); success = (rc == IStatus::RESULT_OK);
@ -4323,7 +4323,7 @@ ISC_STATUS rem_port::fetch(P_SQLDATA * sqldata, PACKET* sendL, bool scroll)
fb_assert(false); fb_assert(false);
} }
if (status_vector.getState() & Firebird::IStatus::STATE_ERRORS) if (status_vector.getState() & IStatus::STATE_ERRORS)
{ {
// If already have an error queued, don't overwrite it // If already have an error queued, don't overwrite it
if (!statement->rsr_flags.test(Rsr::STREAM_ERR)) if (!statement->rsr_flags.test(Rsr::STREAM_ERR))
@ -4375,7 +4375,7 @@ static bool get_next_msg_no(Rrq* request, USHORT incarnation, USHORT * msg_numbe
request->rrq_iface->getInfo(&status_vector, incarnation, request->rrq_iface->getInfo(&status_vector, incarnation,
sizeof(request_info), request_info, sizeof(info_buffer), info_buffer); sizeof(request_info), request_info, sizeof(info_buffer), info_buffer);
if (status_vector.getState() & Firebird::IStatus::STATE_ERRORS) if (status_vector.getState() & IStatus::STATE_ERRORS)
return false; return false;
bool result = false; bool result = false;
@ -4527,7 +4527,7 @@ ISC_STATUS rem_port::get_slice(P_SLC * stuff, PACKET* sendL)
stuff->p_slc_parameters.cstr_address, stuff->p_slc_length, slice); stuff->p_slc_parameters.cstr_address, stuff->p_slc_length, slice);
ISC_STATUS status; ISC_STATUS status;
if (status_vector.getState() & Firebird::IStatus::STATE_ERRORS) if (status_vector.getState() & IStatus::STATE_ERRORS)
status = this->send_response(sendL, 0, 0, &status_vector, false); status = this->send_response(sendL, 0, 0, &status_vector, false);
else else
{ {
@ -4620,7 +4620,7 @@ void rem_port::info(P_OP op, P_INFO* stuff, PACKET* sendL)
buffer_length, //sizeof(temp) buffer_length, //sizeof(temp)
temp_buffer); //temp temp_buffer); //temp
if (!(status_vector.getState() & Firebird::IStatus::STATE_ERRORS)) if (!(status_vector.getState() & IStatus::STATE_ERRORS))
{ {
string version; string version;
versionInfo(version); versionInfo(version);
@ -4801,7 +4801,7 @@ ISC_STATUS rem_port::open_blob(P_OP op, P_BLOB* stuff, PACKET* sendL)
&sendL->p_resp.p_resp_blob_id, bpb_length, bpb)); &sendL->p_resp.p_resp_blob_id, bpb_length, bpb));
USHORT object = 0; USHORT object = 0;
if (!(status_vector.getState() & Firebird::IStatus::STATE_ERRORS)) if (!(status_vector.getState() & IStatus::STATE_ERRORS))
{ {
Rbl* blob = FB_NEW Rbl; Rbl* blob = FB_NEW Rbl;
#ifdef DEBUG_REMOTE_MEMORY #ifdef DEBUG_REMOTE_MEMORY
@ -4848,7 +4848,7 @@ ISC_STATUS rem_port::prepare(P_PREP * stuff, PACKET* sendL)
transaction->rtr_iface->prepare(&status_vector, transaction->rtr_iface->prepare(&status_vector,
stuff->p_prep_data.cstr_length, stuff->p_prep_data.cstr_address); stuff->p_prep_data.cstr_length, stuff->p_prep_data.cstr_address);
if (!(status_vector.getState() & Firebird::IStatus::STATE_ERRORS)) if (!(status_vector.getState() & IStatus::STATE_ERRORS))
{ {
transaction->rtr_limbo = true; transaction->rtr_limbo = true;
} }
@ -4900,7 +4900,7 @@ ISC_STATUS rem_port::prepare_statement(P_SQLST * prepareL, PACKET* sendL)
if (statement->rsr_iface) if (statement->rsr_iface)
{ {
statement->rsr_iface->free(&status_vector); statement->rsr_iface->free(&status_vector);
if (status_vector.getState() & Firebird::IStatus::STATE_ERRORS) if (status_vector.getState() & IStatus::STATE_ERRORS)
return this->send_response(sendL, 0, 0, &status_vector, false); return this->send_response(sendL, 0, 0, &status_vector, false);
} }
@ -4916,13 +4916,13 @@ ISC_STATUS rem_port::prepare_statement(P_SQLST * prepareL, PACKET* sendL)
iface, prepareL->p_sqlst_SQL_str.cstr_length, iface, prepareL->p_sqlst_SQL_str.cstr_length,
reinterpret_cast<const char*>(prepareL->p_sqlst_SQL_str.cstr_address), reinterpret_cast<const char*>(prepareL->p_sqlst_SQL_str.cstr_address),
prepareL->p_sqlst_SQL_dialect, flags); prepareL->p_sqlst_SQL_dialect, flags);
if (status_vector.getState() & Firebird::IStatus::STATE_ERRORS) if (status_vector.getState() & IStatus::STATE_ERRORS)
return this->send_response(sendL, 0, 0, &status_vector, false); return this->send_response(sendL, 0, 0, &status_vector, false);
LocalStatus ls2; LocalStatus ls2;
CheckStatusWrapper s2(&ls2); CheckStatusWrapper s2(&ls2);
statement->rsr_iface->getInfo(&s2, infoLength, info, prepareL->p_sqlst_buffer_length, buffer); statement->rsr_iface->getInfo(&s2, infoLength, info, prepareL->p_sqlst_buffer_length, buffer);
if (s2.getState() & Firebird::IStatus::STATE_ERRORS) if (s2.getState() & IStatus::STATE_ERRORS)
return this->send_response(sendL, 0, 0, &s2, false); return this->send_response(sendL, 0, 0, &s2, false);
REMOTE_reset_statement(statement); REMOTE_reset_statement(statement);
@ -5439,7 +5439,7 @@ ISC_STATUS rem_port::put_segment(P_OP op, P_SGMT * segment, PACKET* sendL)
length += *p++ << 8; length += *p++ << 8;
blob->rbl_iface->putSegment(&status_vector, length, p); blob->rbl_iface->putSegment(&status_vector, length, p);
if (status_vector.getState() & Firebird::IStatus::STATE_ERRORS) if (status_vector.getState() & IStatus::STATE_ERRORS)
return this->send_response(sendL, 0, 0, &status_vector, false); return this->send_response(sendL, 0, 0, &status_vector, false);
p += length; p += length;
} }
@ -5571,7 +5571,7 @@ ISC_STATUS rem_port::receive_after_start(P_DATA* data, PACKET* sendL, IStatus* s
response->p_resp_data.cstr_length = 0; response->p_resp_data.cstr_length = 0;
if (!sendL->p_resp.p_resp_status_vector) if (!sendL->p_resp.p_resp_status_vector)
sendL->p_resp.p_resp_status_vector = FB_NEW_POOL(*getDefaultMemoryPool()) Firebird::DynamicStatusVector(); sendL->p_resp.p_resp_status_vector = FB_NEW_POOL(*getDefaultMemoryPool()) DynamicStatusVector();
sendL->p_resp.p_resp_status_vector->load(status_vector); sendL->p_resp.p_resp_status_vector->load(status_vector);
@ -5661,7 +5661,7 @@ ISC_STATUS rem_port::receive_msg(P_DATA * data, PACKET* sendL)
requestL->rrq_iface->receive(&status_vector, level, requestL->rrq_iface->receive(&status_vector, level,
msg_number, format->fmt_length, message->msg_buffer); msg_number, format->fmt_length, message->msg_buffer);
if (status_vector.getState() & Firebird::IStatus::STATE_ERRORS) if (status_vector.getState() & IStatus::STATE_ERRORS)
return this->send_response(sendL, 0, 0, &status_vector, false); return this->send_response(sendL, 0, 0, &status_vector, false);
message->msg_address = message->msg_buffer; message->msg_address = message->msg_buffer;
@ -5742,7 +5742,7 @@ ISC_STATUS rem_port::receive_msg(P_DATA * data, PACKET* sendL)
// Did we have an error? If so, save it for later delivery // Did we have an error? If so, save it for later delivery
if (status_vector.getState() & Firebird::IStatus::STATE_ERRORS) if (status_vector.getState() & IStatus::STATE_ERRORS)
{ {
// If already have an error queued, don't overwrite it // If already have an error queued, don't overwrite it
@ -6023,7 +6023,7 @@ ISC_STATUS rem_port::send_msg(P_DATA * data, PACKET* sendL)
} }
ISC_STATUS rem_port::send_response(PACKET* p, OBJCT obj, ULONG length, const Firebird::IStatus* status, bool defer_flag) ISC_STATUS rem_port::send_response(PACKET* p, OBJCT obj, ULONG length, const IStatus* status, bool defer_flag)
{ {
StaticStatusVector tmp; StaticStatusVector tmp;
tmp.mergeStatus(status); tmp.mergeStatus(status);
@ -6052,7 +6052,7 @@ ISC_STATUS rem_port::send_response( PACKET* sendL,
// Start by translating the status vector into "generic" form // Start by translating the status vector into "generic" form
Firebird::StaticStatusVector new_vector; StaticStatusVector new_vector;
const ISC_STATUS* old_vector = status_vector; const ISC_STATUS* old_vector = status_vector;
const ISC_STATUS exit_code = old_vector[1]; const ISC_STATUS exit_code = old_vector[1];
@ -6131,7 +6131,7 @@ ISC_STATUS rem_port::send_response( PACKET* sendL,
// of the response packet may contain valid data. Don't trash them. // of the response packet may contain valid data. Don't trash them.
if (!response->p_resp_status_vector) if (!response->p_resp_status_vector)
response->p_resp_status_vector = FB_NEW_POOL(*getDefaultMemoryPool()) Firebird::DynamicStatusVector(); response->p_resp_status_vector = FB_NEW_POOL(*getDefaultMemoryPool()) DynamicStatusVector();
response->p_resp_status_vector->save(new_vector.begin()); response->p_resp_status_vector->save(new_vector.begin());
@ -6170,7 +6170,7 @@ static void send_error(rem_port* port, PACKET* apacket, ISC_STATUS errcode)
} }
// Maybe this can be a member of rem_port? // Maybe this can be a member of rem_port?
static void send_error(rem_port* port, PACKET* apacket, const Firebird::Arg::StatusVector& err) static void send_error(rem_port* port, PACKET* apacket, const Arg::StatusVector& err)
{ {
LocalStatus ls; LocalStatus ls;
CheckStatusWrapper status_vector(&ls); CheckStatusWrapper status_vector(&ls);
@ -6264,13 +6264,13 @@ ISC_STATUS rem_port::service_attach(const char* service_name,
port_server_crypt_callback->destroy(); port_server_crypt_callback->destroy();
provider->setDbCryptCallback(&status_vector, port_server_crypt_callback->getInterface()); provider->setDbCryptCallback(&status_vector, port_server_crypt_callback->getInterface());
if (!(status_vector.getState() & Firebird::IStatus::STATE_ERRORS)) if (!(status_vector.getState() & IStatus::STATE_ERRORS))
{ {
dumpAuthBlock("rem_port::service_attach()", spb, isc_spb_auth_block); dumpAuthBlock("rem_port::service_attach()", spb, isc_spb_auth_block);
ServService iface(provider->attachServiceManager(&status_vector, service_name, ServService iface(provider->attachServiceManager(&status_vector, service_name,
(ULONG) spb->getBufferLength(), spb->getBuffer())); (ULONG) spb->getBufferLength(), spb->getBuffer()));
if (!(status_vector.getState() & Firebird::IStatus::STATE_ERRORS)) if (!(status_vector.getState() & IStatus::STATE_ERRORS))
{ {
Rdb* rdb = FB_NEW Rdb; Rdb* rdb = FB_NEW Rdb;
@ -6314,7 +6314,7 @@ ISC_STATUS rem_port::service_end(P_RLSE* /*release*/, PACKET* sendL)
RefMutexGuard portGuard(*port_cancel_sync, FB_FUNCTION); RefMutexGuard portGuard(*port_cancel_sync, FB_FUNCTION);
rdb->rdb_svc->svc_iface->detach(&status_vector); rdb->rdb_svc->svc_iface->detach(&status_vector);
if (!(status_vector.getState() & Firebird::IStatus::STATE_ERRORS)) if (!(status_vector.getState() & IStatus::STATE_ERRORS))
{ {
port_flags |= PORT_detached; port_flags |= PORT_detached;
rdb->rdb_svc->svc_iface = NULL; rdb->rdb_svc->svc_iface = NULL;
@ -6582,7 +6582,7 @@ ISC_STATUS rem_port::start(P_OP operation, P_DATA * data, PACKET* sendL)
requestL->rrq_iface->start(&status_vector, transaction->rtr_iface, data->p_data_incarnation); requestL->rrq_iface->start(&status_vector, transaction->rtr_iface, data->p_data_incarnation);
if (!(status_vector.getState() & Firebird::IStatus::STATE_ERRORS)) if (!(status_vector.getState() & IStatus::STATE_ERRORS))
{ {
requestL->rrq_rtr = transaction; requestL->rrq_rtr = transaction;
if (operation == op_start_and_receive) if (operation == op_start_and_receive)
@ -6629,7 +6629,7 @@ ISC_STATUS rem_port::start_and_send(P_OP operation, P_DATA* data, PACKET* sendL)
transaction->rtr_iface, data->p_data_incarnation, transaction->rtr_iface, data->p_data_incarnation,
number, format->fmt_length, message->msg_address); number, format->fmt_length, message->msg_address);
if (!(status_vector.getState() & Firebird::IStatus::STATE_ERRORS)) if (!(status_vector.getState() & IStatus::STATE_ERRORS))
{ {
requestL->rrq_rtr = transaction; requestL->rrq_rtr = transaction;
if (operation == op_start_send_and_receive) if (operation == op_start_send_and_receive)
@ -6666,7 +6666,7 @@ ISC_STATUS rem_port::start_transaction(P_OP operation, P_STTR * stuff, PACKET* s
stuff->p_sttr_tpb.cstr_length, stuff->p_sttr_tpb.cstr_address)); stuff->p_sttr_tpb.cstr_length, stuff->p_sttr_tpb.cstr_address));
OBJCT object = 0; OBJCT object = 0;
if (!(status_vector.getState() & Firebird::IStatus::STATE_ERRORS)) if (!(status_vector.getState() & IStatus::STATE_ERRORS))
{ {
Rtr* transaction = make_transaction(rdb, iface); Rtr* transaction = make_transaction(rdb, iface);
if (transaction) if (transaction)
@ -7024,7 +7024,7 @@ ISC_STATUS rem_port::transact_request(P_TRRQ* trrq, PACKET* sendL)
rdb->rdb_iface->transactRequest(&status_vector, transaction->rtr_iface, rdb->rdb_iface->transactRequest(&status_vector, transaction->rtr_iface,
blr_length, blr, in_msg_length, in_msg, out_msg_length, out_msg); blr_length, blr, in_msg_length, in_msg, out_msg_length, out_msg);
if (status_vector.getState() & Firebird::IStatus::STATE_ERRORS) if (status_vector.getState() & IStatus::STATE_ERRORS)
return this->send_response(sendL, 0, 0, &status_vector, false); return this->send_response(sendL, 0, 0, &status_vector, false);
P_DATA* data = &sendL->p_data; P_DATA* data = &sendL->p_data;
@ -7280,12 +7280,12 @@ bool SrvAuthBlock::authCompleted(bool flag)
return flComplete; return flComplete;
} }
void SrvAuthBlock::setLogin(const Firebird::string& user) void SrvAuthBlock::setLogin(const string& user)
{ {
userName = user; userName = user;
} }
void SrvAuthBlock::load(Firebird::ClumpletReader& id) void SrvAuthBlock::load(ClumpletReader& id)
{ {
if (id.find(CNCT_login)) if (id.find(CNCT_login))
{ {
@ -7320,12 +7320,12 @@ const char* SrvAuthBlock::getPluginName()
return pluginName.nullStr(); return pluginName.nullStr();
} }
void SrvAuthBlock::setPluginName(const Firebird::string& name) void SrvAuthBlock::setPluginName(const string& name)
{ {
pluginName = name.ToPathName(); pluginName = name.ToPathName();
} }
void SrvAuthBlock::setPluginList(const Firebird::string& list) void SrvAuthBlock::setPluginList(const string& list)
{ {
if (firstTime) if (firstTime)
{ {
@ -7337,7 +7337,7 @@ void SrvAuthBlock::setPluginList(const Firebird::string& list)
} }
} }
void SrvAuthBlock::setDataForPlugin(const Firebird::UCharBuffer& data) void SrvAuthBlock::setDataForPlugin(const UCharBuffer& data)
{ {
dataForPlugin.assign(data.begin(), data.getCount()); dataForPlugin.assign(data.begin(), data.getCount());
} }