Matrix Science Mascot Parser toolkit
 
Loading...
Searching...
No Matches
ms_http_client.hpp
1/*
2##############################################################################
3# file: ms_http_client.hpp #
4# 'msparser' toolkit #
5# Represents a Mascot server, providing communication to that server #
6##############################################################################
7# COPYRIGHT NOTICE #
8# Copyright 1998-2013 Matrix Science Limited All Rights Reserved. #
9# #
10##############################################################################
11 * @(#)$Source: parser/inc/ms_http_client.hpp $
12 * @(#)$Revision: 1b450440f9c97e1e41d0fc6016a27d68951d4532 | MSPARSER_REL_3_0_0-2024-09-24-0-g93ebaeb4f4 $
13 * @(#)$Date: 2018-07-30 16:23:53 +0100 $
14##############################################################################
15 */
16
17#ifndef MS_HTTP_CLIENT_HPP
18#define MS_HTTP_CLIENT_HPP
19
20
21#include <string>
22
23namespace matrix_science
24{
30 class ms_http_client_session;
31
33
46 class MS_MASCOTRESFILE_API ms_http_client :
47 public ms_errors
48 {
49 public:
51
55 {
63 L_UNSPECIFIEDERROR
64 };
65
67
71 {
76 CP_UNSPECIFIEDERROR
77 };
78
79#ifndef SWIG
80 // C++ STL collection support
82#endif
84 ms_http_client(const std::string & baseUrl, ms_connection_settings settings);
86 virtual ~ms_http_client();
87
88 ms_http_client(const ms_http_client & src);
89#ifndef SWIG
90 ms_http_client& operator=(const ms_http_client & right);
91#endif
92 void copyFrom(const ms_http_client * right);
93
95 std::string baseUrl() const;
97 ms_connection_settings connectionSettings() const;
98
100 void setBaseUrl(const std::string & baseUrl);
102 void setConnectionSettings(const ms_connection_settings & settings);
103#ifndef SWIG
105 bool getIsDatabaseActive(const std::string & databaseName, bool & returnIsActive);
106
108 bool getVersion(int & major, int & minor, int & part3, int & part4);
109
111 bool getOsName(std::string & osname);
112
113#else // SWIG Multiple return values
114 bool getIsDatabaseActive(const std::string & databaseName, bool & OUTPUT);
115 bool getVersion(int & OUTPUT, int & OUTPUT, int & OUTPUT, int & OUTPUT);
116 bool getOsName(std::string & OUTPUT);
117#endif
119 LoginResultCode userLogin(
120 const std::string & username,
121 const std::string & password,
122 ms_http_client_session & returnSession);
123
125 ChangePasswordResultCode changePassword(
126 const std::string & userName,
127 const std::string & oldPassword,
128 const std::string & newPassword);
129#ifndef SWIG
131 bool getIsSecurityEnabled(bool & returnIsSecurityEnabled, std::string & returnUnsecuredSessionId);
132
134 bool getIsWebAuthenticationEnabled(bool & returnIsWebAuthenticationEnabled, std::string & returnWebAuthenticatedSessionId);
135#else // SWIG Multiple return values
136 bool getIsSecurityEnabled(bool & OUTPUT, std::string & OUTPUT);
137 bool getIsWebAuthenticationEnabled(bool & OUTPUT, std::string & OUTPUT);
138#endif
139
140 private:
141 LoginResultCode secureGuestLogin(
142 ms_http_client_session & session);
143 LoginResultCode secureUserLogin(
144 const std::string & username,
145 const std::string & password,
146 ms_http_client_session & returnSession);
147 bool httpGetString(const std::string & action, std::string & returnString);
148
149 ms_http_helper connection_;
150 };
151 // end of http_client_group
153} // namespace matrix_science
154
155#endif // MS_HTTP_CLIENT_HPP
156
157/*------------------------------- End of File -------------------------------*/
Settings required to make an HTTP connection to a Mascot server.
Definition: ms_connection_settings.hpp:54
This class is used as a base class for several Mascot Parser classes.
Definition: ms_errors.hpp:696
This gives access to a Mascot session so searches may be submitted.
Definition: ms_http_client_session.hpp:48
This class enables access to a Mascot server using HTTP.
Definition: ms_http_client.hpp:48
LoginResultCode
Definitions for the types of response from the login program on the Mascot server.
Definition: ms_http_client.hpp:55
@ L_PASSWORDEXPIRED
The password supplied for the specified user has expired.
Definition: ms_http_client.hpp:60
@ L_INCORRECTPASSWORD
The password supplied for the specified user was incorrect.
Definition: ms_http_client.hpp:59
@ L_WEBAUTHENTICATIONFAILED
Web authentication failed for the currently logged in user.
Definition: ms_http_client.hpp:61
@ L_GUESTLOGINDISABLED
The guest login could not be accessed because it is disabled on the server.
Definition: ms_http_client.hpp:62
@ L_SECURITYDISABLED
Security is disabled on the Mascot server.
Definition: ms_http_client.hpp:57
@ L_SUCCESS
The function completed successfully.
Definition: ms_http_client.hpp:56
@ L_UNKNOWNUSER
The user ID supplied was not recognised by the Mascot server.
Definition: ms_http_client.hpp:58
ChangePasswordResultCode
Definitions for the possible responses to an attempt to change a password.
Definition: ms_http_client.hpp:71
@ CP_UNKNOWNUSER
The user ID was not recognised. No password was changed.
Definition: ms_http_client.hpp:73
@ CP_BADNEWPASSWORD
The new password could not be used (e.g. too short). No password was changed.
Definition: ms_http_client.hpp:75
@ CP_SUCCESS
The password was changed successfully.
Definition: ms_http_client.hpp:72
@ CP_INCORRECTPASSWORD
The old password supplied was incorrect. No password was changed.
Definition: ms_http_client.hpp:74
The class provides HTTP, FTP and FILE protocol access to a server.
Definition: ms_http_helper.hpp:57