psasl.h

Go to the documentation of this file.
00001 /*
00002  * sasl.h
00003  *
00004  * Simple Authentication Security Layer interface classes
00005  *
00006  * Portable Windows Library
00007  *
00008  * Copyright (c) 2004 Reitek S.p.A.
00009  *
00010  * The contents of this file are subject to the Mozilla Public License
00011  * Version 1.0 (the "License"); you may not use this file except in
00012  * compliance with the License. You may obtain a copy of the License at
00013  * http://www.mozilla.org/MPL/
00014  *
00015  * Software distributed under the License is distributed on an "AS IS"
00016  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
00017  * the License for the specific language governing rights and limitations
00018  * under the License.
00019  *
00020  * The Original Code is Portable Windows Library.
00021  *
00022  * The Initial Developer of the Original Code is Post Increment
00023  *
00024  * Contributor(s): ______________________________________.
00025  *
00026  * $Log: psasl.h,v $
00027  * Revision 1.3  2004/11/11 07:34:50  csoutheren
00028  * Added #include <ptlib.h>
00029  *
00030  * Revision 1.2  2004/04/28 11:26:42  csoutheren
00031  * Hopefully fixed SASL and SASL2 problems
00032  *
00033  * Revision 1.1  2004/04/18 12:02:31  csoutheren
00034  * Added classes for SASL authentication
00035  * Thanks to Federico Pinna and Reitek S.p.A.
00036  *
00037  *
00038  */
00039 
00040 #if P_SASL2
00041 #ifndef _PSASL
00042 #define _PSASL
00043 
00044 #ifdef P_USE_PRAGMA
00045 #pragma interface
00046 #endif
00047 
00048 #include <ptlib.h>
00049 
00050 class PSASLClient : public PObject
00051 {
00052     PCLASSINFO(PSASLClient, PObject);
00053 
00054 public:
00055     enum  PSASLResult {
00056         Continue = 1,
00057         OK = 0,
00058         Fail = -1
00059     };
00060 
00061 protected:
00062     static PString  s_Realm;
00063     static PString  s_Path;
00064 
00065     void *          m_CallBacks;
00066     void *          m_ConnState;
00067     const PString   m_Service;
00068     const PString   m_UserID;
00069     const PString   m_AuthID;
00070     const PString   m_Password;
00071 
00072     BOOL            Start(const PString& mechanism, const char ** output, unsigned& len);
00073     PSASLResult     Negotiate(const char * input, const char ** output);
00074 
00075 public:
00076     PSASLClient(const PString& service, const PString& uid, const PString& auth, const PString& pwd);
00077     ~PSASLClient();
00078 
00079     static void     SetRealm(const PString& realm)  { s_Realm = realm; }
00080     static void     SetPath(const PString& path)    { s_Path = path; }
00081 
00082     static const PString&  GetRealm()               { return s_Realm; }
00083     static const PString&  GetPath()                { return s_Path; }
00084 
00085     const PString&  GetService() const  { return m_Service; }
00086     const PString&  GetUserID() const   { return m_UserID; }
00087     const PString&  GetAuthID() const   { return m_AuthID; }
00088     const PString&  GetPassword() const { return m_Password; }
00089 
00090     BOOL            Init(const PString& fqdn, PStringSet& supportedMechanisms);
00091     BOOL            Start(const PString& mechanism, PString& output);
00092     PSASLResult     Negotiate(const PString& input, PString& output);
00093     BOOL            End();
00094 };
00095 
00096 #endif  // _PSASL
00097 #endif  // P_SASL2
00098 
00099 // End of File ///////////////////////////////////////////////////////////////

Generated on Fri Mar 7 06:25:02 2008 for PTLib by  doxygen 1.5.1