KD SOAP  1.10.0
KDSoapServerSocket_p.h
1 /****************************************************************************
2 **
3 ** This file is part of the KD Soap library.
4 **
5 ** SPDX-FileCopyrightText: 2010-2020 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
6 **
7 ** SPDX-License-Identifier: LicenseRef-KDAB-KDSoap-AGPL3-Modified OR LicenseRef-KDAB-KDSoap OR LicenseRef-KDAB-KDSoap-US
8 **
9 ** Licensees holding valid commercial KD Soap licenses may use this file in
10 ** accordance with the KD Soap Commercial License Agreement provided with
11 ** the Software.
12 **
13 ** Contact info@kdab.com if any conditions of this licensing are not clear to you.
14 **
15 ****************************************************************************/
16 #ifndef KDSOAPSERVERSOCKET_P_H
17 #define KDSOAPSERVERSOCKET_P_H
18 
19 #include <QtGlobal>
20 
21 #include <QTcpSocket> //may define QT_NO_SSL
22 #ifndef QT_NO_SSL
23 #include <QSslSocket>
24 #endif
25 
26 #include <QMap>
27 QT_BEGIN_NAMESPACE
28 class QObject;
29 QT_END_NAMESPACE
30 class KDSoapSocketList;
32 class KDSoapMessage;
33 class KDSoapHeaders;
34 
35 class KDSoapServerSocket
36 #ifndef QT_NO_SSL
37  : public QSslSocket
38 #else
39  : public QTcpSocket
40 #endif
41 {
42  Q_OBJECT
43 public:
44  KDSoapServerSocket(KDSoapSocketList *owner, QObject *serverObject);
45  ~KDSoapServerSocket();
46 
47  void setResponseDelayed();
48  void sendDelayedReply(KDSoapServerObjectInterface *serverObjectInterface, const KDSoapMessage &replyMsg);
49  void sendReply(KDSoapServerObjectInterface *serverObjectInterface, const KDSoapMessage &replyMsg);
50 Q_SIGNALS:
51  void socketDeleted(KDSoapServerSocket *);
52 
53 private Q_SLOTS:
54  void slotReadyRead();
55 
56 private:
57  void handleRequest(const QMap<QByteArray, QByteArray> &headers, const QByteArray &receivedData);
58  bool handleWsdlDownload();
59  bool handleFileDownload(KDSoapServerObjectInterface *serverObjectInterface, const QString &path);
60  void makeCall(KDSoapServerObjectInterface *serverObjectInterface,
61  const KDSoapMessage &requestMsg, KDSoapMessage &replyMsg,
62  const KDSoapHeaders &requestHeaders,
63  const QByteArray &soapAction, const QString &path);
64  void handleError(KDSoapMessage &replyMsg, const char *errorCode, const QString &error);
65  void setSocketEnabled(bool enabled);
66  void writeXML(const QByteArray &xmlResponse, bool isFault);
67  friend class KDSoapServerObjectInterface;
68 
69  KDSoapSocketList *m_owner;
70  QObject *m_serverObject;
71  bool m_delayedResponse;
72  bool m_doDebug;
73  bool m_socketEnabled;
74  bool m_receivedData;
75 
76  // Current request being assembled
77  bool m_useRawXML;
78  int m_bytesReceived;
79  int m_chunkStart;
80  QMap<QByteArray, QByteArray> m_httpHeaders;
81  QByteArray m_requestBuffer;
82  QByteArray m_decodedRequestBuffer; // used for chunked transfer encoding only
83 
84  // Data for the current call (stored here for delayed replies)
85  QString m_messageNamespace;
86  QString m_method;
87 };
88 
89 #endif // KDSOAPSERVERSOCKET_P_H
Definition: KDSoapMessage.h:188
Definition: KDSoapServerObjectInterface.h:65
Definition: KDSoapMessage.h:34

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/