Main Page Modules Namespace List Class Hierarchy Alphabetical List Compound List File List Namespace Members Compound Members File Members Related Pages

# dePlugins.hpp

Go to the documentation of this file.

    00001 ///////////////////////////////////////////////////////////////////////////////
    00002 /// @file dePlugins.hpp
    00003 ///
    00004 /// @brief base plugin header
    00005 ///
    00006 /// @author Lightning
    00007 ///
    00008 /// This file is the intellectual property of Novus Delta, LLC.. Usage of the
    00009 /// contents of this file is subject to the Destiny3D Member License which
    00010 /// can be found at http://www.destiny3d.com.  Any other usage is prohibited.
    00011 ///
    00012 /// This file is distributed "AS IS" without warranty of any kind.  Novus
    00013 /// Delta, LLC. does not guarantee the fitness of the contents of this file
    00014 /// for any particular purpose.
    00015 ///
    00016 /// Copyright (C) 2001-2003 Novus Delta, LLC. All Rights Reserved.
    00017 ///
    00018 /// <hr>
    00019 ///                                 Change History
    00020 /// <hr>
    00021 ///
    00022 /// @date Nov 2001
    00023 /// @author Lightning
    00024 /// @remarks Creation
    00025 ///
    00026 ///////////////////////////////////////////////////////////////////////////////
    00027
    00028 #ifndef DE_PLUGIN_HPP
    00029 #define DE_PLUGIN_HPP
    00030
    00031 #include "deGlobalTypes.hpp"
    00032
    00033 #if defined(DEPLUGINS_DLL_EXPORTS) || defined(DESTINY3D_EXPORT_ALL)
    00034 #   define DEPLUGIN_API extern "C" DEDLL_EXPORT
    00035 #elif defined(DESTINY3D_STATIC_LINK)
    00036 #   define DEPLUGIN_API extern "C"
    00037 #else
    00038 #   define DEPLUGIN_API extern "C" DEDLL_IMPORT
    00039 #endif
    00040
    00041 #ifdef USING_DESTINY3D
    00042 #ifdef _DEBUG
    00043 #   ifdef DESTINY3D_STATIC_LINK
    00044 #       pragma comment(lib, "dePlugins_sd")
    00045 #       pragma comment(lib, "zlib-d")
    00046 #   else
    00047 #       pragma comment(lib, "dePluginsd")
    00048 #   endif //DESTINY3D_STATIC_LINK
    00049 #else
    00050 #   ifdef DESTINY3D_STATIC_LINK
    00051 #       pragma comment(lib, "dePlugins_s")
    00052 #       pragma comment(lib, "zlib")
    00053 #   else
    00054 #       pragma comment(lib, "dePlugins")
    00055 #   endif //DESTINY3D_STATIC_LINK
    00056 #endif //_DEBUG
    00057 #endif //USING_DESTINY3D
    00058
    00059 //-------------------------------------------
    00060 // Classes Declared
    00061 //-------------------------------------------
    00062 class IdePlugin;
    00063 class IdePluginTwofish;
    00064 class IdePluginRijndael;
    00065 class IdePluginZLib;
    00066 class IdePluginSHA1;
    00067
    00068 //-------------------------------------------
    00069 // Factory functions
    00070 //-------------------------------------------
    00071 extern "C"
    00072 {
    00073     DEPLUGIN_API IdePluginTwofish*  IdePlugin_CreateTwofish();
    00074     DEPLUGIN_API IdePluginRijndael* IdePlugin_CreateRijndael();
    00075     DEPLUGIN_API IdePluginZLib*     IdePlugin_CreateZLib();
    00076     DEPLUGIN_API IdePluginSHA1*     IdePlugin_CreateSHA1();
    00077 }
    00078
    00079 //the base class for plugins
    00080 //class IdePlugin
    00081 DE3D_INTERFACE_(IdePlugin)
    00082 {
    00083     protected:
    00084         virtual ~IdePlugin() {};
    00085
    00086     public:
    00087         enum interface_t
    00088         {
    00089             iface_IdePlugin = 0,
    00090             iface_IdePluginTwofish,
    00091             iface_IdePluginRijndael,
    00092             iface_IdePluginZLib,
    00093             iface_IdePluginSHA1,
    00094             iface_force_32bit = 0x7FFFFFFF
    00095         };
    00096
    00097         //get the interface for a class
    00098         virtual void* GetInterface(IdePlugin::interface_t i) = 0;
    00099
    00100         //release a plugin
    00101         virtual int Release() = 0;
    00102
    00103         //the basic interface functions for the data manipulation
    00104         //buffer/length = input
    00105         //newbuffer/newlength = new output, newlength is set to the length of the new buffer
    00106         //it is updated to the actual written length
    00107         virtual deBoolean EncodeData(void *Buffer, DWORD Length, void *NewBuffer, DWORD *NewLength) = 0;
    00108         virtual deBoolean DecodeData(void *Buffer, DWORD Length, void *NewBuffer, DWORD *NewLength) = 0;
    00109
    00110         //get the maximum size needed for a buffer
    00111         virtual DWORD MaxEncodeLength(DWORD Length) = 0;
    00112         virtual DWORD MaxDecodeLength(void *Buffer) = 0;
    00113
    00114         //other functions are likely to exist to set individual settings for a plugin
    00115 };
    00116
    00117 //class IdePluginTwofish : virtual public IdePlugin
    00118 DE3D_INTERFACE(IdePluginTwofish, IdePlugin)
    00119 {
    00120     protected:
    00121         ~IdePluginTwofish() {};
    00122
    00123     public:
    00124         enum Mode
    00125         {
    00126             ECB = 1,
    00127             CBC,
    00128             CFB1,
    00129         };
    00130
    00131         //different settings that can be set
    00132         virtual deBoolean SetKey(void *KeyBuffer, long Bitsize) = 0;    //what key to use
    00133         virtual deBoolean SetIV(void *IVBuffer, long Length) = 0;       //what IV to use (used on CBC and CFB1)
    00134         virtual deBoolean SetMode(Mode CipherMode) = 0;                 //the type of encryption
    00135         virtual deBoolean SetRounds(int NumberRounds) = 0;              //number of rounds to do
    00136 };
    00137
    00138 //class IdePluginRijndael : virtual public IdePlugin
    00139 DE3D_INTERFACE(IdePluginRijndael, IdePlugin)
    00140 {
    00141     protected:
    00142         ~IdePluginRijndael() {};
    00143
    00144     public:
    00145
    00146         //different settings that can be set
    00147         virtual deBoolean SetKey(void *KeyBuffer, long Bitsize) = 0;    //what key to use
    00148         virtual deBoolean SetIV(void *IVBuffer, long Blocksize) = 0;    //IV to use
    00149 };
    00150
    00151 //class IdePluginZLib : virtual public IdePlugin
    00152 DE3D_INTERFACE(IdePluginZLib, IdePlugin)
    00153 {
    00154     protected:
    00155         ~IdePluginZLib() {};
    00156
    00157     public:
    00158         enum DataType
    00159         {
    00160             BINARY = 0,
    00161             ASCII = 1,
    00162         };
    00163
    00164         //different settings that can be set
    00165         virtual deBoolean SetType(DataType Type) = 0;                   //the type of data to compress
    00166         virtual deBoolean SetCompressAmount(long Amount) = 0;           //how much to compress it (0-9)
    00167 };
    00168
    00169 //class IdePluginSHA1 : virtual public IdePlugin
    00170 DE3D_INTERFACE(IdePluginSHA1, IdePlugin)
    00171 {
    00172     protected:
    00173         ~IdePluginSHA1() {};
    00174
    00175     public:
    00176 };
    00177
    00178 #endif