QxOrm
1.5.0
C++ Object Relational Mapping library
|
00001 /**************************************************************************** 00002 ** 00003 ** https://www.qxorm.com/ 00004 ** Copyright (C) 2013 Lionel Marty (contact@qxorm.com) 00005 ** 00006 ** This file is part of the QxOrm library 00007 ** 00008 ** This software is provided 'as-is', without any express or implied 00009 ** warranty. In no event will the authors be held liable for any 00010 ** damages arising from the use of this software 00011 ** 00012 ** Commercial Usage 00013 ** Licensees holding valid commercial QxOrm licenses may use this file in 00014 ** accordance with the commercial license agreement provided with the 00015 ** Software or, alternatively, in accordance with the terms contained in 00016 ** a written agreement between you and Lionel Marty 00017 ** 00018 ** GNU General Public License Usage 00019 ** Alternatively, this file may be used under the terms of the GNU 00020 ** General Public License version 3.0 as published by the Free Software 00021 ** Foundation and appearing in the file 'license.gpl3.txt' included in the 00022 ** packaging of this file. Please review the following information to 00023 ** ensure the GNU General Public License version 3.0 requirements will be 00024 ** met : http://www.gnu.org/copyleft/gpl.html 00025 ** 00026 ** If you are unsure which license is appropriate for your use, or 00027 ** if you have questions regarding the use of this file, please contact : 00028 ** contact@qxorm.com 00029 ** 00030 ****************************************************************************/ 00031 00032 #ifdef _QX_ENABLE_QT_NETWORK 00033 #ifndef _QX_SERVICE_CONNECT_H_ 00034 #define _QX_SERVICE_CONNECT_H_ 00035 00036 #ifdef _MSC_VER 00037 #pragma once 00038 #endif 00039 00047 #ifndef QT_NO_SSL 00048 #include <QtNetwork/qsslsocket.h> 00049 #include <QtNetwork/qsslconfiguration.h> 00050 #include <QtNetwork/qsslcertificate.h> 00051 #include <QtNetwork/qsslerror.h> 00052 #include <QtNetwork/qsslkey.h> 00053 #endif // QT_NO_SSL 00054 00055 #ifndef Q_MOC_RUN 00056 #include <QxSingleton/QxSingleton.h> 00057 #endif // Q_MOC_RUN 00058 00059 namespace qx { 00060 namespace service { 00061 00068 class QX_DLL_EXPORT QxConnect : public qx::QxSingleton<QxConnect> 00069 { 00070 00071 friend class qx::QxSingleton<QxConnect>; 00072 00073 public: 00074 00075 enum serialization_type { serialization_binary, serialization_xml, serialization_text, serialization_portable_binary, 00076 serialization_wide_binary, serialization_wide_xml, serialization_wide_text, 00077 serialization_polymorphic_binary, serialization_polymorphic_xml, serialization_polymorphic_text, 00078 serialization_qt, serialization_json }; 00079 00080 private: 00081 00082 struct QxConnectImpl; 00083 std::unique_ptr<QxConnectImpl> m_pImpl; 00084 00085 QxConnect(); 00086 virtual ~QxConnect(); 00087 00088 public: 00089 00090 QString getIp(); 00091 long getPort(); 00092 serialization_type getSerializationType(); 00093 long getThreadCount(); 00094 int getMaxWait(); 00095 bool getCompressData(); 00096 bool getEncryptData(); 00097 quint64 getEncryptKey(); 00098 long getKeepAlive(); 00099 bool getModeHTTP(); 00100 qlonglong getSessionTimeOut(); 00101 00102 #ifndef QT_NO_SSL 00103 bool getSSLEnabled(); 00104 QSslConfiguration getSSLConfiguration(); 00105 QList<QSslCertificate> getSSLCACertificates(); 00106 QSslCertificate getSSLLocalCertificate(); 00107 QSslKey getSSLPrivateKey(); 00108 QList<QSslError> getSSLIgnoreErrors(); 00109 QSsl::SslProtocol getSSLProtocol(); 00110 QString getSSLPeerVerifyName(); 00111 QSslSocket::PeerVerifyMode getSSLPeerVerifyMode(); 00112 int getSSLPeerVerifyDepth(); 00113 #endif // QT_NO_SSL 00114 00115 void setIp(const QString & s); 00116 void setPort(long l); 00117 void setSerializationType(serialization_type e); 00118 void setThreadCount(long l); 00119 void setMaxWait(int i); 00120 void setCompressData(bool b); 00121 void setEncryptData(bool b, quint64 key = 0); 00122 void setKeepAlive(long l); 00123 void setModeHTTP(bool b); 00124 void setSessionTimeOut(qlonglong l); 00125 00126 #ifndef QT_NO_SSL 00127 void setSSLEnabled(bool b); 00128 void setSSLConfiguration(QSslConfiguration cfg); 00129 void setSSLCACertificates(QList<QSslCertificate> lst); 00130 void setSSLLocalCertificate(QSslCertificate cert); 00131 void setSSLPrivateKey(QSslKey key); 00132 void setSSLIgnoreErrors(QList<QSslError> lst); 00133 void setSSLProtocol(QSsl::SslProtocol e); 00134 void setSSLPeerVerifyName(const QString & s); 00135 void setSSLPeerVerifyMode(QSslSocket::PeerVerifyMode e); 00136 void setSSLPeerVerifyDepth(int i); 00137 #endif // QT_NO_SSL 00138 00139 }; 00140 00141 } // namespace service 00142 } // namespace qx 00143 00144 QX_DLL_EXPORT_QX_SINGLETON_HPP(qx::service::QxConnect) 00145 00146 #endif // _QX_SERVICE_CONNECT_H_ 00147 #endif // _QX_ENABLE_QT_NETWORK