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