Matrix Science header

ms_http_client.hpp

00001 /*
00002 ##############################################################################
00003 # file: ms_http_client.hpp                                                 #
00004 # 'msparser' toolkit                                                         #
00005 # Represents a Mascot server, providing communication to that server         #
00006 ##############################################################################
00007 # COPYRIGHT NOTICE                                                           #
00008 # Copyright 1998-2013 Matrix Science Limited  All Rights Reserved.           #
00009 #                                                                            #
00010 ##############################################################################
00011  * @(#)$Source: parser/inc/ms_http_client.hpp $
00012  * @(#)$Revision: 1b450440f9c97e1e41d0fc6016a27d68951d4532 | MSPARSER_REL_2_8_1-0-gea32989045 $
00013  * @(#)$Date: 2018-07-30 16:23:53 +0100 $
00014 ##############################################################################
00015  */
00016 
00017 #ifndef MS_HTTP_CLIENT_HPP
00018 #define MS_HTTP_CLIENT_HPP
00019 
00020 
00021 #include <string>
00022 
00023 namespace matrix_science
00024 {
00030     class ms_http_client_session;
00031 
00033 
00046     class MS_MASCOTRESFILE_API ms_http_client :
00047         public ms_errors
00048     {
00049         public:
00051 
00054             enum LoginResultCode
00055             {
00056                 L_SUCCESS, 
00057                 L_SECURITYDISABLED, 
00058                 L_UNKNOWNUSER, 
00059                 L_INCORRECTPASSWORD, 
00060                 L_PASSWORDEXPIRED, 
00061                 L_WEBAUTHENTICATIONFAILED, 
00062                 L_GUESTLOGINDISABLED, 
00063                 L_UNSPECIFIEDERROR 
00064             };
00065 
00067 
00070             enum ChangePasswordResultCode
00071             {
00072                 CP_SUCCESS, 
00073                 CP_UNKNOWNUSER, 
00074                 CP_INCORRECTPASSWORD, 
00075                 CP_BADNEWPASSWORD, 
00076                 CP_UNSPECIFIEDERROR 
00077             };
00078 
00079 #ifndef SWIG
00080             // C++ STL collection support
00081             ms_http_client();
00082 #endif
00083 
00084             ms_http_client(const std::string & baseUrl, ms_connection_settings settings);
00086             virtual ~ms_http_client();
00087 
00088             ms_http_client(const ms_http_client & src);
00089 #ifndef SWIG
00090             ms_http_client& operator=(const ms_http_client & right);
00091 #endif
00092             void copyFrom(const ms_http_client * right);
00093 
00095             std::string baseUrl() const;
00097             ms_connection_settings connectionSettings() const;
00098 
00100             void setBaseUrl(const std::string & baseUrl);
00102             void setConnectionSettings(const ms_connection_settings & settings);
00103 #ifndef SWIG
00104 
00105             bool getIsDatabaseActive(const std::string & databaseName, bool & returnIsActive);
00106 
00108             bool getVersion(int & major, int & minor, int & part3, int & part4);
00109 
00111             bool getOsName(std::string & osname);
00112 
00113 #else // SWIG Multiple return values
00114             bool getIsDatabaseActive(const std::string & databaseName, bool & OUTPUT);
00115             bool getVersion(int & OUTPUT, int & OUTPUT, int & OUTPUT, int & OUTPUT);
00116             bool getOsName(std::string & OUTPUT);
00117 #endif
00118 
00119             LoginResultCode userLogin(
00120                     const std::string & username,
00121                     const std::string & password,
00122                     ms_http_client_session & returnSession);
00123 
00125             ChangePasswordResultCode changePassword(
00126                     const std::string & userName,
00127                     const std::string & oldPassword,
00128                     const std::string & newPassword);
00129 #ifndef SWIG
00130 
00131             bool getIsSecurityEnabled(bool & returnIsSecurityEnabled, std::string & returnUnsecuredSessionId);
00132 
00134             bool getIsWebAuthenticationEnabled(bool & returnIsWebAuthenticationEnabled, std::string & returnWebAuthenticatedSessionId);
00135 #else // SWIG Multiple return values
00136             bool getIsSecurityEnabled(bool & OUTPUT, std::string & OUTPUT);
00137             bool getIsWebAuthenticationEnabled(bool & OUTPUT, std::string & OUTPUT);
00138 #endif
00139 
00140         private:
00141             LoginResultCode secureGuestLogin(
00142                     ms_http_client_session & session);
00143             LoginResultCode secureUserLogin(
00144                     const std::string & username,
00145                     const std::string & password,
00146                     ms_http_client_session & returnSession);
00147             bool httpGetString(const std::string & action, std::string & returnString);
00148 
00149             ms_http_helper connection_;
00150     };
00151  // end of http_client_group
00153 } // namespace matrix_science
00154 
00155 #endif // MS_HTTP_CLIENT_HPP
00156 
00157 /*------------------------------- End of File -------------------------------*/

Copyright © 2022 Matrix Science Ltd.  All Rights Reserved. Generated on Thu Mar 31 2022 01:12:29