KD SOAP  1.9.1
KDSoapServerSocket_p.h
1 /****************************************************************************
2 ** Copyright (C) 2010-2020 Klaralvdalens Datakonsult AB, a KDAB Group company, info@kdab.com.
3 ** All rights reserved.
4 **
5 ** This file is part of the KD Soap library.
6 **
7 ** Licensees holding valid commercial KD Soap licenses may use this file in
8 ** accordance with the KD Soap Commercial License Agreement provided with
9 ** the Software.
10 **
11 **
12 ** This file may be distributed and/or modified under the terms of the
13 ** GNU Lesser General Public License version 2.1 and version 3 as published by the
14 ** Free Software Foundation and appearing in the file LICENSE.LGPL.txt included.
15 **
16 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
17 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
18 **
19 ** Contact info@kdab.com if any conditions of this licensing are not
20 ** clear to you.
21 **
22 **********************************************************************/
23 #ifndef KDSOAPSERVERSOCKET_P_H
24 #define KDSOAPSERVERSOCKET_P_H
25 
26 #include <QtGlobal>
27 
28 #include <QTcpSocket> //may define QT_NO_OPENSSL
29 #ifndef QT_NO_OPENSSL
30 #include <QSslSocket>
31 #endif
32 
33 #include <QMap>
34 QT_BEGIN_NAMESPACE
35 class QObject;
36 QT_END_NAMESPACE
37 class KDSoapSocketList;
39 class KDSoapMessage;
40 class KDSoapHeaders;
41 
42 class KDSoapServerSocket
43 #ifndef QT_NO_OPENSSL
44  : public QSslSocket
45 #else
46  : public QTcpSocket
47 #endif
48 {
49  Q_OBJECT
50 public:
51  KDSoapServerSocket(KDSoapSocketList *owner, QObject *serverObject);
52  ~KDSoapServerSocket();
53 
54  void setResponseDelayed();
55  void sendDelayedReply(KDSoapServerObjectInterface *serverObjectInterface, const KDSoapMessage &replyMsg);
56  void sendReply(KDSoapServerObjectInterface *serverObjectInterface, const KDSoapMessage &replyMsg);
57 Q_SIGNALS:
58  void socketDeleted(KDSoapServerSocket *);
59 
60 private Q_SLOTS:
61  void slotReadyRead();
62 
63 private:
64  void handleRequest(const QMap<QByteArray, QByteArray> &headers, const QByteArray &receivedData);
65  bool handleWsdlDownload();
66  bool handleFileDownload(KDSoapServerObjectInterface *serverObjectInterface, const QString &path);
67  void makeCall(KDSoapServerObjectInterface *serverObjectInterface,
68  const KDSoapMessage &requestMsg, KDSoapMessage &replyMsg,
69  const KDSoapHeaders &requestHeaders,
70  const QByteArray &soapAction, const QString &path);
71  void handleError(KDSoapMessage &replyMsg, const char *errorCode, const QString &error);
72  void setSocketEnabled(bool enabled);
73  void writeXML(const QByteArray &xmlResponse, bool isFault);
74  friend class KDSoapServerObjectInterface;
75 
76  KDSoapSocketList *m_owner;
77  QObject *m_serverObject;
78  bool m_delayedResponse;
79  bool m_doDebug;
80  bool m_socketEnabled;
81  bool m_receivedData;
82 
83  // Current request being assembled
84  bool m_useRawXML;
85  int m_bytesReceived;
86  int m_chunkStart;
87  QMap<QByteArray, QByteArray> m_httpHeaders;
88  QByteArray m_requestBuffer;
89  QByteArray m_decodedRequestBuffer; // used for chunked transfer encoding only
90 
91  // Data for the current call (stored here for delayed replies)
92  QString m_messageNamespace;
93  QString m_method;
94 };
95 
96 #endif // KDSOAPSERVERSOCKET_P_H
Definition: KDSoapMessage.h:195
Definition: KDSoapServerObjectInterface.h:72
Definition: KDSoapMessage.h:41

Klarälvdalens Datakonsult AB (KDAB)
"The Qt, C++ and OpenGL Experts"
https://www.kdab.com/
https://www.kdab.com/development-resources/qt-tools/kd-soap/