nonsaslauth.h

00001 /*
00002   Copyright (c) 2005-2009 by Jakob Schroeter <js@camaya.net>
00003   This file is part of the gloox library. http://camaya.net/gloox
00004 
00005   This software is distributed under a license. The full license
00006   agreement can be found in the file LICENSE in this distribution.
00007   This software may not be copied, modified, sold or distributed
00008   other than expressed in the named license agreement.
00009 
00010   This software is distributed without any warranty.
00011 */
00012 
00013 
00014 #ifndef NONSASLAUTH_H__
00015 #define NONSASLAUTH_H__
00016 
00017 #include "iqhandler.h"
00018 
00019 #include <string>
00020 
00021 namespace gloox
00022 {
00023 
00024   class Client;
00025   class Stanza;
00026   class Tag;
00027 
00039   class GLOOX_API NonSaslAuth : public IqHandler
00040   {
00041     public:
00046       NonSaslAuth( Client* parent );
00047 
00051       virtual ~NonSaslAuth();
00052 
00058       void doAuth( const std::string& sid );
00059 
00060       // reimplemented from IqHandler
00061       virtual bool handleIq( const IQ& iq ) { (void)iq; return false; }
00062 
00063       // reimplemented from IqHandler
00064       virtual void handleIqID( const IQ& iq, int context );
00065 
00066     private:
00067 #ifdef NONSASLAUTH_TEST
00068     public:
00069 #endif
00070 
00076       class Query : public StanzaExtension
00077       {
00078         public:
00084           Query( const std::string& user );
00085 
00090           Query( const Tag* tag = 0 );
00091 
00100           Query* newInstance( const std::string& user, const std::string& sid,
00101                               const std::string& pwd, const std::string& resource ) const;
00102 
00106           virtual ~Query() {}
00107 
00108           // reimplemented from StanzaExtension
00109           virtual const std::string& filterString() const;
00110 
00111           // reimplemented from StanzaExtension
00112           virtual StanzaExtension* newInstance( const Tag* tag ) const
00113           {
00114             return new Query( tag );
00115           }
00116 
00117           // reimplemented from StanzaExtension
00118           virtual Tag* tag() const;
00119 
00120           // reimplemented from StanzaExtension
00121           virtual StanzaExtension* clone() const
00122           {
00123             return new Query( *this );
00124           }
00125 
00126         private:
00127           std::string m_user;
00128           std::string m_pwd;
00129           std::string m_resource;
00130           bool m_digest;
00131 
00132       };
00133 
00134       enum NonSaslAuthTrack
00135       {
00136         TrackRequestAuthFields,
00137         TrackSendAuth
00138       };
00139 
00140       Client* m_parent;
00141       std::string m_sid;
00142 
00143   };
00144 
00145 }
00146 
00147 #endif // NONSASLAUTH_H__

Generated by  doxygen 1.6.2