Matrix Science header

ms_connection_settings.hpp

00001 /*
00002 ##############################################################################
00003 # file: ms_connection_settings.hpp                                           #
00004 # 'msparser' toolkit                                                         #
00005 # Holds the proxy server and Mascot sessionID string                         #
00006 ##############################################################################
00007 # COPYRIGHT NOTICE                                                           #
00008 # Copyright 1998-2005 Matrix Science Limited  All Rights Reserved.           #
00009 #                                                                            #
00010 ##############################################################################
00011 #    $Source: /vol/cvsroot/parser/inc/ms_connection_settings.hpp,v $ #
00012 #     $Author: davidc $                                                      #
00013 #       $Date: 2015/07/22 10:38:29 $                                         #
00014 #   $Revision: 1.25 $                                                        #
00015 # $NoKeywords::                                                            $ #
00016 ##############################################################################
00017 */
00018 
00019 
00020 
00021 #if !defined(ms_connection_settings_INCLUDED_)
00022 #define ms_connection_settings_INCLUDED_
00023 
00024 #ifdef _WIN32
00025 #pragma warning(disable:4251)   // Don't want all classes to be exported
00026 #pragma warning(disable:4786)   // Debug symbols too long
00027 #   ifndef _MATRIX_USE_STATIC_LIB
00028 #       ifdef MS_MASCOTRESFILE_EXPORTS
00029 #           define MS_MASCOTRESFILE_API __declspec(dllexport)
00030 #       else
00031 #           define MS_MASCOTRESFILE_API __declspec(dllimport)
00032 #       endif
00033 #   else
00034 #       define MS_MASCOTRESFILE_API
00035 #   endif
00036 #else
00037 #   define MS_MASCOTRESFILE_API
00038 #endif
00039 
00040 // Includes from the standard template library
00041 #include <string>
00042 
00043 
00044 namespace matrix_science {
00045     class ms_mascotoptions;
00046 
00053 
00054 
00068     class MS_MASCOTRESFILE_API ms_connection_settings
00069     {
00070 
00071     public:
00073 
00076         enum PROXY_TYPE
00077         {
00078             PROXY_TYPE_NO_PROXY       = 0x0000, 
00079             PROXY_TYPE_FROM_REGISTRY  = 0x0001, 
00080             PROXY_TYPE_SPECIFY        = 0x0002, 
00081             PROXY_TYPE_WPAD           = 0x0003, 
00082             PROXY_TYPE_ENVIRONMENT    = 0x0004, 
00083             PROXY_TYPE_AUTO           = 0x0005  
00084         };
00085 
00090         enum HTTP_PROTOCOL
00091         {
00092             HTTP_1_0                = 0x0000, 
00093             HTTP_1_1                = 0x0001, 
00094             HTTP_SYSTEM_DEFAULT     = 0x0002  
00095         };
00096 
00101         enum REDIRECT_POLICY
00102         {
00103             REDIRECT_POLICY_ALWAYS                 = 0x0000, 
00104             REDIRECT_POLICY_DISALLOW_HTTPS_TO_HTTP = 0x0001, 
00105             REDIRECT_POLICY_NEVER                  = 0x0002  
00106         };
00107 
00109         ms_connection_settings();
00110 
00112         ms_connection_settings(const std::string sessionID,
00113                                const std::string proxyServer,
00114                                const std::string proxyUserName,
00115                                const std::string proxyUserPassword);
00116 
00118         ~ms_connection_settings();
00119 
00121         void defaultValues();
00122 
00124         void copyFrom(const ms_connection_settings* right);
00125 
00126 #ifndef SWIG
00127 
00128         ms_connection_settings& operator=(const ms_connection_settings & right);
00129 #endif
00130 
00131         void setSessionID(const std::string sessionID);
00132 
00134         void setProxyServerType(ms_connection_settings::PROXY_TYPE proxyType);
00135 
00137         ms_connection_settings::PROXY_TYPE getProxyServerType() const;
00138 
00140         void setHttpProtocol(ms_connection_settings::HTTP_PROTOCOL httpProtocol);
00141 
00143         ms_connection_settings::HTTP_PROTOCOL getHttpProtocol() const;
00144 
00146         void setProxyServer(const std::string proxyServer); 
00147 
00149         void setProxyUsername(const std::string proxyUserName); 
00150 
00152         void setProxyPassword(const std::string proxyUserPassword); 
00153 
00155         void setUserAgent(const std::string userAgent);
00156 
00158         void setUseHTTPProxyForFTP(bool value);
00159 
00161         std::string getSessionID() const;
00162 
00164         std::string getProxyServer() const; 
00165 
00167         std::string getProxyUsername() const; 
00168         
00170         std::string getProxyPassword() const; 
00171 
00173         std::string getProxyUserAndPassword() const;
00174 
00176         std::string getUserAgent() const;
00177 
00179         bool isUseHTTPProxyForFTP() const;
00180 
00182         void setConnectionTimeout(int timeout);
00183 
00185         int getConnectionTimeout() const;
00186 
00188         void setHttpUsername(const std::string httpUsername); 
00189 
00191         std::string getHttpUsername() const; 
00192 
00194         void setHttpPassword(const std::string httpPassword); 
00195 
00197         std::string getHttpPassword() const; 
00198 
00200         void setRedirectPolicy(ms_connection_settings::REDIRECT_POLICY redirectPolicy);
00201 
00203         ms_connection_settings::REDIRECT_POLICY getRedirectPolicy() const;
00204 
00206         void getProxySettings(const ms_mascotoptions &opts);
00207 
00209         static int proxyTypeStringToEnum(std::string str);
00210 
00212         static std::string proxyTypeToString(int type);
00213 
00214     private:
00215         std::string sessionID_;
00216         std::string proxyServer_;
00217         std::string proxyUserName_;
00218         std::string proxyUserPassword_;
00219         bool useHTTPProxyForFTP_;
00220         std::string userAgent_;
00221         PROXY_TYPE proxyType_;
00222         HTTP_PROTOCOL httpProtocol_;
00223         int connectionTimeout_;
00224         std::string httpUsername_;
00225         std::string httpPassword_;
00226         REDIRECT_POLICY redirectPolicy_;
00227 
00228         struct proxy_type_strings_t {
00229             const char *str;
00230             const char *pretty_str;
00231             int type;
00232         };
00233 
00234         static const struct proxy_type_strings_t proxy_type_strings[];
00235     }; // end of http_client_groupp
00237 }
00238 #endif // !defined(ms_connection_settings_INCLUDED_)
Copyright © 2016 Matrix Science Ltd.  All Rights Reserved. Generated on Fri Jun 2 2017 01:44:50