context_listener.hpp

Go to the documentation of this file.
00001 /*
00002  * ====================================================================
00003  * Copyright (c) 2002-2006 The RapidSvn Group.  All rights reserved.
00004  *
00005  * This library is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU Lesser General Public
00007  * License as published by the Free Software Foundation; either
00008  * version 2.1 of the License, or (at your option) any later version.
00009  * 
00010  * This library is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  * Lesser General Public License for more details.
00014  * 
00015  * You should have received a copy of the GNU Lesser General Public
00016  * License along with this library (in the file LGPL.txt); if not, 
00017  * write to the Free Software Foundation, Inc., 51 Franklin St, 
00018  * Fifth Floor, Boston, MA  02110-1301  USA
00019  *
00020  * This software consists of voluntary contributions made by many
00021  * individuals.  For exact contribution history, see the revision
00022  * history and logs, available at http://rapidsvn.tigris.org/.
00023  * ====================================================================
00024  */
00025 
00026 #ifndef _SVNCPP_CONTEXT_LISTENER_HPP_
00027 #define _SVNCPP_CONTEXT_LISTENER_HPP_ 
00028 
00029 // stl
00030 #include <string>
00031 
00032 // Subversion api
00033 #include "svn_client.h"
00034 
00035 // svncpp
00036 #include "svncpp/pool.hpp"
00037 
00038 namespace svn
00039 {
00046   class ContextListener
00047   {
00048   public:
00063     virtual bool 
00064     contextGetLogin (const std::string & realm,
00065                      std::string & username, 
00066                      std::string & password,
00067                      bool & maySave) = 0;
00068 
00081     virtual void
00082     contextNotify (const char *path,
00083                    svn_wc_notify_action_t action,
00084                    svn_node_kind_t kind,
00085                    const char *mime_type,
00086                    svn_wc_notify_state_t content_state,
00087                    svn_wc_notify_state_t prop_state,
00088                    svn_revnum_t revision) = 0;
00089 
00090     /*
00091      * this method will be called periodically to allow
00092      * the app to cancel long running operations
00093      *
00094      * @return cancel action?
00095      * @retval true cancel
00096      */
00097     virtual bool
00098     contextCancel() = 0;
00099 
00111     virtual bool
00112     contextGetLogMessage (std::string & msg) = 0;
00113 
00114     typedef enum
00115     {
00116       DONT_ACCEPT = 0,
00117       ACCEPT_TEMPORARILY,
00118       ACCEPT_PERMANENTLY
00119     } SslServerTrustAnswer;
00120 
00121 
00126     struct SslServerTrustData
00127     {
00128     public:
00130       apr_uint32_t failures;
00131 
00133       std::string hostname;
00134       std::string fingerprint;
00135       std::string validFrom;
00136       std::string validUntil;
00137       std::string issuerDName;
00138       std::string realm;
00139       bool maySave;
00140 
00141       SslServerTrustData (const apr_uint32_t failures_ = 0)
00142         : failures (failures_), hostname (""), fingerprint (""),
00143           validFrom (""), validUntil (""), issuerDName (""),
00144           realm (""), maySave (true)
00145       {
00146       }
00147 
00148       SslServerTrustData (const SslServerTrustData & src)
00149         : failures (src.failures)
00150       {
00151         hostname = src.hostname;
00152         fingerprint = src.fingerprint;
00153         validFrom = src.validFrom;
00154         validUntil = src.validUntil;
00155         issuerDName = src.issuerDName;
00156         realm = src.realm;
00157         maySave = src.maySave;
00158       }
00159 
00160       SslServerTrustData &
00161       operator =(const SslServerTrustData & src)
00162       {
00163         if (this == &src)
00164           return *this;
00165 
00166         hostname = src.hostname;
00167         fingerprint = src.fingerprint;
00168         validFrom = src.validFrom;
00169         validUntil = src.validUntil;
00170         issuerDName = src.issuerDName;
00171         realm = src.realm;
00172         maySave = src.maySave;
00173         failures = src.failures;
00174 
00175         return *this;
00176       }        
00177     };
00178 
00179 
00188     virtual SslServerTrustAnswer
00189     contextSslServerTrustPrompt (const SslServerTrustData & data, 
00190                                  apr_uint32_t & acceptedFailures) = 0;
00191 
00196     virtual bool 
00197     contextSslClientCertPrompt (std::string & certFile) = 0;
00198 
00207     virtual bool
00208     contextSslClientCertPwPrompt (std::string & password, 
00209                                   const std::string & realm, 
00210                                   bool & maySave) = 0;
00211 
00212     virtual ~ContextListener () { }
00213   };
00214 }
00215 
00216 #endif
00217 /* -----------------------------------------------------------------
00218  * local variables:
00219  * eval: (load-file "../../rapidsvn-dev.el")
00220  * end:
00221  */

Generated on Sat Dec 30 19:12:41 2006 for SvnCpp by  doxygen 1.5.1