Matrix Science Mascot Parser toolkit
 
Loading...
Searching...
No Matches
ms_connection_settings.hpp
1/*
2##############################################################################
3# file: ms_connection_settings.hpp #
4# 'msparser' toolkit #
5# Holds the proxy server and Mascot sessionID string #
6##############################################################################
7# COPYRIGHT NOTICE #
8# Copyright 1998-2005 Matrix Science Limited All Rights Reserved. #
9# #
10##############################################################################
11# $Source: parser/inc/ms_connection_settings.hpp $ #
12# $Author: villek@matrixscience.com $ #
13# $Date: 2018-07-30 16:23:53 +0100 $ #
14# $Revision: 1b450440f9c97e1e41d0fc6016a27d68951d4532 | MSPARSER_REL_3_0_0-2024-09-24-0-g93ebaeb4f4 $ #
15# $NoKeywords:: $ #
16##############################################################################
17*/
18
19
20
21#if !defined(ms_connection_settings_INCLUDED_)
22#define ms_connection_settings_INCLUDED_
23
24
25// Includes from the standard template library
26#include <string>
27
28
29namespace matrix_science {
30 class ms_mascotoptions;
31
39
53 class MS_MASCOTRESFILE_API ms_connection_settings
54 {
55
56 public:
58
62 {
63 PROXY_TYPE_NO_PROXY = 0x0000,
64 PROXY_TYPE_FROM_REGISTRY = 0x0001,
65 PROXY_TYPE_SPECIFY = 0x0002,
66 PROXY_TYPE_WPAD = 0x0003,
67 PROXY_TYPE_ENVIRONMENT = 0x0004,
68 PROXY_TYPE_AUTO = 0x0005
69 };
70
76 {
77 HTTP_1_0 = 0x0000,
78 HTTP_1_1 = 0x0001,
79 HTTP_SYSTEM_DEFAULT = 0x0002
80 };
81
87 {
88 REDIRECT_POLICY_ALWAYS = 0x0000,
89 REDIRECT_POLICY_DISALLOW_HTTPS_TO_HTTP = 0x0001,
90 REDIRECT_POLICY_NEVER = 0x0002
91 };
92
95
97 ms_connection_settings(const std::string sessionID,
98 const std::string proxyServer,
99 const std::string proxyUserName,
100 const std::string proxyUserPassword);
101
104
106 void defaultValues();
107
109 void copyFrom(const ms_connection_settings* right);
110
111#ifndef SWIG
113 ms_connection_settings& operator=(const ms_connection_settings & right);
114#endif
116 void setSessionID(const std::string sessionID);
117
119 void setProxyServerType(ms_connection_settings::PROXY_TYPE proxyType);
120
122 ms_connection_settings::PROXY_TYPE getProxyServerType() const;
123
125 void setHttpProtocol(ms_connection_settings::HTTP_PROTOCOL httpProtocol);
126
128 ms_connection_settings::HTTP_PROTOCOL getHttpProtocol() const;
129
131 void setProxyServer(const std::string proxyServer);
132
134 void setProxyUsername(const std::string proxyUserName);
135
137 void setProxyPassword(const std::string proxyUserPassword);
138
140 void setUserAgent(const std::string userAgent);
141
143 void setUseHTTPProxyForFTP(bool value);
144
146 void setUseHTTPProxyForHTTPS(bool value);
147
149 std::string getSessionID() const;
150
152 std::string getProxyServer() const;
153
155 std::string getProxyUsername() const;
156
158 std::string getProxyPassword() const;
159
161 std::string getProxyUserAndPassword() const;
162
164 std::string getUserAgent() const;
165
167 bool isUseHTTPProxyForFTP() const;
168
170 bool isUseHTTPProxyForHTTPS() const;
171
173 void setConnectionTimeout(int timeout);
174
176 int getConnectionTimeout() const;
177
179 void setHttpUsername(const std::string httpUsername);
180
182 std::string getHttpUsername() const;
183
185 void setHttpPassword(const std::string httpPassword);
186
188 std::string getHttpPassword() const;
189
191 void setRedirectPolicy(ms_connection_settings::REDIRECT_POLICY redirectPolicy);
192
194 ms_connection_settings::REDIRECT_POLICY getRedirectPolicy() const;
195
197 void getProxySettings(const ms_mascotoptions &opts);
198
200 static int proxyTypeStringToEnum(std::string str);
201
203 static std::string proxyTypeToString(int type);
204
205 private:
206 std::string sessionID_;
207 std::string proxyServer_;
208 std::string proxyUserName_;
209 std::string proxyUserPassword_;
210 bool useHTTPProxyForFTP_;
211 bool useHTTPProxyForHTTPS_;
212 std::string userAgent_;
213 PROXY_TYPE proxyType_;
214 HTTP_PROTOCOL httpProtocol_;
215 int connectionTimeout_;
216 std::string httpUsername_;
217 std::string httpPassword_;
218 REDIRECT_POLICY redirectPolicy_;
219
220 struct proxy_type_strings_t {
221 const char *str;
222 const char *pretty_str;
223 int type;
224 };
225
226 static const struct proxy_type_strings_t proxy_type_strings[];
227 }; // end of http_client_groupp
229}
230#endif // !defined(ms_connection_settings_INCLUDED_)
Settings required to make an HTTP connection to a Mascot server.
Definition: ms_connection_settings.hpp:54
REDIRECT_POLICY
Definition: ms_connection_settings.hpp:87
HTTP_PROTOCOL
Definition: ms_connection_settings.hpp:76
PROXY_TYPE
Definitions for types of setting.
Definition: ms_connection_settings.hpp:62
An instance of this class represents all the parameters specified in the Options section of mascot....
Definition: ms_mascotoptions.hpp:91