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  * $Revision: 20385 $
00027  * $Author: rjongbloed $
00028  * $Date: 2008-06-04 10:40:38 +0000 (Wed, 04 Jun 2008) $
00029  */
00030 
00031 #if P_SASL2
00032 #ifndef _PSASL
00033 #define _PSASL
00034 
00035 #ifdef P_USE_PRAGMA
00036 #pragma interface
00037 #endif
00038 
00039 #include <ptlib.h>
00040 
00041 class PSASLClient : public PObject
00042 {
00043     PCLASSINFO(PSASLClient, PObject);
00044 
00045 public:
00046     enum  PSASLResult {
00047         Continue = 1,
00048         OK = 0,
00049         Fail = -1
00050     };
00051 
00052 protected:
00053     static PString  s_Realm;
00054     static PString  s_Path;
00055 
00056     void *          m_CallBacks;
00057     void *          m_ConnState;
00058     const PString   m_Service;
00059     const PString   m_UserID;
00060     const PString   m_AuthID;
00061     const PString   m_Password;
00062 
00063     PBoolean            Start(const PString& mechanism, const char ** output, unsigned& len);
00064     PSASLResult     Negotiate(const char * input, const char ** output);
00065 
00066 public:
00067     PSASLClient(const PString& service, const PString& uid, const PString& auth, const PString& pwd);
00068     ~PSASLClient();
00069 
00070     static void     SetRealm(const PString& realm)  { s_Realm = realm; }
00071     static void     SetPath(const PString& path)    { s_Path = path; }
00072 
00073     static const PString&  GetRealm()               { return s_Realm; }
00074     static const PString&  GetPath()                { return s_Path; }
00075 
00076     const PString&  GetService() const  { return m_Service; }
00077     const PString&  GetUserID() const   { return m_UserID; }
00078     const PString&  GetAuthID() const   { return m_AuthID; }
00079     const PString&  GetPassword() const { return m_Password; }
00080 
00081     PBoolean            Init(const PString& fqdn, PStringSet& supportedMechanisms);
00082     PBoolean            Start(const PString& mechanism, PString& output);
00083     PSASLResult     Negotiate(const PString& input, PString& output);
00084     PBoolean            End();
00085 };
00086 
00087 #endif  // _PSASL
00088 #endif  // P_SASL2
00089 
00090 // End of File ///////////////////////////////////////////////////////////////

Generated on Mon Feb 23 01:57:54 2009 for PTLib by  doxygen 1.5.1