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: /vol/cvsroot/parser/inc/ms_http_client.hpp,v $
00012  * @(#)$Revision: 1.7 $
00013  * @(#)$Date: 2016/05/19 16:07:07 $
00014 ##############################################################################
00015  */
00016 
00017 #ifndef MS_HTTP_CLIENT_HPP
00018 #define MS_HTTP_CLIENT_HPP
00019 
00020 #ifdef _WIN32
00021 #pragma warning(disable:4251)   // Don't want all classes to be exported
00022 #pragma warning(disable:4786)   // Debug symbols too long
00023 #   ifndef _MATRIX_USE_STATIC_LIB
00024 #       ifdef MS_MASCOTRESFILE_EXPORTS
00025 #           define MS_MASCOTRESFILE_API __declspec(dllexport)
00026 #       else
00027 #           define MS_MASCOTRESFILE_API __declspec(dllimport)
00028 #       endif
00029 #   else
00030 #       define MS_MASCOTRESFILE_API
00031 #   endif
00032 #else
00033 #   define MS_MASCOTRESFILE_API
00034 #endif
00035 
00036 #include <string>
00037 
00038 namespace matrix_science
00039 {
00045     class ms_http_client_session;
00046 
00048 
00061     class MS_MASCOTRESFILE_API ms_http_client :
00062         public ms_errors
00063     {
00064         public:
00066 
00069             enum LoginResultCode
00070             {
00071                 L_SUCCESS, 
00072                 L_SECURITYDISABLED, 
00073                 L_UNKNOWNUSER, 
00074                 L_INCORRECTPASSWORD, 
00075                 L_PASSWORDEXPIRED, 
00076                 L_WEBAUTHENTICATIONFAILED, 
00077                 L_GUESTLOGINDISABLED, 
00078                 L_UNSPECIFIEDERROR 
00079             };
00080 
00082 
00085             enum ChangePasswordResultCode
00086             {
00087                 CP_SUCCESS, 
00088                 CP_UNKNOWNUSER, 
00089                 CP_INCORRECTPASSWORD, 
00090                 CP_BADNEWPASSWORD, 
00091                 CP_UNSPECIFIEDERROR 
00092             };
00093 
00094 #ifndef SWIG
00095             // C++ STL collection support
00096             ms_http_client();
00097 #endif
00098 
00099             ms_http_client(const std::string & baseUrl, ms_connection_settings settings);
00101             virtual ~ms_http_client();
00102 
00103             ms_http_client(const ms_http_client & src);
00104 #ifndef SWIG
00105             ms_http_client& operator=(const ms_http_client & right);
00106 #endif
00107             void copyFrom(const ms_http_client * right);
00108 
00110             std::string baseUrl() const;
00112             ms_connection_settings connectionSettings() const;
00113 
00115             void setBaseUrl(const std::string & baseUrl);
00117             void setConnectionSettings(const ms_connection_settings & settings);
00118 
00120             bool getIsDatabaseActive(const std::string & databaseName, bool & returnIsActive);
00121 
00123             bool getVersion(int & major, int & minor, int & part3, int & part4);
00124 
00126             bool getOsName(std::string & osname);
00127 
00129             LoginResultCode userLogin(
00130                     const std::string & username,
00131                     const std::string & password,
00132                     ms_http_client_session & returnSession);
00133 
00135             ChangePasswordResultCode changePassword(
00136                     const std::string & userName,
00137                     const std::string & oldPassword,
00138                     const std::string & newPassword);
00139 
00141             bool getIsSecurityEnabled(bool & returnIsSecurityEnabled, std::string & returnUnsecuredSessionId);
00142 
00144             bool getIsWebAuthenticationEnabled(bool & returnIsWebAuthenticationEnabled, std::string & returnWebAuthenticatedSessionId);
00145 
00146         private:
00147             LoginResultCode secureGuestLogin(
00148                     ms_http_client_session & session);
00149             LoginResultCode secureUserLogin(
00150                     const std::string & username,
00151                     const std::string & password,
00152                     ms_http_client_session & returnSession);
00153             bool httpGetString(const std::string & action, std::string & returnString);
00154 
00155             ms_http_helper connection_;
00156     };
00157  // end of http_client_group
00159 } // namespace matrix_science
00160 
00161 #endif // MS_HTTP_CLIENT_HPP
00162 
00163 /*------------------------------- End of File -------------------------------*/
Copyright © 2016 Matrix Science Ltd.  All Rights Reserved. Generated on Fri Jun 2 2017 01:44:51