QxOrm  1.5.1
C++ Object Relational Mapping library
QxConnect.h
Go to the documentation of this file.
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 
00071 class QX_DLL_EXPORT IxConnect
00072 {
00073 
00074 public:
00075 
00076    enum serialization_type { serialization_binary, serialization_xml, serialization_text, serialization_portable_binary, 
00077                              serialization_wide_binary, serialization_wide_xml, serialization_wide_text, 
00078                              serialization_polymorphic_binary, serialization_polymorphic_xml, serialization_polymorphic_text, 
00079                              serialization_qt, serialization_json };
00080 
00081 protected:
00082 
00083    struct IxConnectImpl;
00084    std::unique_ptr<IxConnectImpl> m_pImpl; 
00085 
00086    IxConnect();
00087    virtual ~IxConnect() = 0;
00088 
00089 public:
00090 
00091    QString getIp();
00092    long getPort();
00093    serialization_type getSerializationType();
00094    long getThreadCount();
00095    int getMaxWait();
00096    bool getCompressData();
00097    bool getEncryptData();
00098    quint64 getEncryptKey();
00099    long getKeepAlive();
00100    bool getModeHTTP();
00101    qlonglong getSessionTimeOut();
00102 
00103 #ifndef QT_NO_SSL
00104    bool getSSLEnabled();
00105    QSslConfiguration getSSLConfiguration();
00106    QList<QSslCertificate> getSSLCACertificates();
00107    QSslCertificate getSSLLocalCertificate();
00108    QSslKey getSSLPrivateKey();
00109    QList<QSslError> getSSLIgnoreErrors();
00110    QSsl::SslProtocol getSSLProtocol();
00111    QString getSSLPeerVerifyName();
00112    QSslSocket::PeerVerifyMode getSSLPeerVerifyMode();
00113    int getSSLPeerVerifyDepth();
00114 #else // QT_NO_SSL
00115    bool getSSLEnabled() { return false; }
00116 #endif // QT_NO_SSL
00117 
00118    void setIp(const QString & s);
00119    void setPort(long l);
00120    void setSerializationType(serialization_type e);
00121    void setThreadCount(long l);
00122    void setMaxWait(int i);
00123    void setCompressData(bool b);
00124    void setEncryptData(bool b, quint64 key = 0);
00125    void setKeepAlive(long l);
00126    void setModeHTTP(bool b);
00127    void setSessionTimeOut(qlonglong l);
00128 
00129 #ifndef QT_NO_SSL
00130    void setSSLEnabled(bool b);
00131    void setSSLConfiguration(QSslConfiguration cfg);
00132    void setSSLCACertificates(QList<QSslCertificate> lst);
00133    void setSSLLocalCertificate(QSslCertificate cert);
00134    void setSSLPrivateKey(QSslKey key);
00135    void setSSLIgnoreErrors(QList<QSslError> lst);
00136    void setSSLProtocol(QSsl::SslProtocol e);
00137    void setSSLPeerVerifyName(const QString & s);
00138    void setSSLPeerVerifyMode(QSslSocket::PeerVerifyMode e);
00139    void setSSLPeerVerifyDepth(int i);
00140 #endif // QT_NO_SSL
00141 
00142 };
00143 
00153 class QX_DLL_EXPORT QxConnect : public IxConnect, public qx::QxSingleton<QxConnect>
00154 {
00155 
00156    friend class qx::QxSingleton<QxConnect>;
00157 
00158 private:
00159 
00160    QxConnect();
00161    virtual ~QxConnect();
00162 
00163 };
00164 
00180 class QX_DLL_EXPORT QxConnectOther : public IxConnect
00181 {
00182 
00183 public:
00184 
00185    QxConnectOther();
00186    virtual ~QxConnectOther();
00187 
00188 };
00189 
00190 } // namespace service
00191 } // namespace qx
00192 
00193 QX_DLL_EXPORT_QX_SINGLETON_HPP(qx::service::QxConnect)
00194 
00195 #endif // _QX_SERVICE_CONNECT_H_
00196 #endif // _QX_ENABLE_QT_NETWORK