8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-22 18:43:02 +01:00

Language independent API

This commit is contained in:
alexpeshkoff 2014-09-29 11:03:47 +00:00
parent fec7a2b7b1
commit 153de0f271
154 changed files with 18896 additions and 4214 deletions

View File

@ -29,15 +29,14 @@
#include <stdlib.h>
#include <ibase.h>
#include <firebird/Crypt.h>
#include <firebird/Provider.h>
#include <firebird/Interface.h>
using namespace Firebird;
class CryptKey : public ICryptKeyCallback
class CryptKey : public Api::CryptKeyCallbackImpl<CryptKey>
{
public:
unsigned int FB_CARG callback(unsigned int, const void*, unsigned int length, void* buffer)
unsigned int callback(unsigned int, const void*, unsigned int length, void* buffer)
{
if (length > 0 && buffer)
{
@ -48,12 +47,7 @@ public:
return 1;
}
int FB_CARG getVersion()
{
return FB_CRYPT_CALLBACK_VERSION;
}
IPluginModule* FB_CARG getModule()
IPluginModule* getModule()
{
return NULL; // OK for application, not for plugin
}
@ -72,7 +66,7 @@ public:
if (tra)
{
tra->rollback(status);
if (!status->isSuccess())
if (status->getStatus() & IStatus::FB_HAS_ERRORS)
{
print("rollback");
tra->release();
@ -81,7 +75,7 @@ public:
if (att)
{
att->detach(status);
if (!status->isSuccess())
if (status->getStatus() & IStatus::FB_HAS_ERRORS)
{
print("detach");
att->release();
@ -103,19 +97,19 @@ public:
p = master->getDispatcher();
p->setDbCryptCallback(status, &key);
if (!status->isSuccess())
if (status->getStatus() & IStatus::FB_HAS_ERRORS)
throw "setDbCryptCallback";
char s[256];
sprintf(s, "localhost:%s", dbName);
att = p->attachDatabase(status, s, 0, NULL);
if (!status->isSuccess())
if (status->getStatus() & IStatus::FB_HAS_ERRORS)
throw "attachDatabase";
if (a != NONE)
{
tra = att->startTransaction(status, 0, NULL);
if (!status->isSuccess())
if (status->getStatus() & IStatus::FB_HAS_ERRORS)
throw "startTransaction";
}
@ -123,20 +117,20 @@ public:
{
att->execute(status, tra, 0,
"ALTER DATABASE ENCRYPT WITH \"DbCrypt_example\"", 3, NULL, NULL, NULL, NULL);
if (!status->isSuccess())
if (status->getStatus() & IStatus::FB_HAS_ERRORS)
throw "execute";
}
if (a == DEC)
{
att->execute(status, tra, 0, "ALTER DATABASE DECRYPT", 3, NULL, NULL, NULL, NULL);
if (!status->isSuccess())
if (status->getStatus() & IStatus::FB_HAS_ERRORS)
throw "execute";
}
if (tra)
{
tra->commit(status);
if (!status->isSuccess())
if (status->getStatus() & IStatus::FB_HAS_ERRORS)
throw "commit";
tra = NULL;
}
@ -145,7 +139,7 @@ public:
getchar();
att->detach(status);
if (!status->isSuccess())
if (status->getStatus() & IStatus::FB_HAS_ERRORS)
throw "detach";
att = NULL;
@ -156,7 +150,7 @@ public:
void print(const char* where)
{
fprintf(stderr, "Error in %s: ", where);
isc_print_status(status->get());
isc_print_status(status->getErrors());
}
private:

View File

@ -27,11 +27,12 @@
#include <stdio.h>
#include <string.h>
#include "firebird.h"
#include "firebird/Crypt.h"
#include "firebird/Interface.h"
#include "firebird.h" // Needed for atomic support
#include "../common/classes/fb_atomic.h"
using namespace Firebird;
namespace
@ -40,7 +41,7 @@ namespace
IMaster* master = NULL;
IPluginManager* pluginManager = NULL;
class PluginModule : public IPluginModule
class PluginModule : public Api::PluginModuleImpl<PluginModule>
{
public:
PluginModule()
@ -62,17 +63,12 @@ public:
}
}
int FB_CARG getVersion()
{
return FB_PLUGIN_MODULE_VERSION;
}
IPluginModule* FB_CARG getModule()
IPluginModule* getModule()
{
return this;
}
void FB_CARG doClean()
void doClean()
{
flag = false;
}
@ -83,10 +79,10 @@ private:
PluginModule module;
class CryptKeyHolder : public IKeyHolderPlugin
class CryptKeyHolder : public Api::KeyHolderPluginImpl<CryptKeyHolder>
{
public:
explicit CryptKeyHolder(IPluginConfig* cnf)
explicit CryptKeyHolder(IPluginConfig* cnf) throw()
: callbackInterface(this), config(cnf), key(0), owner(NULL)
{
config->addRef();
@ -98,10 +94,10 @@ public:
}
// IKeyHolderPlugin implementation
virtual int FB_CARG keyCallback(IStatus* status, ICryptKeyCallback* callback);
virtual ICryptKeyCallback* FB_CARG keyHandle(IStatus* status, const char* keyName);
int keyCallback(IStatus* status, ICryptKeyCallback* callback);
ICryptKeyCallback* keyHandle(IStatus* status, const char* keyName);
int FB_CARG release()
int release()
{
if (--refCounter == 0)
{
@ -111,27 +107,22 @@ public:
return 1;
}
void FB_CARG addRef()
void addRef()
{
++refCounter;
}
int FB_CARG getVersion()
{
return FB_KEYHOLDER_PLUGIN_VERSION;
}
IPluginModule* FB_CARG getModule()
IPluginModule* getModule()
{
return &module;
}
void FB_CARG setOwner(Firebird::IRefCounted* o)
void setOwner(Firebird::IReferenceCounted* o)
{
owner = o;
}
IRefCounted* FB_CARG getOwner()
IReferenceCounted* getOwner()
{
return owner;
}
@ -142,14 +133,14 @@ public:
}
private:
class CallbackInterface : public ICryptKeyCallback
class CallbackInterface : public Api::CryptKeyCallbackImpl<CallbackInterface>
{
public:
explicit CallbackInterface(CryptKeyHolder* p)
: parent(p)
{ }
unsigned int FB_CARG callback(unsigned int, const void*, unsigned int length, void* buffer)
unsigned int callback(unsigned int, const void*, unsigned int length, void* buffer)
{
UCHAR k = parent->getKey();
if (!k)
@ -164,12 +155,7 @@ private:
return 1;
}
int FB_CARG getVersion()
{
return FB_CRYPT_CALLBACK_VERSION;
}
IPluginModule* FB_CARG getModule()
IPluginModule* getModule()
{
return &module;
}
@ -184,7 +170,7 @@ private:
UCHAR key;
AtomicCounter refCounter;
IRefCounted* owner;
IReferenceCounted* owner;
void noKeyError(IStatus* status);
};
@ -200,7 +186,7 @@ void CryptKeyHolder::noKeyError(IStatus* status)
status->setErrors(vector);
}
int FB_CARG CryptKeyHolder::keyCallback(IStatus* status, ICryptKeyCallback* callback)
int CryptKeyHolder::keyCallback(IStatus* status, ICryptKeyCallback* callback)
{
status->init();
@ -236,7 +222,7 @@ int FB_CARG CryptKeyHolder::keyCallback(IStatus* status, ICryptKeyCallback* call
return 1;
}
ICryptKeyCallback* FB_CARG CryptKeyHolder::keyHandle(IStatus* status, const char* keyName)
ICryptKeyCallback* CryptKeyHolder::keyHandle(IStatus* status, const char* keyName)
{
if (strcmp(keyName, "sample") != 0)
{
@ -246,20 +232,15 @@ ICryptKeyCallback* FB_CARG CryptKeyHolder::keyHandle(IStatus* status, const char
return &callbackInterface;
}
class Factory : public IPluginFactory
class Factory : public Api::PluginFactoryImpl<Factory>
{
public:
int FB_CARG getVersion()
{
return FB_PLUGIN_FACTORY_VERSION;
}
IPluginModule* FB_CARG getModule()
IPluginModule* getModule()
{
return &module;
}
IPluginBase* FB_CARG createPlugin(IStatus* status, IPluginConfig* factoryParameter)
IPluginBase* createPlugin(IStatus* status, IPluginConfig* factoryParameter)
{
try
{
@ -267,9 +248,10 @@ public:
p->addRef();
return p;
}
catch (const Exception& ex)
catch (...)
{
ex.stuffException(status);
ISC_STATUS st[3] = {isc_arg_gds, isc_virmemexh, isc_arg_end};
status->setErrors(st);
}
return NULL;
}
@ -285,6 +267,6 @@ extern "C" void FB_PLUGIN_ENTRY_POINT(IMaster* m)
pluginManager = master->getPluginManager();
module.registerMe();
pluginManager->registerPluginFactory(PluginType::KeyHolder, "CryptKeyHolder_example",
pluginManager->registerPluginFactory(IPluginManager::KeyHolder, "CryptKeyHolder_example",
&factory);
}

View File

@ -24,9 +24,9 @@
* Contributor(s): ______________________________________.
*/
#include "firebird.h"
#include "firebird/Crypt.h"
#include "firebird/Interface.h"
#include "firebird.h" // Needed for atomic support
#include "../common/classes/fb_atomic.h"
using namespace Firebird;
@ -37,7 +37,7 @@ namespace
IMaster* master = NULL;
IPluginManager* pluginManager = NULL;
class PluginModule : public IPluginModule
class PluginModule : public Api::PluginModuleImpl<PluginModule>
{
public:
PluginModule()
@ -59,17 +59,12 @@ public:
}
}
int FB_CARG getVersion()
{
return FB_PLUGIN_MODULE_VERSION;
}
IPluginModule* FB_CARG getModule()
IPluginModule* getModule()
{
return this;
}
void FB_CARG doClean()
void doClean()
{
flag = false;
}
@ -80,10 +75,10 @@ private:
PluginModule module;
class DbCrypt : public IDbCryptPlugin
class DbCrypt : public Api::DbCryptPluginImpl<DbCrypt>
{
public:
explicit DbCrypt(IPluginConfig* cnf)
explicit DbCrypt(IPluginConfig* cnf) throw()
: config(cnf), key(0), owner(NULL)
{
config->addRef();
@ -95,11 +90,11 @@ public:
}
// ICryptPlugin implementation
void FB_CARG encrypt(IStatus* status, unsigned int length, const void* from, void* to);
void FB_CARG decrypt(IStatus* status, unsigned int length, const void* from, void* to);
void FB_CARG setKey(IStatus* status, unsigned int length, IKeyHolderPlugin** sources);
void encrypt(IStatus* status, unsigned int length, const void* from, void* to);
void decrypt(IStatus* status, unsigned int length, const void* from, void* to);
void setKey(IStatus* status, unsigned int length, IKeyHolderPlugin** sources);
int FB_CARG release()
int release()
{
if (--refCounter == 0)
{
@ -109,27 +104,22 @@ public:
return 1;
}
void FB_CARG addRef()
void addRef()
{
++refCounter;
}
int FB_CARG getVersion()
{
return FB_DBCRYPT_PLUGIN_VERSION;
}
IPluginModule* FB_CARG getModule()
IPluginModule* getModule()
{
return &module;
}
void FB_CARG setOwner(IRefCounted* o)
void setOwner(IReferenceCounted* o)
{
owner = o;
}
IRefCounted* FB_CARG getOwner()
IReferenceCounted* getOwner()
{
return owner;
}
@ -139,7 +129,7 @@ private:
UCHAR key;
AtomicCounter refCounter;
IRefCounted* owner;
IReferenceCounted* owner;
void noKeyError(IStatus* status);
};
@ -155,7 +145,7 @@ void DbCrypt::noKeyError(IStatus* status)
status->setErrors(vector);
}
void FB_CARG DbCrypt::encrypt(IStatus* status, unsigned int length, const void* from, void* to)
void DbCrypt::encrypt(IStatus* status, unsigned int length, const void* from, void* to)
{
status->init();
@ -174,7 +164,7 @@ void FB_CARG DbCrypt::encrypt(IStatus* status, unsigned int length, const void*
}
}
void FB_CARG DbCrypt::decrypt(IStatus* status, unsigned int length, const void* from, void* to)
void DbCrypt::decrypt(IStatus* status, unsigned int length, const void* from, void* to)
{
status->init();
@ -193,7 +183,7 @@ void FB_CARG DbCrypt::decrypt(IStatus* status, unsigned int length, const void*
}
}
void FB_CARG DbCrypt::setKey(IStatus* status, unsigned int length, IKeyHolderPlugin** sources)
void DbCrypt::setKey(IStatus* status, unsigned int length, IKeyHolderPlugin** sources)
{
status->init();
@ -249,20 +239,15 @@ void FB_CARG DbCrypt::setKey(IStatus* status, unsigned int length, IKeyHolderPlu
noKeyError(status);
}
class Factory : public IPluginFactory
class Factory : public Api::PluginFactoryImpl<Factory>
{
public:
int FB_CARG getVersion()
{
return FB_PLUGIN_FACTORY_VERSION;
}
IPluginModule* FB_CARG getModule()
IPluginModule* getModule()
{
return &module;
}
IPluginBase* FB_CARG createPlugin(IStatus* status, IPluginConfig* factoryParameter)
IPluginBase* createPlugin(IStatus* status, IPluginConfig* factoryParameter)
{
try
{
@ -270,9 +255,10 @@ public:
p->addRef();
return p;
}
catch (const Exception& ex)
catch (...)
{
ex.stuffException(status);
ISC_STATUS st[3] = {isc_arg_gds, isc_virmemexh, isc_arg_end};
status->setErrors(st);
}
return NULL;
}
@ -288,5 +274,5 @@ extern "C" void FB_PLUGIN_ENTRY_POINT(IMaster* m)
pluginManager = master->getPluginManager();
module.registerMe();
pluginManager->registerPluginFactory(PluginType::DbCrypt, "DbCrypt_example", &factory);
pluginManager->registerPluginFactory(IPluginManager::DbCrypt, "DbCrypt_example", &factory);
}

View File

@ -38,7 +38,7 @@
#include <string.h>
#include <ibase.h>
#include <firebird/Provider.h>
#include <firebird/Interface.h>
using namespace Firebird;

View File

@ -40,7 +40,7 @@
#include <string.h>
#include <ibase.h>
#include <firebird/Provider.h>
#include <firebird/Interface.h>
using namespace Firebird;

View File

@ -38,7 +38,7 @@
#include <string.h>
#include <ibase.h>
#include <firebird/Provider.h>
#include <firebird/Interface.h>
using namespace Firebird;

View File

@ -37,7 +37,7 @@
#include <string.h>
#include <ibase.h>
#include <firebird/Provider.h>
#include <firebird/Interface.h>
using namespace Firebird;
@ -254,7 +254,7 @@ void MyField::print(IStatus* st, IAttachment* att, ITransaction* tra, unsigned c
try
{
// use attachment's method to access BLOB object
blob = att->openBlob(st, tra, (ISC_QUAD*) (buf + offset));
blob = att->openBlob(st, tra, (ISC_QUAD*) (buf + offset), 0, NULL);
check(st, "openBlob");
char segbuf[16];

View File

@ -34,8 +34,6 @@
//#define AUTH_VERBOSE
static Firebird::MakeUpgradeInfo<> upInfo;
// register plugin
static Firebird::SimpleFactory<Auth::DebugClient> clientFactory;
static Firebird::SimpleFactory<Auth::DebugServer> serverFactory;
@ -48,8 +46,8 @@ extern "C" void FB_PLUGIN_ENTRY_POINT(Firebird::IMaster* master)
Firebird::PluginManagerInterfacePtr iPlugin;
iPlugin->registerPluginFactory(Firebird::PluginType::AuthClient, name, &clientFactory);
iPlugin->registerPluginFactory(Firebird::PluginType::AuthServer, name, &serverFactory);
iPlugin->registerPluginFactory(Firebird::IPluginManager::AuthClient, name, &clientFactory);
iPlugin->registerPluginFactory(Firebird::IPluginManager::AuthServer, name, &serverFactory);
}
@ -63,8 +61,8 @@ DebugServer::DebugServer(Firebird::IPluginConfig* pConf)
check(&s);
}
int FB_CARG DebugServer::authenticate(Firebird::IStatus* status, IServerBlock* sb,
IWriter* writerInterface)
int DebugServer::authenticate(Firebird::IStatus* status, Firebird::IServerBlock* sb,
Firebird::IWriter* writerInterface)
{
try
{
@ -123,7 +121,7 @@ int FB_CARG DebugServer::authenticate(Firebird::IStatus* status, IServerBlock* s
return AUTH_FAILED;
}
int FB_CARG DebugServer::release()
int DebugServer::release()
{
if (--refCounter == 0)
{
@ -138,7 +136,7 @@ DebugClient::DebugClient(Firebird::IPluginConfig*)
: str(getPool())
{ }
int FB_CARG DebugClient::authenticate(Firebird::IStatus* status, IClientBlock* cb)
int DebugClient::authenticate(Firebird::IStatus* status, Firebird::IClientBlock* cb)
{
try
{
@ -185,7 +183,7 @@ int FB_CARG DebugClient::authenticate(Firebird::IStatus* status, IClientBlock* c
return AUTH_FAILED;
}
int FB_CARG DebugClient::release()
int DebugClient::release()
{
if (--refCounter == 0)
{

View File

@ -34,8 +34,7 @@
#ifdef AUTH_DEBUG
#include "firebird/Auth.h"
#include "firebird/Plugin.h"
#include "firebird/Interface.h"
#include "../common/classes/ImplementHelper.h"
#include "../common/classes/ClumpletWriter.h"
#include "../common/classes/init.h"
@ -47,13 +46,13 @@ namespace Auth {
// The idea of debug plugin is to send some data from server to client,
// modify them on client and return result (which becomes login name) to the server
class DebugServer FB_FINAL : public Firebird::StdPlugin<IServer, FB_AUTH_SERVER_VERSION>
class DebugServer FB_FINAL : public Firebird::StdPlugin<Firebird::Api::ServerImpl<DebugServer> >
{
public:
explicit DebugServer(Firebird::IPluginConfig*);
int authenticate(Firebird::IStatus* status, IServerBlock* sBlock,
IWriter* writerInterface);
int authenticate(Firebird::IStatus* status, Firebird::IServerBlock* sBlock,
Firebird::IWriter* writerInterface);
int release();
private:
@ -61,12 +60,12 @@ private:
Firebird::RefPtr<Firebird::IConfig> config;
};
class DebugClient FB_FINAL : public Firebird::StdPlugin<IClient, FB_AUTH_CLIENT_VERSION>
class DebugClient FB_FINAL : public Firebird::StdPlugin<Firebird::Api::ClientImpl<DebugClient> >
{
public:
DebugClient(Firebird::IPluginConfig*);
int authenticate(Firebird::IStatus* status, IClientBlock* sBlock);
int authenticate(Firebird::IStatus* status, Firebird::IClientBlock* sBlock);
int release();
private:

View File

@ -2,13 +2,14 @@
#define INTERNAL_FIREBIRD
#endif
#include "firebird/Provider.h"
#include "firebird/Interface.h"
#ifdef INTERNAL_FIREBIRD
#include "../common/classes/alloc.h"
#include "../common/StatusHolder.h"
#include "../common/classes/ImplementHelper.h"
#include "../dsql/sqlda_pub.h"
#else // INTERNAL_FIREBIRD

View File

@ -34,7 +34,7 @@ using namespace Firebird;
namespace Auth {
class SrpClient FB_FINAL : public StdPlugin<IClient, FB_AUTH_CLIENT_VERSION>
class SrpClient FB_FINAL : public StdPlugin<Api::ClientImpl<SrpClient> >
{
public:
explicit SrpClient(IPluginConfig*)
@ -43,8 +43,8 @@ public:
{ }
// IClient implementation
int FB_CARG authenticate(IStatus*, IClientBlock* cb);
int FB_CARG release();
int authenticate(IStatus*, IClientBlock* cb);
int release();
private:
RemotePassword* client;
@ -75,7 +75,9 @@ int SrpClient::authenticate(IStatus* status, IClientBlock* cb)
client->genClientKey(data);
dumpIt("Clnt: clientPubKey", data);
cb->putData(status, data.length(), data.begin());
return status->getStatus() & IStatus::FB_HAS_ERRORS ? AUTH_FAILED : AUTH_MORE_DATA;
if (status->getStatus() & IStatus::FB_HAS_ERRORS)
return AUTH_FAILED;
return AUTH_MORE_DATA;
}
HANDSHAKE_DEBUG(fprintf(stderr, "Cli: SRP phase2\n"));
@ -164,7 +166,7 @@ namespace
void registerSrpClient(IPluginManager* iPlugin)
{
iPlugin->registerPluginFactory(PluginType::AuthClient, RemotePassword::plugName, &factory);
iPlugin->registerPluginFactory(IPluginManager::AuthClient, RemotePassword::plugName, &factory);
}
} // namespace Auth

View File

@ -27,7 +27,7 @@
#ifndef AUTH_SRP_CLIENT_H
#define AUTH_SRP_CLIENT_H
#include "firebird/Auth.h"
#include "firebird/Interface.h"
namespace Auth {

View File

@ -29,16 +29,16 @@
#include "../common/classes/ImplementHelper.h"
#include "../common/classes/ClumpletWriter.h"
#include "../common/StatusHolder.h"
#include "firebird/Auth.h"
#include "firebird/Interface.h"
#include "../auth/SecureRemotePassword/srp.h"
#include "../jrd/constants.h"
#include "../jrd/inf_pub.h"
#include "../utilities/gsec/gsec.h"
#include "../auth/SecureRemotePassword/Message.h"
#include "../common/classes/auto.h"
namespace {
Firebird::MakeUpgradeInfo<> upInfo;
const unsigned int INIT_KEY = ((~0) - 1);
unsigned int secDbKey = INIT_KEY;
@ -52,7 +52,7 @@ typedef Field<FB_BOOLEAN> Boolean;
namespace Auth {
class SrpManagement FB_FINAL : public Firebird::StdPlugin<IManagement, FB_AUTH_MANAGE_VERSION>
class SrpManagement FB_FINAL : public Firebird::StdPlugin<Firebird::Api::ManagementImpl<SrpManagement> >
{
public:
explicit SrpManagement(Firebird::IPluginConfig* par)
@ -126,7 +126,7 @@ private:
}
}
void grantRevokeAdmin(Auth::IUser* user, bool ignoreRevoke = false)
void grantRevokeAdmin(Firebird::IUser* user, bool ignoreRevoke = false)
{
if (!user->admin()->entered())
{
@ -185,12 +185,10 @@ private:
public:
// IManagement implementation
void FB_CARG start(Firebird::IStatus* status, ILogonInfo* logonInfo)
void start(Firebird::IStatus* status, Firebird::ILogonInfo* logonInfo)
{
try
{
Firebird::MasterInterfacePtr()->upgradeInterface(logonInfo, FB_AUTH_LOGON_INFO_VERSION, upInfo);
status->init();
if (att)
@ -257,16 +255,10 @@ public:
}
}
int FB_CARG execute(Firebird::IStatus* status, IUser* user, IListUsers* callback)
int execute(Firebird::IStatus* status, Firebird::IUser* user, Firebird::IListUsers* callback)
{
try
{
if (callback)
{
Firebird::MasterInterfacePtr()->upgradeInterface(callback, FB_AUTH_LIST_USERS_VERSION, upInfo);
}
Firebird::MasterInterfacePtr()->upgradeInterface(user, FB_AUTH_USER_VERSION, upInfo);
status->init();
fb_assert(att);
@ -608,7 +600,7 @@ public:
return 0;
}
void FB_CARG commit(Firebird::IStatus* status)
void commit(Firebird::IStatus* status)
{
if (tra)
{
@ -620,7 +612,7 @@ public:
}
}
void FB_CARG rollback(Firebird::IStatus* status)
void rollback(Firebird::IStatus* status)
{
if (tra)
{
@ -632,7 +624,7 @@ public:
}
}
int FB_CARG release()
int release()
{
if (--refCounter == 0)
{
@ -697,7 +689,7 @@ private:
}
}
static void setField(Varfield& to, Auth::ICharUserField* from)
static void setField(Varfield& to, Firebird::ICharUserField* from)
{
if (from->entered())
{
@ -709,7 +701,7 @@ private:
}
}
static void setField(Boolean& to, Auth::IIntUserField* from)
static void setField(Boolean& to, Firebird::IIntUserField* from)
{
if (from->entered())
{
@ -721,7 +713,7 @@ private:
}
}
void setField(Firebird::IStatus* st, Blob& to, Auth::ICharUserField* from)
void setField(Firebird::IStatus* st, Blob& to, Firebird::ICharUserField* from)
{
if (from->entered())
{
@ -733,7 +725,7 @@ private:
}
}
static void allocField(Auth::IUserField* value, Firebird::string& update, const char* name)
static void allocField(Firebird::IUserField* value, Firebird::string& update, const char* name)
{
if (value->entered() || value->specified())
{
@ -744,7 +736,7 @@ private:
}
template <typename FT>
static void allocField(Firebird::AutoPtr<FT>& field, Message& up, Auth::IUserField* value)
static void allocField(Firebird::AutoPtr<FT>& field, Message& up, Firebird::IUserField* value)
{
if (value->entered() || value->specified())
{
@ -752,7 +744,7 @@ private:
}
}
static void assignField(Firebird::AutoPtr<Varfield>& field, Auth::ICharUserField* name)
static void assignField(Firebird::AutoPtr<Varfield>& field, Firebird::ICharUserField* name)
{
if (field.hasData())
{
@ -768,7 +760,7 @@ private:
}
}
static void assignField(Firebird::AutoPtr<Boolean>& field, Auth::IIntUserField* name)
static void assignField(Firebird::AutoPtr<Boolean>& field, Firebird::IIntUserField* name)
{
if (field.hasData())
{
@ -784,7 +776,7 @@ private:
}
}
void assignField(Firebird::IStatus* st, Firebird::AutoPtr<Blob>& field, Auth::ICharUserField* name)
void assignField(Firebird::IStatus* st, Firebird::AutoPtr<Blob>& field, Firebird::ICharUserField* name)
{
if (field.hasData())
{
@ -801,7 +793,7 @@ private:
}
}
static void listField(Auth::ICharUserField* to, Varfield& from)
static void listField(Firebird::ICharUserField* to, Varfield& from)
{
Firebird::LocalStatus st;
to->setEntered(&st, from.null ? 0 : 1);
@ -813,7 +805,7 @@ private:
}
}
static void listField(Auth::IIntUserField* to, Boolean& from)
static void listField(Firebird::IIntUserField* to, Boolean& from)
{
Firebird::LocalStatus st;
to->setEntered(&st, from.null ? 0 : 1);
@ -825,7 +817,7 @@ private:
}
}
void listField(Auth::ICharUserField* to, Blob& from)
void listField(Firebird::ICharUserField* to, Blob& from)
{
Firebird::LocalStatus st;
to->setEntered(&st, from.null ? 0 : 1);
@ -836,7 +828,7 @@ private:
Firebird::IBlob* blob = NULL;
try
{
blob = att->openBlob(&st, tra, &from);
blob = att->openBlob(&st, tra, &from, 0, NULL);
check(&st);
char segbuf[256];
@ -865,7 +857,7 @@ private:
}
}
void blobWrite(Firebird::IStatus* st, Blob& to, Auth::ICharUserField* from)
void blobWrite(Firebird::IStatus* st, Blob& to, Firebird::ICharUserField* from)
{
to.null = FB_FALSE;
const char* ptr = from->get();
@ -874,7 +866,7 @@ private:
Firebird::IBlob* blob = NULL;
try
{
blob = att->createBlob(st, tra, &to);
blob = att->createBlob(st, tra, &to, 0, NULL);
check(st);
blob->putSegment(st, l, ptr);
@ -900,6 +892,6 @@ static Firebird::SimpleFactory<Auth::SrpManagement> factory;
extern "C" void FB_PLUGIN_ENTRY_POINT(Firebird::IMaster* master)
{
Firebird::CachedMasterInterface::set(master);
Firebird::PluginManagerInterfacePtr()->registerPluginFactory(Firebird::PluginType::AuthUserManagement, Auth::RemotePassword::plugName, &Auth::factory);
Firebird::myModule->registerMe();
Firebird::PluginManagerInterfacePtr()->registerPluginFactory(Firebird::IPluginManager::AuthUserManagement, Auth::RemotePassword::plugName, &Auth::factory);
Firebird::getUnloadDetector()->registerMe();
}

View File

@ -32,7 +32,7 @@
#include "../common/classes/ClumpletWriter.h"
#include "../auth/SecureRemotePassword/Message.h"
#include "../jrd/EngineInterface.h"
#include "../jrd/constants.h"
using namespace Firebird;
@ -43,14 +43,12 @@ unsigned int secDbKey = INIT_KEY;
const unsigned int SZ_LOGIN = 31;
MakeUpgradeInfo<> upInfo;
}
namespace Auth {
class SrpServer FB_FINAL : public StdPlugin<IServer, FB_AUTH_SERVER_VERSION>
class SrpServer FB_FINAL : public StdPlugin<Api::ServerImpl<SrpServer> >
{
public:
explicit SrpServer(IPluginConfig* par)
@ -65,8 +63,8 @@ public:
}
// IServer implementation
int FB_CARG authenticate(IStatus* status, IServerBlock* sBlock, IWriter* writerInterface);
int FB_CARG release();
int authenticate(IStatus* status, IServerBlock* sBlock, IWriter* writerInterface);
int release();
private:
RemotePassword* server;
@ -248,7 +246,6 @@ int SrpServer::authenticate(IStatus* status, IServerBlock* sb, IWriter* writerIn
BigInteger serverProof = server->clientProof(account.c_str(), salt.c_str(), sessionKey);
if (clientProof == serverProof)
{
MasterInterfacePtr()->upgradeInterface(writerInterface, FB_AUTH_WRITER_VERSION, upInfo);
writerInterface->add(status, account.c_str());
if (status->getStatus() & IStatus::FB_HAS_ERRORS)
{
@ -288,7 +285,7 @@ namespace
void registerSrpServer(IPluginManager* iPlugin)
{
iPlugin->registerPluginFactory(PluginType::AuthServer, RemotePassword::plugName, &factory);
iPlugin->registerPluginFactory(IPluginManager::AuthServer, RemotePassword::plugName, &factory);
}
} // namespace Auth

View File

@ -27,7 +27,7 @@
#ifndef AUTH_SRP_SERVER_H
#define AUTH_SRP_SERVER_H
#include "firebird/Auth.h"
#include "firebird/Interface.h"
namespace Auth {

View File

@ -35,7 +35,7 @@
namespace Auth {
int SecurityDatabaseClient::authenticate(Firebird::IStatus* status, IClientBlock* cb)
int SecurityDatabaseClient::authenticate(Firebird::IStatus* status, Firebird::IClientBlock* cb)
{
// fprintf(stderr, "Clnt: Legacy: lgn=%s pswd=%s\n", cb->getLogin(), cb->getPassword());
if (!(cb->getLogin() && cb->getPassword()))
@ -43,8 +43,8 @@ int SecurityDatabaseClient::authenticate(Firebird::IStatus* status, IClientBlock
return AUTH_CONTINUE;
}
TEXT pwt[Auth::MAX_LEGACY_PASSWORD_LENGTH + 2];
ENC_crypt(pwt, sizeof pwt, cb->getPassword(), Auth::LEGACY_PASSWORD_SALT);
TEXT pwt[MAX_LEGACY_PASSWORD_LENGTH + 2];
ENC_crypt(pwt, sizeof pwt, cb->getPassword(), LEGACY_PASSWORD_SALT);
cb->putData(status, static_cast<unsigned>(strlen(&pwt[2])), &pwt[2]);
if (status->getStatus() & Firebird::IStatus::FB_HAS_ERRORS)
{
@ -70,7 +70,7 @@ namespace {
void registerLegacyClient(Firebird::IPluginManager* iPlugin)
{
iPlugin->registerPluginFactory(Firebird::PluginType::AuthClient, "Legacy_Auth", &factory);
iPlugin->registerPluginFactory(Firebird::IPluginManager::AuthClient, "Legacy_Auth", &factory);
}
} // namespace Auth

View File

@ -27,7 +27,7 @@
#ifndef AUTH_LEGACY_CLIENT_H
#define AUTH_LEGACY_CLIENT_H
#include "firebird/Auth.h"
#include "firebird/Interface.h"
#include "../common/classes/ImplementHelper.h"
namespace Auth {
@ -35,7 +35,7 @@ namespace Auth {
// Required to stop analyzing rest of plugins before first roundtrip to server
// if legacy login is present in DPB
class SecurityDatabaseClient FB_FINAL : public Firebird::StdPlugin<IClient, FB_AUTH_CLIENT_VERSION>
class SecurityDatabaseClient FB_FINAL : public Firebird::StdPlugin<Firebird::Api::ClientImpl<SecurityDatabaseClient> >
{
public:
explicit SecurityDatabaseClient(Firebird::IPluginConfig*)
@ -43,8 +43,8 @@ public:
}
// IClient implementation
int FB_CARG authenticate(Firebird::IStatus*, IClientBlock* data);
int FB_CARG release();
int authenticate(Firebird::IStatus*, Firebird::IClientBlock* data);
int release();
};
void registerLegacyClient(Firebird::IPluginManager* iPlugin);

View File

@ -41,9 +41,7 @@
#include "../common/classes/ImplementHelper.h"
#include "../common/classes/ClumpletWriter.h"
#include "../common/StatusHolder.h"
#include "firebird/Plugin.h"
static Firebird::MakeUpgradeInfo<> upInfo;
#include "firebird/Interface.h"
// Here we use version-independent symbolic link (or copy) of actual database
DATABASE database = STATIC FILENAME "security.fdb";
@ -51,7 +49,7 @@ DATABASE database = STATIC FILENAME "security.fdb";
static Firebird::GlobalPtr<Firebird::Mutex> execLineMutex; // protects various gpre generated structures
static bool grantRevokeAdmin(ISC_STATUS* isc_status, FB_API_HANDLE database, FB_API_HANDLE trans,
Auth::IUser* user)
Firebird::IUser* user)
{
if (!user->admin()->entered())
{
@ -113,12 +111,10 @@ SecurityDatabaseManagement::SecurityDatabaseManagement(Firebird::IPluginConfig*
check(&s);
}
void FB_CARG SecurityDatabaseManagement::start(Firebird::IStatus* st, ILogonInfo* logonInfo)
void SecurityDatabaseManagement::start(Firebird::IStatus* st, Firebird::ILogonInfo* logonInfo)
{
try
{
Firebird::MasterInterfacePtr()->upgradeInterface(logonInfo, FB_AUTH_LOGON_INFO_VERSION, upInfo);
st->init();
if (secDbKey == INIT_KEY)
@ -169,7 +165,7 @@ void FB_CARG SecurityDatabaseManagement::start(Firebird::IStatus* st, ILogonInfo
}
}
void FB_CARG SecurityDatabaseManagement::commit(Firebird::IStatus* st)
void SecurityDatabaseManagement::commit(Firebird::IStatus* st)
{
try
{
@ -190,7 +186,7 @@ void FB_CARG SecurityDatabaseManagement::commit(Firebird::IStatus* st)
}
}
void FB_CARG SecurityDatabaseManagement::rollback(Firebird::IStatus* st)
void SecurityDatabaseManagement::rollback(Firebird::IStatus* st)
{
try
{
@ -211,7 +207,7 @@ void FB_CARG SecurityDatabaseManagement::rollback(Firebird::IStatus* st)
}
}
int FB_CARG SecurityDatabaseManagement::release()
int SecurityDatabaseManagement::release()
{
if (--refCounter == 0)
{
@ -236,7 +232,7 @@ static inline void strStore(char* to, const char* from, size_t len)
strncpy(to, from, len);
}
int FB_CARG SecurityDatabaseManagement::execute(Firebird::IStatus* st, IUser* user, IListUsers* callback)
int SecurityDatabaseManagement::execute(Firebird::IStatus* st, Firebird::IUser* user, Firebird::IListUsers* callback)
{
/*************************************
*
@ -302,8 +298,6 @@ int FB_CARG SecurityDatabaseManagement::execute(Firebird::IStatus* st, IUser* us
try
{
Firebird::MasterInterfacePtr()->upgradeInterface(user, FB_AUTH_USER_VERSION, upInfo);
ISC_STATUS_ARRAY isc_status;
fb_utils::init_status(isc_status);
st->init();
@ -765,6 +759,6 @@ static Firebird::SimpleFactory<Auth::SecurityDatabaseManagement> factory;
extern "C" void FB_PLUGIN_ENTRY_POINT(Firebird::IMaster* master)
{
Firebird::CachedMasterInterface::set(master);
Firebird::PluginManagerInterfacePtr()->registerPluginFactory(Firebird::PluginType::AuthUserManagement, "Legacy_UserManager", &factory);
Firebird::myModule->registerMe();
Firebird::PluginManagerInterfacePtr()->registerPluginFactory(Firebird::IPluginManager::AuthUserManagement, "Legacy_UserManager", &factory);
Firebird::getUnloadDetector()->registerMe();
}

View File

@ -28,23 +28,23 @@
#define AUTH_LEGACY_MANAGEMENT_H
#include "../common/classes/ImplementHelper.h"
#include "firebird/Auth.h"
#include "firebird/Interface.h"
namespace Auth {
class SecurityDatabaseManagement FB_FINAL : public Firebird::StdPlugin<IManagement, FB_AUTH_MANAGE_VERSION>
class SecurityDatabaseManagement FB_FINAL : public Firebird::StdPlugin<Firebird::Api::ManagementImpl<SecurityDatabaseManagement> >
{
public:
explicit SecurityDatabaseManagement(Firebird::IPluginConfig* par);
// IManagement implementation
void FB_CARG start(Firebird::IStatus* status, ILogonInfo* logonInfo);
int FB_CARG execute(Firebird::IStatus* status, IUser* user, IListUsers* callback);
void FB_CARG commit(Firebird::IStatus* status);
void FB_CARG rollback(Firebird::IStatus* status);
void start(Firebird::IStatus* status, Firebird::ILogonInfo* logonInfo);
int execute(Firebird::IStatus* status, Firebird::IUser* user, Firebird::IListUsers* callback);
void commit(Firebird::IStatus* status);
void rollback(Firebird::IStatus* status);
int FB_CARG release();
int release();
private:
Firebird::RefPtr<Firebird::IFirebirdConf> config;

View File

@ -41,7 +41,7 @@
#include "../common/classes/objects_array.h"
#include "../common/classes/init.h"
#include "../common/classes/ImplementHelper.h"
#include "firebird/Timer.h"
#include "firebird/Interface.h"
#include "../remote/remot_proto.h"
@ -51,8 +51,6 @@ using namespace Firebird;
namespace {
MakeUpgradeInfo<> upInfo;
// BLR to search database for user name record
const UCHAR PWD_REQUEST[] =
@ -126,7 +124,7 @@ const UCHAR TPB[4] =
namespace Auth {
class SecurityDatabase FB_FINAL : public Firebird::RefCntIface<Firebird::ITimer, FB_TIMER_VERSION>
class SecurityDatabase FB_FINAL : public Firebird::RefCntIface<Firebird::Api::TimerImpl<SecurityDatabase> >
{
public:
int verify(IWriter* authBlock, IServerBlock* sBlock);
@ -151,9 +149,9 @@ public:
}
// ITimer implementation
void FB_CARG handler();
void handler();
int FB_CARG release()
int release()
{
if (--refCounter == 0)
{
@ -325,7 +323,7 @@ int SecurityDatabase::verify(IWriter* authBlock, IServerBlock* sBlock)
char pw1[MAX_LEGACY_PASSWORD_LENGTH + 1];
if (!lookup_user(login.c_str(), pw1))
{
return AUTH_FAILED;
return IAuth::AUTH_FAILED;
}
pw1[MAX_LEGACY_PASSWORD_LENGTH] = 0;
string storedHash(pw1, MAX_LEGACY_PASSWORD_LENGTH);
@ -346,20 +344,19 @@ int SecurityDatabase::verify(IWriter* authBlock, IServerBlock* sBlock)
}
if (!legacyHash)
{
return AUTH_FAILED;
return IAuth::AUTH_FAILED;
}
}
LocalStatus s;
MasterInterfacePtr()->upgradeInterface(authBlock, FB_AUTH_WRITER_VERSION, upInfo);
authBlock->add(&s, login.c_str());
check(&s);
authBlock->setDb(&s, secureDbName);
check(&s);
return AUTH_SUCCESS;
return IAuth::AUTH_SUCCESS;
}
return AUTH_CONTINUE;
return IAuth::AUTH_CONTINUE;
}
void SecurityDatabase::checkStatus(const char* callName, ISC_STATUS userError)
@ -392,7 +389,7 @@ typedef HalfStaticArray<SecurityDatabase*, 4> InstancesArray;
GlobalPtr<InstancesArray> instances;
GlobalPtr<Mutex> instancesMutex;
void FB_CARG SecurityDatabase::handler()
void SecurityDatabase::handler()
{
try
{
@ -525,7 +522,7 @@ int SecurityDatabaseServer::authenticate(Firebird::IStatus* status, IServerBlock
HANDSHAKE_DEBUG(fprintf(stderr, "LegacyServer: exception status %d\n", status->getStatus()));
HANDSHAKE_DEBUG(isc_print_status(status->getErrors()));
HANDSHAKE_DEBUG(isc_print_status(status->getWarnings()));
return AUTH_FAILED;
return IAuth::AUTH_FAILED;
}
}
@ -546,7 +543,7 @@ namespace {
void registerLegacyServer(Firebird::IPluginManager* iPlugin)
{
iPlugin->registerPluginFactory(Firebird::PluginType::AuthServer, "Legacy_Auth", &factory);
iPlugin->registerPluginFactory(Firebird::IPluginManager::AuthServer, "Legacy_Auth", &factory);
}
} // namespace Auth
@ -558,9 +555,9 @@ extern "C" void FB_EXPORTED FB_PLUGIN_ENTRY_POINT(IMaster* master)
{
CachedMasterInterface::set(master);
myModule->setCleanup(Auth::SecurityDatabase::cleanup);
getUnloadDetector()->setCleanup(Auth::SecurityDatabase::cleanup);
Auth::registerLegacyServer(PluginManagerInterfacePtr());
myModule->registerMe();
getUnloadDetector()->registerMe();
}
#endif // PLUG_MODULE

View File

@ -34,7 +34,7 @@
#include "../common/classes/ClumpletWriter.h"
#include "../common/classes/ImplementHelper.h"
#include "firebird/Auth.h"
#include "firebird/Interface.h"
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
@ -43,7 +43,7 @@
namespace Auth {
class SecurityDatabaseServer FB_FINAL : public Firebird::StdPlugin<IServer, FB_AUTH_SERVER_VERSION>
class SecurityDatabaseServer FB_FINAL : public Firebird::StdPlugin<Firebird::Api::ServerImpl<SecurityDatabaseServer> >
{
public:
explicit SecurityDatabaseServer(Firebird::IPluginConfig* p)
@ -51,8 +51,8 @@ public:
{ }
// IServer implementation
int FB_CARG authenticate(Firebird::IStatus* status, IServerBlock* sBlock, IWriter* writerInterface);
int FB_CARG release();
int authenticate(Firebird::IStatus* status, Firebird::IServerBlock* sBlock, Firebird::IWriter* writerInterface);
int release();
private:
Firebird::RefPtr<Firebird::IPluginConfig> iParameter;

View File

@ -71,8 +71,6 @@ namespace
*dataSize = strlen(name);
}
*/
MakeUpgradeInfo<> upInfo;
}
namespace Auth {
@ -365,7 +363,6 @@ int WinSspiServer::authenticate(Firebird::IStatus* status,
bool wheel = false;
string login;
sspi.getLogin(login, wheel);
MasterInterfacePtr()->upgradeInterface(writerInterface, FB_AUTH_WRITER_VERSION, upInfo);
writerInterface->add(status, login.c_str());
if (wheel)
@ -443,12 +440,12 @@ int WinSspiClient::release()
void registerTrustedClient(Firebird::IPluginManager* iPlugin)
{
iPlugin->registerPluginFactory(Firebird::PluginType::AuthClient, plugName, &clientFactory);
iPlugin->registerPluginFactory(Firebird::IPluginManager::AuthClient, plugName, &clientFactory);
}
void registerTrustedServer(Firebird::IPluginManager* iPlugin)
{
iPlugin->registerPluginFactory(Firebird::PluginType::AuthServer, plugName, &serverFactory);
iPlugin->registerPluginFactory(Firebird::IPluginManager::AuthServer, plugName, &serverFactory);
}
} // namespace Auth

View File

@ -40,7 +40,7 @@
#include <../common/classes/array.h>
#include "../common/classes/ImplementHelper.h"
#include <../jrd/ibase.h>
#include "firebird/Auth.h"
#include "firebird/Interface.h"
#define SECURITY_WIN32
@ -100,12 +100,12 @@ public:
bool getLogin(Firebird::string& login, bool& wh);
};
class WinSspiServer : public Firebird::StdPlugin<IServer, FB_AUTH_SERVER_VERSION>
class WinSspiServer : public Firebird::StdPlugin<Firebird::Api::ServerImpl<WinSspiServer> >
{
public:
// IServer implementation
int FB_CARG authenticate(Firebird::IStatus* status, IServerBlock* sBlock, IWriter* writerInterface);
int FB_CARG release();
int authenticate(Firebird::IStatus* status, Firebird::IServerBlock* sBlock, Firebird::IWriter* writerInterface);
int release();
WinSspiServer(Firebird::IPluginConfig*);
@ -114,12 +114,12 @@ private:
AuthSspi sspi;
};
class WinSspiClient : public Firebird::StdPlugin<IClient, FB_AUTH_CLIENT_VERSION>
class WinSspiClient : public Firebird::StdPlugin<Firebird::Api::ClientImpl<WinSspiClient> >
{
public:
// IClient implementation
int FB_CARG authenticate(Firebird::IStatus* status, IClientBlock* sBlock);
int FB_CARG release();
int authenticate(Firebird::IStatus* status, Firebird::IClientBlock* sBlock);
int release();
WinSspiClient(Firebird::IPluginConfig*);

View File

@ -30,7 +30,7 @@
#ifndef FB_AUTH_H
#define FB_AUTH_H
#include "firebird/Auth.h"
#include "firebird/Interface.h"
#include "../common/classes/ClumpletWriter.h"
#include "../common/classes/init.h"
#include "../common/classes/array.h"
@ -39,7 +39,7 @@
namespace Auth {
class WriterImplementation : public Firebird::AutoIface<IWriter, FB_AUTH_WRITER_VERSION>
class WriterImplementation : public Firebird::AutoIface<Firebird::Api::WriterImpl<WriterImplementation> >
{
public:
WriterImplementation();
@ -48,10 +48,10 @@ public:
void setPlugin(const char* m);
// IWriter implementation
void FB_CARG reset();
void FB_CARG add(Firebird::IStatus* st, const char* name);
void FB_CARG setType(Firebird::IStatus* st, const char* value);
void FB_CARG setDb(Firebird::IStatus* st, const char* value);
void reset();
void add(Firebird::IStatus* st, const char* name);
void setType(Firebird::IStatus* st, const char* value);
void setDb(Firebird::IStatus* st, const char* value);
private:
Firebird::ClumpletWriter current, result;

View File

@ -44,7 +44,7 @@ MetadataBuilder::MetadataBuilder(unsigned fieldCount)
msgMetadata->items.grow(fieldCount);
}
int FB_CARG MetadataBuilder::release()
int MetadataBuilder::release()
{
if (--refCounter != 0)
{
@ -55,7 +55,7 @@ int FB_CARG MetadataBuilder::release()
return 0;
}
void FB_CARG MetadataBuilder::setType(IStatus* status, unsigned index, unsigned type)
void MetadataBuilder::setType(IStatus* status, unsigned index, unsigned type)
{
try
{
@ -81,7 +81,7 @@ void FB_CARG MetadataBuilder::setType(IStatus* status, unsigned index, unsigned
}
}
void FB_CARG MetadataBuilder::setSubType(IStatus* status, unsigned index, int subType)
void MetadataBuilder::setSubType(IStatus* status, unsigned index, int subType)
{
try
{
@ -96,7 +96,7 @@ void FB_CARG MetadataBuilder::setSubType(IStatus* status, unsigned index, int su
}
}
void FB_CARG MetadataBuilder::setLength(IStatus* status, unsigned index, unsigned length)
void MetadataBuilder::setLength(IStatus* status, unsigned index, unsigned length)
{
try
{
@ -114,7 +114,7 @@ void FB_CARG MetadataBuilder::setLength(IStatus* status, unsigned index, unsigne
}
}
void FB_CARG MetadataBuilder::setCharSet(IStatus* status, unsigned index, unsigned charSet)
void MetadataBuilder::setCharSet(IStatus* status, unsigned index, unsigned charSet)
{
try
{
@ -129,7 +129,7 @@ void FB_CARG MetadataBuilder::setCharSet(IStatus* status, unsigned index, unsign
}
}
void FB_CARG MetadataBuilder::setScale(IStatus* status, unsigned index, unsigned scale)
void MetadataBuilder::setScale(IStatus* status, unsigned index, unsigned scale)
{
try
{
@ -144,7 +144,7 @@ void FB_CARG MetadataBuilder::setScale(IStatus* status, unsigned index, unsigned
}
}
void FB_CARG MetadataBuilder::truncate(IStatus* status, unsigned count)
void MetadataBuilder::truncate(IStatus* status, unsigned count)
{
try
{
@ -161,7 +161,7 @@ void FB_CARG MetadataBuilder::truncate(IStatus* status, unsigned count)
}
}
void FB_CARG MetadataBuilder::remove(IStatus* status, unsigned index)
void MetadataBuilder::remove(IStatus* status, unsigned index)
{
try
{
@ -177,7 +177,7 @@ void FB_CARG MetadataBuilder::remove(IStatus* status, unsigned index)
}
}
void FB_CARG MetadataBuilder::moveNameToIndex(IStatus* status, const char* name, unsigned index)
void MetadataBuilder::moveNameToIndex(IStatus* status, const char* name, unsigned index)
{
try
{
@ -206,7 +206,7 @@ void FB_CARG MetadataBuilder::moveNameToIndex(IStatus* status, const char* name,
}
}
unsigned FB_CARG MetadataBuilder::addField(IStatus* status)
unsigned MetadataBuilder::addField(IStatus* status)
{
try
{
@ -224,7 +224,7 @@ unsigned FB_CARG MetadataBuilder::addField(IStatus* status)
}
}
IMessageMetadata* FB_CARG MetadataBuilder::getMetadata(IStatus* status)
IMessageMetadata* MetadataBuilder::getMetadata(IStatus* status)
{
try
{
@ -386,7 +386,7 @@ int MsgMetadata::release()
return 0;
}
/*
int AttMetadata::release()
{
if (--refCounter != 0)
@ -396,6 +396,6 @@ int AttMetadata::release()
delete this;
return 0;
}
}*/
} // namespace Firebird

View File

@ -25,7 +25,7 @@
#ifndef COMMON_MSG_METADATA_H
#define COMMON_MSG_METADATA_H
#include "firebird/Provider.h"
#include "firebird/Interface.h"
#include "iberror.h"
#include "../common/classes/fb_string.h"
#include "../common/classes/objects_array.h"
@ -38,7 +38,7 @@ class MetadataBuilder;
class StatementMetadata;
class MetadataFromBlr;
class MsgMetadata : public RefCntIface<IMessageMetadata, FB_MESSAGE_METADATA_VERSION>
class MsgMetadata : public RefCntIface<Api::MessageMetadataImpl<MsgMetadata> >
{
friend class MetadataBuilder;
friend class StatementMetadata;
@ -138,14 +138,14 @@ public:
}
// IMessageMetadata implementation
virtual int FB_CARG release();
int release();
virtual unsigned FB_CARG getCount(IStatus* /*status*/)
unsigned getCount(IStatus* /*status*/)
{
return (unsigned) items.getCount();
}
virtual const char* FB_CARG getField(IStatus* status, unsigned index)
const char* getField(IStatus* status, unsigned index)
{
if (index < items.getCount())
return items[index].field.c_str();
@ -154,7 +154,7 @@ public:
return NULL;
}
virtual const char* FB_CARG getRelation(IStatus* status, unsigned index)
const char* getRelation(IStatus* status, unsigned index)
{
if (index < items.getCount())
return items[index].relation.c_str();
@ -163,7 +163,7 @@ public:
return NULL;
}
virtual const char* FB_CARG getOwner(IStatus* status, unsigned index)
const char* getOwner(IStatus* status, unsigned index)
{
if (index < items.getCount())
return items[index].owner.c_str();
@ -172,7 +172,7 @@ public:
return NULL;
}
virtual const char* FB_CARG getAlias(IStatus* status, unsigned index)
const char* getAlias(IStatus* status, unsigned index)
{
if (index < items.getCount())
return items[index].alias.c_str();
@ -181,7 +181,7 @@ public:
return NULL;
}
virtual unsigned FB_CARG getType(IStatus* status, unsigned index)
unsigned getType(IStatus* status, unsigned index)
{
if (index < items.getCount())
return items[index].type;
@ -190,7 +190,7 @@ public:
return 0;
}
virtual FB_BOOLEAN FB_CARG isNullable(IStatus* status, unsigned index)
FB_BOOLEAN isNullable(IStatus* status, unsigned index)
{
if (index < items.getCount())
return items[index].nullable;
@ -199,7 +199,7 @@ public:
return false;
}
virtual int FB_CARG getSubType(IStatus* status, unsigned index)
int getSubType(IStatus* status, unsigned index)
{
if (index < items.getCount())
return items[index].subType;
@ -208,7 +208,7 @@ public:
return 0;
}
virtual unsigned FB_CARG getLength(IStatus* status, unsigned index)
unsigned getLength(IStatus* status, unsigned index)
{
if (index < items.getCount())
return items[index].length;
@ -217,7 +217,7 @@ public:
return 0;
}
virtual int FB_CARG getScale(IStatus* status, unsigned index)
int getScale(IStatus* status, unsigned index)
{
if (index < items.getCount())
return items[index].scale;
@ -226,7 +226,7 @@ public:
return 0;
}
virtual unsigned FB_CARG getCharSet(IStatus* status, unsigned index)
unsigned getCharSet(IStatus* status, unsigned index)
{
if (index < items.getCount())
return items[index].charSet;
@ -235,7 +235,7 @@ public:
return 0;
}
virtual unsigned FB_CARG getOffset(IStatus* status, unsigned index)
unsigned getOffset(IStatus* status, unsigned index)
{
if (index < items.getCount())
return items[index].offset;
@ -244,7 +244,7 @@ public:
return 0;
}
virtual unsigned FB_CARG getNullOffset(IStatus* status, unsigned index)
unsigned getNullOffset(IStatus* status, unsigned index)
{
if (index < items.getCount())
return items[index].nullInd;
@ -253,9 +253,9 @@ public:
return 0;
}
virtual IMetadataBuilder* FB_CARG getBuilder(IStatus* status);
IMetadataBuilder* getBuilder(IStatus* status);
virtual unsigned FB_CARG getMessageLength(IStatus* /*status*/)
unsigned getMessageLength(IStatus* /*status*/)
{
return length;
}
@ -278,39 +278,39 @@ private:
unsigned length;
};
//class AttMetadata : public Api::MessageMetadataBaseImpl<AttMetadata, MsgMetadata>
class AttMetadata : public MsgMetadata
{
public:
explicit AttMetadata(RefCounted* att)
: MsgMetadata(),
attachment(att)
: attachment(att)
{ }
// re-implement here release() present in MsgMetadata to call correct dtor
virtual int FB_CARG release();
//virtual int release();
RefPtr<RefCounted> attachment;
};
class MetadataBuilder FB_FINAL : public RefCntIface<IMetadataBuilder, FB_METADATA_BUILDER_VERSION>
class MetadataBuilder FB_FINAL : public RefCntIface<Api::MetadataBuilderImpl<MetadataBuilder> >
{
public:
explicit MetadataBuilder(const MsgMetadata* from);
MetadataBuilder(unsigned fieldCount);
virtual int FB_CARG release();
int release();
// IMetadataBuilder implementation
virtual void FB_CARG setType(IStatus* status, unsigned index, unsigned type);
virtual void FB_CARG setSubType(IStatus* status, unsigned index, int subType);
virtual void FB_CARG setLength(IStatus* status, unsigned index, unsigned length);
virtual void FB_CARG setCharSet(IStatus* status, unsigned index, unsigned charSet);
virtual void FB_CARG setScale(IStatus* status, unsigned index, unsigned scale);
virtual void FB_CARG truncate(IStatus* status, unsigned count);
virtual void FB_CARG remove(IStatus* status, unsigned index);
virtual void FB_CARG moveNameToIndex(IStatus* status, const char* name, unsigned index);
virtual unsigned FB_CARG addField(IStatus* status);
virtual IMessageMetadata* FB_CARG getMetadata(IStatus* status);
void setType(IStatus* status, unsigned index, unsigned type);
void setSubType(IStatus* status, unsigned index, int subType);
void setLength(IStatus* status, unsigned index, unsigned length);
void setCharSet(IStatus* status, unsigned index, unsigned charSet);
void setScale(IStatus* status, unsigned index, unsigned scale);
void truncate(IStatus* status, unsigned count);
void remove(IStatus* status, unsigned index);
void moveNameToIndex(IStatus* status, const char* name, unsigned index);
unsigned addField(IStatus* status);
IMessageMetadata* getMetadata(IStatus* status);
private:
RefPtr<MsgMetadata> msgMetadata;

View File

@ -29,6 +29,7 @@
#include "../jrd/inf_pub.h"
#include "../yvalve/gds_proto.h"
#include "../common/utils_proto.h"
#include "../dsql/sqlda_pub.h"
namespace Firebird {

View File

@ -25,7 +25,7 @@
#ifndef COMMON_STATEMENT_METADATA_H
#define COMMON_STATEMENT_METADATA_H
#include "firebird/Provider.h"
#include "firebird/Interface.h"
#include "iberror.h"
#include "../common/classes/Nullable.h"
#include "../common/classes/array.h"

View File

@ -252,12 +252,12 @@ ISC_STATUS StatusVector::ImplStatusVector::copyTo(IStatus* dest) const throw()
if (v[warning] == isc_arg_warning)
{
dest->setWarnings(length - warning, &v[warning]);
dest->setWarnings2(length - warning, &v[warning]);
if (warning)
dest->setErrors(warning, v);
dest->setErrors2(warning, v);
}
else
dest->setErrors(length, v);
dest->setErrors2(length, v);
}
return m_status_vector[1];
}

View File

@ -30,10 +30,10 @@
#define FB_STATUS_ARG
#include "fb_exception.h"
#include "firebird/Interface.h"
namespace Firebird {
class IStatus;
class AbstractString;
class MetaName;
class Exception;

View File

@ -29,57 +29,58 @@
#ifndef FB_STATUS_HOLDER
#define FB_STATUS_HOLDER
#include "firebird/Provider.h"
#include "firebird/Interface.h"
#include "../common/utils_proto.h"
#include "../common/classes/ImplementHelper.h"
#include "../common/classes/array.h"
namespace Firebird {
class BaseStatus : public IStatus
template <class Final>
class BaseStatus : public Api::StatusImpl<Final>
{
public:
// IStatus implementation
virtual void FB_CARG init()
void init()
{
errors.init();
warnings.init();
}
virtual void FB_CARG setErrors(const ISC_STATUS* value)
void setErrors(const ISC_STATUS* value)
{
errors.set(fb_utils::statusLength(value), value);
}
virtual void FB_CARG setErrors(unsigned int length, const ISC_STATUS* value)
void setErrors2(unsigned int length, const ISC_STATUS* value)
{
errors.set(length, value);
}
virtual void FB_CARG setWarnings(const ISC_STATUS* value)
void setWarnings(const ISC_STATUS* value)
{
warnings.set(fb_utils::statusLength(value), value);
}
virtual void FB_CARG setWarnings(unsigned int length, const ISC_STATUS* value)
void setWarnings2(unsigned int length, const ISC_STATUS* value)
{
warnings.set(length, value);
}
virtual const ISC_STATUS* FB_CARG getErrors() const
const ISC_STATUS* getErrors() const
{
return errors.get();
}
virtual const ISC_STATUS* FB_CARG getWarnings() const
const ISC_STATUS* getWarnings() const
{
return warnings.get();
}
virtual unsigned FB_CARG getStatus() const
unsigned getStatus() const
{
return (errors.vector[1] ? FB_HAS_ERRORS : 0) |
(warnings.vector[1] ? FB_HAS_WARNINGS : 0);
return (errors.vector[1] ? IStatus::FB_HAS_ERRORS : 0) |
(warnings.vector[1] ? IStatus::FB_HAS_WARNINGS : 0);
}
public:
@ -107,12 +108,12 @@ private:
fb_utils::copyStatus(vector, FB_NELEM(vector), value, length);
}
virtual const ISC_STATUS* FB_CARG get() const
const ISC_STATUS* get() const
{
return vector;
}
virtual void FB_CARG init()
void init()
{
fb_utils::init_status(vector);
}
@ -129,10 +130,10 @@ private:
ErrorVector errors, warnings;
};
class LocalStatus : public AutoIface<BaseStatus, FB_STATUS_VERSION>
class LocalStatus : public AutoIface<BaseStatus<LocalStatus> >
{
public:
virtual void FB_CARG dispose()
void dispose()
{ }
};

View File

@ -28,7 +28,7 @@
#include <stdio.h>
#include <ctype.h>
#include "../common/utils_proto.h"
#include "../jrd/EngineInterface.h"
#include "../jrd/constants.h"
using namespace Firebird;
@ -95,7 +95,7 @@ static bool serverSizeValidate(ISC_STATUS* status, const TEXT* server)
}
static int typeBuffer(ISC_STATUS*, char*, int, Auth::UserData&, Auth::IListUsers*, Firebird::string&);
static int typeBuffer(ISC_STATUS*, char*, int, Auth::UserData&, Firebird::IListUsers*, Firebird::string&);
// all this spb-writing functions should be gone
@ -317,7 +317,7 @@ static void userInfoToSpb(char*& spb, Auth::UserData& userData)
}
static void setAttr(string& a, const char* nm, Auth::IIntUserField* f)
static void setAttr(string& a, const char* nm, Firebird::IIntUserField* f)
{
if (f->entered())
{
@ -358,7 +358,7 @@ static void setAttr(IStatus* status, Auth::UserData* u)
void callRemoteServiceManager(ISC_STATUS* status,
isc_svc_handle handle,
Auth::UserData& userData,
Auth::IListUsers* callback)
Firebird::IListUsers* callback)
{
char spb_buffer[1024];
char* spb = spb_buffer;
@ -602,7 +602,7 @@ static void parseLong(const char*& p, Auth::IntField& f, FB_SIZE_T& loop)
**/
static int typeBuffer(ISC_STATUS* status, char* buf, int offset,
Auth::UserData& uData, Auth::IListUsers* callback,
Auth::UserData& uData, Firebird::IListUsers* callback,
Firebird::string& text)
{
const char* p = &buf[offset];

View File

@ -31,7 +31,7 @@
isc_svc_handle attachRemoteServiceManager(ISC_STATUS*, const TEXT*, const TEXT*,
bool, int, const TEXT*);
isc_svc_handle attachRemoteServiceManager(ISC_STATUS*, const TEXT*, const TEXT*, bool, const TEXT*, bool);
void callRemoteServiceManager(ISC_STATUS*, isc_svc_handle, Auth::UserData&, Auth::IListUsers*);
void callRemoteServiceManager(ISC_STATUS*, isc_svc_handle, Auth::UserData&, Firebird::IListUsers*);
void detachRemoteServiceManager(ISC_STATUS*, isc_svc_handle);
#endif // UTILITIES_GSEC_CALL_SERVICE_H

View File

@ -32,7 +32,7 @@
#include "fb_exception.h"
#include "../jrd/ibase.h"
#include "firebird/Auth.h"
#include "firebird/Interface.h"
#ifdef DEBUG_CLUMPLETS
#include "../yvalve/gds_proto.h"

View File

@ -40,21 +40,20 @@ template <typename P>
class GetPlugins
{
public:
GetPlugins(unsigned int interfaceType, unsigned int desiredVersion,
UpgradeInfo* ui, const char* namesList = NULL)
GetPlugins(unsigned int interfaceType, const char* namesList = NULL)
: masterInterface(), pluginInterface(),
pluginSet(NULL), currentPlugin(NULL)
{
LocalStatus status;
pluginSet.assignRefNoIncr(pluginInterface->getPlugins(&status, interfaceType,
(namesList ? namesList : Config::getDefaultConfig()->getPlugins(interfaceType)),
desiredVersion, ui, NULL));
P::VERSION, getUnloadDetector(), NULL));
check(&status);
getPlugin();
}
GetPlugins(unsigned int interfaceType, unsigned int desiredVersion, UpgradeInfo* ui,
GetPlugins(unsigned int interfaceType,
Config* knownConfig, const char* namesList = NULL)
: masterInterface(), pluginInterface(),
pluginSet(NULL), currentPlugin(NULL)
@ -62,7 +61,7 @@ public:
LocalStatus status;
pluginSet.assignRefNoIncr(pluginInterface->getPlugins(&status, interfaceType,
(namesList ? namesList : knownConfig->getPlugins(interfaceType)),
desiredVersion, ui, new FirebirdConf(knownConfig)));
P::VERSION, getUnloadDetector(), new FirebirdConf(knownConfig)));
check(&status);
getPlugin();

View File

@ -34,15 +34,26 @@ namespace
{
Firebird::IMaster* cached = NULL;
#ifdef DEV_BUILD
#ifdef NEVERDEF
typedef Firebird::ReferenceCounterDebugger* ReferenceCounterDebuggerPtr;
TLS_DECLARE(ReferenceCounterDebuggerPtr*, debugArray);
#endif // DEV_BUILD
Firebird::UnloadDetector myModule;
}
namespace Firebird
{
UnloadDetector myModule;
UnloadDetectorHelper* getUnloadDetector()
{
return &myModule;
}
IPluginModule* getPluginModule()
{
return &myModule;
}
void CachedMasterInterface::set(IMaster* master)
{
@ -60,7 +71,24 @@ IMaster* CachedMasterInterface::getMasterInterface()
return cached;
}
#ifdef DEV_BUILD
void upgradeInterface(FirebirdApi<FirebirdPolicy>::Versioned* toUpgrade, int desiredVersion, void* function)
{
MasterInterfacePtr()->upgradeInterface(toUpgrade, desiredVersion, getPluginModule(), function);
}
void logOldPlugin()
{
gds__log("Old version of trace plugin is used - new types of events are ignored");
}
ISC_STATUS* getUpgradeError()
{
static ISC_STATUS failure[2] = {isc_arg_gds, isc_wish_list};
return failure;
}
#ifdef NOT_USED_OR_REPLACED
class IDebug
{
public:

View File

@ -29,9 +29,7 @@
#ifndef FB_COMMON_CLASSES_IMPLEMENT_HELPER
#define FB_COMMON_CLASSES_IMPLEMENT_HELPER
#include "firebird/Plugin.h"
#include "firebird/Timer.h"
#include "firebird/Provider.h"
#include "firebird/Interface.h"
#include "../common/classes/alloc.h"
#include "gen/iberror.h"
#include "../yvalve/gds_proto.h"
@ -43,36 +41,30 @@
namespace Firebird {
// If you need interface on stack, use template AutoPtr<YourInterface, AutoDisposable>
// as second parameter to store it.
typedef SimpleDispose<IDisposable> AutoDisposable;
IPluginModule* getPluginModule();
// Implement standard interface and plugin functions
// Helps to implement generic versioned interfaces
template <class C, int V>
template <class C>
class VersionedIface : public C
{
public:
VersionedIface() { }
int FB_CARG getVersion()
IPluginModule* getModule()
{
return V;
return getPluginModule();
}
IPluginModule* FB_CARG getModule();
private:
VersionedIface(const VersionedIface&);
VersionedIface& operator=(const VersionedIface&);
};
// Helps to implement versioned interfaces on stack or static
template <class C, int V>
class AutoIface : public VersionedIface<C, V>
template <class C>
class AutoIface : public VersionedIface<C>
{
public:
AutoIface() { }
@ -84,16 +76,16 @@ public:
};
// Helps to implement disposable interfaces
template <class C, int V>
class DisposeIface : public VersionedIface<C, V>, public GlobalStorage
template <class C>
class DisposeIface : public VersionedIface<C>, public GlobalStorage
{
public:
DisposeIface() { }
};
// Helps to implement standard interfaces
template <class C, int V>
class RefCntIface : public VersionedIface<C, V>, public GlobalStorage
template <class C>
class RefCntIface : public VersionedIface<C>, public GlobalStorage
{
public:
RefCntIface() : refCounter(0) { }
@ -108,7 +100,7 @@ protected:
public:
#endif
void FB_CARG addRef()
void addRef()
{
++refCounter;
}
@ -119,22 +111,22 @@ protected:
// Helps to implement plugins
template <class C, int V>
class StdPlugin : public RefCntIface<C, V>
template <class C>
class StdPlugin : public RefCntIface<C>
{
private:
IRefCounted* owner;
IReferenceCounted* owner;
public:
StdPlugin() : owner(NULL)
{ }
IRefCounted* FB_CARG getOwner()
IReferenceCounted* getOwner()
{
return owner;
}
void FB_CARG setOwner(IRefCounted* iface)
void setOwner(IReferenceCounted* iface)
{
owner = iface;
}
@ -143,10 +135,10 @@ public:
// Trivial factory
template <class P>
class SimpleFactoryBase : public AutoIface<IPluginFactory, FB_PLUGIN_FACTORY_VERSION>
class SimpleFactoryBase : public AutoIface<Api::PluginFactoryImpl<SimpleFactoryBase<P> > >
{
public:
IPluginBase* FB_CARG createPlugin(IStatus* status, IPluginConfig* factoryParameter)
IPluginBase* createPlugin(IStatus* status, IPluginConfig* factoryParameter)
{
try
{
@ -274,7 +266,7 @@ public:
// when yvalve is starting fb_shutdown(). This causes almost unavoidable segfault.
// To avoid it this class is added - it detects spontaneous (not by PluginManager)
// module unload and notifies PluginManager about this said fact.
class UnloadDetectorHelper FB_FINAL : public VersionedIface<IPluginModule, FB_PLUGIN_MODULE_VERSION>
class UnloadDetectorHelper FB_FINAL : public VersionedIface<Api::PluginModuleImpl<UnloadDetectorHelper> >
{
public:
typedef void VoidNoParam();
@ -308,11 +300,7 @@ public:
cleanup = function;
}
private:
VoidNoParam* cleanup;
bool flagOsUnload;
void FB_CARG doClean()
void doClean()
{
flagOsUnload = false;
@ -322,49 +310,14 @@ private:
cleanup = NULL;
}
}
private:
VoidNoParam* cleanup;
bool flagOsUnload;
};
typedef GlobalPtr<UnloadDetectorHelper, InstanceControl::PRIORITY_DETECT_UNLOAD> UnloadDetector;
extern UnloadDetector myModule;
template <class C, int V> IPluginModule* VersionedIface<C, V>::getModule()
{
return &myModule;
}
// Default replacement for missing virtual functions
class DefaultMissingEntrypoint
{
public:
virtual void FB_CARG noEntrypoint()
{
Arg::Gds(isc_wish_list).raise();
}
};
// Helps to create update information
template <typename M = DefaultMissingEntrypoint>
class MakeUpgradeInfo
{
public:
MakeUpgradeInfo()
{
ui.missingFunctionClass = &missing;
ui.clientModule = &myModule;
}
operator UpgradeInfo*()
{
return &ui;
}
private:
M missing;
struct UpgradeInfo ui;
};
UnloadDetectorHelper* getUnloadDetector();
// Generic status checker
inline void check(IStatus* status)
@ -378,7 +331,7 @@ inline void check(IStatus* status)
// debugger for reference counters
#ifdef DEV_BUILD
#ifdef NEVERDEF
#define FB_CAT2(a, b) a##b
#define FB_CAT1(a, b) FB_CAT2(a, b)
#define FB_RefDeb(c, p, l) Firebird::ReferenceCounterDebugger FB_CAT1(refCntDbg_, l)(c, p)

View File

@ -32,6 +32,8 @@
#include "../common/classes/BlrReader.h"
#include "../common/gdsassert.h"
#include "../common/MsgMetadata.h"
#include "../dsql/sqlda_pub.h"
#include "../jrd/blr.h"
namespace Firebird
{

View File

@ -29,7 +29,7 @@
#ifndef FB_COMMON_CLASSES_INTERNAL_MESSAGE_BUFFER
#define FB_COMMON_CLASSES_INTERNAL_MESSAGE_BUFFER
#include "firebird/Provider.h"
#include "firebird/Interface.h"
namespace Firebird {

View File

@ -385,7 +385,7 @@ int fb_msg_format(void* handle, USHORT facility, USHORT number, unsigned int bsi
else if (n == -2)
{
s += "message file ";
s += fb_utils::getPrefix(Firebird::DirType::FB_DIR_MSG, MSG_FILE).ToString();
s += fb_utils::getPrefix(Firebird::IConfigManager::FB_DIR_MSG, MSG_FILE).ToString();
s += " not found";
}
else

View File

@ -26,11 +26,10 @@
#include "firebird.h"
#include "../common/classes/fb_string.h"
#include "../common/classes/File.h"
#include "firebird/Interface.h"
namespace Firebird {
class IStatus;
class TempFile : public File
{
public:

View File

@ -30,6 +30,7 @@
#define CLASSES_LOCKS_H
#include "firebird.h"
#include "fb_exception.h"
#include "../common/gdsassert.h"
#include "../common/classes/Reasons.h"

View File

@ -30,6 +30,7 @@
#define CLASSES_SEMAPHORE_H
#include "../common/gdsassert.h"
#include "fb_exception.h"
#ifdef WIN_NT
// Note: Windows does not need signal safe version of the class

View File

@ -25,6 +25,7 @@
*/
#include "firebird.h"
#include "fb_exception.h"
#include "../common/gdsassert.h"
#ifdef HAVE_SYS_TIMES_H

View File

@ -28,8 +28,8 @@
#include "../common/classes/init.h"
#include "../common/dllinst.h"
#include "../common/os/fbsyslog.h"
#include "../jrd/EngineInterface.h"
#include "firebird/Plugin.h"
#include "../jrd/constants.h"
#include "firebird/Interface.h"
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
@ -50,7 +50,7 @@ public:
{
try
{
ConfigFile file(fb_utils::getPrefix(Firebird::DirType::FB_DIR_CONF, CONFIG_FILE),
ConfigFile file(fb_utils::getPrefix(Firebird::IConfigManager::FB_DIR_CONF, CONFIG_FILE),
ConfigFile::ERROR_WHEN_MISS);
defaultConfig = new Config(file);
}
@ -666,19 +666,19 @@ const char* Config::getPlugins(unsigned int type) const
{
switch (type)
{
case Firebird::PluginType::Provider:
case Firebird::IPluginManager::Provider:
return (const char*) values[KEY_PLUG_PROVIDERS];
case Firebird::PluginType::AuthServer:
case Firebird::IPluginManager::AuthServer:
return (const char*) values[KEY_PLUG_AUTH_SERVER];
case Firebird::PluginType::AuthClient:
case Firebird::IPluginManager::AuthClient:
return (const char*) values[KEY_PLUG_AUTH_CLIENT];
case Firebird::PluginType::AuthUserManagement:
case Firebird::IPluginManager::AuthUserManagement:
return (const char*) values[KEY_PLUG_AUTH_MANAGE];
case Firebird::PluginType::Trace:
case Firebird::IPluginManager::Trace:
return (const char*) values[KEY_PLUG_TRACE];
case Firebird::PluginType::WireCrypt:
case Firebird::IPluginManager::WireCrypt:
return (const char*) values[KEY_PLUG_WIRE_CRYPT];
case Firebird::PluginType::KeyHolder:
case Firebird::IPluginManager::KeyHolder:
return (const char*) values[KEY_PLUG_KEY_HOLDER];
}
@ -686,27 +686,27 @@ const char* Config::getPlugins(unsigned int type) const
return NULL; // compiler warning silencer
}
unsigned int FB_CARG FirebirdConf::getKey(const char* name)
unsigned int FirebirdConf::getKey(const char* name)
{
return Config::getKeyByName(name);
}
ISC_INT64 FB_CARG FirebirdConf::asInteger(unsigned int key)
ISC_INT64 FirebirdConf::asInteger(unsigned int key)
{
return config->getInt(key);
}
const char* FB_CARG FirebirdConf::asString(unsigned int key)
const char* FirebirdConf::asString(unsigned int key)
{
return config->getString(key);
}
FB_BOOLEAN FB_CARG FirebirdConf::asBoolean(unsigned int key)
FB_BOOLEAN FirebirdConf::asBoolean(unsigned int key)
{
return config->getBoolean(key);
}
int FB_CARG FirebirdConf::release()
int FirebirdConf::release()
{
if (--refCounter == 0)
{

View File

@ -332,7 +332,7 @@ public:
};
// Implementation of interface to access master configuration file
class FirebirdConf FB_FINAL : public Firebird::RefCntIface<Firebird::IFirebirdConf, FB_FIREBIRD_CONF_VERSION>
class FirebirdConf FB_FINAL : public Firebird::RefCntIface<Firebird::Api::FirebirdConfImpl<FirebirdConf> >
{
public:
FirebirdConf(Config* existingConfig)
@ -340,12 +340,12 @@ public:
{ }
// IFirebirdConf implementation
unsigned int FB_CARG getKey(const char* name);
ISC_INT64 FB_CARG asInteger(unsigned int key);
const char* FB_CARG asString(unsigned int key);
FB_BOOLEAN FB_CARG asBoolean(unsigned int key);
unsigned int getKey(const char* name);
SINT64 asInteger(unsigned int key);
const char* asString(unsigned int key);
FB_BOOLEAN asBoolean(unsigned int key);
int FB_CARG release();
int release();
private:
Firebird::RefPtr<Config> config;

View File

@ -497,13 +497,12 @@ bool ConfigFile::translate(const char* fileName, const String& from, String& to)
bool ConfigFile::substituteStandardDir(const String& from, String& to) const
{
using namespace fb_utils;
using namespace Firebird::DirType;
struct Dir {
unsigned code;
const char* name;
} dirs[] = {
#define NMDIR(a) {a, #a},
#define NMDIR(a) {Firebird::IConfigManager::a, #a},
NMDIR(FB_DIR_CONF)
NMDIR(FB_DIR_SECDB)
NMDIR(FB_DIR_PLUGINS)
@ -513,7 +512,7 @@ bool ConfigFile::substituteStandardDir(const String& from, String& to) const
NMDIR(FB_DIR_INTL)
NMDIR(FB_DIR_MSG)
#undef NMDIR
{FB_DIRCOUNT, NULL}
{Firebird::IConfigManager::FB_DIRCOUNT, NULL}
};
for (const Dir* d = dirs; d->name; ++d)

View File

@ -179,7 +179,7 @@ namespace
{
public:
explicit AliasesConf(MemoryPool& p)
: ConfigCache(p, fb_utils::getPrefix(Firebird::DirType::FB_DIR_CONF, ALIAS_FILE)),
: ConfigCache(p, fb_utils::getPrefix(Firebird::IConfigManager::FB_DIR_CONF, ALIAS_FILE)),
databases(getPool()), aliases(getPool())
{ }

View File

@ -1,5 +1,5 @@
#include "firebird.h"
#include "firebird/Provider.h"
#include "firebird/Interface.h"
#include <string.h>
#include <errno.h>
#include <stdarg.h>
@ -163,7 +163,7 @@ ISC_STATUS BadAlloc::stuffException(IStatus* status) const throw()
if (status)
{
status->setErrors(FB_NELEM(sv), sv);
status->setErrors2(FB_NELEM(sv), sv);
}
return sv[1];
@ -187,7 +187,7 @@ ISC_STATUS LongJump::stuffException(IStatus* status) const throw()
if (status)
{
status->setErrors(FB_NELEM(sv), sv);
status->setErrors2(FB_NELEM(sv), sv);
}
return sv[1];
@ -293,4 +293,9 @@ void fatal_exception::raiseFmt(const char* format, ...)
throw fatal_exception(buffer);
}
void raiseVersionError()
{
fatal_exception::raise("Interface version too old");
}
} // namespace Firebird

View File

@ -952,14 +952,14 @@ static bool make_object_name(TEXT*, size_t, const TEXT*, const TEXT*);
namespace {
class TimerEntry FB_FINAL : public Firebird::RefCntIface<Firebird::ITimer, FB_TIMER_VERSION>
class TimerEntry FB_FINAL : public Firebird::RefCntIface<Firebird::ITimer>
{
public:
TimerEntry(int id, USHORT num)
: semId(id), semNum(num)
{ }
void FB_CARG handler()
void handler()
{
for(;;)
{
@ -976,7 +976,7 @@ public:
}
}
int FB_CARG release()
int release()
{
if (--refCounter == 0)
{

View File

@ -197,7 +197,7 @@ ModuleLoader::Module* ModuleLoader::loadModule(const PathName& modPath)
if (PathUtils::isRelative(modPath))
{
MasterInterfacePtr master;
const char* baseDir = master->getConfigManager()->getDirectory(DirType::FB_DIR_BIN);
const char* baseDir = master->getConfigManager()->getDirectory(IConfigManager::FB_DIR_BIN);
PathName fullName;
PathUtils::concatPath(fullName, baseDir, modPath);

View File

@ -37,14 +37,12 @@ void raise()
(Arg::Gds(isc_random) << "Missing user management plugin").raise();
}
MakeUpgradeInfo<> ui;
} // anonymous namespace
namespace Auth {
Get::Get(Config* firebirdConf)
: GetPlugins<Auth::IManagement>(PluginType::AuthUserManagement, FB_AUTH_MANAGE_VERSION, ui, firebirdConf)
: GetPlugins<Firebird::IManagement>(IPluginManager::AuthUserManagement, firebirdConf)
{
if (!hasData())
{
@ -52,7 +50,7 @@ Get::Get(Config* firebirdConf)
}
}
void FB_CARG UserData::clear(Firebird::IStatus*)
void UserData::clear(Firebird::IStatus*)
{
op = 0;

View File

@ -24,14 +24,14 @@
#ifndef UTILITIES_SECUR_PROTO_H
#define UTILITIES_SECUR_PROTO_H
#include "firebird/Auth.h"
#include "firebird/Interface.h"
#include "../common/classes/ImplementHelper.h"
#include "../common/classes/GetPlugins.h"
#include "../common/classes/array.h"
namespace Auth {
class CharField : public Firebird::AutoIface<ICharUserField, FB_AUTH_CHAR_FIELD_VERSION>
class CharField : public Firebird::AutoIface<Firebird::Api::CharUserFieldImpl<CharField> >
{
public:
CharField()
@ -39,17 +39,17 @@ public:
{ }
// ICharUserField implementation
int FB_CARG entered()
int entered()
{
return e;
}
int FB_CARG specified()
int specified()
{
return s;
}
void FB_CARG setEntered(Firebird::IStatus*, int newValue)
void setEntered(Firebird::IStatus*, int newValue)
{
e = newValue;
}
@ -63,12 +63,12 @@ public:
}
}
const char* FB_CARG get()
const char* get()
{
return value.c_str();
}
void FB_CARG set(Firebird::IStatus* status, const char* newValue)
void set(Firebird::IStatus* status, const char* newValue)
{
try
{
@ -96,7 +96,7 @@ private:
Firebird::string value;
};
class IntField : public Firebird::AutoIface<IIntUserField, FB_AUTH_INT_FIELD_VERSION>
class IntField : public Firebird::AutoIface<Firebird::Api::IntUserFieldImpl<IntField> >
{
public:
IntField()
@ -104,17 +104,17 @@ public:
{ }
// IIntUserField implementation
int FB_CARG entered()
int entered()
{
return e;
}
int FB_CARG specified()
int specified()
{
return s;
}
void FB_CARG setEntered(Firebird::IStatus*, int newValue)
void setEntered(Firebird::IStatus*, int newValue)
{
e = newValue;
}
@ -128,12 +128,12 @@ public:
}
}
int FB_CARG get()
int get()
{
return value;
}
void FB_CARG set(Firebird::IStatus*, int newValue)
void set(Firebird::IStatus*, int newValue)
{
value = newValue;
}
@ -149,7 +149,9 @@ private:
int value;
};
class UserData : public IUser
typedef Firebird::Array<UCHAR> AuthenticationBlock;
class UserData : public Firebird::VersionedIface<Firebird::Api::UserImpl<UserData> >
{
public:
UserData()
@ -157,59 +159,58 @@ public:
{ }
// IUser implementation
int FB_CARG operation()
int operation()
{
return op;
}
ICharUserField* FB_CARG userName()
Firebird::ICharUserField* userName()
{
return &user;
}
ICharUserField* FB_CARG password()
Firebird::ICharUserField* password()
{
return &pass;
}
ICharUserField* FB_CARG firstName()
Firebird::ICharUserField* firstName()
{
return &first;
}
ICharUserField* FB_CARG lastName()
Firebird::ICharUserField* lastName()
{
return &last;
}
ICharUserField* FB_CARG middleName()
Firebird::ICharUserField* middleName()
{
return &middle;
}
ICharUserField* FB_CARG comment()
Firebird::ICharUserField* comment()
{
return &com;
}
ICharUserField* FB_CARG attributes()
Firebird::ICharUserField* attributes()
{
return &attr;
}
IIntUserField* FB_CARG admin()
Firebird::IIntUserField* admin()
{
return &adm;
}
IIntUserField* FB_CARG active()
Firebird::IIntUserField* active()
{
return &act;
}
void FB_CARG clear(Firebird::IStatus* status);
void clear(Firebird::IStatus* status);
typedef Firebird::Array<UCHAR> AuthenticationBlock;
int op, trustedAuth;
CharField user, pass, first, last, middle, com, attr;
@ -222,14 +223,18 @@ public:
IntField u, g;
};
class StackUserData FB_FINAL : public Firebird::AutoIface<UserData, FB_AUTH_USER_VERSION>
{
};
class DynamicUserData FB_FINAL : public Firebird::VersionedIface<UserData, FB_AUTH_USER_VERSION>
class StackUserData FB_FINAL : public UserData
{
public:
void* operator new(size_t, void* memory) throw()
{
return memory;
}
};
class DynamicUserData FB_FINAL : public UserData
{
public:
#ifdef DEBUG_GDS_ALLOC
void* operator new(size_t size, Firebird::MemoryPool& pool, const char* fileName, int line)
{
@ -243,13 +248,13 @@ public:
#endif // DEBUG_GDS_ALLOC
};
class Get : public Firebird::GetPlugins<Auth::IManagement>
class Get : public Firebird::GetPlugins<Firebird::IManagement>
{
public:
Get(Config* firebirdConf);
};
int setGsecCode(int code, IUser* iUser);
int setGsecCode(int code, Firebird::IUser* iUser);
} // namespace Auth

View File

@ -49,6 +49,7 @@
#include "../common/os/path_utils.h"
#include "../common/os/fbsyslog.h"
#include "../common/StatusArg.h"
#include "../dsql/sqlda_pub.h"
#ifdef WIN_NT
#include <direct.h>
@ -998,8 +999,6 @@ bool bootBuild()
return state == FB_BOOT_SET;
}
using namespace ::Firebird::DirType;
// Build full file name in specified directory
Firebird::PathName getPrefix(unsigned int prefType, const char* name)
{
@ -1012,12 +1011,12 @@ Firebird::PathName getPrefix(unsigned int prefType, const char* name)
FB_GUARDDIR, FB_PLUGDIR
};
fb_assert(FB_NELEM(configDir) == FB_DIRCOUNT);
fb_assert(prefType < FB_DIRCOUNT);
fb_assert(FB_NELEM(configDir) == Firebird::IConfigManager::FB_DIRCOUNT);
fb_assert(prefType < Firebird::IConfigManager::FB_DIRCOUNT);
if (! bootBuild())
{
if (prefType != FB_DIR_CONF && prefType != FB_DIR_MSG && configDir[prefType][0])
if (prefType != Firebird::IConfigManager::FB_DIR_CONF && prefType != Firebird::IConfigManager::FB_DIR_MSG && configDir[prefType][0])
{
// Value is set explicitly and is not environment overridable
PathUtils::concatPath(s, configDir[prefType], name);
@ -1027,8 +1026,8 @@ Firebird::PathName getPrefix(unsigned int prefType, const char* name)
switch(prefType)
{
case FB_DIR_BIN:
case FB_DIR_SBIN:
case Firebird::IConfigManager::FB_DIR_BIN:
case Firebird::IConfigManager::FB_DIR_SBIN:
#ifdef WIN_NT
s = "";
#else
@ -1036,14 +1035,14 @@ Firebird::PathName getPrefix(unsigned int prefType, const char* name)
#endif
break;
case FB_DIR_CONF:
case FB_DIR_LOG:
case FB_DIR_GUARD:
case FB_DIR_SECDB:
case Firebird::IConfigManager::FB_DIR_CONF:
case Firebird::IConfigManager::FB_DIR_LOG:
case Firebird::IConfigManager::FB_DIR_GUARD:
case Firebird::IConfigManager::FB_DIR_SECDB:
s = "";
break;
case FB_DIR_LIB:
case Firebird::IConfigManager::FB_DIR_LIB:
#ifdef WIN_NT
s = "";
#else
@ -1051,43 +1050,43 @@ Firebird::PathName getPrefix(unsigned int prefType, const char* name)
#endif
break;
case FB_DIR_PLUGINS:
case Firebird::IConfigManager::FB_DIR_PLUGINS:
s = "plugins";
break;
case FB_DIR_INC:
case Firebird::IConfigManager::FB_DIR_INC:
s = "include";
break;
case FB_DIR_DOC:
case Firebird::IConfigManager::FB_DIR_DOC:
s = "doc";
break;
case FB_DIR_UDF:
case Firebird::IConfigManager::FB_DIR_UDF:
s = "UDF";
break;
case FB_DIR_SAMPLE:
case Firebird::IConfigManager::FB_DIR_SAMPLE:
s = "examples";
break;
case FB_DIR_SAMPLEDB:
case Firebird::IConfigManager::FB_DIR_SAMPLEDB:
s = "examples/empbuild";
break;
case FB_DIR_HELP:
case Firebird::IConfigManager::FB_DIR_HELP:
s = "help";
break;
case FB_DIR_INTL:
case Firebird::IConfigManager::FB_DIR_INTL:
s = "intl";
break;
case FB_DIR_MISC:
case Firebird::IConfigManager::FB_DIR_MISC:
s = "misc";
break;
case FB_DIR_MSG:
case Firebird::IConfigManager::FB_DIR_MSG:
gds__prefix_msg(tmp, name);
return tmp;

View File

@ -33,7 +33,7 @@
#include "../common/classes/fb_string.h"
#include "../common/classes/array.h"
#include "gen/iberror.h"
#include "firebird/Provider.h"
#include "firebird/Interface.h"
#ifdef SFIO
#include <stdio.h>

View File

@ -10837,7 +10837,7 @@ dsc* UdfCallNode::execute(thread_db* tdbb, jrd_req* request) const
catch (const Exception& ex)
{
const bool noPriv = (ex.stuff_exception(tdbb->tdbb_status_vector) == isc_no_priv);
trace.finish(noPriv ? res_unauthorized : res_failed);
trace.finish(noPriv ? ITraceConnection::TRACE_RESULT_UNAUTHORIZED : ITraceConnection::TRACE_RESULT_FAILED);
tdbb->setRequest(request);
EXE_unwind(tdbb, funcRequest);
@ -10854,7 +10854,7 @@ dsc* UdfCallNode::execute(thread_db* tdbb, jrd_req* request) const
if (*nullPtr)
{
request->req_flags |= req_null;
trace.finish(res_successful);
trace.finish(ITraceConnection::TRACE_RESULT_SUCCESS);
}
else
{
@ -10864,7 +10864,7 @@ dsc* UdfCallNode::execute(thread_db* tdbb, jrd_req* request) const
value->vlu_desc = *fmtDesc;
value->vlu_desc.dsc_address = outMsg + argOffset;
trace.finish(res_successful, &value->vlu_desc);
trace.finish(ITraceConnection::TRACE_RESULT_SUCCESS, &value->vlu_desc);
}
EXE_unwind(tdbb, funcRequest);

View File

@ -2844,7 +2844,7 @@ void ExecProcedureNode::executeProcedure(thread_db* tdbb, jrd_req* request) cons
catch (const Exception& ex)
{
const bool noPriv = (ex.stuff_exception(tdbb->tdbb_status_vector) == isc_no_priv);
trace.finish(false, noPriv ? res_unauthorized : res_failed);
trace.finish(false, noPriv ? Firebird::ITraceConnection::TRACE_RESULT_UNAUTHORIZED : ITraceConnection::TRACE_RESULT_FAILED);
EXE_unwind(tdbb, procRequest);
procRequest->req_attachment = NULL;
@ -2853,7 +2853,7 @@ void ExecProcedureNode::executeProcedure(thread_db* tdbb, jrd_req* request) cons
}
// trace procedure execution finish
trace.finish(false, res_successful);
trace.finish(false, ITraceConnection::TRACE_RESULT_SUCCESS);
EXE_unwind(tdbb, procRequest);
procRequest->req_attachment = NULL;

View File

@ -256,14 +256,14 @@ bool DsqlDmlRequest::fetch(thread_db* tdbb, UCHAR* msgBuffer)
if (eofReached)
{
trace.fetch(true, res_successful);
trace.fetch(true, ITraceConnection::TRACE_RESULT_SUCCESS);
return false;
}
map_in_out(this, true, message, delayedFormat, msgBuffer);
delayedFormat = NULL;
trace.fetch(false, res_successful);
trace.fetch(false, ITraceConnection::TRACE_RESULT_SUCCESS);
return true;
}
@ -549,7 +549,7 @@ static void close_cursor(thread_db* tdbb, dsql_req* request)
if (request->req_fetch_baseline)
{
TraceDSQLFetch trace(attachment, request);
trace.fetch(true, res_successful);
trace.fetch(true, ITraceConnection::TRACE_RESULT_SUCCESS);
}
if (request->req_traced && TraceManager::need_dsql_free(attachment))
@ -716,7 +716,7 @@ void DsqlDmlRequest::dsqlPass(thread_db* tdbb, DsqlCompilerScratch* scratch,
catch (const Exception&)
{
status = tdbb->tdbb_status_vector[1];
*traceResult = (status == isc_no_priv ? res_unauthorized : res_failed);
*traceResult = (status == isc_no_priv ? ITraceConnection::TRACE_RESULT_UNAUTHORIZED : ITraceConnection::TRACE_RESULT_FAILED);
}
// restore warnings (if there are any)
@ -886,7 +886,7 @@ void DsqlDmlRequest::execute(thread_db* tdbb, jrd_tra** traHandle,
}
const bool have_cursor = reqTypeWithCursor(statement->getType()) && !singleton;
trace.finish(have_cursor, res_successful);
trace.finish(have_cursor, ITraceConnection::TRACE_RESULT_SUCCESS);
}
void DsqlDdlRequest::dsqlPass(thread_db* tdbb, DsqlCompilerScratch* scratch,
@ -950,7 +950,7 @@ void DsqlDdlRequest::execute(thread_db* tdbb, jrd_tra** traHandle,
JRD_autocommit_ddl(tdbb, req_transaction);
trace.finish(false, res_successful);
trace.finish(false, ITraceConnection::TRACE_RESULT_SUCCESS);
}
// Rethrow an exception with isc_no_meta_update and prefix codes.
@ -1499,7 +1499,7 @@ static dsql_req* prepareStatement(thread_db* tdbb, dsql_dbb* database, jrd_tra*
request->req_traced = true;
trace.setStatement(request);
ntrace_result_t traceResult = res_successful;
ntrace_result_t traceResult = ITraceConnection::TRACE_RESULT_SUCCESS;
try
{
request->dsqlPass(tdbb, scratch, &traceResult);
@ -1515,7 +1515,7 @@ static dsql_req* prepareStatement(thread_db* tdbb, dsql_dbb* database, jrd_tra*
}
catch (const Firebird::Exception&)
{
trace.prepare(res_failed);
trace.prepare(ITraceConnection::TRACE_RESULT_FAILED);
if (request)
{

View File

@ -26,6 +26,7 @@
#define DSQL_DSQL_PROTO_H
#include "../common/classes/array.h"
#include "firebird/Interface.h"
namespace Jrd {
class Attachment;
@ -33,10 +34,6 @@ namespace Jrd {
class dsql_req;
}
namespace Firebird {
class IMessageMetadata;
}
void DSQL_execute(Jrd::thread_db*, Jrd::jrd_tra**, Jrd::dsql_req*, bool,
Firebird::IMessageMetadata*, const UCHAR*, Firebird::IMessageMetadata*, UCHAR*);
void DSQL_execute_immediate(Jrd::thread_db*, Jrd::Attachment*, Jrd::jrd_tra**,

View File

@ -684,46 +684,41 @@ bool MET_trigger_exists(gpre_dbb* /*db*/, const TEXT* /*trigger_name*/)
using namespace Firebird;
class DummyMasterImpl : public IMaster
class DummyMasterImpl : public FirebirdApi<FirebirdPolicy>::MasterImpl<DummyMasterImpl>
{
public:
// IMaster implementation (almost dummy, for boot build)
virtual int FB_CARG getVersion()
{
return FB_MASTER_VERSION;
}
virtual IPluginModule* FB_CARG getModule()
IPluginModule* getModule()
{
return NULL;
}
virtual IStatus* FB_CARG getStatus()
IStatus* getStatus()
{
fb_assert(false);
return NULL;
}
virtual IProvider* FB_CARG getDispatcher()
IProvider* getDispatcher()
{
fb_assert(false);
return NULL;
}
virtual IPluginManager* FB_CARG getPluginManager()
IPluginManager* getPluginManager()
{
//fb_assert(false);
return NULL;
}
virtual int FB_CARG upgradeInterface(IVersioned* /*toUpgrade*/, int /*desiredVersion*/,
struct UpgradeInfo* /*upInfo*/)
int upgradeInterface(IVersioned* /*toUpgrade*/, int /*desiredVersion*/,
IPluginModule* /*destMod*/, void* /*function*/)
{
fb_assert(false);
return 0;
}
virtual const char* FB_CARG circularAlloc(const char* s, size_t len, intptr_t /*thr*/)
const char* circularAlloc(const char* s, unsigned len, intptr_t /*thr*/)
{
char* buf = (char*) malloc(len + 1);
memcpy(buf, s, len);
@ -731,58 +726,53 @@ public:
return buf;
}
virtual ITimerControl* FB_CARG getTimerControl()
ITimerControl* getTimerControl()
{
fb_assert(false);
return NULL;
}
virtual IAttachment* FB_CARG registerAttachment(IProvider* /*provider*/, IAttachment* /*attachment*/)
IAttachment* registerAttachment(IProvider* /*provider*/, IAttachment* /*attachment*/)
{
fb_assert(false);
return NULL;
}
virtual ITransaction* FB_CARG registerTransaction(IAttachment* /*attachment*/, ITransaction* /*transaction*/)
ITransaction* registerTransaction(IAttachment* /*attachment*/, ITransaction* /*transaction*/)
{
fb_assert(false);
return NULL;
}
virtual IDtc* FB_CARG getDtc()
IDtc* getDtc()
{
fb_assert(false);
return NULL;
}
virtual int FB_CARG same(IVersioned* /*first*/, IVersioned* /*second*/)
int same(IVersioned* /*first*/, IVersioned* /*second*/)
{
return 0;
}
virtual IMetadataBuilder* FB_CARG getMetadataBuilder(IStatus* status, unsigned fieldCount)
IMetadataBuilder* getMetadataBuilder(IStatus* status, unsigned fieldCount)
{
fb_assert(false);
return NULL;
}
virtual IDebug* FB_CARG getDebug()
{
return NULL;
}
virtual int FB_CARG serverMode(int mode)
int serverMode(int mode)
{
return -1;
}
virtual IUtl* FB_CARG getUtlInterface()
IUtl* getUtlInterface()
{
fb_assert(false);
return NULL;
}
virtual IConfigManager* FB_CARG getConfigManager()
IConfigManager* getConfigManager()
{
fb_assert(false);
return NULL;

View File

@ -1364,7 +1364,7 @@ static void gen_database_data() //(const act* action)
{
Firebird::PathName include_buffer;
include_buffer = fb_utils::getPrefix(Firebird::DirType::FB_DIR_INC, INCLUDE_FTN_FILE);
include_buffer = fb_utils::getPrefix(Firebird::IConfigManager::FB_DIR_INC, INCLUDE_FTN_FILE);
sprintf(output_buffer, INCLUDE_ISC_FTN, include_buffer.c_str());
FTN_print_buffer(output_buffer);

View File

@ -1427,7 +1427,7 @@ static void gen_database(int column)
fprintf(gpreGlob.out_file, "\n/**** GDS Preprocessor Definitions ****/\n");
fprintf(gpreGlob.out_file, "#ifndef JRD_IBASE_H\n#include %s\n#endif\n", GDS_INCLUDE);
fprintf(gpreGlob.out_file, "#include <firebird/Provider.h>\n");
fprintf(gpreGlob.out_file, "#include <firebird/Interface.h>\n");
fprintf(gpreGlob.out_file, "#define CAST_CONST_MSG(A) (reinterpret_cast<const unsigned char*>(A))\n");
fprintf(gpreGlob.out_file, "#define CAST_MSG(A) (reinterpret_cast<unsigned char*>(A))\n");

View File

@ -42,11 +42,11 @@
#endif
#include "fb_types.h"
#include "firebird/Interface.h"
#include "../common/ThreadStart.h"
namespace Firebird
{
class IStatus;
class MemoryPool;
class Exception

View File

@ -64,7 +64,7 @@
#ifdef __cplusplus
#include "../common/common.h"
#include "fb_exception.h"
//#include "fb_exception.h"
#endif
#ifndef NULL

View File

@ -1,172 +0,0 @@
/*
* PROGRAM: Firebird authentication
* MODULE: Auth.h
* DESCRIPTION: Interfaces, used by authentication plugins
*
* The contents of this file are subject to the Initial
* Developer's Public License Version 1.0 (the "License");
* you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
* http://www.ibphoenix.com/main.nfs?a=ibphoenix&page=ibp_idpl.
*
* Software distributed under the License is distributed AS IS,
* WITHOUT WARRANTY OF ANY KIND, either express or implied.
* See the License for the specific language governing rights
* and limitations under the License.
*
* The Original Code was created by Alex Peshkov
* for the Firebird Open Source RDBMS project.
*
* Copyright (c) 2010 Alex Peshkov <peshkoff at mail.ru>
* and all contributors signed below.
*
* All Rights Reserved.
* Contributor(s): ______________________________________.
*
*
*/
#ifndef FB_AUTH_INTERFACE
#define FB_AUTH_INTERFACE
#include "firebird/Plugin.h"
namespace Firebird {
class IStatus;
}
namespace Auth {
const int AUTH_SUCCESS = 0;
const int AUTH_MORE_DATA = 1;
const int AUTH_CONTINUE = 2;
const int AUTH_FAILED = -1;
class IWriter : public Firebird::IVersioned
{
public:
virtual void FB_CARG reset() = 0;
virtual void FB_CARG add(Firebird::IStatus* status, const char* name) = 0;
virtual void FB_CARG setType(Firebird::IStatus* status, const char* value) = 0;
virtual void FB_CARG setDb(Firebird::IStatus* status, const char* value) = 0;
};
#define FB_AUTH_WRITER_VERSION (FB_VERSIONED_VERSION + 4)
// Representation of auth-related data, passed to/from server auth plugin
class IServerBlock : public Firebird::IVersioned
{
public:
virtual const char* FB_CARG getLogin() = 0;
virtual const unsigned char* FB_CARG getData(unsigned int* length) = 0;
virtual void FB_CARG putData(Firebird::IStatus* status, unsigned int length, const void* data) = 0;
virtual void FB_CARG putKey(Firebird::IStatus* status, Firebird::FbCryptKey* cryptKey) = 0;
};
#define FB_AUTH_SERVER_BLOCK_VERSION (FB_VERSIONED_VERSION + 4)
// Representation of auth-related data, passed to/from client auth plugin
class IClientBlock : public Firebird::IRefCounted
{
public:
virtual const char* FB_CARG getLogin() = 0;
virtual const char* FB_CARG getPassword() = 0;
virtual const unsigned char* FB_CARG getData(unsigned int* length) = 0;
virtual void FB_CARG putData(Firebird::IStatus* status, unsigned int length, const void* data) = 0;
virtual void FB_CARG putKey(Firebird::IStatus* status, Firebird::FbCryptKey* cryptKey) = 0;
};
#define FB_AUTH_CLIENT_BLOCK_VERSION (FB_REFCOUNTED_VERSION + 5)
// server part of authentication plugin
class IServer : public Firebird::IPluginBase
{
public:
virtual int FB_CARG authenticate(Firebird::IStatus* status, IServerBlock* sBlock, IWriter* writerInterface) = 0;
};
#define FB_AUTH_SERVER_VERSION (FB_PLUGIN_VERSION + 1)
// .. and corresponding client
class IClient : public Firebird::IPluginBase
{
public:
virtual int FB_CARG authenticate(Firebird::IStatus* status, IClientBlock* cBlock) = 0;
};
#define FB_AUTH_CLIENT_VERSION (FB_PLUGIN_VERSION + 1)
class IUserField : public Firebird::IVersioned
{
public:
virtual int FB_CARG entered() = 0;
virtual int FB_CARG specified() = 0;
virtual void FB_CARG setEntered(Firebird::IStatus* status, int newValue) = 0;
};
#define FB_AUTH_FIELD_VERSION (FB_VERSIONED_VERSION + 3)
class ICharUserField : public IUserField
{
public:
virtual const char* FB_CARG get() = 0;
virtual void FB_CARG set(Firebird::IStatus* status, const char* newValue) = 0;
};
#define FB_AUTH_CHAR_FIELD_VERSION (FB_AUTH_FIELD_VERSION + 2)
class IIntUserField : public IUserField
{
public:
virtual int FB_CARG get() = 0;
virtual void FB_CARG set(Firebird::IStatus* status, int newValue) = 0;
};
#define FB_AUTH_INT_FIELD_VERSION (FB_AUTH_FIELD_VERSION + 2)
class IUser : public Firebird::IVersioned
{
public:
virtual int FB_CARG operation() = 0;
virtual ICharUserField* FB_CARG userName() = 0;
virtual ICharUserField* FB_CARG password() = 0;
virtual ICharUserField* FB_CARG firstName() = 0;
virtual ICharUserField* FB_CARG lastName() = 0;
virtual ICharUserField* FB_CARG middleName() = 0;
virtual ICharUserField* FB_CARG comment() = 0;
virtual ICharUserField* FB_CARG attributes() = 0;
virtual IIntUserField* FB_CARG active() = 0;
virtual IIntUserField* FB_CARG admin() = 0;
virtual void FB_CARG clear(Firebird::IStatus* status) = 0;
};
#define FB_AUTH_USER_VERSION (FB_VERSIONED_VERSION + 11)
class IListUsers : public Firebird::IVersioned
{
public:
virtual void FB_CARG list(Firebird::IStatus* status, IUser* user) = 0;
};
#define FB_AUTH_LIST_USERS_VERSION (FB_VERSIONED_VERSION + 1)
class ILogonInfo : public Firebird::IVersioned
{
public:
virtual const char* FB_CARG name() = 0;
virtual const char* FB_CARG role() = 0;
virtual const char* FB_CARG networkProtocol() = 0;
virtual const char* FB_CARG remoteAddress() = 0;
virtual const unsigned char* FB_CARG authBlock(unsigned* length) = 0;
};
#define FB_AUTH_LOGON_INFO_VERSION (FB_VERSIONED_VERSION + 5)
class IManagement : public Firebird::IPluginBase
{
public:
virtual void FB_CARG start(Firebird::IStatus* status, ILogonInfo* logonInfo) = 0;
virtual int FB_CARG execute(Firebird::IStatus* status, IUser* user, IListUsers* callback) = 0;
virtual void FB_CARG commit(Firebird::IStatus* status) = 0;
virtual void FB_CARG rollback(Firebird::IStatus* status) = 0;
};
#define FB_AUTH_MANAGE_VERSION (FB_PLUGIN_VERSION + 4)
} // namespace Auth
#endif // FB_AUTH_INTERFACE

View File

@ -1,98 +0,0 @@
/*
* The contents of this file are subject to the Initial
* Developer's Public License Version 1.0 (the "License");
* you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
* http://www.ibphoenix.com/main.nfs?a=ibphoenix&page=ibp_idpl.
*
* Software distributed under the License is distributed AS IS,
* WITHOUT WARRANTY OF ANY KIND, either express or implied.
* See the License for the specific language governing rights
* and limitations under the License.
*
* The Original Code was created by Alexander Peshkov
* for the Firebird Open Source RDBMS project.
*
* Copyright (c) 2012 Alex Peshkov <peshkoff@mail.ru>
* and all contributors signed below.
*
* All Rights Reserved.
* Contributor(s): ______________________________________.
*/
#ifndef FIREBIRD_CRYPT_PLUGIN_H
#define FIREBIRD_CRYPT_PLUGIN_H
#include "./Plugin.h"
namespace Firebird {
// Part 1. Network crypt.
// Plugins of this type are used to crypt data, sent over the wire
// Plugin must support encrypt and decrypt operations.
// Interface of plugin is the same for both client and server,
// and it may have different or same implementations for client and server.
class IWireCryptPlugin : public IPluginBase
{
public:
// getKnownTypes() function must return list of acceptable keys' types
// special type 'builtin' means that crypt plugin knows itself where to get the key from
virtual const char* FB_CARG getKnownTypes(IStatus* status) = 0;
virtual void FB_CARG setKey(IStatus* status, FbCryptKey* key) = 0;
virtual void FB_CARG encrypt(IStatus* status, unsigned int length, const void* from, void* to) = 0;
virtual void FB_CARG decrypt(IStatus* status, unsigned int length, const void* from, void* to) = 0;
};
#define FB_WIRECRYPT_PLUGIN_VERSION (FB_PLUGIN_VERSION + 4)
// Part 2. Database crypt.
// This interface is used to transfer some data (related to crypt keys)
// between different components of firebird.
class ICryptKeyCallback : public IVersioned
{
public:
virtual unsigned int FB_CARG callback(unsigned int dataLength, const void* data,
unsigned int bufferLength, void* buffer) = 0;
};
#define FB_CRYPT_CALLBACK_VERSION (FB_VERSIONED_VERSION + 1)
// Key holder accepts key(s) from attachment at database attach time
// (or gets them it some other arbitrary way)
// and sends it to database crypt plugin on request.
class IKeyHolderPlugin : public IPluginBase
{
public:
// keyCallback() is called when new attachment is probably ready to provide keys
// to key holder plugin, ICryptKeyCallback interface is provided by attachment.
virtual int FB_CARG keyCallback(IStatus* status, ICryptKeyCallback* callback) = 0;
// Crypt plugin calls keyHandle() when it needs a key, stored in key holder.
// Key is not returned directly - instead of it callback interface is returned.
// Missing key with given name is not an error condition for keyHandle().
// It should just return NULL in this case
virtual ICryptKeyCallback* FB_CARG keyHandle(IStatus* status, const char* keyName) = 0;
};
#define FB_KEYHOLDER_PLUGIN_VERSION (FB_PLUGIN_VERSION + 2)
class IDbCryptPlugin : public IPluginBase
{
public:
// When database crypt plugin is loaded, setKey() is called to provide information
// about key holders, available for a given database.
// It's supposed that crypt plugin will invoke keyHandle() function from them
// to access callback interface for getting actual crypt key.
// If crypt plugin fails to find appropriate key in sources, it should raise error.
virtual void FB_CARG setKey(IStatus* status, unsigned int length, IKeyHolderPlugin** sources) = 0;
virtual void FB_CARG encrypt(IStatus* status, unsigned int length, const void* from, void* to) = 0;
virtual void FB_CARG decrypt(IStatus* status, unsigned int length, const void* from, void* to) = 0;
};
#define FB_DBCRYPT_PLUGIN_VERSION (FB_PLUGIN_VERSION + 3)
} // namespace Firebird
#endif // FIREBIRD_CRYPT_PLUGIN_H

View File

@ -1,212 +0,0 @@
/*
* The contents of this file are subject to the Initial
* Developer's Public License Version 1.0 (the "License");
* you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
* http://www.ibphoenix.com/main.nfs?a=ibphoenix&page=ibp_idpl.
*
* Software distributed under the License is distributed AS IS,
* WITHOUT WARRANTY OF ANY KIND, either express or implied.
* See the License for the specific language governing rights
* and limitations under the License.
*
* The Original Code was created by Adriano dos Santos Fernandes
* for the Firebird Open Source RDBMS project, based on previous work done
* by Eugeney Putilin <evgeneyputilin at mail.ru>,
* Vlad Khorsun <hvlad at users.sourceforge.net> and
* Roman Rokytskyy <roman at rokytskyy.de>.
*
* Copyright (c) 2008 Adriano dos Santos Fernandes <adrianosf@uol.com.br>
* and all contributors signed below.
*
* All Rights Reserved.
* Contributor(s): ______________________________________.
* Eugeney Putilin <evgeneyputilin at mail.ru>
* Vlad Khorsun <hvlad at users.sourceforge.net>
* Roman Rokytskyy <roman at rokytskyy.de>
*/
#ifndef FIREBIRD_EXTERNAL_API_H
#define FIREBIRD_EXTERNAL_API_H
#include "FirebirdApi.h"
#include "./Plugin.h"
#include "./Provider.h"
namespace Firebird {
class ExternalEngine;
// Connection to current database in external engine.
// Context passed to ExternalEngine has SYSDBA privileges.
// Context passed to ExternalFunction, ExternalProcedure and ExternalTrigger
// has user privileges.
// There is one ExternalContext per attachment. The privileges and character
// set properties are changed during the calls.
class ExternalContext
{
public:
// Gets the IMaster associated with this context.
virtual IMaster* FB_CARG getMaster() = 0;
// Gets the ExternalEngine associated with this context.
virtual ExternalEngine* FB_CARG getEngine(IStatus* status) = 0;
// Gets the Attachment associated with this context.
virtual IAttachment* FB_CARG getAttachment(IStatus* status) = 0;
// Obtained transaction is valid only before control is returned to the engine
// or in ExternalResultSet::fetch calls of correspondent ExternalProcedure::open.
virtual ITransaction* FB_CARG getTransaction(IStatus* status) = 0;
virtual const char* FB_CARG getUserName() = 0;
virtual const char* FB_CARG getDatabaseName() = 0;
// Get user attachment character set.
virtual const Utf8* FB_CARG getClientCharSet() = 0;
// Misc info associated with a context. The pointers are never accessed or freed by Firebird.
// Obtains an unique (across all contexts) code to associate plugin and/or user information.
virtual int FB_CARG obtainInfoCode() = 0;
// Gets a value associated with this code or FB_NULL if no value was set.
virtual void* FB_CARG getInfo(int code) = 0;
// Sets a value associated with this code and returns the last value.
virtual void* FB_CARG setInfo(int code, void* value) = 0;
};
// To return set of rows in selectable procedures.
class ExternalResultSet : public IDisposable
{
public:
virtual FB_BOOLEAN FB_CARG fetch(IStatus* status) = 0;
};
#define FB_EXTERNAL_RESULT_SET_VERSION (FB_DISPOSABLE_VERSION + 1)
class ExternalFunction : public IDisposable
{
public:
// This method is called just before execute and informs the engine our requested character
// set for data exchange inside that method.
// During this call, the context uses the character set obtained from ExternalEngine::getCharSet.
virtual void FB_CARG getCharSet(IStatus* status, ExternalContext* context,
Utf8* name, uint nameSize) = 0;
virtual void FB_CARG execute(IStatus* status, ExternalContext* context,
void* inMsg, void* outMsg) = 0;
};
#define FB_EXTERNAL_FUNCTION_VERSION (FB_DISPOSABLE_VERSION + 2)
class ExternalProcedure : public IDisposable
{
public:
// This method is called just before open and informs the engine our requested character
// set for data exchange inside that method and ExternalResultSet::fetch.
// During this call, the context uses the character set obtained from ExternalEngine::getCharSet.
virtual void FB_CARG getCharSet(IStatus* status, ExternalContext* context,
Utf8* name, uint nameSize) = 0;
// Returns a ExternalResultSet for selectable procedures.
// Returning NULL results in a result set of one record.
// Procedures without output parameters should return NULL.
virtual ExternalResultSet* FB_CARG open(IStatus* status, ExternalContext* context,
void* inMsg, void* outMsg) = 0;
};
#define FB_EXTERNAL_PROCEDURE_VERSION (FB_DISPOSABLE_VERSION + 2)
class ExternalTrigger : public IDisposable
{
public:
enum Type
{
TYPE_BEFORE = 1,
TYPE_AFTER,
TYPE_DATABASE
};
enum Action
{
ACTION_INSERT = 1,
ACTION_UPDATE,
ACTION_DELETE,
ACTION_CONNECT,
ACTION_DISCONNECT,
ACTION_TRANS_START,
ACTION_TRANS_COMMIT,
ACTION_TRANS_ROLLBACK,
ACTION_DDL
};
public:
// This method is called just before execute and informs the engine our requested character
// set for data exchange inside that method.
// During this call, the context uses the character set obtained from ExternalEngine::getCharSet.
virtual void FB_CARG getCharSet(IStatus* status, ExternalContext* context,
Utf8* name, uint nameSize) = 0;
virtual void FB_CARG execute(IStatus* status, ExternalContext* context,
Action action, void* oldMsg, void* newMsg) = 0;
};
#define FB_EXTERNAL_TRIGGER_VERSION (FB_DISPOSABLE_VERSION + 2)
class IRoutineMetadata : public IVersioned
{
public:
virtual const char* FB_CARG getPackage(IStatus* status) const = 0;
virtual const char* FB_CARG getName(IStatus* status) const = 0;
virtual const char* FB_CARG getEntryPoint(IStatus* status) const = 0;
virtual const char* FB_CARG getBody(IStatus* status) const = 0;
virtual IMessageMetadata* FB_CARG getInputMetadata(IStatus* status) const = 0;
virtual IMessageMetadata* FB_CARG getOutputMetadata(IStatus* status) const = 0;
virtual IMessageMetadata* FB_CARG getTriggerMetadata(IStatus* status) const = 0;
virtual const char* FB_CARG getTriggerTable(IStatus* status) const = 0;
virtual ExternalTrigger::Type FB_CARG getTriggerType(IStatus* status) const = 0;
};
#define FB_ROUTINE_METADATA_VERSION (FB_VERSIONED_VERSION + 9)
// In SuperServer, shared by all attachments to one database and disposed when last (non-external)
// user attachment to the database is closed.
class ExternalEngine : public IPluginBase
{
public:
// This method is called once (per ExternalEngine instance) before any following methods.
// The requested character set for data exchange inside methods of this interface should
// be copied to charSet parameter.
// During this call, the context uses the UTF-8 character set.
virtual void FB_CARG open(IStatus* status, ExternalContext* context,
Utf8* charSet, uint charSetSize) = 0;
// Attachment is being opened.
virtual void FB_CARG openAttachment(IStatus* status, ExternalContext* context) = 0;
// Attachment is being closed.
virtual void FB_CARG closeAttachment(IStatus* status, ExternalContext* context) = 0;
// Called when engine wants to load object in the cache. Objects are disposed when
// going out of the cache.
virtual ExternalFunction* FB_CARG makeFunction(IStatus* status, ExternalContext* context,
const IRoutineMetadata* metadata,
IMetadataBuilder* inBuilder, IMetadataBuilder* outBuilder) = 0;
virtual ExternalProcedure* FB_CARG makeProcedure(IStatus* status, ExternalContext* context,
const IRoutineMetadata* metadata,
IMetadataBuilder* inBuilder, IMetadataBuilder* outBuilder) = 0;
virtual ExternalTrigger* FB_CARG makeTrigger(IStatus* status, ExternalContext* context,
const IRoutineMetadata* metadata, IMetadataBuilder* fieldsBuilder) = 0;
};
#define FB_EXTERNAL_ENGINE_VERSION (FB_PLUGIN_VERSION + 6)
} // namespace Firebird
#endif // FIREBIRD_EXTERNAL_API_H

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -32,115 +32,244 @@
#include "ibase.h"
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
# define FB_CARG __cdecl
#else
# define FB_CARG
#define CLOOP_CARG __cdecl
#endif
namespace Firebird {
struct dsc;
struct PerformanceInfo;
// Forward declaration - used to identify client and provider of upgraded interface
class IPluginModule;
namespace Firebird
{
// Versioned interface - base for all FB interfaces
class IVersioned
struct FbCryptKey;
struct DtcStart;
#include "IdlFbInterfaces.h"
#ifdef INCLUDE_Firebird_H // Building internal module
class FirebirdPolicy;
extern void raiseVersionError();
extern void upgradeInterface(FirebirdApi<FirebirdPolicy>::Versioned* toUpgrade, int desiredVersion, void* function);
extern void logOldPlugin();
extern ISC_STATUS* getUpgradeError();
namespace
{
static void defaultUpgradeFunction(void*, FirebirdApi<FirebirdPolicy>::Status* status)
{
status->setErrors2(2, getUpgradeError());
}
// This may be used when old plugin, missing some newer events is used.
// Reasonable action here is to log once and ignore next times.
static void ignoreMissing(void*)
{
static bool flagFirst = true;
if (flagFirst)
{
flagFirst = false;
logOldPlugin();
}
};
template <typename T>
static inline void upgradeVersionedInterface(T* versioned)
{
if (versioned && versioned->cloopVTable->version < T::VERSION)
{
upgradeInterface(versioned, T::VERSION, (void*)defaultUpgradeFunction);
}
}
template <>
void upgradeVersionedInterface<FirebirdApi<FirebirdPolicy>::TracePlugin>
(FirebirdApi<FirebirdPolicy>::TracePlugin* versioned)
{
if (versioned && versioned->cloopVTable->version < FirebirdApi<FirebirdPolicy>::TracePlugin::VERSION)
{
upgradeInterface(versioned, FirebirdApi<FirebirdPolicy>::TracePlugin::VERSION, (void*)ignoreMissing);
}
}
}
class FirebirdPolicy
{
public:
virtual int FB_CARG getVersion() = 0;
virtual IPluginModule* FB_CARG getModule() = 0;
};
// If this is changed, types of all interfaces must be changed
#define FB_VERSIONED_VERSION 2
template <unsigned V, typename T>
static inline void checkVersion(T* versioned)
{
if (versioned && versioned->cloopVTable->version < V)
{
raiseVersionError();
}
}
// Reference counted interface - base for refCounted FB interfaces
class IRefCounted : public IVersioned
template <typename T>
static inline T* upgrade(T* versioned)
{
upgradeVersionedInterface(versioned);
return versioned;
}
static void checkException(FirebirdApi<FirebirdPolicy>::Status* status) { }
static void catchException(FirebirdApi<FirebirdPolicy>::Status* status) { }
typedef FirebirdApi<FirebirdPolicy>::Status* Status;
};
#else // INCLUDE_Firebird_H building external module
// use empty default policy
class FirebirdPolicy
{
public:
virtual void FB_CARG addRef() = 0;
virtual int FB_CARG release() = 0;
};
// If this is changed, types of refCounted interfaces must be changed
#define FB_REFCOUNTED_VERSION (FB_VERSIONED_VERSION + 2)
template <unsigned V, typename T>
static inline void checkVersion(T* versioned) { }
// Disposable interface - base for disposable FB interfaces
class IDisposable : public IVersioned
template <typename T>
static inline T* upgrade(T* versioned)
{
return versioned;
}
template <typename S>
static void checkException(S status) { }
template <typename S>
static void catchException(S status) { }
typedef FirebirdApi<FirebirdPolicy>::Status* Status;
};
#endif // INCLUDE_Firebird_H
//awk <FirebirdInterface.idl '($1 == "interface") {printf "\ttypedef FirebirdApi<FirebirdPolicy>::%s I%s;\n", $2, $2;}'
typedef FirebirdApi<FirebirdPolicy>::Versioned IVersioned;
typedef FirebirdApi<FirebirdPolicy>::ReferenceCounted IReferenceCounted;
typedef FirebirdApi<FirebirdPolicy>::Disposable IDisposable;
typedef FirebirdApi<FirebirdPolicy>::Status IStatus;
typedef FirebirdApi<FirebirdPolicy>::Master IMaster;
typedef FirebirdApi<FirebirdPolicy>::PluginBase IPluginBase;
typedef FirebirdApi<FirebirdPolicy>::PluginSet IPluginSet;
typedef FirebirdApi<FirebirdPolicy>::ConfigEntry IConfigEntry;
typedef FirebirdApi<FirebirdPolicy>::Config IConfig;
typedef FirebirdApi<FirebirdPolicy>::FirebirdConf IFirebirdConf;
typedef FirebirdApi<FirebirdPolicy>::PluginConfig IPluginConfig;
typedef FirebirdApi<FirebirdPolicy>::PluginFactory IPluginFactory;
typedef FirebirdApi<FirebirdPolicy>::PluginModule IPluginModule;
typedef FirebirdApi<FirebirdPolicy>::PluginManager IPluginManager;
typedef FirebirdApi<FirebirdPolicy>::ConfigManager IConfigManager;
typedef FirebirdApi<FirebirdPolicy>::EventCallback IEventCallback;
typedef FirebirdApi<FirebirdPolicy>::Blob IBlob;
typedef FirebirdApi<FirebirdPolicy>::Transaction ITransaction;
typedef FirebirdApi<FirebirdPolicy>::MessageMetadata IMessageMetadata;
typedef FirebirdApi<FirebirdPolicy>::MetadataBuilder IMetadataBuilder;
typedef FirebirdApi<FirebirdPolicy>::ResultSet IResultSet;
typedef FirebirdApi<FirebirdPolicy>::Statement IStatement;
typedef FirebirdApi<FirebirdPolicy>::Request IRequest;
typedef FirebirdApi<FirebirdPolicy>::Events IEvents;
typedef FirebirdApi<FirebirdPolicy>::Attachment IAttachment;
typedef FirebirdApi<FirebirdPolicy>::Service IService;
typedef FirebirdApi<FirebirdPolicy>::Provider IProvider;
typedef FirebirdApi<FirebirdPolicy>::Dtc IDtc;
typedef FirebirdApi<FirebirdPolicy>::Auth IAuth;
typedef FirebirdApi<FirebirdPolicy>::Writer IWriter;
typedef FirebirdApi<FirebirdPolicy>::ServerBlock IServerBlock;
typedef FirebirdApi<FirebirdPolicy>::ClientBlock IClientBlock;
typedef FirebirdApi<FirebirdPolicy>::Server IServer;
typedef FirebirdApi<FirebirdPolicy>::Client IClient;
typedef FirebirdApi<FirebirdPolicy>::UserField IUserField;
typedef FirebirdApi<FirebirdPolicy>::CharUserField ICharUserField;
typedef FirebirdApi<FirebirdPolicy>::IntUserField IIntUserField;
typedef FirebirdApi<FirebirdPolicy>::User IUser;
typedef FirebirdApi<FirebirdPolicy>::ListUsers IListUsers;
typedef FirebirdApi<FirebirdPolicy>::LogonInfo ILogonInfo;
typedef FirebirdApi<FirebirdPolicy>::Management IManagement;
typedef FirebirdApi<FirebirdPolicy>::WireCryptPlugin IWireCryptPlugin;
typedef FirebirdApi<FirebirdPolicy>::CryptKeyCallback ICryptKeyCallback;
typedef FirebirdApi<FirebirdPolicy>::KeyHolderPlugin IKeyHolderPlugin;
typedef FirebirdApi<FirebirdPolicy>::DbCryptPlugin IDbCryptPlugin;
typedef FirebirdApi<FirebirdPolicy>::ExternalContext IExternalContext;
typedef FirebirdApi<FirebirdPolicy>::ExternalResultSet IExternalResultSet;
typedef FirebirdApi<FirebirdPolicy>::ExternalFunction IExternalFunction;
typedef FirebirdApi<FirebirdPolicy>::ExternalProcedure IExternalProcedure;
typedef FirebirdApi<FirebirdPolicy>::ExternalTrigger IExternalTrigger;
typedef FirebirdApi<FirebirdPolicy>::RoutineMetadata IRoutineMetadata;
typedef FirebirdApi<FirebirdPolicy>::ExternalEngine IExternalEngine;
typedef FirebirdApi<FirebirdPolicy>::Timer ITimer;
typedef FirebirdApi<FirebirdPolicy>::TimerControl ITimerControl;
typedef FirebirdApi<FirebirdPolicy>::VersionCallback IVersionCallback;
typedef FirebirdApi<FirebirdPolicy>::Utl IUtl;
typedef FirebirdApi<FirebirdPolicy>::TraceConnection ITraceConnection;
typedef FirebirdApi<FirebirdPolicy>::TraceDatabaseConnection ITraceDatabaseConnection;
typedef FirebirdApi<FirebirdPolicy>::TraceTransaction ITraceTransaction;
typedef FirebirdApi<FirebirdPolicy>::TraceParams ITraceParams;
typedef FirebirdApi<FirebirdPolicy>::TraceStatement ITraceStatement;
typedef FirebirdApi<FirebirdPolicy>::TraceSQLStatement ITraceSQLStatement;
typedef FirebirdApi<FirebirdPolicy>::TraceBLRStatement ITraceBLRStatement;
typedef FirebirdApi<FirebirdPolicy>::TraceDYNRequest ITraceDYNRequest;
typedef FirebirdApi<FirebirdPolicy>::TraceContextVariable ITraceContextVariable;
typedef FirebirdApi<FirebirdPolicy>::TraceProcedure ITraceProcedure;
typedef FirebirdApi<FirebirdPolicy>::TraceFunction ITraceFunction;
typedef FirebirdApi<FirebirdPolicy>::TraceTrigger ITraceTrigger;
typedef FirebirdApi<FirebirdPolicy>::TraceServiceConnection ITraceServiceConnection;
typedef FirebirdApi<FirebirdPolicy>::TraceStatusVector ITraceStatusVector;
typedef FirebirdApi<FirebirdPolicy>::TraceSweepInfo ITraceSweepInfo;
typedef FirebirdApi<FirebirdPolicy>::TraceLogWriter ITraceLogWriter;
typedef FirebirdApi<FirebirdPolicy>::TraceInitInfo ITraceInitInfo;
typedef FirebirdApi<FirebirdPolicy>::TracePlugin ITracePlugin;
typedef FirebirdApi<FirebirdPolicy>::TraceFactory ITraceFactory;
typedef FirebirdApi<FirebirdPolicy> Api;
struct FbCryptKey
{
public:
virtual void FB_CARG dispose() = 0;
const char* type; // If NULL type is auth plugin name
const void* encryptKey;
const void* decryptKey; // May be NULL for symmetric keys
unsigned encryptLength;
unsigned decryptLength; // Ignored when decryptKey is NULL
};
// If this is changed, types of disposable interfaces must be changed
#define FB_DISPOSABLE_VERSION (FB_VERSIONED_VERSION + 1)
// Interface to work with status vector
class IStatus : public IDisposable
struct DtcStart
{
public:
static const unsigned FB_HAS_WARNINGS = 0x01;
static const unsigned FB_HAS_ERRORS = 0x02;
static const int FB_ERROR = -1;
static const int FB_OK = 0;
static const int FB_EOF = 1;
static const int FB_SEGMENT = 2;
virtual void FB_CARG init() = 0;
virtual unsigned FB_CARG getStatus() const = 0;
virtual void FB_CARG setErrors(unsigned int length, const ISC_STATUS* value) = 0;
virtual void FB_CARG setWarnings(unsigned int length, const ISC_STATUS* value) = 0;
virtual void FB_CARG setErrors(const ISC_STATUS* value) = 0;
virtual void FB_CARG setWarnings(const ISC_STATUS* value) = 0;
virtual const ISC_STATUS* FB_CARG getErrors() const = 0;
virtual const ISC_STATUS* FB_CARG getWarnings() const = 0;
IAttachment* attachment;
const unsigned char* tpb;
unsigned tpbLength;
};
#define FB_STATUS_VERSION (FB_DISPOSABLE_VERSION + 8)
class IProvider;
class IUtl;
class IPluginManager;
class ITimerControl;
class IAttachment;
class ITransaction;
class IDtc;
class IMetadataBuilder;
class IDebug;
class IConfigManager;
typedef void PluginEntrypoint(IMaster* masterInterface);
typedef char Utf8; // Utf8* used as nul-terminated string
struct UpgradeInfo
#ifdef INCLUDE_Firebird_H // Building internal module
// This item is for ISC API emulation only
// It may be gone in future versions
// Please do not use it!
static IMessageMetadata* const DELAYED_OUT_FORMAT = (IMessageMetadata*)(1);
namespace
{
void* missingFunctionClass;
IPluginModule* clientModule;
};
template <>
void upgradeVersionedInterface<IMessageMetadata>(IMessageMetadata* versioned)
{
if (versioned && versioned != DELAYED_OUT_FORMAT &&
versioned->cloopVTable->version < FirebirdApi<FirebirdPolicy>::TracePlugin::VERSION)
{
upgradeInterface(versioned, FirebirdApi<FirebirdPolicy>::TracePlugin::VERSION, (void*)ignoreMissing);
}
}
}
// Master interface is used to access almost all other interfaces.
class IMaster : public IVersioned
{
public:
virtual IStatus* FB_CARG getStatus() = 0;
virtual IProvider* FB_CARG getDispatcher() = 0;
virtual IPluginManager* FB_CARG getPluginManager() = 0;
virtual int FB_CARG upgradeInterface(IVersioned* toUpgrade, int desiredVersion,
struct UpgradeInfo* upgradeInfo) = 0;
virtual const char* FB_CARG circularAlloc(const char* s, size_t len, intptr_t thr) = 0;
virtual ITimerControl* FB_CARG getTimerControl() = 0;
virtual IDtc* FB_CARG getDtc() = 0;
virtual IAttachment* FB_CARG registerAttachment(IProvider* provider, IAttachment* attachment) = 0;
virtual ITransaction* FB_CARG registerTransaction(IAttachment* attachment, ITransaction* transaction) = 0;
// This function is required to compare interfaces based on vtables of them
virtual int FB_CARG same(IVersioned* first, IVersioned* second) = 0;
virtual IMetadataBuilder* FB_CARG getMetadataBuilder(IStatus* status, unsigned fieldCount) = 0;
virtual Firebird::IDebug* FB_CARG getDebug() = 0;
virtual int FB_CARG serverMode(int mode) = 0;
virtual IUtl* FB_CARG getUtlInterface() = 0;
virtual IConfigManager* FB_CARG getConfigManager() = 0;
};
#define FB_MASTER_VERSION (FB_VERSIONED_VERSION + 15)
#endif //INCLUDE_Firebird_H
} // namespace Firebird
#define FB_PLUGIN_ENTRY_POINT firebird_plugin
extern "C"
{
// Additional API function.

View File

@ -24,7 +24,7 @@
#define FIREBIRD_MESSAGE_H
#include "ibase.h"
#include "./Provider.h"
#include "./Interface.h"
#include "./impl/boost/preprocessor/seq/for_each_i.hpp"
#include <assert.h>
#include <time.h>

View File

@ -1,271 +0,0 @@
/*
* The contents of this file are subject to the Initial
* Developer's Public License Version 1.0 (the "License");
* you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
* http://www.ibphoenix.com/main.nfs?a=ibphoenix&page=ibp_idpl.
*
* Software distributed under the License is distributed AS IS,
* WITHOUT WARRANTY OF ANY KIND, either express or implied.
* See the License for the specific language governing rights
* and limitations under the License.
*
* The Original Code was created by Adriano dos Santos Fernandes
* for the Firebird Open Source RDBMS project.
*
* Copyright (c) 2008 Adriano dos Santos Fernandes <adrianosf@uol.com.br>
* and all contributors signed below.
*
* All Rights Reserved.
* Contributor(s): ______________________________________.
*/
/*
* Firebird plugins are accessed using methods of PluginLoader interface.
* For each plugin_module tag found, it constructs a Plugin object, reads the corresponding
* plugin_config tag and inserts all config information in the object.
*
* When requested, the engine gets the attribute value of plugin_module/filename, load it as a
* dynamic (shared) library and calls the exported function firebirdPlugin (FB_PLUGIN_ENTRY_POINT
* definition, PluginEntrypoint prototype) passing the Plugin object as parameter.
*
* The plugin library may save the plugin object and call they methods later. The object and all
* pointers returned by it are valid until the plugin is unloaded (done through OS unload of the
* dynamic library) when Firebird is shutting down.
*
* Inside the plugin entry point (firebirdPlugin), the plugin may register extra functionality that
* may be obtained by Firebird when required. Currently only External Engines may be registered
* through Plugin::setExternalEngineFactory.
*
* Example plugin configuration file:
*
* <external_engine UDR>
* plugin_module UDR_engine
* </external_engine>
*
* <plugin_module UDR_engine>
* filename $(this)/udr_engine
* plugin_config UDR_config
* </plugin_module>
*
* <plugin_config UDR_config>
* path $(this)/udr
* </plugin_config>
*
* Note that the external_engine tag is ignored at this stage. Only plugin_module and plugin_config
* are read. The dynamic library extension may be ommitted, and $(this) expands to the directory of
* the .conf file.
*
* Plugins may access Firebird API through the fbclient library.
*/
#ifndef FIREBIRD_PLUGIN_API_H
#define FIREBIRD_PLUGIN_API_H
#include "./Interface.h"
#define FB_PLUGIN_ENTRY_POINT firebird_plugin
namespace Firebird {
// IPluginBase interface - base for master plugin interfaces (factories are registered for them)
class IPluginBase : public IRefCounted
{
public:
// Additional (compared with Interface) functions getOwner() and setOwner()
// are needed to release() owner of the plugin. This is done in releasePlugin()
// function in IPluginManager. Such method is needed to make sure that owner is released
// after plugin itself, and therefore module is unloaded after release of last plugin from it.
// Releasing owner from release() of plugin will unload module and after returning control
// to missing code segfault is unavoidable.
virtual void FB_CARG setOwner(IRefCounted*) = 0;
virtual IRefCounted* FB_CARG getOwner() = 0;
};
#define FB_PLUGIN_VERSION (FB_REFCOUNTED_VERSION + 2)
// IPluginSet - low level tool to access plugins according to parameter from firebird.conf
class IPluginSet : public IRefCounted
{
public:
virtual const char* FB_CARG getName() const = 0;
virtual const char* FB_CARG getModuleName() const = 0;
virtual IPluginBase* FB_CARG getPlugin(IStatus* status) = 0;
virtual void FB_CARG next(IStatus* status) = 0;
virtual void FB_CARG set(IStatus* status, const char*) = 0;
};
#define FB_PLUGIN_SET_VERSION (FB_REFCOUNTED_VERSION + 5)
// Interfaces to work with configuration data
class IConfig;
// Entry in configuration file
class IConfigEntry : public IRefCounted
{
public:
virtual const char* FB_CARG getName() = 0;
virtual const char* FB_CARG getValue() = 0;
virtual ISC_INT64 FB_CARG getIntValue() = 0;
virtual FB_BOOLEAN FB_CARG getBoolValue() = 0;
virtual IConfig* FB_CARG getSubConfig(IStatus* status) = 0;
};
#define FB_CONFIG_PARAMETER_VERSION (FB_REFCOUNTED_VERSION + 5)
// Generic form of access to configuration file - find specific entry in it
class IConfig : public IRefCounted
{
public:
virtual IConfigEntry* FB_CARG find(IStatus* status, const char* name) = 0;
virtual IConfigEntry* FB_CARG findValue(IStatus* status, const char* name, const char* value) = 0;
virtual IConfigEntry* FB_CARG findPos(IStatus* status, const char* name, unsigned int pos) = 0;
};
#define FB_CONFIG_VERSION (FB_REFCOUNTED_VERSION + 3)
// Used to access config values from firebird.conf (may be DB specific)
class IFirebirdConf : public IRefCounted
{
public:
// Get integer key by it's name
// Value ~0 means name is invalid
// Keys are stable: one can use once obtained key in other instances of this interface
virtual unsigned int FB_CARG getKey(const char* name) = 0;
// Use to access integer values
virtual ISC_INT64 FB_CARG asInteger(unsigned int key) = 0;
// Use to access string values
virtual const char* FB_CARG asString(unsigned int key) = 0;
// Use to access boolean values
virtual FB_BOOLEAN FB_CARG asBoolean(unsigned int key) = 0;
};
#define FB_FIREBIRD_CONF_VERSION (FB_REFCOUNTED_VERSION + 4)
// This interface is passed to plugin's factory as it's single parameter
// and contains methods to access specific plugin's configuration data
class IPluginConfig : public IRefCounted
{
public:
virtual const char* FB_CARG getConfigFileName() = 0;
virtual IConfig* FB_CARG getDefaultConfig(IStatus* status) = 0;
virtual IFirebirdConf* FB_CARG getFirebirdConf(IStatus* status) = 0;
virtual void FB_CARG setReleaseDelay(IStatus* status, ISC_UINT64 microSeconds) = 0;
};
#define FB_PLUGIN_CONFIG_VERSION (FB_REFCOUNTED_VERSION + 4)
// Required to creat instances of given plugin
class IPluginFactory : public IVersioned
{
public:
virtual IPluginBase* FB_CARG createPlugin(IStatus* status, IPluginConfig* factoryParameter) = 0;
};
#define FB_PLUGIN_FACTORY_VERSION (FB_VERSIONED_VERSION + 1)
// Required to let plugins manager invoke module's cleanup routine before unloading it.
// For some OS/compiler this may be done in dtor of global variable in module itself.
// Others (Windows/VC) fail to create some very useful resources (threads) when module is unloading.
class IPluginModule : public IVersioned
{
public:
virtual void FB_CARG doClean() = 0;
};
#define FB_PLUGIN_MODULE_VERSION (FB_VERSIONED_VERSION + 1)
// Interface to deal with plugins here and there, returned by master interface
class IPluginManager : public IVersioned
{
public:
// Main function called by plugin modules in firebird_plugin()
virtual void FB_CARG registerPluginFactory(unsigned int interfaceType, const char* defaultName,
IPluginFactory* factory) = 0;
// Sets cleanup for plugin module
// Pay attention - this should be called at plugin-register time!
// Only at this moment manager knows, which module sets his cleanup
virtual void FB_CARG registerModule(IPluginModule* cleanup) = 0;
// Remove registered module before cleanup routine.
// This method must be called by module which detects that it's unloaded,
// but not notified prior to it by PluginManager via IPluginModule.
virtual void FB_CARG unregisterModule(IPluginModule* cleanup) = 0;
// Main function called to access plugins registered in plugins manager
// Has front-end in GetPlugins.h - template GetPlugins
// In namesList parameter comma or space separated list of names of configured plugins is passed
// UpgradeInfo is used to add functions "notImplemented" to the end of vtable
// in case when plugin's version is less than desired
// If caller already has an interface for firebird.conf, it may be passed here
// If parameter is missing, plugins will get access to default (non database specific) config
virtual IPluginSet* FB_CARG getPlugins(IStatus* status, unsigned int interfaceType,
const char* namesList, int desiredVersion,
UpgradeInfo* ui, IFirebirdConf* firebirdConf) = 0;
// Get generic config interface for given file
virtual IConfig* FB_CARG getConfig(IStatus* status, const char* filename) = 0;
// Plugins must be released using this function - use of plugin's release()
// will cause resources leak
virtual void FB_CARG releasePlugin(IPluginBase* plugin) = 0;
};
#define FB_PLUGIN_MANAGER_VERSION (FB_VERSIONED_VERSION + 6)
struct FbCryptKey
{
const char* type; // If NULL type is auth plugin name
const void* encryptKey;
const void* decryptKey; // May be NULL for symmetric keys
unsigned int encryptLength;
unsigned int decryptLength; // Ignored when decryptKey is NULL
};
typedef void PluginEntrypoint(IMaster* masterInterface);
namespace PluginType {
static const unsigned int Provider = 1;
static const unsigned int FirstNonLibPlugin = 2;
static const unsigned int AuthServer = 3;
static const unsigned int AuthClient = 4;
static const unsigned int AuthUserManagement = 5;
static const unsigned int ExternalEngine = 6;
static const unsigned int Trace = 7;
static const unsigned int WireCrypt = 8;
static const unsigned int DbCrypt = 9;
static const unsigned int KeyHolder = 10;
static const unsigned int MaxType = 11; // keep in sync please
}
// Generic access to all config interfaces
class IConfigManager : public IVersioned
{
public:
virtual const char* FB_CARG getDirectory(unsigned code) = 0;
virtual IFirebirdConf* FB_CARG getFirebirdConf() = 0;
virtual IFirebirdConf* FB_CARG getDatabaseConf(const char* dbName) = 0;
virtual IConfig* FB_CARG getPluginConfig(const char* configuredPlugin) = 0;
};
#define FB_CONFIG_MANAGER_VERSION (FB_VERSIONED_VERSION + 4)
namespace DirType {
// Codes for IConfigManager::getDirectory()
static const unsigned int FB_DIR_BIN = 0;
static const unsigned int FB_DIR_SBIN = 1;
static const unsigned int FB_DIR_CONF = 2;
static const unsigned int FB_DIR_LIB = 3;
static const unsigned int FB_DIR_INC = 4;
static const unsigned int FB_DIR_DOC = 5;
static const unsigned int FB_DIR_UDF = 6;
static const unsigned int FB_DIR_SAMPLE = 7;
static const unsigned int FB_DIR_SAMPLEDB = 8;
static const unsigned int FB_DIR_HELP = 9;
static const unsigned int FB_DIR_INTL = 10;
static const unsigned int FB_DIR_MISC = 11;
static const unsigned int FB_DIR_SECDB = 12;
static const unsigned int FB_DIR_MSG = 13;
static const unsigned int FB_DIR_LOG = 14;
static const unsigned int FB_DIR_GUARD = 15;
static const unsigned int FB_DIR_PLUGINS = 16;
static const unsigned int FB_DIRCOUNT = 17;
}
} // namespace Firebird
#endif // FIREBIRD_PLUGIN_API_H

View File

@ -1,314 +0,0 @@
/*
* PROGRAM: Firebird basic API
* MODULE: firebird/Provider.h
* DESCRIPTION: Interfaces, used by yValve
*
* The contents of this file are subject to the Initial
* Developer's Public License Version 1.0 (the "License");
* you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
* http://www.ibphoenix.com/main.nfs?a=ibphoenix&page=ibp_idpl.
*
* Software distributed under the License is distributed AS IS,
* WITHOUT WARRANTY OF ANY KIND, either express or implied.
* See the License for the specific language governing rights
* and limitations under the License.
*
* The Original Code was created by Alex Peshkov
* for the Firebird Open Source RDBMS project.
*
* Copyright (c) 2010 Alex Peshkov <peshkoff at mail.ru>
* and all contributors signed below.
*
* All Rights Reserved.
* Contributor(s): ______________________________________.
*
*
*/
#ifndef FB_PROVIDER_INTERFACE
#define FB_PROVIDER_INTERFACE
#include "./Plugin.h"
namespace Firebird {
// This interfaces are implemented by yvalve code and by each of providers.
class IAttachment; // Forward
class ICryptKeyCallback; // From Crypt.h
class IEventCallback : public IRefCounted
{
public:
// eventCallbackFunction is missing error status cause it's always called from places
// where an ability to report an error to the user is missing
virtual void FB_CARG eventCallbackFunction(unsigned int length, const unsigned char* events) = 0;
};
#define FB_EVENT_CALLBACK_VERSION (FB_REFCOUNTED_VERSION + 1)
class IBlob : public IRefCounted
{
public:
virtual void FB_CARG getInfo(IStatus* status,
unsigned int itemsLength, const unsigned char* items,
unsigned int bufferLength, unsigned char* buffer) = 0;
virtual int FB_CARG getSegment(IStatus* status, unsigned int bufferLength,
void* buffer, unsigned int* segmentLength) = 0;
virtual void FB_CARG putSegment(IStatus* status, unsigned int length,
const void* buffer) = 0;
virtual void FB_CARG cancel(IStatus* status) = 0;
virtual void FB_CARG close(IStatus* status) = 0;
virtual int FB_CARG seek(IStatus* status, int mode, int offset) = 0; // returns position
};
#define FB_BLOB_VERSION (FB_REFCOUNTED_VERSION + 6)
class ITransaction : public IRefCounted
{
public:
virtual void FB_CARG getInfo(IStatus* status,
unsigned int itemsLength, const unsigned char* items,
unsigned int bufferLength, unsigned char* buffer) = 0;
virtual void FB_CARG prepare(IStatus* status,
unsigned int msgLength = 0, const unsigned char* message = 0) = 0;
virtual void FB_CARG commit(IStatus* status) = 0;
virtual void FB_CARG commitRetaining(IStatus* status) = 0;
virtual void FB_CARG rollback(IStatus* status) = 0;
virtual void FB_CARG rollbackRetaining(IStatus* status) = 0;
virtual void FB_CARG disconnect(IStatus* status) = 0;
virtual ITransaction* FB_CARG join(IStatus* status, ITransaction* transaction) = 0;
virtual ITransaction* FB_CARG validate(IStatus* status, IAttachment* attachment) = 0;
virtual ITransaction* FB_CARG enterDtc(IStatus* status) = 0;
};
#define FB_TRANSACTION_VERSION (FB_REFCOUNTED_VERSION + 10)
class IMetadataBuilder; // Forward
class IMessageMetadata : public IRefCounted
{
public:
virtual unsigned FB_CARG getCount(IStatus* status) = 0;
virtual const char* FB_CARG getField(IStatus* status, unsigned index) = 0;
virtual const char* FB_CARG getRelation(IStatus* status, unsigned index) = 0;
virtual const char* FB_CARG getOwner(IStatus* status, unsigned index) = 0;
virtual const char* FB_CARG getAlias(IStatus* status, unsigned index) = 0;
virtual unsigned FB_CARG getType(IStatus* status, unsigned index) = 0;
virtual FB_BOOLEAN FB_CARG isNullable(IStatus* status, unsigned index) = 0;
virtual int FB_CARG getSubType(IStatus* status, unsigned index) = 0;
virtual unsigned FB_CARG getLength(IStatus* status, unsigned index) = 0;
virtual int FB_CARG getScale(IStatus* status, unsigned index) = 0;
virtual unsigned FB_CARG getCharSet(IStatus* status, unsigned index) = 0;
virtual unsigned FB_CARG getOffset(IStatus* status, unsigned index) = 0;
virtual unsigned FB_CARG getNullOffset(IStatus* status, unsigned index) = 0;
virtual IMetadataBuilder* FB_CARG getBuilder(IStatus* status) = 0;
virtual unsigned FB_CARG getMessageLength(IStatus* status) = 0;
};
#define FB_MESSAGE_METADATA_VERSION (FB_REFCOUNTED_VERSION + 15)
class IMetadataBuilder : public IRefCounted
{
public:
virtual void FB_CARG setType(IStatus* status, unsigned index, unsigned type) = 0;
virtual void FB_CARG setSubType(IStatus* status, unsigned index, int subType) = 0;
virtual void FB_CARG setLength(IStatus* status, unsigned index, unsigned length) = 0;
virtual void FB_CARG setCharSet(IStatus* status, unsigned index, unsigned charSet) = 0;
virtual void FB_CARG setScale(IStatus* status, unsigned index, unsigned scale) = 0;
virtual void FB_CARG truncate(IStatus* status, unsigned count) = 0;
virtual void FB_CARG moveNameToIndex(IStatus* status, const char* name, unsigned index) = 0;
virtual void FB_CARG remove(IStatus* status, unsigned index) = 0;
virtual unsigned FB_CARG addField(IStatus* status) = 0;
virtual IMessageMetadata* FB_CARG getMetadata(IStatus* status) = 0;
};
#define FB_METADATA_BUILDER_VERSION (FB_REFCOUNTED_VERSION + 10)
// This item is for ISC API emulation only
// It may be gone in future versions
// Please do not use it!
static IMessageMetadata* const DELAYED_OUT_FORMAT = (IMessageMetadata*)(1);
class IResultSet : public IRefCounted
{
public:
virtual int FB_CARG fetchNext(IStatus* status, void* message) = 0;
virtual int FB_CARG fetchPrior(IStatus* status, void* message) = 0;
virtual int FB_CARG fetchFirst(IStatus* status, void* message) = 0;
virtual int FB_CARG fetchLast(IStatus* status, void* message) = 0;
virtual int FB_CARG fetchAbsolute(IStatus* status, unsigned int position, void* message) = 0;
virtual int FB_CARG fetchRelative(IStatus* status, int offset, void* message) = 0;
virtual FB_BOOLEAN FB_CARG isEof(IStatus* status) = 0;
virtual FB_BOOLEAN FB_CARG isBof(IStatus* status) = 0;
virtual IMessageMetadata* FB_CARG getMetadata(IStatus* status) = 0;
virtual void FB_CARG close(IStatus* status) = 0;
// This item is for ISC API emulation only
// It may be gone in future versions
// Please do not use it!
virtual void FB_CARG setDelayedOutputFormat(IStatus* status, IMessageMetadata* format) = 0;
};
#define FB_RESULTSET_VERSION (FB_REFCOUNTED_VERSION + 11)
class IStatement : public IRefCounted
{
public:
// Prepare flags.
static const unsigned PREPARE_PREFETCH_NONE = 0x00;
static const unsigned PREPARE_PREFETCH_TYPE = 0x01;
static const unsigned PREPARE_PREFETCH_INPUT_PARAMETERS = 0x02;
static const unsigned PREPARE_PREFETCH_OUTPUT_PARAMETERS = 0x04;
static const unsigned PREPARE_PREFETCH_LEGACY_PLAN = 0x08;
static const unsigned PREPARE_PREFETCH_DETAILED_PLAN = 0x10;
static const unsigned PREPARE_PREFETCH_AFFECTED_RECORDS = 0x20; // not used yet
static const unsigned PREPARE_PREFETCH_FLAGS = 0x40;
static const unsigned PREPARE_PREFETCH_METADATA =
PREPARE_PREFETCH_TYPE | PREPARE_PREFETCH_FLAGS |
PREPARE_PREFETCH_INPUT_PARAMETERS | PREPARE_PREFETCH_OUTPUT_PARAMETERS;
static const unsigned PREPARE_PREFETCH_ALL =
PREPARE_PREFETCH_METADATA | PREPARE_PREFETCH_LEGACY_PLAN | PREPARE_PREFETCH_DETAILED_PLAN |
PREPARE_PREFETCH_AFFECTED_RECORDS;
// Statement flags.
static const unsigned FLAG_HAS_CURSOR = 0x01;
static const unsigned FLAG_REPEAT_EXECUTE = 0x02;
virtual void FB_CARG getInfo(IStatus* status,
unsigned int itemsLength, const unsigned char* items,
unsigned int bufferLength, unsigned char* buffer) = 0;
virtual unsigned FB_CARG getType(IStatus* status) = 0;
virtual const char* FB_CARG getPlan(IStatus* status, FB_BOOLEAN detailed) = 0;
virtual ISC_UINT64 FB_CARG getAffectedRecords(IStatus* status) = 0;
virtual IMessageMetadata* FB_CARG getInputMetadata(IStatus* status) = 0;
virtual IMessageMetadata* FB_CARG getOutputMetadata(IStatus* status) = 0;
virtual ITransaction* FB_CARG execute(IStatus* status, ITransaction* transaction,
IMessageMetadata* inMetadata, void* inBuffer, IMessageMetadata* outMetadata, void* outBuffer) = 0;
virtual IResultSet* FB_CARG openCursor(IStatus* status, ITransaction* transaction,
IMessageMetadata* inMetadata, void* inBuffer, IMessageMetadata* outMetadata) = 0;
virtual void FB_CARG setCursorName(IStatus* status, const char* name) = 0;
virtual void FB_CARG free(IStatus* status) = 0;
virtual unsigned FB_CARG getFlags(IStatus* status) = 0;
};
#define FB_STATEMENT_VERSION (FB_REFCOUNTED_VERSION + 11)
class IRequest : public IRefCounted
{
public:
virtual void FB_CARG receive(IStatus* status, int level, unsigned int msgType,
unsigned int length, unsigned char* message) = 0;
virtual void FB_CARG send(IStatus* status, int level, unsigned int msgType,
unsigned int length, const unsigned char* message) = 0;
virtual void FB_CARG getInfo(IStatus* status, int level,
unsigned int itemsLength, const unsigned char* items,
unsigned int bufferLength, unsigned char* buffer) = 0;
virtual void FB_CARG start(IStatus* status, ITransaction* tra, int level) = 0;
virtual void FB_CARG startAndSend(IStatus* status, ITransaction* tra, int level, unsigned int msgType,
unsigned int length, const unsigned char* message) = 0;
virtual void FB_CARG unwind(IStatus* status, int level) = 0;
virtual void FB_CARG free(IStatus* status) = 0;
};
#define FB_REQUEST_VERSION (FB_REFCOUNTED_VERSION + 7)
class IEvents : public IRefCounted
{
public:
virtual void FB_CARG cancel(IStatus* status) = 0;
};
#define FB_EVENTS_VERSION (FB_REFCOUNTED_VERSION + 1)
class IAttachment : public IRefCounted
{
public:
virtual void FB_CARG getInfo(IStatus* status,
unsigned int itemsLength, const unsigned char* items,
unsigned int bufferLength, unsigned char* buffer) = 0;
virtual ITransaction* FB_CARG startTransaction(IStatus* status,
unsigned int tpbLength, const unsigned char* tpb) = 0;
virtual ITransaction* FB_CARG reconnectTransaction(IStatus* status,
unsigned int length, const unsigned char* id) = 0;
virtual IRequest* FB_CARG compileRequest(IStatus* status,
unsigned int blrLength, const unsigned char* blr) = 0;
virtual void FB_CARG transactRequest(IStatus* status, ITransaction* transaction,
unsigned int blrLength, const unsigned char* blr,
unsigned int inMsgLength, const unsigned char* inMsg,
unsigned int outMsgLength, unsigned char* outMsg) = 0;
virtual IBlob* FB_CARG createBlob(IStatus* status, ITransaction* transaction, ISC_QUAD* id,
unsigned int bpbLength = 0, const unsigned char* bpb = 0) = 0;
virtual IBlob* FB_CARG openBlob(IStatus* status, ITransaction* transaction, ISC_QUAD* id,
unsigned int bpbLength = 0, const unsigned char* bpb = 0) = 0;
virtual int FB_CARG getSlice(IStatus* status, ITransaction* transaction, ISC_QUAD* id,
unsigned int sdlLength, const unsigned char* sdl,
unsigned int paramLength, const unsigned char* param,
int sliceLength, unsigned char* slice) = 0;
virtual void FB_CARG putSlice(IStatus* status, ITransaction* transaction, ISC_QUAD* id,
unsigned int sdlLength, const unsigned char* sdl,
unsigned int paramLength, const unsigned char* param,
int sliceLength, unsigned char* slice) = 0;
virtual void FB_CARG executeDyn(IStatus* status, ITransaction* transaction, unsigned int length,
const unsigned char* dyn) = 0;
virtual IStatement* FB_CARG prepare(IStatus* status, ITransaction* tra,
unsigned int stmtLength, const char* sqlStmt, unsigned dialect, unsigned int flags) = 0;
virtual ITransaction* FB_CARG execute(IStatus* status, ITransaction* transaction,
unsigned int stmtLength, const char* sqlStmt, unsigned dialect,
IMessageMetadata* inMetadata, void* inBuffer, IMessageMetadata* outMetadata, void* outBuffer) = 0;
virtual IResultSet* FB_CARG openCursor(IStatus* status, ITransaction* transaction,
unsigned int stmtLength, const char* sqlStmt, unsigned dialect,
IMessageMetadata* inMetadata, void* inBuffer, IMessageMetadata* outMetadata,
const char* cursorName) = 0;
virtual IEvents* FB_CARG queEvents(IStatus* status, IEventCallback* callback,
unsigned int length, const unsigned char* events) = 0;
virtual void FB_CARG cancelOperation(IStatus* status, int option) = 0;
virtual void FB_CARG ping(IStatus* status) = 0;
virtual void FB_CARG detach(IStatus* status) = 0;
virtual void FB_CARG dropDatabase(IStatus* status) = 0;
};
#define FB_ATTACHMENT_VERSION (FB_REFCOUNTED_VERSION + 18)
class IService : public IRefCounted
{
public:
virtual void FB_CARG detach(IStatus* status) = 0;
virtual void FB_CARG query(IStatus* status,
unsigned int sendLength, const unsigned char* sendItems,
unsigned int receiveLength, const unsigned char* receiveItems,
unsigned int bufferLength, unsigned char* buffer) = 0;
virtual void FB_CARG start(IStatus* status,
unsigned int spbLength, const unsigned char* spb) = 0;
};
#define FB_SERVICE_VERSION (FB_REFCOUNTED_VERSION + 3)
class IProvider : public IPluginBase
{
public:
virtual IAttachment* FB_CARG attachDatabase(IStatus* status, const char* fileName,
unsigned int dpbLength, const unsigned char* dpb) = 0;
virtual IAttachment* FB_CARG createDatabase(IStatus* status, const char* fileName,
unsigned int dpbLength, const unsigned char* dpb) = 0;
virtual IService* FB_CARG attachServiceManager(IStatus* status, const char* service,
unsigned int spbLength, const unsigned char* spb) = 0;
virtual void FB_CARG shutdown(IStatus* status, unsigned int timeout, const int reason) = 0;
virtual void FB_CARG setDbCryptCallback(IStatus* status, ICryptKeyCallback* cryptCallback) = 0;
};
#define FB_PROVIDER_VERSION (FB_PLUGIN_VERSION + 5)
// DtcStart - structure to start transaction over >1 attachments (former TEB)
struct DtcStart
{
IAttachment* attachment;
const unsigned char* tpb;
unsigned int tpbLength;
};
// Distributed transactions coordinator
class IDtc : public IVersioned
{
public:
virtual ITransaction* FB_CARG start(IStatus* status, unsigned int cnt, DtcStart* components) = 0;
virtual ITransaction* FB_CARG join(IStatus* status, ITransaction* one, ITransaction* two) = 0;
};
#define FB_DTC_VERSION (FB_VERSIONED_VERSION + 2)
} // namespace Firebird
#endif // FB_PROVIDER_INTERFACE

View File

@ -1,61 +0,0 @@
/*
* PROGRAM: Firebird interface.
* MODULE: firebird/Timer.h
* DESCRIPTION: Timer interface definition.
*
* The contents of this file are subject to the Initial
* Developer's Public License Version 1.0 (the "License");
* you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
* http://www.ibphoenix.com/main.nfs?a=ibphoenix&page=ibp_idpl.
*
* Software distributed under the License is distributed AS IS,
* WITHOUT WARRANTY OF ANY KIND, either express or implied.
* See the License for the specific language governing rights
* and limitations under the License.
*
* The Original Code was created by Alex Peshkov
* for the Firebird Open Source RDBMS project.
*
* Copyright (c) 2011 Alex Peshkov <peshkoff at mail.ru>
* and all contributors signed below.
*
* All Rights Reserved.
* Contributor(s): ______________________________________.
*
*
*/
#ifndef FIREBIRD_TIMER_H
#define FIREBIRD_TIMER_H
#include "./Interface.h"
namespace Firebird {
// Identifies particular timer.
// Callback function is invoked when timer fires.
class ITimer : public IRefCounted
{
public:
virtual void FB_CARG handler() = 0;
};
#define FB_TIMER_VERSION (FB_REFCOUNTED_VERSION + 1)
typedef ISC_INT64 TimerDelay;
// Interface to set timer for particular time
class ITimerControl : public IVersioned
{
public:
// Set timer
virtual void FB_CARG start(IStatus* status, ITimer* timer, TimerDelay microSeconds) = 0;
// Stop timer
virtual void FB_CARG stop(IStatus* status, ITimer* timer) = 0;
};
#define FB_TIMER_CONTROL_VERSION (FB_VERSIONED_VERSION + 2)
} // namespace Firebird
#endif // FIREBIRD_TIMER_H

View File

@ -23,7 +23,6 @@
#ifndef FIREBIRD_UDR_CPP_ENGINE
#define FIREBIRD_UDR_CPP_ENGINE
#include "./ExternalEngine.h"
#include "./UdrEngine.h"
#include "./Message.h"
#ifndef JRD_IBASE_H
@ -57,7 +56,7 @@ namespace Firebird
}
#define FB_UDR_EXECUTE_FUNCTION \
virtual void FB_CARG execute(::Firebird::IStatus* status, ::Firebird::ExternalContext* context, \
void execute(::Firebird::IStatus* status, ::Firebird::IExternalContext* context, \
void* in, void* out) \
{ \
try \
@ -67,7 +66,7 @@ namespace Firebird
FB__UDR_CATCH \
} \
\
void internalExecute(::Firebird::IStatus* status, ::Firebird::ExternalContext* context, \
void internalExecute(::Firebird::IStatus* status, ::Firebird::IExternalContext* context, \
InMessage::Type* in, OutMessage::Type* out)
@ -89,8 +88,8 @@ namespace Firebird
}
#define FB_UDR_EXECUTE_PROCEDURE \
virtual ::Firebird::ExternalResultSet* FB_CARG open(::Firebird::IStatus* status, \
::Firebird::ExternalContext* context, void* in, void* out) \
::Firebird::IExternalResultSet* open(::Firebird::IStatus* status, \
::Firebird::IExternalContext* context, void* in, void* out) \
{ \
try \
{ \
@ -104,13 +103,13 @@ namespace Firebird
class ResultSet : public ::Firebird::Udr::ResultSet<ResultSet, Impl, InMessage, OutMessage> \
{ \
public: \
ResultSet(::Firebird::IStatus* status, ::Firebird::ExternalContext* context, \
ResultSet(::Firebird::IStatus* status, ::Firebird::IExternalContext* context, \
Impl* const procedure, InMessage::Type* const in, OutMessage::Type* const out) \
: ::Firebird::Udr::ResultSet<ResultSet, Impl, InMessage, OutMessage>( \
context, procedure, in, out)
#define FB_UDR_FETCH_PROCEDURE \
virtual FB_BOOLEAN FB_CARG fetch(::Firebird::IStatus* status) \
FB_BOOLEAN fetch(::Firebird::IStatus* status) \
{ \
try \
{ \
@ -141,8 +140,8 @@ namespace Firebird
}
#define FB_UDR_EXECUTE_TRIGGER \
virtual void FB_CARG execute(::Firebird::IStatus* status, ::Firebird::ExternalContext* context, \
::Firebird::ExternalTrigger::Action action, void* oldFields, void* newFields) \
void execute(::Firebird::IStatus* status, ::Firebird::IExternalContext* context, \
unsigned int action, void* oldFields, void* newFields) \
{ \
try \
{ \
@ -152,14 +151,14 @@ namespace Firebird
FB__UDR_CATCH \
} \
\
void internalExecute(::Firebird::IStatus* status, ::Firebird::ExternalContext* context, \
::Firebird::ExternalTrigger::Action action, \
void internalExecute(::Firebird::IStatus* status, ::Firebird::IExternalContext* context, \
unsigned int action, \
FieldsMessage::Type* oldFields, FieldsMessage::Type* newFields)
#define FB_UDR_CONSTRUCTOR \
Impl(::Firebird::IStatus* const status, ::Firebird::ExternalContext* const context, \
const ::Firebird::IRoutineMetadata* const metadata__) \
Impl(::Firebird::IStatus* const status, ::Firebird::IExternalContext* const context, \
::Firebird::IRoutineMetadata* const metadata__) \
: master(context->getMaster()), \
metadata(metadata__)
@ -168,15 +167,15 @@ namespace Firebird
#define FB__UDR_COMMON_IMPL \
Impl(const void* const, ::Firebird::ExternalContext* const context, \
const ::Firebird::IRoutineMetadata* const aMetadata) \
Impl(const void* const, ::Firebird::IExternalContext* const context, \
::Firebird::IRoutineMetadata* const aMetadata) \
: master(context->getMaster()), \
metadata(aMetadata) \
{ \
} \
\
::Firebird::IMaster* master; \
const ::Firebird::IRoutineMetadata* metadata;
::Firebird::IRoutineMetadata* metadata;
#define FB__UDR_COMMON_TYPE(name) \
struct name \
@ -278,7 +277,7 @@ private:
ISC_STATUS_ARRAY statusVector;
};
class StatusImpl : public IStatus
class StatusImpl : public Api::StatusImpl<StatusImpl>
{
public:
StatusImpl(IMaster* master)
@ -287,63 +286,63 @@ public:
{
}
virtual int FB_CARG getVersion()
int getVersion()
{
return FB_STATUS_VERSION;
return IStatus::VERSION;
}
virtual IPluginModule* FB_CARG getModule()
IPluginModule* getModule()
{
return NULL;
}
virtual void FB_CARG dispose()
void dispose()
{
delegate->dispose();
delete this;
}
virtual void FB_CARG setErrors(const ISC_STATUS* value)
void setErrors(const ISC_STATUS* value)
{
delegate->setErrors(value);
state = delegate->getStatus();
}
virtual void FB_CARG setWarnings(const ISC_STATUS* value)
void setWarnings(const ISC_STATUS* value)
{
delegate->setWarnings(value);
state = delegate->getStatus();
}
virtual void FB_CARG setErrors(unsigned length, const ISC_STATUS* value)
void setErrors2(unsigned length, const ISC_STATUS* value)
{
delegate->setErrors(length, value);
delegate->setErrors2(length, value);
state = delegate->getStatus();
}
virtual void FB_CARG setWarnings(unsigned length, const ISC_STATUS* value)
void setWarnings2(unsigned length, const ISC_STATUS* value)
{
delegate->setWarnings(length, value);
delegate->setWarnings2(length, value);
state = delegate->getStatus();
}
virtual void FB_CARG init()
void init()
{
delegate->init();
state = 0;
}
virtual const ISC_STATUS* FB_CARG getErrors() const
const ISC_STATUS* getErrors() const
{
return delegate->getErrors();
}
virtual const ISC_STATUS* FB_CARG getWarnings() const
const ISC_STATUS* getWarnings() const
{
return delegate->getWarnings();
}
virtual unsigned FB_CARG getStatus() const
unsigned getStatus() const
{
return state;
}
@ -367,7 +366,7 @@ template <typename T> class Procedure;
class Helper
{
public:
static isc_db_handle getIscDbHandle(ExternalContext* context)
static isc_db_handle getIscDbHandle(IExternalContext* context)
{
StatusImpl status(context->getMaster());
@ -383,7 +382,7 @@ public:
return handle;
}
static isc_tr_handle getIscTrHandle(ExternalContext* context)
static isc_tr_handle getIscTrHandle(IExternalContext* context)
{
StatusImpl status(context->getMaster());
@ -402,10 +401,10 @@ public:
template <typename This, typename Procedure, typename InMessage, typename OutMessage>
class ResultSet : public ExternalResultSet, public Helper
class ResultSet : public Api::ExternalResultSetImpl<This>, public Helper
{
public:
ResultSet(ExternalContext* aContext, Procedure* aProcedure,
ResultSet(IExternalContext* aContext, Procedure* aProcedure,
typename InMessage::Type* aIn, typename OutMessage::Type* aOut)
: context(aContext),
procedure(aProcedure),
@ -415,23 +414,23 @@ public:
}
public:
virtual int FB_CARG getVersion()
int getVersion()
{
return FB_EXTERNAL_RESULT_SET_VERSION;
return IExternalResultSet::VERSION;
}
virtual IPluginModule* FB_CARG getModule()
IPluginModule* getModule()
{
return NULL;
}
virtual void FB_CARG dispose()
void dispose()
{
delete static_cast<This*>(this);
}
protected:
ExternalContext* const context;
IExternalContext* const context;
Procedure* const procedure;
typename InMessage::Type* const in;
typename OutMessage::Type* const out;
@ -439,86 +438,71 @@ protected:
template <typename This>
class Function : public ExternalFunction, public Helper
class Function : public Api::ExternalFunctionImpl<This>, public Helper
{
public:
FB__UDR_COMMON_TYPE(InMessage);
FB__UDR_COMMON_TYPE(OutMessage);
virtual int FB_CARG getVersion()
{
return FB_EXTERNAL_FUNCTION_VERSION;
}
virtual IPluginModule* FB_CARG getModule()
IPluginModule* getModule()
{
return NULL;
}
virtual void FB_CARG dispose()
void dispose()
{
delete static_cast<This*>(this);
}
virtual void FB_CARG getCharSet(IStatus* /*status*/, ExternalContext* /*context*/,
Utf8* /*name*/, uint /*nameSize*/)
void getCharSet(IStatus* /*status*/, IExternalContext* /*context*/,
Utf8* /*name*/, unsigned /*nameSize*/)
{
}
};
template <typename This>
class Procedure : public ExternalProcedure, public Helper
class Procedure : public Api::ExternalProcedureImpl<This>, public Helper
{
public:
FB__UDR_COMMON_TYPE(InMessage);
FB__UDR_COMMON_TYPE(OutMessage);
virtual int FB_CARG getVersion()
{
return FB_EXTERNAL_PROCEDURE_VERSION;
}
virtual IPluginModule* FB_CARG getModule()
IPluginModule* getModule()
{
return NULL;
}
virtual void FB_CARG dispose()
void dispose()
{
delete static_cast<This*>(this);
}
virtual void FB_CARG getCharSet(IStatus* /*status*/, ExternalContext* /*context*/,
Utf8* /*name*/, uint /*nameSize*/)
void getCharSet(IStatus* /*status*/, IExternalContext* /*context*/,
Utf8* /*name*/, unsigned /*nameSize*/)
{
}
};
template <typename This>
class Trigger : public ExternalTrigger, public Helper
class Trigger : public Api::ExternalTriggerImpl<This>, public Helper
{
public:
FB__UDR_COMMON_TYPE(FieldsMessage);
virtual int FB_CARG getVersion()
{
return FB_EXTERNAL_TRIGGER_VERSION;
}
virtual IPluginModule* FB_CARG getModule()
IPluginModule* getModule()
{
return NULL;
}
virtual void FB_CARG dispose()
void dispose()
{
delete static_cast<This*>(this);
}
virtual void FB_CARG getCharSet(IStatus* /*status*/, ExternalContext* /*context*/,
Utf8* /*name*/, uint /*nameSize*/)
void getCharSet(IStatus* /*status*/, IExternalContext* /*context*/,
Utf8* /*name*/, unsigned /*nameSize*/)
{
}
};
@ -532,15 +516,15 @@ public:
fbUdrRegFunction(name, this);
}
virtual void FB_CARG setup(IStatus* status, ExternalContext* /*context*/,
const IRoutineMetadata* /*metadata*/, IMetadataBuilder* in, IMetadataBuilder* out)
void setup(IStatus* status, IExternalContext* /*context*/,
IRoutineMetadata* /*metadata*/, IMetadataBuilder* in, IMetadataBuilder* out)
{
T::InMessage::setup(status, in);
T::OutMessage::setup(status, out);
}
virtual ExternalFunction* FB_CARG newItem(IStatus* status, ExternalContext* context,
const IRoutineMetadata* metadata)
IExternalFunction* newItem(IStatus* status, IExternalContext* context,
IRoutineMetadata* metadata)
{
try
{
@ -561,15 +545,15 @@ public:
fbUdrRegProcedure(name, this);
}
virtual void FB_CARG setup(IStatus* status, ExternalContext* /*context*/,
const IRoutineMetadata* /*metadata*/, IMetadataBuilder* in, IMetadataBuilder* out)
void setup(IStatus* status, IExternalContext* /*context*/,
IRoutineMetadata* /*metadata*/, IMetadataBuilder* in, IMetadataBuilder* out)
{
T::InMessage::setup(status, in);
T::OutMessage::setup(status, out);
}
virtual ExternalProcedure* FB_CARG newItem(IStatus* status, ExternalContext* context,
const IRoutineMetadata* metadata)
IExternalProcedure* newItem(IStatus* status, IExternalContext* context,
IRoutineMetadata* metadata)
{
try
{
@ -590,14 +574,14 @@ public:
fbUdrRegTrigger(name, this);
}
virtual void FB_CARG setup(IStatus* status, ExternalContext* /*context*/,
const IRoutineMetadata* /*metadata*/, IMetadataBuilder* fields)
void setup(IStatus* status, IExternalContext* /*context*/,
IRoutineMetadata* /*metadata*/, IMetadataBuilder* fields)
{
T::FieldsMessage::setup(status, fields);
}
virtual ExternalTrigger* FB_CARG newItem(IStatus* status, ExternalContext* context,
const IRoutineMetadata* metadata)
IExternalTrigger* newItem(IStatus* status, IExternalContext* context,
IRoutineMetadata* metadata)
{
try
{

View File

@ -23,7 +23,7 @@
#ifndef FIREBIRD_UDR_H
#define FIREBIRD_UDR_H
#include "./ExternalEngine.h"
#include "./Interface.h"
#ifndef FB_EXPORTED
#if defined(DARWIN)
@ -47,28 +47,28 @@ namespace Firebird
class FunctionFactory
{
public:
virtual void FB_CARG setup(IStatus* status, ExternalContext* context, const IRoutineMetadata* metadata,
virtual void setup(IStatus* status, IExternalContext* context, IRoutineMetadata* metadata,
IMetadataBuilder* inBuilder, IMetadataBuilder* outBuilder) = 0;
virtual ExternalFunction* FB_CARG newItem(IStatus* status, ExternalContext* context,
const IRoutineMetadata* metadata) = 0;
virtual IExternalFunction* newItem(IStatus* status, IExternalContext* context,
IRoutineMetadata* metadata) = 0;
};
class ProcedureFactory
{
public:
virtual void FB_CARG setup(IStatus* status, ExternalContext* context, const IRoutineMetadata* metadata,
virtual void setup(IStatus* status, IExternalContext* context, IRoutineMetadata* metadata,
IMetadataBuilder* inBuilder, IMetadataBuilder* outBuilder) = 0;
virtual ExternalProcedure* FB_CARG newItem(IStatus* status, ExternalContext* context,
const IRoutineMetadata* metadata) = 0;
virtual IExternalProcedure* newItem(IStatus* status, IExternalContext* context,
IRoutineMetadata* metadata) = 0;
};
class TriggerFactory
{
public:
virtual void FB_CARG setup(IStatus* status, ExternalContext* context, const IRoutineMetadata* metadata,
virtual void setup(IStatus* status, IExternalContext* context, IRoutineMetadata* metadata,
IMetadataBuilder* fieldsBuilder) = 0;
virtual ExternalTrigger* FB_CARG newItem(IStatus* status, ExternalContext* context,
const IRoutineMetadata* metadata) = 0;
virtual IExternalTrigger* newItem(IStatus* status, IExternalContext* context,
IRoutineMetadata* metadata) = 0;
};
// Routine registration functions.

View File

@ -1,65 +0,0 @@
/*
* PROGRAM: Firebird basic API
* MODULE: firebird/Utl.h
* DESCRIPTION: Misc calls
*
* The contents of this file are subject to the Initial
* Developer's Public License Version 1.0 (the "License");
* you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
* http://www.ibphoenix.com/main.nfs?a=ibphoenix&page=ibp_idpl.
*
* Software distributed under the License is distributed AS IS,
* WITHOUT WARRANTY OF ANY KIND, either express or implied.
* See the License for the specific language governing rights
* and limitations under the License.
*
* The Original Code was created by Alex Peshkov
* for the Firebird Open Source RDBMS project.
*
* Copyright (c) 2013 Alex Peshkov <peshkoff at mail.ru>
* and all contributors signed below.
*
* All Rights Reserved.
* Contributor(s): ______________________________________.
*
*
*/
#ifndef FB_UTL_INTERFACE
#define FB_UTL_INTERFACE
#include "./Interface.h"
namespace Firebird {
class IVersionCallback : public IVersioned
{
public:
virtual void FB_CARG callback(IStatus* status, const char* text) = 0;
};
#define FB_VERSION_CALLBACK_VERSION (FB_VERSIONED_VERSION + 1)
class IAttachment;
class ITransaction;
class IUtl : public IVersioned
{
public:
virtual void FB_CARG getFbVersion(IStatus* status, IAttachment* att,
IVersionCallback* callback) = 0;
virtual void FB_CARG loadBlob(IStatus* status, ISC_QUAD* blobId,
IAttachment* att, ITransaction* tra, const char* file, FB_BOOLEAN txt) = 0;
virtual void FB_CARG dumpBlob(IStatus* status, ISC_QUAD* blobId,
IAttachment* att, ITransaction* tra, const char* file, FB_BOOLEAN txt) = 0;
virtual void FB_CARG getPerfCounters(IStatus* status, IAttachment* att,
const char* countersSet, ISC_INT64* counters) = 0;
virtual IAttachment* FB_CARG executeCreateDatabase(Firebird::IStatus* status,
unsigned stmtLength, const char* creatDBstatement, unsigned dialect,
FB_BOOLEAN* stmtIsCreateDb = NULL) = 0;
};
#define FB_UTL_VERSION (FB_VERSIONED_VERSION + 5)
} // namespace Firebird
#endif // FB_UTL_INTERFACE

View File

@ -90,7 +90,7 @@ int main(int argc, char** argv)
char entry[200];
const int t_type = atoi(vector[i]);
sprintf(module, INTL_MODULE, t_type);
path = fb_utils::getPrefix(Firebird::DirType::FB_DIR_LIB, module);
path = fb_utils::getPrefix(Firebird::IConfigManager::FB_DIR_LIB, module);
sprintf(entry, INTL_INIT_ENTRY, t_type);
printf("path=%s entry=%s\n", path.c_str(), entry);
func = (FPTR_INT) ISC_lookup_entrypoint(path.c_str(), entry, NULL);

View File

@ -1866,7 +1866,7 @@ void ISQL_print_validation(FILE* fp,
if (blobid->gds_quad_high == 0 || !DB)
return;
Firebird::IBlob* blob = DB->openBlob(fbStatus, trans, blobid);
Firebird::IBlob* blob = DB->openBlob(fbStatus, trans, blobid, 0, NULL);
if (ISQL_errmsg(fbStatus))
return;
@ -2942,7 +2942,7 @@ static processing_state bulk_insert_hack(const char* command)
blobid = (ISC_QUAD*) datap;
{ // scope
Firebird::IBlob* bs = DB->createBlob(fbStatus, M__trans, blobid);
Firebird::IBlob* bs = DB->createBlob(fbStatus, M__trans, blobid, 0, NULL);
if (failed())
{
STDERROUT("Unable to create blob");
@ -3882,7 +3882,7 @@ static processing_state create_db(const TEXT* statement, TEXT* d_name)
unsigned dialect =
(isqlGlob.SQL_dialect == 0 || isqlGlob.SQL_dialect == SQL_DIALECT_V6_TRANSITION) ?
requested_SQL_dialect : isqlGlob.SQL_dialect;
DB = Firebird::UtlInterfacePtr()->executeCreateDatabase(fbStatus, 0, local_statement, dialect);
DB = Firebird::UtlInterfacePtr()->executeCreateDatabase(fbStatus, 0, local_statement, dialect, NULL);
if (ISQL_errmsg(fbStatus))
{
ret = FAIL;

View File

@ -24,7 +24,7 @@
#ifndef ISQL_ISQL_PROTO_H
#define ISQL_ISQL_PROTO_H
#include <firebird/Provider.h>
#include <firebird/Interface.h>
struct IsqlVar;

View File

@ -59,7 +59,7 @@
#include "../common/classes/ImplementHelper.h"
#include "../isql/OptionsBase.h"
#include <firebird/Utl.h>
#include <firebird/Interface.h>
#ifdef HAVE_CTYPE_H
#include <ctype.h>
@ -121,11 +121,11 @@ namespace {
// Used to make sure that local calls to print stuff go to isqlGlob.Out
// and not to stdout if IUtl::version gets called
class VersionCallback : public Firebird::AutoIface<Firebird::IVersionCallback, FB_VERSION_CALLBACK_VERSION>
class VersionCallback : public Firebird::AutoIface<Firebird::Api::VersionCallbackImpl<VersionCallback> >
{
public:
// IVersionCallback implementation
void FB_CARG callback(Firebird::IStatus*, const char* text)
void callback(Firebird::IStatus*, const char* text)
{
isqlGlob.printf("%s%s", text, NEWLINE);
}

View File

@ -25,7 +25,7 @@
#define ISQL_SHOW_PROTO_H
#include "../common/classes/fb_string.h"
#include <firebird/Provider.h>
#include <firebird/Interface.h>
void SHOW_comments(bool force);
bool SHOW_dbb_parameters (Firebird::IAttachment*, SCHAR*, const UCHAR*, unsigned, bool, const char*);

View File

@ -46,10 +46,6 @@ namespace EDS {
class Connection;
}
namespace Firebird {
class ICryptKeyCallback;
}
class CharSetContainer;
namespace Jrd

View File

@ -27,7 +27,7 @@
*/
#include "firebird.h"
#include "firebird/Crypt.h"
#include "firebird/Interface.h"
#include "gen/iberror.h"
#include "../jrd/CryptoManager.h"
@ -106,17 +106,6 @@ namespace {
Jrd::WIN window;
Ods::header_page* header;
};
class NoEntrypoint
{
public:
virtual void FB_CARG noEntrypoint(IStatus* s)
{
Arg::Gds(isc_wish_list).copyTo(s);
}
};
MakeUpgradeInfo<NoEntrypoint> upInfo;
}
namespace Jrd {
@ -196,8 +185,7 @@ namespace Jrd {
return;
}
GetPlugins<IDbCryptPlugin> cryptControl(PluginType::DbCrypt, FB_DBCRYPT_PLUGIN_VERSION,
upInfo, dbb.dbb_config, pluginName);
GetPlugins<IDbCryptPlugin> cryptControl(IPluginManager::DbCrypt, dbb.dbb_config, pluginName);
if (!cryptControl.hasData())
{
(Arg::Gds(isc_no_crypt_plugin) << pluginName).raise();
@ -679,8 +667,8 @@ namespace Jrd {
{
MutexLockGuard g(holdersMutex, FB_FUNCTION);
for (GetPlugins<IKeyHolderPlugin> keyControl(PluginType::KeyHolder,
FB_KEYHOLDER_PLUGIN_VERSION, upInfo, config); keyControl.hasData(); keyControl.next())
for (GetPlugins<IKeyHolderPlugin> keyControl(IPluginManager::KeyHolder, config);
keyControl.hasData(); keyControl.next())
{
IKeyHolderPlugin* keyPlugin = keyControl.plugin();
LocalStatus st;

View File

@ -37,16 +37,12 @@
#include "../common/classes/stack.h"
#include "../common/ThreadStart.h"
#include "../jrd/ods.h"
#include "firebird/Interface.h"
// forward
class Config;
namespace Firebird {
class IDbCryptPlugin;
class IKeyHolderPlugin;
}
namespace Ods {
struct pag;
}

View File

@ -308,7 +308,7 @@ public:
bool exist;
};
class Linger FB_FINAL : public Firebird::RefCntIface<Firebird::ITimer, FB_TIMER_VERSION>
class Linger FB_FINAL : public Firebird::RefCntIface<Firebird::Api::TimerImpl<Linger> >
{
public:
explicit Linger(Database* a_dbb)
@ -320,8 +320,8 @@ public:
void destroy();
// ITimer implementation
void FB_CARG handler();
int FB_CARG release();
void handler();
int release();
private:
Database* dbb;

View File

@ -27,7 +27,7 @@
*/
#include "firebird.h"
#include "firebird/Provider.h"
#include "firebird/Interface.h"
#include "../auth/SecureRemotePassword/Message.h"
#include "gen/iberror.h"

View File

@ -23,13 +23,11 @@
#ifndef JRD_ENGINE_INTERFACE_H
#define JRD_ENGINE_INTERFACE_H
#include "firebird/Provider.h"
#include "firebird/Interface.h"
#include "../common/classes/ImplementHelper.h"
#include "../common/StatementMetadata.h"
#include "../common/classes/RefCounted.h"
#define CURRENT_ENGINE "Engine12"
namespace Jrd {
// Engine objects used by interface objects
@ -46,20 +44,20 @@ class JStatement;
class JAttachment;
class JProvider;
class JBlob FB_FINAL : public Firebird::RefCntIface<Firebird::IBlob, FB_BLOB_VERSION>
class JBlob FB_FINAL : public Firebird::RefCntIface<Firebird::Api::BlobImpl<JBlob> >
{
public:
// IBlob implementation
virtual int FB_CARG release();
virtual void FB_CARG getInfo(Firebird::IStatus* status,
unsigned int itemsLength, const unsigned char* items,
unsigned int bufferLength, unsigned char* buffer);
virtual int FB_CARG getSegment(Firebird::IStatus* status, unsigned int length, void* buffer,
unsigned int* segmentLength);
virtual void FB_CARG putSegment(Firebird::IStatus* status, unsigned int length, const void* buffer);
virtual void FB_CARG cancel(Firebird::IStatus* status);
virtual void FB_CARG close(Firebird::IStatus* status);
virtual int FB_CARG seek(Firebird::IStatus* status, int mode, int offset); // returns position
int release();
void getInfo(Firebird::IStatus* status,
unsigned int itemsLength, const unsigned char* items,
unsigned int bufferLength, unsigned char* buffer);
int getSegment(Firebird::IStatus* status, unsigned int length, void* buffer,
unsigned int* segmentLength);
void putSegment(Firebird::IStatus* status, unsigned int length, const void* buffer);
void cancel(Firebird::IStatus* status);
void close(Firebird::IStatus* status);
int seek(Firebird::IStatus* status, int mode, int offset); // returns position
public:
JBlob(blb* handle, StableAttachmentPart* sa);
@ -86,24 +84,24 @@ private:
void freeEngineData(Firebird::IStatus* status);
};
class JTransaction FB_FINAL : public Firebird::RefCntIface<Firebird::ITransaction, FB_TRANSACTION_VERSION>
class JTransaction FB_FINAL : public Firebird::RefCntIface<Firebird::Api::TransactionImpl<JTransaction> >
{
public:
// ITransaction implementation
virtual int FB_CARG release();
virtual void FB_CARG getInfo(Firebird::IStatus* status,
unsigned int itemsLength, const unsigned char* items,
unsigned int bufferLength, unsigned char* buffer);
virtual void FB_CARG prepare(Firebird::IStatus* status,
unsigned int msg_length = 0, const unsigned char* message = 0);
virtual void FB_CARG commit(Firebird::IStatus* status);
virtual void FB_CARG commitRetaining(Firebird::IStatus* status);
virtual void FB_CARG rollback(Firebird::IStatus* status);
virtual void FB_CARG rollbackRetaining(Firebird::IStatus* status);
virtual void FB_CARG disconnect(Firebird::IStatus* status);
virtual Firebird::ITransaction* FB_CARG join(Firebird::IStatus* status, Firebird::ITransaction* transaction);
virtual JTransaction* FB_CARG validate(Firebird::IStatus* status, Firebird::IAttachment* testAtt);
virtual JTransaction* FB_CARG enterDtc(Firebird::IStatus* status);
int release();
void getInfo(Firebird::IStatus* status,
unsigned int itemsLength, const unsigned char* items,
unsigned int bufferLength, unsigned char* buffer);
void prepare(Firebird::IStatus* status,
unsigned int msg_length = 0, const unsigned char* message = 0);
void commit(Firebird::IStatus* status);
void commitRetaining(Firebird::IStatus* status);
void rollback(Firebird::IStatus* status);
void rollbackRetaining(Firebird::IStatus* status);
void disconnect(Firebird::IStatus* status);
Firebird::ITransaction* join(Firebird::IStatus* status, Firebird::ITransaction* transaction);
JTransaction* validate(Firebird::IStatus* status, Firebird::IAttachment* testAtt);
JTransaction* enterDtc(Firebird::IStatus* status);
public:
JTransaction(jrd_tra* handle, StableAttachmentPart* sa);
@ -138,22 +136,22 @@ private:
void freeEngineData(Firebird::IStatus* status);
};
class JResultSet FB_FINAL : public Firebird::RefCntIface<Firebird::IResultSet, FB_RESULTSET_VERSION>
class JResultSet FB_FINAL : public Firebird::RefCntIface<Firebird::Api::ResultSetImpl<JResultSet> >
{
public:
// IResultSet implementation
virtual int FB_CARG release();
virtual int FB_CARG fetchNext(Firebird::IStatus* status, void* message);
virtual int FB_CARG fetchPrior(Firebird::IStatus* status, void* message);
virtual int FB_CARG fetchFirst(Firebird::IStatus* status, void* message);
virtual int FB_CARG fetchLast(Firebird::IStatus* status, void* message);
virtual int FB_CARG fetchAbsolute(Firebird::IStatus* status, unsigned int position, void* message);
virtual int FB_CARG fetchRelative(Firebird::IStatus* status, int offset, void* message);
virtual FB_BOOLEAN FB_CARG isEof(Firebird::IStatus* status);
virtual FB_BOOLEAN FB_CARG isBof(Firebird::IStatus* status);
virtual Firebird::IMessageMetadata* FB_CARG getMetadata(Firebird::IStatus* status);
virtual void FB_CARG close(Firebird::IStatus* status);
virtual void FB_CARG setDelayedOutputFormat(Firebird::IStatus* status, Firebird::IMessageMetadata* format);
int release();
int fetchNext(Firebird::IStatus* status, void* message);
int fetchPrior(Firebird::IStatus* status, void* message);
int fetchFirst(Firebird::IStatus* status, void* message);
int fetchLast(Firebird::IStatus* status, void* message);
int fetchAbsolute(Firebird::IStatus* status, unsigned int position, void* message);
int fetchRelative(Firebird::IStatus* status, int offset, void* message);
FB_BOOLEAN isEof(Firebird::IStatus* status);
FB_BOOLEAN isBof(Firebird::IStatus* status);
Firebird::IMessageMetadata* getMetadata(Firebird::IStatus* status);
void close(Firebird::IStatus* status);
void setDelayedOutputFormat(Firebird::IStatus* status, Firebird::IMessageMetadata* format);
public:
JResultSet(JStatement* aStatement);
@ -175,28 +173,28 @@ private:
void freeEngineData(Firebird::IStatus* status);
};
class JStatement FB_FINAL : public Firebird::RefCntIface<Firebird::IStatement, FB_STATEMENT_VERSION>
class JStatement FB_FINAL : public Firebird::RefCntIface<Firebird::Api::StatementImpl<JStatement> >
{
public:
// IStatement implementation
virtual int FB_CARG release();
virtual void FB_CARG getInfo(Firebird::IStatus* status,
unsigned int itemsLength, const unsigned char* items,
unsigned int bufferLength, unsigned char* buffer);
virtual void FB_CARG free(Firebird::IStatus* status);
virtual ISC_UINT64 FB_CARG getAffectedRecords(Firebird::IStatus* userStatus);
virtual Firebird::IMessageMetadata* FB_CARG getOutputMetadata(Firebird::IStatus* userStatus);
virtual Firebird::IMessageMetadata* FB_CARG getInputMetadata(Firebird::IStatus* userStatus);
virtual unsigned FB_CARG getType(Firebird::IStatus* status);
virtual const char* FB_CARG getPlan(Firebird::IStatus* status, FB_BOOLEAN detailed);
virtual Firebird::ITransaction* FB_CARG execute(Firebird::IStatus* status,
int release();
void getInfo(Firebird::IStatus* status,
unsigned int itemsLength, const unsigned char* items,
unsigned int bufferLength, unsigned char* buffer);
void free(Firebird::IStatus* status);
ISC_UINT64 getAffectedRecords(Firebird::IStatus* userStatus);
Firebird::IMessageMetadata* getOutputMetadata(Firebird::IStatus* userStatus);
Firebird::IMessageMetadata* getInputMetadata(Firebird::IStatus* userStatus);
unsigned getType(Firebird::IStatus* status);
const char* getPlan(Firebird::IStatus* status, FB_BOOLEAN detailed);
Firebird::ITransaction* execute(Firebird::IStatus* status,
Firebird::ITransaction* transaction, Firebird::IMessageMetadata* inMetadata, void* inBuffer,
Firebird::IMessageMetadata* outMetadata, void* outBuffer);
virtual JResultSet* FB_CARG openCursor(Firebird::IStatus* status,
JResultSet* openCursor(Firebird::IStatus* status,
Firebird::ITransaction* transaction, Firebird::IMessageMetadata* inMetadata, void* inBuffer,
Firebird::IMessageMetadata* outMetadata);
virtual void FB_CARG setCursorName(Firebird::IStatus* status, const char* name);
virtual unsigned FB_CARG getFlags(Firebird::IStatus* status);
void setCursorName(Firebird::IStatus* status, const char* name);
unsigned getFlags(Firebird::IStatus* status);
public:
JStatement(dsql_req* handle, StableAttachmentPart* sa, Firebird::Array<UCHAR>& meta);
@ -230,23 +228,23 @@ inline dsql_req* JResultSet::getHandle() throw()
return statement->getHandle();
}
class JRequest FB_FINAL : public Firebird::RefCntIface<Firebird::IRequest, FB_REQUEST_VERSION>
class JRequest FB_FINAL : public Firebird::RefCntIface<Firebird::Api::RequestImpl<JRequest> >
{
public:
// IRequest implementation
virtual int FB_CARG release();
virtual void FB_CARG receive(Firebird::IStatus* status, int level, unsigned int msg_type,
unsigned int length, unsigned char* message);
virtual void FB_CARG send(Firebird::IStatus* status, int level, unsigned int msg_type,
unsigned int length, const unsigned char* message);
virtual void FB_CARG getInfo(Firebird::IStatus* status, int level,
unsigned int itemsLength, const unsigned char* items,
unsigned int bufferLength, unsigned char* buffer);
virtual void FB_CARG start(Firebird::IStatus* status, Firebird::ITransaction* tra, int level);
virtual void FB_CARG startAndSend(Firebird::IStatus* status, Firebird::ITransaction* tra, int level, unsigned int msg_type,
unsigned int length, const unsigned char* message);
virtual void FB_CARG unwind(Firebird::IStatus* status, int level);
virtual void FB_CARG free(Firebird::IStatus* status);
int release();
void receive(Firebird::IStatus* status, int level, unsigned int msg_type,
unsigned int length, unsigned char* message);
void send(Firebird::IStatus* status, int level, unsigned int msg_type,
unsigned int length, const unsigned char* message);
void getInfo(Firebird::IStatus* status, int level,
unsigned int itemsLength, const unsigned char* items,
unsigned int bufferLength, unsigned char* buffer);
void start(Firebird::IStatus* status, Firebird::ITransaction* tra, int level);
void startAndSend(Firebird::IStatus* status, Firebird::ITransaction* tra, int level,
unsigned int msg_type, unsigned int length, const unsigned char* message);
void unwind(Firebird::IStatus* status, int level);
void free(Firebird::IStatus* status);
public:
JRequest(JrdStatement* handle, StableAttachmentPart* sa);
@ -268,12 +266,12 @@ private:
void freeEngineData(Firebird::IStatus* status);
};
class JEvents FB_FINAL : public Firebird::RefCntIface<Firebird::IEvents, FB_EVENTS_VERSION>
class JEvents FB_FINAL : public Firebird::RefCntIface<Firebird::Api::EventsImpl<JEvents> >
{
public:
// IEvents implementation
virtual int FB_CARG release();
virtual void FB_CARG cancel(Firebird::IStatus* status);
int release();
void cancel(Firebird::IStatus* status);
public:
JEvents(int aId, StableAttachmentPart* sa, Firebird::IEventCallback* aCallback);
@ -296,54 +294,54 @@ private:
void freeEngineData(Firebird::IStatus* status);
};
class JAttachment FB_FINAL : public Firebird::RefCntIface<Firebird::IAttachment, FB_ATTACHMENT_VERSION>
class JAttachment FB_FINAL : public Firebird::RefCntIface<Firebird::Api::AttachmentImpl<JAttachment> >
{
public:
// IAttachment implementation
virtual int FB_CARG release();
virtual void FB_CARG addRef();
int release();
void addRef();
virtual void FB_CARG getInfo(Firebird::IStatus* status,
unsigned int itemsLength, const unsigned char* items,
unsigned int bufferLength, unsigned char* buffer);
virtual JTransaction* FB_CARG startTransaction(Firebird::IStatus* status,
void getInfo(Firebird::IStatus* status,
unsigned int itemsLength, const unsigned char* items,
unsigned int bufferLength, unsigned char* buffer);
JTransaction* startTransaction(Firebird::IStatus* status,
unsigned int tpbLength, const unsigned char* tpb);
virtual JTransaction* FB_CARG reconnectTransaction(Firebird::IStatus* status, unsigned int length, const unsigned char* id);
virtual JRequest* FB_CARG compileRequest(Firebird::IStatus* status, unsigned int blr_length, const unsigned char* blr);
virtual void FB_CARG transactRequest(Firebird::IStatus* status, Firebird::ITransaction* transaction,
unsigned int blr_length, const unsigned char* blr,
unsigned int in_msg_length, const unsigned char* in_msg,
unsigned int out_msg_length, unsigned char* out_msg);
virtual JBlob* FB_CARG createBlob(Firebird::IStatus* status, Firebird::ITransaction* transaction,
JTransaction* reconnectTransaction(Firebird::IStatus* status, unsigned int length, const unsigned char* id);
JRequest* compileRequest(Firebird::IStatus* status, unsigned int blr_length, const unsigned char* blr);
void transactRequest(Firebird::IStatus* status, Firebird::ITransaction* transaction,
unsigned int blr_length, const unsigned char* blr,
unsigned int in_msg_length, const unsigned char* in_msg,
unsigned int out_msg_length, unsigned char* out_msg);
JBlob* createBlob(Firebird::IStatus* status, Firebird::ITransaction* transaction,
ISC_QUAD* id, unsigned int bpbLength = 0, const unsigned char* bpb = 0);
virtual JBlob* FB_CARG openBlob(Firebird::IStatus* status, Firebird::ITransaction* transaction,
JBlob* openBlob(Firebird::IStatus* status, Firebird::ITransaction* transaction,
ISC_QUAD* id, unsigned int bpbLength = 0, const unsigned char* bpb = 0);
virtual int FB_CARG getSlice(Firebird::IStatus* status, Firebird::ITransaction* transaction, ISC_QUAD* id,
unsigned int sdl_length, const unsigned char* sdl,
unsigned int param_length, const unsigned char* param,
int sliceLength, unsigned char* slice);
virtual void FB_CARG putSlice(Firebird::IStatus* status, Firebird::ITransaction* transaction, ISC_QUAD* id,
unsigned int sdl_length, const unsigned char* sdl,
unsigned int param_length, const unsigned char* param,
int sliceLength, unsigned char* slice);
virtual void FB_CARG executeDyn(Firebird::IStatus* status, Firebird::ITransaction* transaction, unsigned int length,
int getSlice(Firebird::IStatus* status, Firebird::ITransaction* transaction, ISC_QUAD* id,
unsigned int sdl_length, const unsigned char* sdl,
unsigned int param_length, const unsigned char* param,
int sliceLength, unsigned char* slice);
void putSlice(Firebird::IStatus* status, Firebird::ITransaction* transaction, ISC_QUAD* id,
unsigned int sdl_length, const unsigned char* sdl,
unsigned int param_length, const unsigned char* param,
int sliceLength, unsigned char* slice);
void executeDyn(Firebird::IStatus* status, Firebird::ITransaction* transaction, unsigned int length,
const unsigned char* dyn);
virtual JStatement* FB_CARG prepare(Firebird::IStatus* status, Firebird::ITransaction* tra,
JStatement* prepare(Firebird::IStatus* status, Firebird::ITransaction* tra,
unsigned int stmtLength, const char* sqlStmt, unsigned int dialect, unsigned int flags);
virtual Firebird::ITransaction* FB_CARG execute(Firebird::IStatus* status,
Firebird::ITransaction* execute(Firebird::IStatus* status,
Firebird::ITransaction* transaction, unsigned int stmtLength, const char* sqlStmt,
unsigned int dialect, Firebird::IMessageMetadata* inMetadata, void* inBuffer,
Firebird::IMessageMetadata* outMetadata, void* outBuffer);
virtual Firebird::IResultSet* FB_CARG openCursor(Firebird::IStatus* status,
Firebird::IResultSet* openCursor(Firebird::IStatus* status,
Firebird::ITransaction* transaction, unsigned int stmtLength, const char* sqlStmt,
unsigned int dialect, Firebird::IMessageMetadata* inMetadata, void* inBuffer,
Firebird::IMessageMetadata* outMetadata, const char* cursorName);
virtual JEvents* FB_CARG queEvents(Firebird::IStatus* status, Firebird::IEventCallback* callback,
unsigned int length, const unsigned char* events);
virtual void FB_CARG cancelOperation(Firebird::IStatus* status, int option);
virtual void FB_CARG ping(Firebird::IStatus* status);
virtual void FB_CARG detach(Firebird::IStatus* status);
virtual void FB_CARG dropDatabase(Firebird::IStatus* status);
JEvents* queEvents(Firebird::IStatus* status, Firebird::IEventCallback* callback,
unsigned int length, const unsigned char* events);
void cancelOperation(Firebird::IStatus* status, int option);
void ping(Firebird::IStatus* status);
void detach(Firebird::IStatus* status);
void dropDatabase(Firebird::IStatus* status);
public:
explicit JAttachment(StableAttachmentPart* js);
@ -353,7 +351,7 @@ public:
return att;
}
Attachment* getHandle() throw();
Jrd::Attachment* getHandle() throw();
StableAttachmentPart* getAttachment() throw()
{
@ -369,29 +367,29 @@ private:
void freeEngineData(Firebird::IStatus* status);
};
class JService FB_FINAL : public Firebird::RefCntIface<Firebird::IService, FB_SERVICE_VERSION>
class JService FB_FINAL : public Firebird::RefCntIface<Firebird::Api::ServiceImpl<JService> >
{
public:
// IService implementation
virtual int FB_CARG release();
virtual void FB_CARG detach(Firebird::IStatus* status);
virtual void FB_CARG query(Firebird::IStatus* status,
unsigned int sendLength, const unsigned char* sendItems,
unsigned int receiveLength, const unsigned char* receiveItems,
unsigned int bufferLength, unsigned char* buffer);
virtual void FB_CARG start(Firebird::IStatus* status,
unsigned int spbLength, const unsigned char* spb);
int release();
void detach(Firebird::IStatus* status);
void query(Firebird::IStatus* status,
unsigned int sendLength, const unsigned char* sendItems,
unsigned int receiveLength, const unsigned char* receiveItems,
unsigned int bufferLength, unsigned char* buffer);
void start(Firebird::IStatus* status,
unsigned int spbLength, const unsigned char* spb);
public:
explicit JService(Service* handle);
explicit JService(Jrd::Service* handle);
Firebird::Mutex mutex;
Service* svc;
Jrd::Service* svc;
private:
void freeEngineData(Firebird::IStatus* status);
};
class JProvider FB_FINAL : public Firebird::StdPlugin<Firebird::IProvider, FB_PROVIDER_VERSION>
class JProvider FB_FINAL : public Firebird::StdPlugin<Firebird::Api::ProviderImpl<JProvider> >
{
public:
explicit JProvider(Firebird::IPluginConfig* pConf)
@ -406,17 +404,17 @@ public:
}
// IProvider implementation
virtual JAttachment* FB_CARG attachDatabase(Firebird::IStatus* status, const char* fileName,
JAttachment* attachDatabase(Firebird::IStatus* status, const char* fileName,
unsigned int dpbLength, const unsigned char* dpb);
virtual JAttachment* FB_CARG createDatabase(Firebird::IStatus* status, const char* fileName,
JAttachment* createDatabase(Firebird::IStatus* status, const char* fileName,
unsigned int dpbLength, const unsigned char* dpb);
virtual JService* FB_CARG attachServiceManager(Firebird::IStatus* status, const char* service,
JService* attachServiceManager(Firebird::IStatus* status, const char* service,
unsigned int spbLength, const unsigned char* spb);
virtual void FB_CARG shutdown(Firebird::IStatus* status, unsigned int timeout, const int reason);
virtual void FB_CARG setDbCryptCallback(Firebird::IStatus* status,
void shutdown(Firebird::IStatus* status, unsigned int timeout, const int reason);
void setDbCryptCallback(Firebird::IStatus* status,
Firebird::ICryptKeyCallback* cryptCallback);
virtual int FB_CARG release();
int release();
private:
Firebird::ICryptKeyCallback* cryptCallback;

View File

@ -433,7 +433,7 @@ namespace
{
if (request->req_operation == jrd_req::req_evaluate)
{
trigger->execute(tdbb, (ExternalTrigger::Action) request->req_trigger_action,
trigger->execute(tdbb, request->req_trigger_action,
getRpb(request, 0), getRpb(request, 1));
request->req_operation = jrd_req::req_return;
@ -458,9 +458,6 @@ namespace
namespace Jrd {
static MakeUpgradeInfo<> upInfo;
template <typename T> class ExtEngineManager::ContextManager
{
public:
@ -573,7 +570,7 @@ private:
ExtEngineManager::ExternalContextImpl::ExternalContextImpl(thread_db* tdbb,
ExternalEngine* aEngine)
IExternalEngine* aEngine)
: engine(aEngine),
internalAttachment(tdbb->getAttachment()),
internalTransaction(NULL),
@ -638,50 +635,50 @@ IMaster* ExtEngineManager::ExternalContextImpl::getMaster()
return master;
}
ExternalEngine* ExtEngineManager::ExternalContextImpl::getEngine(IStatus* /*status*/)
IExternalEngine* ExtEngineManager::ExternalContextImpl::getEngine(IStatus* /*status*/)
{
return engine;
}
Firebird::IAttachment* FB_CARG ExtEngineManager::ExternalContextImpl::getAttachment(IStatus* /*status*/)
Firebird::IAttachment* ExtEngineManager::ExternalContextImpl::getAttachment(IStatus* /*status*/)
{
return externalAttachment;
}
Firebird::ITransaction* FB_CARG ExtEngineManager::ExternalContextImpl::getTransaction(IStatus* /*status*/)
Firebird::ITransaction* ExtEngineManager::ExternalContextImpl::getTransaction(IStatus* /*status*/)
{
return externalTransaction;
}
const char* FB_CARG ExtEngineManager::ExternalContextImpl::getUserName()
const char* ExtEngineManager::ExternalContextImpl::getUserName()
{
return internalAttachment->att_user->usr_user_name.c_str();
}
const char* FB_CARG ExtEngineManager::ExternalContextImpl::getDatabaseName()
const char* ExtEngineManager::ExternalContextImpl::getDatabaseName()
{
return internalAttachment->att_database->dbb_database_name.c_str();
}
const Utf8* FB_CARG ExtEngineManager::ExternalContextImpl::getClientCharSet()
const Utf8* ExtEngineManager::ExternalContextImpl::getClientCharSet()
{
return clientCharSet.c_str();
}
int FB_CARG ExtEngineManager::ExternalContextImpl::obtainInfoCode()
int ExtEngineManager::ExternalContextImpl::obtainInfoCode()
{
static AtomicCounter counter;
return ++counter;
}
void* FB_CARG ExtEngineManager::ExternalContextImpl::getInfo(int code)
void* ExtEngineManager::ExternalContextImpl::getInfo(int code)
{
void* value = NULL;
miscInfo.get(code, value);
return value;
}
void* FB_CARG ExtEngineManager::ExternalContextImpl::setInfo(int code, void* value)
void* ExtEngineManager::ExternalContextImpl::setInfo(int code, void* value)
{
void* oldValue = getInfo(code);
miscInfo.put(code, value);
@ -693,7 +690,7 @@ void* FB_CARG ExtEngineManager::ExternalContextImpl::setInfo(int code, void* val
ExtEngineManager::Function::Function(thread_db* tdbb, ExtEngineManager* aExtManager,
ExternalEngine* aEngine, RoutineMetadata* aMetadata, ExternalFunction* aFunction,
IExternalEngine* aEngine, RoutineMetadata* aMetadata, IExternalFunction* aFunction,
const Jrd::Function* aUdf)
: extManager(aExtManager),
engine(aEngine),
@ -715,7 +712,7 @@ ExtEngineManager::Function::~Function()
void ExtEngineManager::Function::execute(thread_db* tdbb, UCHAR* inMsg, UCHAR* outMsg) const
{
EngineAttachmentInfo* attInfo = extManager->getEngineAttachment(tdbb, engine);
ContextManager<ExternalFunction> ctxManager(tdbb, attInfo, function,
ContextManager<IExternalFunction> ctxManager(tdbb, attInfo, function,
(udf->getName().package.isEmpty() ?
CallerName(obj_udf, udf->getName().identifier) :
CallerName(obj_package_header, udf->getName().package)));
@ -732,7 +729,7 @@ void ExtEngineManager::Function::execute(thread_db* tdbb, UCHAR* inMsg, UCHAR* o
ExtEngineManager::Procedure::Procedure(thread_db* tdbb, ExtEngineManager* aExtManager,
ExternalEngine* aEngine, RoutineMetadata* aMetadata, ExternalProcedure* aProcedure,
IExternalEngine* aEngine, RoutineMetadata* aMetadata, IExternalProcedure* aProcedure,
const jrd_prc* aPrc)
: extManager(aExtManager),
engine(aEngine),
@ -768,7 +765,7 @@ ExtEngineManager::ResultSet::ResultSet(thread_db* tdbb, UCHAR* inMsg, UCHAR* out
firstFetch(true)
{
attInfo = procedure->extManager->getEngineAttachment(tdbb, procedure->engine);
ContextManager<ExternalProcedure> ctxManager(tdbb, attInfo, procedure->procedure,
ContextManager<IExternalProcedure> ctxManager(tdbb, attInfo, procedure->procedure,
(procedure->prc->getName().package.isEmpty() ?
CallerName(obj_procedure, procedure->prc->getName().identifier) :
CallerName(obj_package_header, procedure->prc->getName().package)));
@ -802,7 +799,7 @@ bool ExtEngineManager::ResultSet::fetch(thread_db* tdbb)
if (!resultSet)
return wasFirstFetch;
ContextManager<ExternalProcedure> ctxManager(tdbb, attInfo, charSet,
ContextManager<IExternalProcedure> ctxManager(tdbb, attInfo, charSet,
(procedure->prc->getName().package.isEmpty() ?
CallerName(obj_procedure, procedure->prc->getName().identifier) :
CallerName(obj_package_header, procedure->prc->getName().package)));
@ -822,8 +819,8 @@ bool ExtEngineManager::ResultSet::fetch(thread_db* tdbb)
ExtEngineManager::Trigger::Trigger(thread_db* tdbb, MemoryPool& pool, ExtEngineManager* aExtManager,
ExternalEngine* aEngine, RoutineMetadata* aMetadata,
ExternalTrigger* aTrigger, const Jrd::Trigger* aTrg)
IExternalEngine* aEngine, RoutineMetadata* aMetadata,
IExternalTrigger* aTrigger, const Jrd::Trigger* aTrg)
: extManager(aExtManager),
engine(aEngine),
metadata(aMetadata),
@ -874,11 +871,11 @@ ExtEngineManager::Trigger::~Trigger()
}
void ExtEngineManager::Trigger::execute(thread_db* tdbb, ExternalTrigger::Action action,
void ExtEngineManager::Trigger::execute(thread_db* tdbb, unsigned action,
record_param* oldRpb, record_param* newRpb) const
{
EngineAttachmentInfo* attInfo = extManager->getEngineAttachment(tdbb, engine);
ContextManager<ExternalTrigger> ctxManager(tdbb, attInfo, trigger,
ContextManager<IExternalTrigger> ctxManager(tdbb, attInfo, trigger,
CallerName(obj_trigger, trg->name));
// ASF: Using Array instead of HalfStaticArray to not need to do alignment hacks here.
@ -986,7 +983,7 @@ unloaded only on program exit, causing at that moment AV if this code is active:
EnginesMap::Accessor accessor(&engines);
for (bool found = accessor.getFirst(); found; found = accessor.getNext())
{
ExternalEngine* engine = accessor.current()->second;
IExternalEngine* engine = accessor.current()->second;
pi->releasePlugin(engine);
}
*/
@ -1003,7 +1000,7 @@ void ExtEngineManager::initialize()
void ExtEngineManager::closeAttachment(thread_db* tdbb, Attachment* attachment)
{
Array<ExternalEngine*> enginesCopy;
Array<IExternalEngine*> enginesCopy;
{ // scope
ReadLockGuard readGuard(enginesLock, FB_FUNCTION);
@ -1016,15 +1013,15 @@ void ExtEngineManager::closeAttachment(thread_db* tdbb, Attachment* attachment)
RefDeb(DEB_RLS_JATT, "ExtEngineManager::closeAttachment");
Attachment::Checkout attCout(attachment, FB_FUNCTION, true);
for (Array<ExternalEngine*>::iterator i = enginesCopy.begin(); i != enginesCopy.end(); ++i)
for (Array<IExternalEngine*>::iterator i = enginesCopy.begin(); i != enginesCopy.end(); ++i)
{
ExternalEngine* engine = *i;
IExternalEngine* engine = *i;
EngineAttachmentInfo* attInfo = getEngineAttachment(tdbb, engine, true);
if (attInfo)
{
{ // scope
ContextManager<ExternalFunction> ctxManager(tdbb, attInfo, attInfo->adminCharSet);
ContextManager<IExternalFunction> ctxManager(tdbb, attInfo, attInfo->adminCharSet);
LocalStatus status;
engine->closeAttachment(&status, attInfo->context); //// FIXME: log status
}
@ -1042,7 +1039,7 @@ void ExtEngineManager::makeFunction(thread_db* tdbb, CompilerScratch* csb, Jrd::
entryPointTrimmed.trim();
EngineAttachmentInfo* attInfo = getEngineAttachment(tdbb, engine);
ContextManager<ExternalFunction> ctxManager(tdbb, attInfo, attInfo->adminCharSet,
ContextManager<IExternalFunction> ctxManager(tdbb, attInfo, attInfo->adminCharSet,
(udf->getName().package.isEmpty() ?
CallerName(obj_udf, udf->getName().identifier) :
CallerName(obj_package_header, udf->getName().package)));
@ -1066,7 +1063,7 @@ void ExtEngineManager::makeFunction(thread_db* tdbb, CompilerScratch* csb, Jrd::
RefPtr<IMetadataBuilder> outBuilder(REF_NO_INCR, metadata->outputParameters->getBuilder(&status));
status.check();
ExternalFunction* externalFunction;
IExternalFunction* externalFunction;
{ // scope
Attachment::Checkout attCout(tdbb->getAttachment(), FB_FUNCTION);
@ -1151,7 +1148,7 @@ void ExtEngineManager::makeProcedure(thread_db* tdbb, CompilerScratch* csb, jrd_
entryPointTrimmed.trim();
EngineAttachmentInfo* attInfo = getEngineAttachment(tdbb, engine);
ContextManager<ExternalProcedure> ctxManager(tdbb, attInfo, attInfo->adminCharSet,
ContextManager<IExternalProcedure> ctxManager(tdbb, attInfo, attInfo->adminCharSet,
(prc->getName().package.isEmpty() ?
CallerName(obj_procedure, prc->getName().identifier) :
CallerName(obj_package_header, prc->getName().package)));
@ -1175,7 +1172,7 @@ void ExtEngineManager::makeProcedure(thread_db* tdbb, CompilerScratch* csb, jrd_
RefPtr<IMetadataBuilder> outBuilder(REF_NO_INCR, metadata->outputParameters->getBuilder(&status));
status.check();
ExternalProcedure* externalProcedure;
IExternalProcedure* externalProcedure;
{ // scope
Attachment::Checkout attCout(tdbb->getAttachment(), FB_FUNCTION);
@ -1256,13 +1253,13 @@ void ExtEngineManager::makeProcedure(thread_db* tdbb, CompilerScratch* csb, jrd_
void ExtEngineManager::makeTrigger(thread_db* tdbb, CompilerScratch* csb, Jrd::Trigger* trg,
const MetaName& engine, const string& entryPoint, const string& body,
ExternalTrigger::Type type)
unsigned type)
{
string entryPointTrimmed = entryPoint;
entryPointTrimmed.trim();
EngineAttachmentInfo* attInfo = getEngineAttachment(tdbb, engine);
ContextManager<ExternalTrigger> ctxManager(tdbb, attInfo, attInfo->adminCharSet,
ContextManager<IExternalTrigger> ctxManager(tdbb, attInfo, attInfo->adminCharSet,
CallerName(obj_trigger, trg->name));
///MemoryPool& pool = *tdbb->getDefaultPool();
@ -1302,7 +1299,7 @@ void ExtEngineManager::makeTrigger(thread_db* tdbb, CompilerScratch* csb, Jrd::T
status.check();
}
ExternalTrigger* externalTrigger;
IExternalTrigger* externalTrigger;
{ // scope
Attachment::Checkout attCout(tdbb->getAttachment(), FB_FUNCTION);
@ -1347,10 +1344,10 @@ void ExtEngineManager::makeTrigger(thread_db* tdbb, CompilerScratch* csb, Jrd::T
}
ExternalEngine* ExtEngineManager::getEngine(thread_db* tdbb, const MetaName& name)
IExternalEngine* ExtEngineManager::getEngine(thread_db* tdbb, const MetaName& name)
{
ReadLockGuard readGuard(enginesLock, FB_FUNCTION);
ExternalEngine* engine = NULL;
IExternalEngine* engine = NULL;
if (!engines.get(name, engine))
{
@ -1359,8 +1356,7 @@ ExternalEngine* ExtEngineManager::getEngine(thread_db* tdbb, const MetaName& nam
if (!engines.get(name, engine))
{
GetPlugins<ExternalEngine> engineControl(PluginType::ExternalEngine,
FB_EXTERNAL_ENGINE_VERSION, upInfo, name.c_str());
GetPlugins<IExternalEngine> engineControl(IPluginManager::ExternalEngine, name.c_str());
if (engineControl.hasData())
{
@ -1383,7 +1379,7 @@ ExternalEngine* ExtEngineManager::getEngine(thread_db* tdbb, const MetaName& nam
setupAdminCharSet(tdbb, engine, attInfo);
ContextManager<ExternalFunction> ctxManager(tdbb, attInfo, attInfo->adminCharSet);
ContextManager<IExternalFunction> ctxManager(tdbb, attInfo, attInfo->adminCharSet);
LocalStatus status;
engine->openAttachment(&status, attInfo->context); //// FIXME: log status
}
@ -1421,13 +1417,13 @@ ExternalEngine* ExtEngineManager::getEngine(thread_db* tdbb, const MetaName& nam
ExtEngineManager::EngineAttachmentInfo* ExtEngineManager::getEngineAttachment(
thread_db* tdbb, const MetaName& name)
{
ExternalEngine* engine = getEngine(tdbb, name);
IExternalEngine* engine = getEngine(tdbb, name);
return getEngineAttachment(tdbb, engine);
}
ExtEngineManager::EngineAttachmentInfo* ExtEngineManager::getEngineAttachment(
thread_db* tdbb, ExternalEngine* engine, bool closing)
thread_db* tdbb, IExternalEngine* engine, bool closing)
{
EngineAttachment key(engine, tdbb->getAttachment());
EngineAttachmentInfo* attInfo = NULL;
@ -1449,7 +1445,7 @@ ExtEngineManager::EngineAttachmentInfo* ExtEngineManager::getEngineAttachment(
enginesAttachments.put(key, attInfo);
ContextManager<ExternalFunction> ctxManager(tdbb, attInfo, attInfo->adminCharSet);
ContextManager<IExternalFunction> ctxManager(tdbb, attInfo, attInfo->adminCharSet);
Attachment::Checkout attCout(tdbb->getAttachment(), FB_FUNCTION);
LocalStatus status;
engine->openAttachment(&status, attInfo->context); //// FIXME: log status
@ -1469,10 +1465,10 @@ ExtEngineManager::EngineAttachmentInfo* ExtEngineManager::getEngineAttachment(
}
void ExtEngineManager::setupAdminCharSet(thread_db* tdbb, ExternalEngine* engine,
void ExtEngineManager::setupAdminCharSet(thread_db* tdbb, IExternalEngine* engine,
EngineAttachmentInfo* attInfo)
{
ContextManager<ExternalFunction> ctxManager(tdbb, attInfo, CS_UTF8);
ContextManager<IExternalFunction> ctxManager(tdbb, attInfo, CS_UTF8);
Utf8 charSetName[MAX_SQL_IDENTIFIER_SIZE] = "NONE";

View File

@ -24,7 +24,7 @@
#define JRD_EXT_ENGINE_MANAGER_H
#include "FirebirdApi.h"
#include "firebird/ExternalEngine.h"
#include "firebird/Interface.h"
#include "../common/classes/array.h"
#include "../common/classes/fb_string.h"
#include "../common/classes/GenericMap.h"
@ -61,7 +61,7 @@ private:
class TransactionImpl;
class RoutineMetadata FB_FINAL :
public Firebird::VersionedIface<Firebird::IRoutineMetadata, FB_ROUTINE_METADATA_VERSION>,
public Firebird::VersionedIface<Firebird::Api::RoutineMetadataImpl<RoutineMetadata> >,
public Firebird::PermanentStorage
{
public:
@ -72,54 +72,54 @@ private:
entryPoint(pool),
body(pool),
triggerTable(pool),
triggerType(Firebird::ExternalTrigger::Type(0))
triggerType(0)
{
}
virtual const char* FB_CARG getPackage(Firebird::IStatus* /*status*/) const
const char* getPackage(Firebird::IStatus* /*status*/) const
{
return package.nullStr();
}
virtual const char* FB_CARG getName(Firebird::IStatus* /*status*/) const
const char* getName(Firebird::IStatus* /*status*/) const
{
return name.c_str();
}
virtual const char* FB_CARG getEntryPoint(Firebird::IStatus* /*status*/) const
const char* getEntryPoint(Firebird::IStatus* /*status*/) const
{
return entryPoint.c_str();
}
virtual const char* FB_CARG getBody(Firebird::IStatus* /*status*/) const
const char* getBody(Firebird::IStatus* /*status*/) const
{
return body.c_str();
}
virtual Firebird::IMessageMetadata* FB_CARG getInputMetadata(
Firebird::IMessageMetadata* getInputMetadata(
Firebird::IStatus* /*status*/) const
{
return getMetadata(inputParameters);
}
virtual Firebird::IMessageMetadata* FB_CARG getOutputMetadata(
Firebird::IMessageMetadata* getOutputMetadata(
Firebird::IStatus* /*status*/) const
{
return getMetadata(outputParameters);
}
virtual Firebird::IMessageMetadata* FB_CARG getTriggerMetadata(
Firebird::IMessageMetadata* getTriggerMetadata(
Firebird::IStatus* /*status*/) const
{
return getMetadata(triggerFields);
}
virtual const char* FB_CARG getTriggerTable(Firebird::IStatus* /*status*/) const
const char* getTriggerTable(Firebird::IStatus* /*status*/) const
{
return triggerTable.c_str();
}
virtual Firebird::ExternalTrigger::Type FB_CARG getTriggerType(Firebird::IStatus* /*status*/) const
unsigned getTriggerType(Firebird::IStatus* /*status*/) const
{
return triggerType;
}
@ -133,7 +133,7 @@ private:
Firebird::RefPtr<Firebird::IMessageMetadata> outputParameters;
Firebird::RefPtr<Firebird::IMessageMetadata> triggerFields;
Firebird::MetaName triggerTable;
Firebird::ExternalTrigger::Type triggerType;
unsigned triggerType;
private:
static Firebird::IMessageMetadata* getMetadata(const Firebird::IMessageMetadata* par)
@ -144,30 +144,30 @@ private:
}
};
class ExternalContextImpl : public Firebird::ExternalContext
class ExternalContextImpl : public Firebird::VersionedIface<Firebird::Api::ExternalContextImpl<ExternalContextImpl> >
{
friend class AttachmentImpl;
public:
ExternalContextImpl(thread_db* tdbb, Firebird::ExternalEngine* aEngine);
ExternalContextImpl(thread_db* tdbb, Firebird::IExternalEngine* aEngine);
virtual ~ExternalContextImpl();
void releaseTransaction();
void setTransaction(thread_db* tdbb);
virtual Firebird::IMaster* FB_CARG getMaster();
virtual Firebird::ExternalEngine* FB_CARG getEngine(Firebird::IStatus* status);
virtual Firebird::IAttachment* FB_CARG getAttachment(Firebird::IStatus* status);
virtual Firebird::ITransaction* FB_CARG getTransaction(Firebird::IStatus* status);
virtual const char* FB_CARG getUserName();
virtual const char* FB_CARG getDatabaseName();
virtual const Firebird::Utf8* FB_CARG getClientCharSet();
virtual int FB_CARG obtainInfoCode();
virtual void* FB_CARG getInfo(int code);
virtual void* FB_CARG setInfo(int code, void* value);
Firebird::IMaster* getMaster();
Firebird::IExternalEngine* getEngine(Firebird::IStatus* status);
Firebird::IAttachment* getAttachment(Firebird::IStatus* status);
Firebird::ITransaction* getTransaction(Firebird::IStatus* status);
const char* getUserName();
const char* getDatabaseName();
const Firebird::Utf8* getClientCharSet();
int obtainInfoCode();
void* getInfo(int code);
void* setInfo(int code, void* value);
private:
Firebird::ExternalEngine* engine;
Firebird::IExternalEngine* engine;
Attachment* internalAttachment;
jrd_tra* internalTransaction;
Firebird::IAttachment* externalAttachment;
@ -178,7 +178,7 @@ private:
struct EngineAttachment
{
EngineAttachment(Firebird::ExternalEngine* aEngine, Jrd::Attachment* aAttachment)
EngineAttachment(Firebird::IExternalEngine* aEngine, Jrd::Attachment* aAttachment)
: engine(aEngine),
attachment(aAttachment)
{
@ -190,7 +190,7 @@ private:
(i1.engine == i2.engine && i1.attachment > i2.attachment);
}
Firebird::ExternalEngine* engine;
Firebird::IExternalEngine* engine;
Jrd::Attachment* attachment;
};
@ -203,7 +203,7 @@ private:
{
}
Firebird::ExternalEngine* engine;
Firebird::IExternalEngine* engine;
Firebird::AutoPtr<ExternalContextImpl> context;
USHORT adminCharSet;
};
@ -213,9 +213,9 @@ public:
{
public:
Function(thread_db* tdbb, ExtEngineManager* aExtManager,
Firebird::ExternalEngine* aEngine,
Firebird::IExternalEngine* aEngine,
RoutineMetadata* aMetadata,
Firebird::ExternalFunction* aFunction,
Firebird::IExternalFunction* aFunction,
const Jrd::Function* aUdf);
~Function();
@ -223,9 +223,9 @@ public:
private:
ExtEngineManager* extManager;
Firebird::ExternalEngine* engine;
Firebird::IExternalEngine* engine;
Firebird::AutoPtr<RoutineMetadata> metadata;
Firebird::ExternalFunction* function;
Firebird::IExternalFunction* function;
const Jrd::Function* udf;
Database* database;
};
@ -236,9 +236,9 @@ public:
{
public:
Procedure(thread_db* tdbb, ExtEngineManager* aExtManager,
Firebird::ExternalEngine* aEngine,
Firebird::IExternalEngine* aEngine,
RoutineMetadata* aMetadata,
Firebird::ExternalProcedure* aProcedure,
Firebird::IExternalProcedure* aProcedure,
const jrd_prc* aPrc);
~Procedure();
@ -246,9 +246,9 @@ public:
private:
ExtEngineManager* extManager;
Firebird::ExternalEngine* engine;
Firebird::IExternalEngine* engine;
Firebird::AutoPtr<RoutineMetadata> metadata;
Firebird::ExternalProcedure* procedure;
Firebird::IExternalProcedure* procedure;
const jrd_prc* prc;
Database* database;
@ -268,7 +268,7 @@ public:
Attachment* attachment;
bool firstFetch;
EngineAttachmentInfo* attInfo;
Firebird::ExternalResultSet* resultSet;
Firebird::IExternalResultSet* resultSet;
USHORT charSet;
};
@ -276,21 +276,21 @@ public:
{
public:
Trigger(thread_db* tdbb, MemoryPool& pool, ExtEngineManager* aExtManager,
Firebird::ExternalEngine* aEngine, RoutineMetadata* aMetadata,
Firebird::ExternalTrigger* aTrigger, const Jrd::Trigger* aTrg);
Firebird::IExternalEngine* aEngine, RoutineMetadata* aMetadata,
Firebird::IExternalTrigger* aTrigger, const Jrd::Trigger* aTrg);
~Trigger();
void execute(thread_db* tdbb, Firebird::ExternalTrigger::Action action,
void execute(thread_db* tdbb, unsigned action,
record_param* oldRpb, record_param* newRpb) const;
private:
void setValues(thread_db* tdbb, Firebird::Array<UCHAR>& msgBuffer, record_param* rpb) const;
ExtEngineManager* extManager;
Firebird::ExternalEngine* engine;
Firebird::IExternalEngine* engine;
Firebird::AutoPtr<RoutineMetadata> metadata;
Firebird::AutoPtr<Format> format;
Firebird::ExternalTrigger* trigger;
Firebird::IExternalTrigger* trigger;
const Jrd::Trigger* trg;
Firebird::Array<USHORT> fieldsPos;
Database* database;
@ -320,21 +320,21 @@ public:
const Firebird::string& body);
void makeTrigger(thread_db* tdbb, CompilerScratch* csb, Jrd::Trigger* trg,
const Firebird::MetaName& engine, const Firebird::string& entryPoint,
const Firebird::string& body, Firebird::ExternalTrigger::Type type);
const Firebird::string& body, unsigned type);
private:
Firebird::ExternalEngine* getEngine(thread_db* tdbb,
Firebird::IExternalEngine* getEngine(thread_db* tdbb,
const Firebird::MetaName& name);
EngineAttachmentInfo* getEngineAttachment(thread_db* tdbb,
const Firebird::MetaName& name);
EngineAttachmentInfo* getEngineAttachment(thread_db* tdbb,
Firebird::ExternalEngine* engine, bool closing = false);
void setupAdminCharSet(thread_db* tdbb, Firebird::ExternalEngine* engine,
Firebird::IExternalEngine* engine, bool closing = false);
void setupAdminCharSet(thread_db* tdbb, Firebird::IExternalEngine* engine,
EngineAttachmentInfo* attInfo);
private:
typedef Firebird::GenericMap<Firebird::Pair<
Firebird::Left<Firebird::MetaName, Firebird::ExternalEngine*> > > EnginesMap;
Firebird::Left<Firebird::MetaName, Firebird::IExternalEngine*> > > EnginesMap;
typedef Firebird::GenericMap<Firebird::Pair<Firebird::NonPooled<
EngineAttachment, EngineAttachmentInfo*> >, EngineAttachment> EnginesAttachmentsMap;

View File

@ -416,7 +416,7 @@ bool IntlManager::initialize()
ObjectsArray<ConfigFile::String> conflicts;
string builtinConfig;
PathName intlPath = fb_utils::getPrefix(Firebird::DirType::FB_DIR_INTL, "");
PathName intlPath = fb_utils::getPrefix(Firebird::IConfigManager::FB_DIR_INTL, "");
ScanDir dir(intlPath.c_str(), "*.conf");

View File

@ -27,7 +27,7 @@
*/
#include "firebird.h"
#include "firebird/Provider.h"
#include "firebird/Interface.h"
#include "../auth/SecureRemotePassword/Message.h"
#include "gen/iberror.h"

View File

@ -2376,7 +2376,7 @@ dsc* evlSetContext(thread_db* tdbb, const SysFunction*, const NestValueArray& ar
}
}
if (attachment->att_trace_manager->needs(TRACE_EVENT_SET_CONTEXT))
if (attachment->att_trace_manager->needs(ITraceConnection::TRACE_EVENT_SET_CONTEXT))
{
TraceConnectionImpl conn(attachment);
TraceTransactionImpl tran(transaction);

View File

@ -35,7 +35,95 @@
using namespace Jrd;
using namespace Firebird;
static MakeUpgradeInfo<> upInfo;
namespace {
class UserIdInfo : public AutoIface<Api::LogonInfoImpl<UserIdInfo> >
{
public:
explicit UserIdInfo(const Attachment* pAtt)
: att(pAtt)
{ }
// ILogonInfo implementation
const char* name()
{
return att->att_user->usr_user_name.c_str();
}
const char* role()
{
return att->att_user->usr_sql_role_name.c_str();
}
const char* networkProtocol()
{
return att->att_network_protocol.c_str();
}
const char* remoteAddress()
{
return att->att_remote_address.c_str();
}
const unsigned char* authBlock(unsigned* length)
{
const Auth::AuthenticationBlock& aBlock = att->att_user->usr_auth_block;
*length = aBlock.getCount();
return aBlock.getCount() ? aBlock.begin() : NULL;
}
private:
const Attachment* att;
};
class FillSnapshot : public AutoIface<Api::ListUsersImpl<FillSnapshot> >
{
public:
explicit FillSnapshot(UserManagement* um)
: userManagement(um)
{ }
// IListUsers implementation
void list(IStatus* status, Firebird::IUser* user)
{
try
{
userManagement->list(user);
}
catch (const Firebird::Exception& ex)
{
ex.stuffException(status);
}
}
private:
UserManagement* userManagement;
};
class OldAttributes : public AutoIface<Api::ListUsersImpl<OldAttributes> >
{
public:
OldAttributes()
: present(false)
{ }
// IListUsers implementation
void list(IStatus* status, Firebird::IUser* data)
{
try
{
value = data->attributes()->entered() ? data->attributes()->get() : "";
present = true;
}
catch (const Firebird::Exception& ex)
{
ex.stuffException(status);
}
}
string value;
bool present;
};
} // anonymous namespace
const Format* UsersTableScan::getFormat(thread_db* tdbb, jrd_rel* relation) const
{
@ -70,45 +158,6 @@ UserManagement::UserManagement(jrd_tra* tra)
fb_assert(manager);
manager->addRef();
class UserIdInfo : public AutoIface<Auth::ILogonInfo, FB_AUTH_LOGON_INFO_VERSION>
{
public:
explicit UserIdInfo(const Attachment* pAtt)
: att(pAtt)
{ }
// ILogonInfo implementation
const char* FB_CARG name()
{
return att->att_user->usr_user_name.c_str();
}
const char* FB_CARG role()
{
return att->att_user->usr_sql_role_name.c_str();
}
const char* FB_CARG networkProtocol()
{
return att->att_network_protocol.c_str();
}
const char* FB_CARG remoteAddress()
{
return att->att_remote_address.c_str();
}
const unsigned char* FB_CARG authBlock(unsigned* length)
{
const Auth::UserData::AuthenticationBlock& aBlock = att->att_user->usr_auth_block;
*length = aBlock.getCount();
return aBlock.getCount() ? aBlock.begin() : NULL;
}
private:
const Attachment* att;
};
LocalStatus status;
UserIdInfo idInfo(att);
manager->start(&status, &idInfo);
@ -169,7 +218,7 @@ USHORT UserManagement::put(Auth::DynamicUserData* userData)
return ret;
}
void UserManagement::checkSecurityResult(int errcode, Firebird::IStatus* status, const char* userName, Auth::IUser* user)
void UserManagement::checkSecurityResult(int errcode, Firebird::IStatus* status, const char* userName, Firebird::IUser* user)
{
if (!errcode)
{
@ -222,31 +271,6 @@ void UserManagement::execute(USHORT id)
cmd.user.setEntered(&status, 1);
check(&status);
class OldAttributes : public Firebird::AutoIface<Auth::IListUsers, FB_AUTH_LIST_USERS_VERSION>
{
public:
OldAttributes()
: present(false)
{ }
// IListUsers implementation
void FB_CARG list(IStatus* status, Auth::IUser* data)
{
try
{
value = data->attributes()->entered() ? data->attributes()->get() : "";
present = true;
}
catch (const Firebird::Exception& ex)
{
ex.stuffException(status);
}
}
string value;
bool present;
};
OldAttributes oldAttributes;
int ret = manager->execute(&status, &cmd, &oldAttributes);
checkSecurityResult(ret, &status, command->userName()->get(), command);
@ -346,7 +370,7 @@ void UserManagement::execute(USHORT id)
commands[id] = NULL;
}
void UserManagement::list(Auth::IUser* u)
void UserManagement::list(Firebird::IUser* u)
{
RecordBuffer* buffer = getData(rel_sec_users);
Record* record = buffer->getTempRecord();
@ -453,31 +477,6 @@ RecordBuffer* UserManagement::getList(thread_db* tdbb, jrd_rel* relation)
allocBuffer(threadDbb, *pool, rel_sec_users);
allocBuffer(threadDbb, *pool, rel_sec_user_attributes);
class FillSnapshot : public Firebird::AutoIface<Auth::IListUsers, FB_AUTH_LIST_USERS_VERSION>
{
public:
explicit FillSnapshot(UserManagement* um)
: userManagement(um)
{ }
// IListUsers implementation
void FB_CARG list(IStatus* status, Auth::IUser* user)
{
try
{
MasterInterfacePtr()->upgradeInterface(user, FB_AUTH_USER_VERSION, upInfo);
userManagement->list(user);
}
catch (const Firebird::Exception& ex)
{
ex.stuffException(status);
}
}
private:
UserManagement* userManagement;
};
FillSnapshot fillSnapshot(this);
LocalStatus status;

View File

@ -29,7 +29,7 @@
#include "../jrd/ibase.h"
#include "../jrd/Monitoring.h"
#include "../jrd/recsrc/RecordSource.h"
#include "firebird/Auth.h"
#include "firebird/Interface.h"
#include "../common/security.h"
namespace Jrd {
@ -67,14 +67,14 @@ public:
// return users list for SEC$USERS
RecordBuffer* getList(thread_db* tdbb, jrd_rel* relation);
// callback for users display
void list(Auth::IUser* u);
void list(Firebird::IUser* u);
private:
thread_db* threadDbb;
Firebird::HalfStaticArray<Auth::DynamicUserData*, 8> commands;
Auth::IManagement* manager;
Firebird::IManagement* manager;
static void checkSecurityResult(int errcode, Firebird::IStatus* status, const char* userName, Auth::IUser* user);
static void checkSecurityResult(int errcode, Firebird::IStatus* status, const char* userName, Firebird::IUser* user);
};
} // namespace

View File

@ -32,7 +32,7 @@
#include "../common/classes/array.h"
#include "../common/classes/File.h"
#include "firebird/Provider.h"
#include "firebird/Interface.h"
#include "../common/classes/ImplementHelper.h"
#include "../common/dsc.h"

View File

@ -428,4 +428,6 @@ const int DDL_TRIGGER_DROP_MAPPING = 47;
const TraNumber MAX_TRA_NUMBER = ~TraNumber(0);
#define CURRENT_ENGINE "Engine12"
#endif // JRD_CONSTANTS_H

View File

@ -29,7 +29,7 @@
#include "../common/isc_s_proto.h"
#include "../common/file_params.h"
#include "../jrd/que.h"
#include "firebird/Provider.h"
#include "firebird/Interface.h"
// Global section header

View File

@ -1140,7 +1140,7 @@ void EXE_execute_triggers(thread_db* tdbb,
EXE_start(tdbb, trigger, transaction);
const bool ok = (trigger->req_operation != jrd_req::req_unwind);
trace.finish(ok ? res_successful : res_failed);
trace.finish(ok ? Firebird::ITraceConnection::TRACE_RESULT_SUCCESS : Firebird::ITraceConnection::TRACE_RESULT_FAILED);
EXE_unwind(tdbb, trigger);
trigger->req_attachment = NULL;

View File

@ -141,11 +141,11 @@ void IbUtil::initialize()
#ifdef WIN_NT
// using bin folder
if (tryLibrary(fb_utils::getPrefix(Firebird::DirType::FB_DIR_BIN, LIBNAME), message[1]))
if (tryLibrary(fb_utils::getPrefix(Firebird::IConfigManager::FB_DIR_BIN, LIBNAME), message[1]))
return;
// using firebird root (takes into account environment settings)
if (tryLibrary(fb_utils::getPrefix(Firebird::DirType::FB_DIR_CONF, LIBNAME), message[2]))
if (tryLibrary(fb_utils::getPrefix(Firebird::IConfigManager::FB_DIR_CONF, LIBNAME), message[2]))
return;
#else
// using install directory
@ -153,11 +153,11 @@ void IbUtil::initialize()
return;
// using firebird root (takes into an account environment settings)
if (tryLibrary(fb_utils::getPrefix(Firebird::DirType::FB_DIR_CONF, "lib/" LIBNAME), message[1]))
if (tryLibrary(fb_utils::getPrefix(Firebird::IConfigManager::FB_DIR_CONF, "lib/" LIBNAME), message[1]))
return;
// using libraries directory
if (tryLibrary(fb_utils::getPrefix(Firebird::DirType::FB_DIR_LIB, LIBNAME), message[2]))
if (tryLibrary(fb_utils::getPrefix(Firebird::IConfigManager::FB_DIR_LIB, LIBNAME), message[2]))
return;
#endif // WIN_NT

Some files were not shown because too many files have changed in this diff Show More