Firebird 3: provider-based architecture, plugins and OO approach to API Alex Peshkov Firebird Foundation 2011
Architectural goals of Firebird3 <ul><li>Provide more and better ways for users to extend functionality of firebird </li><...
Providers – based architecture (OSRI) Providers Clients YValve Network listener User program (isql, php, etc.) Engine8_11 ...
Server with additional provider Providers Clients YValve Network listener ODBC gate Engine12
Server with additional provider <ul><li>EXECUTE STATEMENT 'ODBC SPECIFIC OPERATOR' </li></ul><ul><li>ON EXTERNAL 'ODBC://o...
Client with additional provider Providers Clients YValve User program Engine12 Cache Network redirector
Client with additional provider <ul><li>Client: </li></ul><ul><ul><li>Attach Database 'CACHE://SRV/dbAlias' </li></ul></ul...
Plugins <ul><li>Provide almost unlimited capabilities of extending firebird with what user needs </li></ul><ul><ul><li>UDF...
Plugins <ul><li>May be plugged only into specially prepared points of main firebird code </li></ul><ul><li>Firebird 3 will...
Plugins <ul><li>Have interface, specific for each predefined point in firebird code </li></ul><ul><li>Have common rules of...
Plugins and providers-base architecture <ul><li>Provider is invoked from specific point of a code (from yValve) </li></ul>...
Choosing API <ul><li>Functional API </li></ul><ul><ul><li>Follows existing (isc_attach_database) style </li></ul></ul><ul>...
<ul><li>Firebird API contains 2 types of objects: </li></ul><ul><ul><li>Interface - C++ class with pure-virtual only funct...
<ul><li>Firebird API contains 2 types of objects: </li></ul><ul><ul><li>Structure - C struct, containing POD (plain old da...
<ul><li>Provides access to other interfaces </li></ul><ul><li>Stands separate from the others, cause created (from user PO...
Common rules <ul><li>All interfaces are derived from IVersioned, IDisposable or IRefCounted (last two are also derived fro...
IVersioned – version of interface <ul><li>Firebird interfaces are not COM interfaces – we support multiple versions of sam...
IVersioned – version of interface <ul><ul><li>class IVersioned { </li></ul></ul><ul><ul><li>int getVersion(); </li></ul></...
IVersioned – version of interface <ul><li>Upgrade is supported by IVersioned and function: </li></ul><ul><ul><li>IMaster::...
IVersioned – version of interface <ul><li>Samples of missingFunctionClass </li></ul><ul><ul><li>class NoEntrypoint { </li>...
IVersioned – version of interface <ul><li>Calling functions in upgraded interface </li></ul><ul><ul><li>class IService : p...
Explicit lifetime control <ul><li>Required when interface is created at one place and destroyed at another </li></ul><ul><...
Explicit lifetime control <ul><li>IRefCounted – OK to pass across thread boundary, can be destroyed by any thread in safe ...
IPluginBase <ul><li>Base interface for all primary plugin interfaces </li></ul><ul><ul><li>class IPluginBase : public IRef...
IPluginFactory <ul><li>Created by plugin module to register plugin in firebird: </li></ul><ul><ul><li>class IPluginFactory...
Interfaces hierarchy IVersioned IMaster IDisposable IRefCounted IPluginBase IPluginFactory IStatus IPluginConfig IService ...
C++ wrapper over interfaces <ul><li>Helps to perform repeating tasks when working with interfaces </li></ul><ul><ul><li>cl...
C++ wrapper over interfaces <ul><li>Other useful templates: </li></ul><ul><ul><li>template <class C, int V> class AutoIfac...
Configuring plugins <ul><li>List of plugins to be used </li></ul><ul><ul><li>Set in firebird.conf for each plugin type </l...
Configuring plugins <ul><li>Plugin's specific configuration </li></ul><ul><ul><li>Depends only upon plugin itself </li></u...
Configuring plugins <ul><li>New configurartion file plugins.conf </li></ul><ul><ul><li>Has 2 types of records – config and...
Configuring plugins <ul><li>Plugin record format: </li></ul><ul><ul><li>Plugin = Name { </li></ul></ul><ul><ul><li>Module ...
Configuring plugins <ul><li>When we need plugins.conf </li></ul><ul><ul><li>Names conflict in 2 plugins, taken from differ...
Configuring plugins <ul><li>When we need plugins.conf </li></ul><ul><ul><li>Use same plugin with different configuration <...
Accessing configuration data from plugin <ul><li>Configuration is passed to plugin when it is created: </li></ul><ul><ul><...
Accessing configuration data from plugin <ul><li>IPluginConfig layout </li></ul><ul><ul><li>class IPluginConfig : public I...
Accessing configuration data from plugin <ul><li>IConfig and IConfigEntry layout </li></ul><ul><ul><li>class IConfig : pub...
Accessing configuration data from plugin <ul><li>Sample </li></ul><ul><ul><li>IConfig* group(IConfig* iConf, char* entry) ...
Accessing firebird.conf from plugin <ul><li>Accessing global file </li></ul><ul><ul><li>iPluginMgr->getConfig(“$(root)/fir...
Accessing firebird.conf from plugin <ul><li>Sample – from secure remote passwords </li></ul><ul><ul><li>IFirebirdConf* cnf...
Using OO provider's API <ul><li>Main provider's API - IProvider </li></ul><ul><ul><li>class IProvider : public IPluginBase...
Using OO provider's API <ul><li>Clients get access to provider's API using IMaster interface: </li></ul><ul><ul><li>IStatu...
Provider's interfaces IProvider attachService() attachDatabase() startTransaction() allocateStatement() IAttachment compil...
Provider's interfaces <ul><li>IStatement – new message description </li></ul><ul><ul><li>class IStatement : public IVersio...
Provider's interfaces <ul><li>IEvents – new name, old object </li></ul><ul><ul><li>class IEventCallback : public Iversione...
Provider's interfaces <ul><ul><li>class IParametersMetadata : public IVersioned { </li></ul></ul><ul><ul><li>int getCount(...
Provider's interfaces <ul><li>ITransaction – new API functions, related with 2PC (distributed transactions) </li></ul><ul>...
Distributed transactions coordinator <ul><li>Starting transaction in single database </li></ul><ul><ul><li>IAttachment::st...
Distributed transactions coordinator <ul><li>DTC interface </li></ul><ul><ul><li>class IDtc : public Iversioned { </li></u...
Distributed transactions coordinator <ul><li>Sample A </li></ul><ul><ul><li>DtcStart comp[2] = { {att1, 0, 0}, {att2, 0, 0...
Master interface <ul><ul><li>class IMaster : public IVersioned { </li></ul></ul><ul><ul><li>IStatus* getStatus(); </li></u...
External Engine <ul><ul><li>class ExternalEngine : public IPluginBase { </li></ul></ul><ul><ul><li>ExternalFunction* makeF...
External Engine <ul><li>Interfaces used </li></ul><ul><ul><li>ExternalContext – attachment of external engine to database....
External Engine <ul><li>Interfaces exported – procedure, triger and function </li></ul><ul><ul><li>class ExternalProcedure...
External Engine <ul><li>Existing plugins: </li></ul><ul><ul><li>UDR – user defined routines on C/C++ </li></ul></ul><ul><u...
External Engine <ul><li>JAVA sample – Java class </li></ul><ul><ul><li>public class FbRegex { </li></ul></ul><ul><ul><li>p...
External Engine <ul><li>JAVA sample – SQL operator </li></ul><ul><ul><li>create function regex_replace ( </li></ul></ul><u...
External Engine <ul><li>UDR sample – C++ boost-enhanced </li></ul><ul><ul><li>FB_UDR_BEGIN_PROCEDURE(gen_rows2) </li></ul>...
External Engine <ul><li>UDR sample – SQL operator </li></ul><ul><ul><li>create procedure gen_rows2 ( </li></ul></ul><ul><u...
Trace <ul><ul><li>class TraceFactory : public IPluginBase { </li></ul></ul><ul><ul><li>ntrace_mask_t /*64 bit*/ trace_need...
Trace <ul><ul><li>class TraceConnection : public IVersioned { </li></ul></ul><ul><ul><li>int getConnectionID(); </li></ul>...
Trace <ul><ul><li>class TracePlugin : public IRefCounted { </li></ul></ul><ul><ul><li>char* trace_get_error(); </li></ul><...
Authentication <ul><li>3 types of authentication plugins: </li></ul><ul><ul><li>Server – checks whether client correct or ...
Authentication <ul><ul><li>class IAuthServer : public IPluginBase { </li></ul></ul><ul><ul><li>AuthResult  authenticate(IS...
Authentication <ul><ul><li>class IAuthClient : public IPluginBase { </li></ul></ul><ul><ul><li>AuthResult  authenticate(IS...
Authentication <ul><li>4 plugins in firebird 3 </li></ul><ul><ul><li>Secure remote password protocol </li></ul></ul><ul><u...
Secure remote password <ul><li>Up to 20 symbols in password </li></ul><ul><li>Password is never passed over the wire </li>...
Authentication <ul><ul><li>class IManagement : public IPluginBase { </li></ul></ul><ul><ul><li>void start(IStatus* status,...
Authentication <ul><ul><li>class ILogonInfo : public IVersioned { </li></ul></ul><ul><ul><li>char* FB_CARG name(); </li></...
Authentication <ul><ul><li>class IUser : public IVersioned { </li></ul></ul><ul><ul><li>int operation(); </li></ul></ul><u...
Authentication <ul><ul><li>class IUserField : public IVersioned { </li></ul></ul><ul><ul><li>int entered(); </li></ul></ul...
Crypt <ul><ul><li>class ICrypt : public IPluginBase { </li></ul></ul><ul><ul><li>void setKey(IStatus* status, int length, ...
Thanks for your attention!
Upcoming SlideShare
Loading in...5
×

Firebird 3: provider-based architecture, plugins and OO approach to API

2,747

Published on

This session will be devoted to the architecture of Firebird 3:
The Interface-based API of plugins, and its configuration (which can be done separately for each database)
OSRI (Open Systems Relational Interface) implementation with plugins (more details about OSRI)
Non-SQL stored procedures and triggers with plugins
Safe passwords and network encryption
Trace plugin and more
Who would be interested in this topic?
The plugins API in Firebird 3 is designed to significantly improve the capabilities of embedding external code.

There will be areas of extension which will allow the following:
external triggers and procedures (written in almost any programming language)
custom trace plugins
security plugins to implement custom users identification (biometrics, etc)
traffic encryption using algorithms others than SHA1 and RC4
Special attention will be devoted to non-standard providers, such as bridges to external (non-Firebird) databases or ODBC connection and caching abilities.

Published in: Technology, Education
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
2,747
On Slideshare
0
From Embeds
0
Number of Embeds
5
Actions
Shares
0
Downloads
21
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Firebird 3: provider-based architecture, plugins and OO approach to API

  1. 1. Firebird 3: provider-based architecture, plugins and OO approach to API Alex Peshkov Firebird Foundation 2011
  2. 2. Architectural goals of Firebird3 <ul><li>Provide more and better ways for users to extend functionality of firebird </li></ul><ul><li>How to do it: </li></ul><ul><ul><li>Introduce (or may be restore ?) provider-based architecture </li></ul></ul><ul><ul><li>Introduce (or may be extend ?) plugins </li></ul></ul>
  3. 3. Providers – based architecture (OSRI) Providers Clients YValve Network listener User program (isql, php, etc.) Engine8_11 Engine12 Network redirector
  4. 4. Server with additional provider Providers Clients YValve Network listener ODBC gate Engine12
  5. 5. Server with additional provider <ul><li>EXECUTE STATEMENT 'ODBC SPECIFIC OPERATOR' </li></ul><ul><li>ON EXTERNAL 'ODBC://odbc_datasource_name' </li></ul><ul><li>Engine12: </li></ul><ul><ul><li>Attach Database 'ODBC://odbc_datasource_name' </li></ul></ul><ul><li>YValve: </li></ul><ul><ul><li>Tries known providers, including ODBC gate </li></ul></ul><ul><li>ODBC gate: </li></ul><ul><ul><li>Recognizes 'ODBC://' prefix </li></ul></ul><ul><ul><li>Calls appropriate ODBC function to establish connection </li></ul></ul>
  6. 6. Client with additional provider Providers Clients YValve User program Engine12 Cache Network redirector
  7. 7. Client with additional provider <ul><li>Client: </li></ul><ul><ul><li>Attach Database 'CACHE://SRV/dbAlias' </li></ul></ul><ul><li>Yvalve: </li></ul><ul><ul><li>Tries known providers, including CACHE </li></ul></ul><ul><li>CACHE: </li></ul><ul><ul><li>Recognizes 'CACHE://' prefix </li></ul></ul><ul><ul><li>Can use 'INET://somehost/dbAlias' to access remote data </li></ul></ul><ul><ul><li>Can use embedded connection to access cached data </li></ul></ul>
  8. 8. Plugins <ul><li>Provide almost unlimited capabilities of extending firebird with what user needs </li></ul><ul><ul><li>UDFs and blob filters are also a kind of plugins with specific interface and calling rules </li></ul></ul><ul><li>Require (like UDFs) special care to avoid malicious code, executed in server context </li></ul><ul><ul><li>all plugins, not described explicitly in configuration file, are loaded from $(root)/plugins, slash in names is not permitted </li></ul></ul><ul><ul><li>if one provides path information in explicit plugin description – he should care about it himself </li></ul></ul>
  9. 9. Plugins <ul><li>May be plugged only into specially prepared points of main firebird code </li></ul><ul><li>Firebird 3 will support the following types of plugins: </li></ul><ul><ul><li>Trace; </li></ul></ul><ul><ul><li>External engines; </li></ul></ul><ul><ul><li>Authentication (server/client) and users' management; </li></ul></ul><ul><ul><li>Crypt (network and may be database). </li></ul></ul>
  10. 10. Plugins <ul><li>Have interface, specific for each predefined point in firebird code </li></ul><ul><li>Have common rules of load/unload and configuration </li></ul><ul><li>Have common interface, controlling that common features </li></ul>
  11. 11. Plugins and providers-base architecture <ul><li>Provider is invoked from specific point of a code (from yValve) </li></ul><ul><li>Providers should be loaded/unloaded to/from firebird process address space </li></ul><ul><li>Providers can and should be treated as a special kind of plugins </li></ul><ul><ul><li>this avoids adding special code, duplicating one for plugins </li></ul></ul>
  12. 12. Choosing API <ul><li>Functional API </li></ul><ul><ul><li>Follows existing (isc_attach_database) style </li></ul></ul><ul><li>Object-oriented API </li></ul><ul><ul><li>Used in a lot of modern software </li></ul></ul><ul><ul><li>Saves resources when loading plugin </li></ul></ul><ul><li>Backward compatibility at yValve level for providers API </li></ul>
  13. 13. <ul><li>Firebird API contains 2 types of objects: </li></ul><ul><ul><li>Interface - C++ class with pure-virtual only functions; </li></ul></ul><ul><ul><ul><li>class IIntUserField : public IUserField </li></ul></ul></ul><ul><ul><ul><li>{ </li></ul></ul></ul><ul><ul><ul><li>public: </li></ul></ul></ul><ul><ul><ul><li>virtual int FB_CARG get() = 0; </li></ul></ul></ul><ul><ul><ul><li>virtual void FB_CARG set(int newValue) = 0; </li></ul></ul></ul><ul><ul><ul><li>}; </li></ul></ul></ul><ul><ul><ul><li>Simplified form, used later </li></ul></ul></ul><ul><ul><ul><li>class IIntUserField : public IUserField </li></ul></ul></ul><ul><ul><ul><li>{ </li></ul></ul></ul><ul><ul><ul><li>int get(); </li></ul></ul></ul><ul><ul><ul><li>void set(int newValue); </li></ul></ul></ul><ul><ul><ul><li>}; </li></ul></ul></ul>Interfaces
  14. 14. <ul><li>Firebird API contains 2 types of objects: </li></ul><ul><ul><li>Structure - C struct, containing POD (plain old data) only; </li></ul></ul><ul><ul><ul><li>struct FbMessage </li></ul></ul></ul><ul><ul><ul><li>{ </li></ul></ul></ul><ul><ul><ul><li>const unsigned char* blr; </li></ul></ul></ul><ul><ul><ul><li>unsigned char* buffer; </li></ul></ul></ul><ul><ul><ul><li>unsigned int blrLength; </li></ul></ul></ul><ul><ul><ul><li>unsigned int bufferLength; </li></ul></ul></ul><ul><ul><ul><li>}; </li></ul></ul></ul>Interfaces
  15. 15. <ul><li>Provides access to other interfaces </li></ul><ul><li>Stands separate from the others, cause created (from user POV) not by any other interface, but by API function: </li></ul><ul><ul><li>IMaster* fb_get_master_interface(); </li></ul></ul><ul><li>This is the only one new API function, required to support OO API </li></ul>Master interface
  16. 16. Common rules <ul><li>All interfaces are derived from IVersioned, IDisposable or IRefCounted (last two are also derived from IVersioned). </li></ul><ul><li>All plugins are derived from IPluginBase (derived from IRefCounted). </li></ul><ul><li>Interfaces guaranteed lifetime: </li></ul><ul><ul><li>IRefCounted – as long as not released last time, </li></ul></ul><ul><ul><li>IDisposable – as long as not disposed, </li></ul></ul><ul><ul><li>non of this (just versioned) – according to lifetime of outer object (which created that interface) </li></ul></ul>
  17. 17. IVersioned – version of interface <ul><li>Firebird interfaces are not COM interfaces – we support multiple versions of same interface. </li></ul><ul><li>Interface version can be upgraded by code, receiving interface from other module. </li></ul><ul><li>Interface version is always equal to total number of virtual functions in it. </li></ul><ul><li>Use of upgraded interface does not cause any delays when using it's functions. </li></ul>
  18. 18. IVersioned – version of interface <ul><ul><li>class IVersioned { </li></ul></ul><ul><ul><li>int getVersion(); </li></ul></ul><ul><ul><li>IPluginModule* getModule(); </li></ul></ul><ul><ul><li>}; </li></ul></ul>
  19. 19. IVersioned – version of interface <ul><li>Upgrade is supported by IVersioned and function: </li></ul><ul><ul><li>IMaster::upgradeInterface( </li></ul></ul><ul><ul><li>IVersioned* toUpgrade, </li></ul></ul><ul><ul><li>int desiredVersion, </li></ul></ul><ul><ul><li>struct UpgradeInfo* upgradeInfo). </li></ul></ul><ul><ul><li>struct UpgradeInfo </li></ul></ul><ul><ul><li>{ </li></ul></ul><ul><ul><li>void* missingFunctionClass; </li></ul></ul><ul><ul><li>IPluginModule* clientModule; </li></ul></ul><ul><ul><li>}; </li></ul></ul>
  20. 20. IVersioned – version of interface <ul><li>Samples of missingFunctionClass </li></ul><ul><ul><li>class NoEntrypoint { </li></ul></ul><ul><ul><li>virtual void FB_CARG noEntry(IStatus* s) { </li></ul></ul><ul><ul><li>s->set(Arg::Gds(isc_wish_list).value()); </li></ul></ul><ul><ul><li>} </li></ul></ul><ul><ul><li>}; </li></ul></ul><ul><ul><li>class IgnoreMissing { </li></ul></ul><ul><ul><li>virtual int FB_CARG noEvent() { </li></ul></ul><ul><ul><li>return 1; </li></ul></ul><ul><ul><li>} </li></ul></ul><ul><ul><li>} </li></ul></ul>
  21. 21. IVersioned – version of interface <ul><li>Calling functions in upgraded interface </li></ul><ul><ul><li>class IService : public IRefCounted </li></ul></ul><ul><ul><li>{ </li></ul></ul><ul><ul><li>void detach(IStatus* status); </li></ul></ul><ul><ul><li>void query(IStatus* status, </li></ul></ul><ul><ul><li>int sendLength, char* sendItems, </li></ul></ul><ul><ul><li>int receiveLength, char* receiveItems, </li></ul></ul><ul><ul><li>int bufferLength, char* buffer); </li></ul></ul><ul><ul><li>void start(IStatus* status, </li></ul></ul><ul><ul><li>int spbLength, char* spb); </li></ul></ul><ul><ul><li>}; </li></ul></ul>
  22. 22. Explicit lifetime control <ul><li>Required when interface is created at one place and destroyed at another </li></ul><ul><li>IDisposable – used in interfaces, not intended to be passed from thread to thread </li></ul><ul><ul><li>class IDisposable : public IVersioned { </li></ul></ul><ul><ul><li>void FB_CARG dispose(); </li></ul></ul><ul><ul><li>}; </li></ul></ul><ul><li>Used as base for IStatus </li></ul>
  23. 23. Explicit lifetime control <ul><li>IRefCounted – OK to pass across thread boundary, can be destroyed by any thread in safe way </li></ul><ul><ul><li>class IRefCounted : public IVersioned </li></ul></ul><ul><ul><li>{ </li></ul></ul><ul><ul><li>void addRef(); </li></ul></ul><ul><ul><li>int release(); </li></ul></ul><ul><ul><li>}; </li></ul></ul><ul><li>Base of many interfaces, including IPluginBase </li></ul>
  24. 24. IPluginBase <ul><li>Base interface for all primary plugin interfaces </li></ul><ul><ul><li>class IPluginBase : public IRefCounted { </li></ul></ul><ul><ul><li>void setOwner(IRefCounted*); </li></ul></ul><ul><ul><li>IRefCounted* getOwner(); </li></ul></ul><ul><ul><li>}; </li></ul></ul><ul><li>Plays key role when unloading plugin module from process space </li></ul>
  25. 25. IPluginFactory <ul><li>Created by plugin module to register plugin in firebird: </li></ul><ul><ul><li>class IPluginFactory : public IVersioned { </li></ul></ul><ul><ul><li>IPluginBase* createPlugin </li></ul></ul><ul><ul><li>(IPluginConfig* factoryParameter); </li></ul></ul><ul><ul><li>}; </li></ul></ul><ul><li>Registered in plugin manager: </li></ul><ul><ul><li>IPluginManager::registerPluginFactory </li></ul></ul><ul><ul><li>(int pluginType, </li></ul></ul><ul><ul><li>char* name, </li></ul></ul><ul><ul><li>IPluginFactory* factory) </li></ul></ul>
  26. 26. Interfaces hierarchy IVersioned IMaster IDisposable IRefCounted IPluginBase IPluginFactory IStatus IPluginConfig IService IProvider ExternalEngine
  27. 27. C++ wrapper over interfaces <ul><li>Helps to perform repeating tasks when working with interfaces </li></ul><ul><ul><li>class Abc: public IVersionedIface { .... } </li></ul></ul><ul><ul><li>#define ABC_VERSION (FB_VERSIONED_VERSION + 3) </li></ul></ul><ul><ul><li>template <class C, int V> class VersionedIface; </li></ul></ul><ul><ul><li>Abc* abcInstance = </li></ul></ul><ul><ul><li>new VersionedIface<Abc, ABC_VERSION>; </li></ul></ul>
  28. 28. C++ wrapper over interfaces <ul><li>Other useful templates: </li></ul><ul><ul><li>template <class C, int V> class AutoIface; </li></ul></ul><ul><ul><li>template <class C, int V> class DisposeIface; </li></ul></ul><ul><ul><li>template <class C, int V> class RefCntIface; </li></ul></ul><ul><ul><ul><li>missing release() method </li></ul></ul></ul><ul><ul><li>template <class C, int V> class StdPlugin; </li></ul></ul><ul><ul><li>template <class P> SimpleFactory; </li></ul></ul>
  29. 29. Configuring plugins <ul><li>List of plugins to be used </li></ul><ul><ul><li>Set in firebird.conf for each plugin type </li></ul></ul><ul><ul><li>Default values: </li></ul></ul><ul><ul><li>AuthServer = Srp, Win_Sspi </li></ul></ul><ul><ul><li>AuthClient = Srp, Win_Sspi, Legacy_Auth </li></ul></ul><ul><ul><li>UserManager = Srp </li></ul></ul><ul><ul><li>TracePlugin = fbtrace </li></ul></ul><ul><ul><li>Providers = Remote,Engine12,Loopback </li></ul></ul>
  30. 30. Configuring plugins <ul><li>Plugin's specific configuration </li></ul><ul><ul><li>Depends only upon plugin itself </li></ul></ul><ul><li>Advantages of using standard configuration </li></ul><ul><ul><li>Saves time/efforts when writing plugin code </li></ul></ul><ul><ul><li>Plugin's users configure it in familiar manner </li></ul></ul><ul><li>Standard configuration methods </li></ul><ul><ul><li>File of predefined format [param=value] in predefined place [$(root)/plugins/] </li></ul></ul><ul><ul><li>Record in common for all plugins file </li></ul></ul>
  31. 31. Configuring plugins <ul><li>New configurartion file plugins.conf </li></ul><ul><ul><li>Has 2 types of records – config and plugin </li></ul></ul><ul><li>Config record – stores plugin-specific data </li></ul><ul><ul><li>Config = ConfName { </li></ul></ul><ul><ul><li>Param1 = Value1 </li></ul></ul><ul><ul><li>Param2 = Value2 </li></ul></ul><ul><ul><li>} </li></ul></ul><ul><li>Plugin record - sets rules of plugin's loading </li></ul>
  32. 32. Configuring plugins <ul><li>Plugin record format: </li></ul><ul><ul><li>Plugin = Name { </li></ul></ul><ul><ul><li>Module = /path/to/module </li></ul></ul><ul><ul><li>RegisterName = regName </li></ul></ul><ul><ul><li>Config = ConfName </li></ul></ul><ul><ul><li>ConfigFile = /path/to/file </li></ul></ul><ul><ul><li>} </li></ul></ul><ul><li>Defaults: </li></ul><ul><ul><li>Plugin = % { </li></ul></ul><ul><ul><li>Module = $(root)/plugins/% </li></ul></ul><ul><ul><li>RegisterName = % </li></ul></ul><ul><ul><li>ConfigFile = $(root)/plugins/%.conf </li></ul></ul><ul><ul><li>} </li></ul></ul>
  33. 33. Configuring plugins <ul><li>When we need plugins.conf </li></ul><ul><ul><li>Names conflict in 2 plugins, taken from different places </li></ul></ul><ul><ul><li>Plugin = Crypt1 { </li></ul></ul><ul><ul><ul><li>Module = $(root)/plugins/Crypt1 </li></ul></ul></ul><ul><ul><ul><li>RegisterName = BestCrypt </li></ul></ul></ul><ul><ul><li>} </li></ul></ul><ul><ul><li>Plugin = Crypt2 { </li></ul></ul><ul><ul><ul><li>#Module = $(root)/plugins/Crypt2 </li></ul></ul></ul><ul><ul><ul><li>RegisterName = BestCrypt </li></ul></ul></ul><ul><ul><li>} </li></ul></ul>
  34. 34. Configuring plugins <ul><li>When we need plugins.conf </li></ul><ul><ul><li>Use same plugin with different configuration </li></ul></ul><ul><ul><li>Plugin = first { </li></ul></ul><ul><ul><ul><li>Module = $(root)/plugins/abc </li></ul></ul></ul><ul><ul><ul><li>RegisterName = abc </li></ul></ul></ul><ul><ul><ul><li>#ConfigFile = $(root)/plugins/first.conf </li></ul></ul></ul><ul><ul><li>} </li></ul></ul><ul><ul><li>Plugin = second { </li></ul></ul><ul><ul><ul><li>Module = $(root)/plugins/abc </li></ul></ul></ul><ul><ul><ul><li>RegisterName = abc </li></ul></ul></ul><ul><ul><li>} </li></ul></ul>
  35. 35. Accessing configuration data from plugin <ul><li>Configuration is passed to plugin when it is created: </li></ul><ul><ul><li>IPluginBase* IPluginFactory::createPlugin (IPluginConfig* factoryParameter) </li></ul></ul><ul><li>Typical implementation (in SimpleFactory): </li></ul><ul><ul><li>IPluginBase* createPlugin(IPluginConfig* fPar) </li></ul></ul><ul><ul><li>{ </li></ul></ul><ul><ul><li>P* plugin = new P(fPar); </li></ul></ul><ul><ul><li>plugin->addRef(); </li></ul></ul><ul><ul><li>return plugin; </li></ul></ul><ul><ul><li>} </li></ul></ul>
  36. 36. Accessing configuration data from plugin <ul><li>IPluginConfig layout </li></ul><ul><ul><li>class IPluginConfig : public IRefCounted { </li></ul></ul><ul><ul><li>const char* getConfigFileName(); </li></ul></ul><ul><ul><li>IConfig* getDefaultConfig(); </li></ul></ul><ul><ul><li>IFirebirdConf* getFirebirdConf(); </li></ul></ul><ul><ul><li>}; </li></ul></ul><ul><li>Related method in IPluginManager </li></ul><ul><ul><li>IConfig* getConfig(const char* filename); </li></ul></ul>
  37. 37. Accessing configuration data from plugin <ul><li>IConfig and IConfigEntry layout </li></ul><ul><ul><li>class IConfig : public IRefCounted { </li></ul></ul><ul><ul><li>IConfigEntry* find(const char* name); </li></ul></ul><ul><ul><li>IConfigEntry* findValue(char* name, char* val); </li></ul></ul><ul><ul><li>IConfigEntry* findPos(char* name, int pos); </li></ul></ul><ul><ul><li>}; </li></ul></ul><ul><ul><li>class IConfigEntry : public IRefCounted { </li></ul></ul><ul><ul><li>const char* getName(); </li></ul></ul><ul><ul><li>const char* getValue(); </li></ul></ul><ul><ul><li>IConfig* getSubConfig(); </li></ul></ul><ul><ul><li>}; </li></ul></ul>
  38. 38. Accessing configuration data from plugin <ul><li>Sample </li></ul><ul><ul><li>IConfig* group(IConfig* iConf, char* entry) </li></ul></ul><ul><ul><li>{ </li></ul></ul><ul><ul><li>IConfigEntry* ce = findValue(“Group”, entry); </li></ul></ul><ul><ul><li>return ce ? ce->getSubConfig() : NULL; </li></ul></ul><ul><ul><li>} </li></ul></ul><ul><ul><li>int count(IConfig* iConf, char* param) </li></ul></ul><ul><ul><li>{ </li></ul></ul><ul><ul><li>int n; </li></ul></ul><ul><ul><li>for (n = 0; iConf->findPos(param, n); ++n); </li></ul></ul><ul><ul><li>return n; </li></ul></ul><ul><ul><li>}; </li></ul></ul>
  39. 39. Accessing firebird.conf from plugin <ul><li>Accessing global file </li></ul><ul><ul><li>iPluginMgr->getConfig(“$(root)/firebird.conf”); </li></ul></ul><ul><li>Accessing per-database configuration </li></ul><ul><ul><li>class IFirebirdConf : public IRefCounted { </li></ul></ul><ul><ul><li>int getKey(char* name); </li></ul></ul><ul><ul><li>int asInteger(int key); </li></ul></ul><ul><ul><li>const char* asString(unsigned int key); </li></ul></ul><ul><ul><li>}; </li></ul></ul>
  40. 40. Accessing firebird.conf from plugin <ul><li>Sample – from secure remote passwords </li></ul><ul><ul><li>IFirebirdConf* cnf; </li></ul></ul><ul><ul><li>SrpManagement(IPluginConfig* par) </li></ul></ul><ul><ul><li>: cnf(par->getFirebirdConf()) </li></ul></ul><ul><ul><li>{ } </li></ul></ul><ul><ul><li>void start(IStatus* status, ILogonInfo* logonInfo) </li></ul></ul><ul><ul><li>{ </li></ul></ul><ul><ul><li>int dbKey = cnf->getKey(&quot;SecurityDatabase&quot;); </li></ul></ul><ul><ul><li>char* secDbName = config->asString(dbKey); </li></ul></ul>
  41. 41. Using OO provider's API <ul><li>Main provider's API - IProvider </li></ul><ul><ul><li>class IProvider : public IPluginBase { </li></ul></ul><ul><ul><li>IAttachment* attachDatabase (IStatus* status, </li></ul></ul><ul><ul><li>char* fileName, int dpbLength, char* dpb); </li></ul></ul><ul><ul><li>IAttachment* createDatabase(IStatus* status, </li></ul></ul><ul><ul><li>char* fileName, int dpbLength, char* dpb); </li></ul></ul><ul><ul><li>IService* attachServiceManager(IStatus* status, </li></ul></ul><ul><ul><li>char* service, int spbLength, char* spb); </li></ul></ul><ul><ul><li>void shutdown(IStatus* status, </li></ul></ul><ul><ul><li>int timeout, int reason); </li></ul></ul><ul><ul><li>}; </li></ul></ul>
  42. 42. Using OO provider's API <ul><li>Clients get access to provider's API using IMaster interface: </li></ul><ul><ul><li>IStatus* status = iMaster->getStatus(); </li></ul></ul><ul><ul><li>IProvider* dispatch = iMaster->getDispatcher(); </li></ul></ul><ul><ul><li>IAttachment *att = dispatch->attachDatabase </li></ul></ul><ul><ul><li>(status, “employee”, dpbLength, dpb); </li></ul></ul><ul><ul><li>dispatch->release(); </li></ul></ul><ul><ul><li>// work with attachment ... </li></ul></ul><ul><ul><li>att->detach(status); </li></ul></ul><ul><ul><li>status->release(); </li></ul></ul>
  43. 43. Provider's interfaces IProvider attachService() attachDatabase() startTransaction() allocateStatement() IAttachment compileRequest() openBlob() queEvents() IService ITransaction IStatement getParameters() IRequest IBlob IEvents IParameters Metadata
  44. 44. Provider's interfaces <ul><li>IStatement – new message description </li></ul><ul><ul><li>class IStatement : public IVersioned { </li></ul></ul><ul><ul><li>int fetch(IStatus* status, FbMessage* msg); </li></ul></ul><ul><ul><li>// … other functions </li></ul></ul><ul><ul><li>}; </li></ul></ul><ul><ul><li>isc_dsql_fetch_m(STATUS*, FB_API_HANDLE*, USHORT blr_length, SCHAR* blr, USHORT msg_length, SCHAR* msg); </li></ul></ul>
  45. 45. Provider's interfaces <ul><li>IEvents – new name, old object </li></ul><ul><ul><li>class IEventCallback : public Iversioned { </li></ul></ul><ul><ul><li>void callbackFunction(int length, char* events); </li></ul></ul><ul><ul><li>}; </li></ul></ul><ul><ul><li>IEvents* IAttachment::queEvents(IStatus* status, </li></ul></ul><ul><ul><li>IEventCallback* callback, int len, char* events); </li></ul></ul><ul><ul><li>class IEvents : public IRefCounted { </li></ul></ul><ul><ul><li>void cancel(IStatus* status); </li></ul></ul><ul><ul><li>}; </li></ul></ul>
  46. 46. Provider's interfaces <ul><ul><li>class IParametersMetadata : public IVersioned { </li></ul></ul><ul><ul><li>int getCount(IStatus* status); </li></ul></ul><ul><ul><li>char* getField(IStatus* status, int index); </li></ul></ul><ul><ul><li>char* getRelation(IStatus* status, int index); </li></ul></ul><ul><ul><li>char* getOwner(IStatus* status, int index); </li></ul></ul><ul><ul><li>char* getAlias(IStatus* status, int index); </li></ul></ul><ul><ul><li>int getType(IStatus* status, int index); </li></ul></ul><ul><ul><li>bool isNullable(IStatus* status, int index); </li></ul></ul><ul><ul><li>int getSubType(IStatus* status, int index); </li></ul></ul><ul><ul><li>int getLength(IStatus* status, int index); </li></ul></ul><ul><ul><li>int getScale(IStatus* status, int index); </li></ul></ul><ul><ul><li>}; </li></ul></ul>
  47. 47. Provider's interfaces <ul><li>ITransaction – new API functions, related with 2PC (distributed transactions) </li></ul><ul><ul><li>class ITransaction : public IRefCounted { </li></ul></ul><ul><ul><li>// prepare, commit, rollback, etc... </li></ul></ul><ul><ul><li>ITransaction* join(IStatus* status, </li></ul></ul><ul><ul><li>ITransaction* tra); </li></ul></ul><ul><ul><li>ITransaction* validate(IStatus* status, </li></ul></ul><ul><ul><li>IAttachment* attachment); </li></ul></ul><ul><ul><li>ITransaction* enterDtc(IStatus* status); </li></ul></ul><ul><ul><li>}; </li></ul></ul>
  48. 48. Distributed transactions coordinator <ul><li>Starting transaction in single database </li></ul><ul><ul><li>IAttachment::startTransaction(IStatus* status, </li></ul></ul><ul><ul><li>int tpbLength, char* tpb); </li></ul></ul><ul><li>DTC interface </li></ul><ul><ul><li>IDtc* iDtc = iMaster->getDtc(); </li></ul></ul>
  49. 49. Distributed transactions coordinator <ul><li>DTC interface </li></ul><ul><ul><li>class IDtc : public Iversioned { </li></ul></ul><ul><ul><li>ITransaction* start(IStatus* status, int cnt, </li></ul></ul><ul><ul><li>DtcStart* components); </li></ul></ul><ul><ul><li>ITransaction* join(IStatus* status, </li></ul></ul><ul><ul><li>ITransaction* one, ITransaction* two); </li></ul></ul><ul><ul><li>}; </li></ul></ul><ul><ul><li>struct DtcStart { </li></ul></ul><ul><ul><li>IAttachment* attachment; </li></ul></ul><ul><ul><li>char* tpb; </li></ul></ul><ul><ul><li>int tpbLength; </li></ul></ul><ul><ul><li>}; </li></ul></ul>
  50. 50. Distributed transactions coordinator <ul><li>Sample A </li></ul><ul><ul><li>DtcStart comp[2] = { {att1, 0, 0}, {att2, 0, 0} }; </li></ul></ul><ul><ul><li>ITransaction* distr = iDtc->start(status, 2, comp); </li></ul></ul><ul><li>Sample B </li></ul><ul><ul><li>ITransaction* t1 = </li></ul></ul><ul><ul><li>att1->startTransaction(status, 0, 0); </li></ul></ul><ul><ul><li>ITransaction* t2 = </li></ul></ul><ul><ul><li>att2->startTransaction(status, 0, 0); </li></ul></ul><ul><ul><li>ITransaction* distr = t1->join(status, t2); </li></ul></ul>
  51. 51. Master interface <ul><ul><li>class IMaster : public IVersioned { </li></ul></ul><ul><ul><li>IStatus* getStatus(); </li></ul></ul><ul><ul><li>IProvider* getDispatcher() = 0; </li></ul></ul><ul><ul><li>IPluginManager* getPluginManager(); </li></ul></ul><ul><ul><li>int upgradeInterface(IVersioned* toUpgrade, </li></ul></ul><ul><ul><li>int desiredVersion, UpgradeInfo* upInfo); </li></ul></ul><ul><ul><li>ITimerControl* getTimerControl(); </li></ul></ul><ul><ul><li>IDtc* getDtc() = 0; </li></ul></ul><ul><ul><li>}; </li></ul></ul>
  52. 52. External Engine <ul><ul><li>class ExternalEngine : public IPluginBase { </li></ul></ul><ul><ul><li>ExternalFunction* makeFunction(Error* error, </li></ul></ul><ul><ul><li>ExternalContext* context, </li></ul></ul><ul><ul><li>IRoutineMetadata* metadata, </li></ul></ul><ul><ul><li>BlrMessage* inBlr, BlrMessage* outBlr); </li></ul></ul><ul><ul><li>ExternalProcedure* makeProcedure(...); </li></ul></ul><ul><ul><li>ExternalTrigger* makeTrigger(Error* error, </li></ul></ul><ul><ul><li>ExternalContext* context, </li></ul></ul><ul><ul><li>IRoutineMetadata* metadata); </li></ul></ul><ul><ul><li>}; </li></ul></ul>
  53. 53. External Engine <ul><li>Interfaces used </li></ul><ul><ul><li>ExternalContext – attachment of external engine to database. </li></ul></ul><ul><ul><li>IRoutineMetadata – metadata of procedure /trigger /function (name, entry point, etc.) </li></ul></ul><ul><ul><li>Both interfaces passed to plugin from firebird </li></ul></ul>
  54. 54. External Engine <ul><li>Interfaces exported – procedure, triger and function </li></ul><ul><ul><li>class ExternalProcedure : public Disposable { </li></ul></ul><ul><ul><li>ExternalResultSet* open(Error* error, </li></ul></ul><ul><ul><li>ExternalContext* context, </li></ul></ul><ul><ul><li>void* inMsg, void* outMsg); </li></ul></ul><ul><ul><li>}; </li></ul></ul><ul><ul><li>class ExternalResultSet : public Disposable { </li></ul></ul><ul><ul><li>virtual bool FB_CALL fetch(Error* error); </li></ul></ul><ul><ul><li>}; </li></ul></ul>
  55. 55. External Engine <ul><li>Existing plugins: </li></ul><ul><ul><li>UDR – user defined routines on C/C++ </li></ul></ul><ul><ul><ul><li>will be install with firebird server </li></ul></ul></ul><ul><ul><li>JAVA </li></ul></ul><ul><ul><ul><li>will be isntalled with jaybird </li></ul></ul></ul>
  56. 56. External Engine <ul><li>JAVA sample – Java class </li></ul><ul><ul><li>public class FbRegex { </li></ul></ul><ul><ul><li>public static String replace(String regex, </li></ul></ul><ul><ul><li>String str, String replacement) { </li></ul></ul><ul><ul><li>return str.replaceAll(regex, replacement); </li></ul></ul><ul><ul><li>} </li></ul></ul><ul><ul><li>} </li></ul></ul>
  57. 57. External Engine <ul><li>JAVA sample – SQL operator </li></ul><ul><ul><li>create function regex_replace ( </li></ul></ul><ul><ul><li>regex varchar(60), str varchar(60), </li></ul></ul><ul><ul><li>replacement varchar(60) </li></ul></ul><ul><ul><li>) </li></ul></ul><ul><ul><li>returns varchar(60) </li></ul></ul><ul><ul><li>external name </li></ul></ul><ul><ul><li>'org.firebirdsql.example.fbjava.FbRegex.replace ( </li></ul></ul><ul><ul><li>java.lang.String, java.lang.String, </li></ul></ul><ul><ul><li>java.lang.String </li></ul></ul><ul><ul><li>) </li></ul></ul><ul><ul><li>return java.lang.String' </li></ul></ul><ul><ul><li>engine java; </li></ul></ul>
  58. 58. External Engine <ul><li>UDR sample – C++ boost-enhanced </li></ul><ul><ul><li>FB_UDR_BEGIN_PROCEDURE(gen_rows2) </li></ul></ul><ul><ul><li>FB_UDR_EXECUTE_MESSAGE_PROCEDURE </li></ul></ul><ul><ul><li>( (FB_INTEGER, start) </li></ul></ul><ul><ul><li>(FB_INTEGER, end) </li></ul></ul><ul><ul><li>, </li></ul></ul><ul><ul><li>(FB_INTEGER, result) ) </li></ul></ul><ul><ul><li>{ out->result = in->start – 1; } </li></ul></ul><ul><ul><li>FB_UDR_FETCH_PROCEDURE </li></ul></ul><ul><ul><li>{ return out->result++ < in->end; } </li></ul></ul><ul><ul><li>FB_UDR_END_PROCEDURE </li></ul></ul>
  59. 59. External Engine <ul><li>UDR sample – SQL operator </li></ul><ul><ul><li>create procedure gen_rows2 ( </li></ul></ul><ul><ul><li>start_n integer not null, </li></ul></ul><ul><ul><li>end_n integer not null </li></ul></ul><ul><ul><li>) returns ( </li></ul></ul><ul><ul><li>n integer not null </li></ul></ul><ul><ul><li>) </li></ul></ul><ul><ul><li>external name 'udrcpp_example!gen_rows2' </li></ul></ul><ul><ul><li>engine udr; </li></ul></ul>
  60. 60. Trace <ul><ul><li>class TraceFactory : public IPluginBase { </li></ul></ul><ul><ul><li>ntrace_mask_t /*64 bit*/ trace_needs(); </li></ul></ul><ul><ul><li>TracePlugin* trace_create(IStatus* status, </li></ul></ul><ul><ul><li>TraceInitInfo* init_info); </li></ul></ul><ul><ul><li>}; </li></ul></ul><ul><ul><li>class TraceInitInfo : public IVersioned { </li></ul></ul><ul><ul><li>TraceConnection* getConnection(); </li></ul></ul><ul><ul><li>TraceLogWriter* getLogWriter(); </li></ul></ul><ul><ul><li>// .......... </li></ul></ul><ul><ul><li>}; </li></ul></ul>
  61. 61. Trace <ul><ul><li>class TraceConnection : public IVersioned { </li></ul></ul><ul><ul><li>int getConnectionID(); </li></ul></ul><ul><ul><li>char* getDatabaseName(); </li></ul></ul><ul><ul><li>int FB_CARG getProcessID(); </li></ul></ul><ul><ul><li>// .... </li></ul></ul><ul><ul><li>}; </li></ul></ul><ul><ul><li>class TraceLogWriter : public IRefCounted { </li></ul></ul><ul><ul><li>size_t write(const void* buf, size_t size); </li></ul></ul><ul><ul><li>}; </li></ul></ul><ul><ul><li>Also controls audit/trace mode </li></ul></ul>
  62. 62. Trace <ul><ul><li>class TracePlugin : public IRefCounted { </li></ul></ul><ul><ul><li>char* trace_get_error(); </li></ul></ul><ul><ul><li>int trace_attach(TraceConnection* connection, </li></ul></ul><ul><ul><li>ntrace_boolean_t create_db, </li></ul></ul><ul><ul><li>ntrace_result_t att_result); </li></ul></ul><ul><ul><li>int trace_transaction_start( </li></ul></ul><ul><ul><li>TraceConnection* connection, </li></ul></ul><ul><ul><li>TraceTransaction* transaction, </li></ul></ul><ul><ul><li>size_t tpb_length, ntrace_byte_t* tpb, </li></ul></ul><ul><ul><li>ntrace_result_t tra_result); </li></ul></ul><ul><ul><li>// .................... </li></ul></ul><ul><ul><li>}; </li></ul></ul>
  63. 63. Authentication <ul><li>3 types of authentication plugins: </li></ul><ul><ul><li>Server – checks whether client correct or not </li></ul></ul><ul><ul><li>Client – prepares data for validation by server </li></ul></ul><ul><ul><li>User manager (not always required) </li></ul></ul><ul><ul><li>enum AuthResult {AUTH_SUCCESS, AUTH_CONTINUE, AUTH_FAILED, AUTH_MORE_DATA}; </li></ul></ul>
  64. 64. Authentication <ul><ul><li>class IAuthServer : public IPluginBase { </li></ul></ul><ul><ul><li>AuthResult authenticate(IStatus* status, </li></ul></ul><ul><ul><li>AuthServerBlock* sBlock, IAuthPar* par); </li></ul></ul><ul><ul><li>AuthResult getSessionKey(IStatus* status, </li></ul></ul><ul><ul><li>char** key, int* keyLen); </li></ul></ul><ul><ul><li>}; </li></ul></ul><ul><ul><li>class AuthServerBlock : public IVersioned { </li></ul></ul><ul><ul><li>char* getLogin(); </li></ul></ul><ul><ul><li>char* getData(int* length); </li></ul></ul><ul><ul><li>void putData(int length, void* data); </li></ul></ul><ul><ul><li>}; </li></ul></ul>
  65. 65. Authentication <ul><ul><li>class IAuthClient : public IPluginBase { </li></ul></ul><ul><ul><li>AuthResult authenticate(IStatus* status, </li></ul></ul><ul><ul><li>AuthClientBlock* sBlock); </li></ul></ul><ul><ul><li>AuthResult getSessionKey(IStatus* status, </li></ul></ul><ul><ul><li>char** key, int* keyLen); </li></ul></ul><ul><ul><li>}; </li></ul></ul><ul><ul><li>class AuthClientBlock : public IVersioned { </li></ul></ul><ul><ul><li>char* getLogin(); </li></ul></ul><ul><ul><li>char* getPassword(); </li></ul></ul><ul><ul><li>char* getData(int* length); </li></ul></ul><ul><ul><li>void putData(int length, void* data); </li></ul></ul><ul><ul><li>}; </li></ul></ul>
  66. 66. Authentication <ul><li>4 plugins in firebird 3 </li></ul><ul><ul><li>Secure remote password protocol </li></ul></ul><ul><ul><li>Windows - trusted authentication </li></ul></ul><ul><ul><li>Linux – ssh-like handshake </li></ul></ul><ul><ul><li>Legacy (DES on client) </li></ul></ul>
  67. 67. Secure remote password <ul><li>Up to 20 symbols in password </li></ul><ul><li>Password is never passed over the wire </li></ul><ul><li>Resistant to many attacks, including 'man in the middle' </li></ul><ul><li>Can generate strong crypt keys on both client and server during authentication </li></ul><ul><li>Does not require additional client-server roundtrips due to changes in network protocol </li></ul>
  68. 68. Authentication <ul><ul><li>class IManagement : public IPluginBase { </li></ul></ul><ul><ul><li>void start(IStatus* status, ILogonInfo* lgnInfo); </li></ul></ul><ul><ul><li>int execute(IStatus* status, IUser* user, </li></ul></ul><ul><ul><li>IListUsers* callback); </li></ul></ul><ul><ul><li>void commit(IStatus* status); </li></ul></ul><ul><ul><li>void rollback(IStatus* status); </li></ul></ul><ul><ul><li>}; </li></ul></ul>
  69. 69. Authentication <ul><ul><li>class ILogonInfo : public IVersioned { </li></ul></ul><ul><ul><li>char* FB_CARG name(); </li></ul></ul><ul><ul><li>char* FB_CARG role(); </li></ul></ul><ul><ul><li>int FB_CARG forceAdmin(); </li></ul></ul><ul><ul><li>char* FB_CARG networkProtocol(); </li></ul></ul><ul><ul><li>char* FB_CARG remoteAddress(); </li></ul></ul><ul><ul><li>int FB_CARG authBlock(char** bytes); </li></ul></ul><ul><ul><li>}; </li></ul></ul>
  70. 70. Authentication <ul><ul><li>class IUser : public IVersioned { </li></ul></ul><ul><ul><li>int operation(); </li></ul></ul><ul><ul><li>ICharUserField* userName(); </li></ul></ul><ul><ul><li>ICharUserField* password(); </li></ul></ul><ul><ul><li>ICharUserField* firstName(); </li></ul></ul><ul><ul><li>ICharUserField* lastName(); </li></ul></ul><ul><ul><li>ICharUserField* middleName(); </li></ul></ul><ul><ul><li>ICharUserField* groupName(); </li></ul></ul><ul><ul><li>IIntUserField* FB_CARG uid(); </li></ul></ul><ul><ul><li>IIntUserField* FB_CARG gid(); </li></ul></ul><ul><ul><li>IIntUserField* FB_CARG admin(); </li></ul></ul><ul><ul><li>void FB_CARG clear(); </li></ul></ul><ul><ul><li>}; </li></ul></ul>
  71. 71. Authentication <ul><ul><li>class IUserField : public IVersioned { </li></ul></ul><ul><ul><li>int entered(); </li></ul></ul><ul><ul><li>void setEntered(int newValue); </li></ul></ul><ul><ul><li>}; </li></ul></ul><ul><ul><li>class ICharUserField : public IUserField { </li></ul></ul><ul><ul><li>char* get() = 0; </li></ul></ul><ul><ul><li>void set(char* newValue) = 0; </li></ul></ul><ul><ul><li>}; </li></ul></ul>
  72. 72. Crypt <ul><ul><li>class ICrypt : public IPluginBase { </li></ul></ul><ul><ul><li>void setKey(IStatus* status, int length, </li></ul></ul><ul><ul><li>void* key); </li></ul></ul><ul><ul><li>void transform(IStatus* status, int length, </li></ul></ul><ul><ul><li>void* to, void* from); </li></ul></ul><ul><ul><li>}; </li></ul></ul>
  73. 73. Thanks for your attention!
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×