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