00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
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