D:/Storage/CVS_Head/h323plus/include/h235pluginmgr.h

00001 /*
00002  * h235pluginmgr.h
00003  *
00004  * h235 Implementation for the h323plus library.
00005  *
00006  * Copyright (c) 2006 ISVO (Asia) Pte Ltd. All Rights Reserved.
00007  *
00008  * The contents of this file are subject to the Mozilla Public License
00009  * Version 1.1 (the "License"); you may not use this file except in
00010  * compliance with the License. You may obtain a copy of the License at
00011  * http://www.mozilla.org/MPL/
00012  *
00013  * Alternatively, the contents of this file may be used under the terms
00014  * of the General Public License (the  "GNU License"), in which case the
00015  * provisions of GNU License are applicable instead of those
00016  * above. If you wish to allow use of your version of this file only
00017  * under the terms of the GNU License and not to allow others to use
00018  * your version of this file under the MPL, indicate your decision by
00019  * deleting the provisions above and replace them with the notice and
00020  * other provisions required by the GNU License. If you do not delete
00021  * the provisions above, a recipient may use your version of this file
00022  * under either the MPL or the GNU License."
00023  *
00024  * Software distributed under the License is distributed on an "AS IS"
00025  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
00026  * the License for the specific language governing rights and limitations
00027  * under the License.
00028  *
00029  *
00030  * Contributor(s): ______________________________________.
00031  *
00032  * $Log: h235pluginmgr.h,v $
00033  * Revision 1.1  2007/08/06 20:50:49  shorne
00034  * First commit of h323plus
00035  *
00036  *
00037  *
00038 */
00039 
00040 #include <ptlib.h>
00041 #include <ptlib/pluginmgr.h>
00042 #include <h235auth.h>
00043 
00044 #if _MSC_VER > 1000
00045 #pragma once
00046 #endif // _MSC_VER > 1000
00047 
00048 #ifdef _MSC_VER
00049 #pragma warning(disable:4100)
00050 #endif
00051 
00053 
00054 struct Pluginh235_Definition;
00055 class H235PluginAuthenticator : public H235Authenticator
00056 {
00057     PCLASSINFO(H235PluginAuthenticator, H235Authenticator);
00058 
00059   public:
00060 
00061     H235PluginAuthenticator(Pluginh235_Definition * _def);
00062 
00063     H235_ClearToken * CreateClearToken();
00064     H225_CryptoH323Token * CreateCryptoToken();
00065 
00066     BOOL Finalise(
00067       PBYTEArray & rawPDU
00068     );
00069 
00070         const char * GetName() const { return h235name; };
00071         void SetName(PString & name) { h235name = name; };
00072 
00073     ValidationResult ValidateClearToken(
00074       const H235_ClearToken & clearToken
00075     );
00076 
00077     ValidationResult ValidateCryptoToken(
00078       const H225_CryptoH323Token & cryptoToken,
00079       const PBYTEArray & rawPDU
00080     );
00081 
00082     BOOL IsCapability(
00083       const H235_AuthenticationMechanism & mechansim,
00084       const PASN_ObjectId & algorithmOID
00085     );
00086 
00087     BOOL SetCapability(
00088       H225_ArrayOf_AuthenticationMechanism & mechansims,
00089       H225_ArrayOf_PASN_ObjectId & algorithmOIDs
00090     );
00091 
00092     BOOL UseGkAndEpIdentifiers() const;
00093 
00094     BOOL IsSecuredPDU(
00095       unsigned rasPDU,
00096       BOOL received
00097     ) const;
00098 
00099     BOOL IsSecuredSignalPDU(
00100       unsigned signalPDU,
00101       BOOL received
00102     ) const;
00103 
00104     BOOL IsActive() const;
00105 
00106     const PString & GetRemoteId() const;
00107     void SetRemoteId(const PString & id);
00108 
00109     const PString & GetLocalId() const;
00110     void SetLocalId(const PString & id);
00111 
00112     const PString & GetPassword() const;
00113     void SetPassword(const PString & pw);
00114 
00115     int GetTimestampGracePeriod() const;
00116     void SetTimestampGracePeriod(int grace);
00117 
00118 
00119     Application GetApplication(); 
00120 
00121 protected:
00122         PString h235name;
00123         unsigned type;
00124     Pluginh235_Definition * def; 
00125 };
00126 
00127 
00128 
00130 
00131 class h235PluginDeviceManager : public PPluginModuleManager
00132 {
00133   PCLASSINFO(h235PluginDeviceManager, PPluginModuleManager);
00134   public:
00135     h235PluginDeviceManager(PPluginManager * pluginMgr = NULL);
00136     ~h235PluginDeviceManager();
00137 
00138     void OnLoadPlugin(PDynaLink & dll, INT code);
00139 
00140     virtual void OnShutdown();
00141 
00142     static void Bootstrap();
00143 
00144     virtual BOOL Registerh235(unsigned int count, void * _h235List);
00145     virtual BOOL Unregisterh235(unsigned int count, void * _h235List);
00146 
00147     void CreateH235Authenticator(Pluginh235_Definition * h235authenticator);
00148 
00149 };
00150 
00151 static PFactory<PPluginModuleManager>::Worker<h235PluginDeviceManager> h323PluginCodecManagerFactory("h235PluginDeviceManager", true);
00152 
00154 
00155 typedef PFactory<H235Authenticator> h235Factory;
00156 
00157 #define H235_REGISTER(cls, h235Name)   static h235Factory::Worker<cls> cls##Factory(h235Name, true); \
00158 
00159 #define H235_DEFINE_AUTHENTICATOR(cls, h235Name, fmtName) \
00160 class cls : public H235PluginAuthenticator { \
00161   public: \
00162     cls() : H235PluginAuthenticator() { } \
00163     PString GetName() const \
00164     { return fmtName; } \
00165 }; \
00166  H235_REGISTER(cls, capName) \
00167 
00169 

Generated on Thu Oct 25 13:42:10 2007 for h323plus by  doxygen 1.5.2