KD SOAP
KDSoapServerSocket_p.h
1 /****************************************************************************
2 ** Copyright (C) 2010-2016 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 #ifndef QT_NO_OPENSSL
29 #include <QSslSocket>
30 #else
31 #include <QTcpSocket>
32 #endif
33 
34 #include <QMap>
35 QT_BEGIN_NAMESPACE
36 class QObject;
37 QT_END_NAMESPACE
38 class KDSoapSocketList;
40 class KDSoapMessage;
41 class KDSoapHeaders;
42 
43 class KDSoapServerSocket
44 #ifndef QT_NO_OPENSSL
45  : public QSslSocket
46 #else
47  : public QTcpSocket
48 #endif
49 {
50  Q_OBJECT
51 public:
52  KDSoapServerSocket(KDSoapSocketList *owner, QObject *serverObject);
53  ~KDSoapServerSocket();
54 
55  void setResponseDelayed();
56  void sendDelayedReply(KDSoapServerObjectInterface *serverObjectInterface, const KDSoapMessage &replyMsg);
57  void sendReply(KDSoapServerObjectInterface *serverObjectInterface, const KDSoapMessage &replyMsg);
58 Q_SIGNALS:
59  void socketDeleted(KDSoapServerSocket *);
60 
61 private Q_SLOTS:
62  void slotReadyRead();
63 
64 private:
65  void handleRequest(const QMap<QByteArray, QByteArray> &headers, const QByteArray &receivedData);
66  bool handleWsdlDownload();
67  bool handleFileDownload(KDSoapServerObjectInterface *serverObjectInterface, const QString &path);
68  void makeCall(KDSoapServerObjectInterface *serverObjectInterface,
69  const KDSoapMessage &requestMsg, KDSoapMessage &replyMsg,
70  const KDSoapHeaders &requestHeaders,
71  const QByteArray &soapAction, const QString &path);
72  void handleError(KDSoapMessage &replyMsg, const char *errorCode, const QString &error);
73  void setSocketEnabled(bool enabled);
74  void writeXML(const QByteArray &xmlResponse, bool isFault);
75  friend class KDSoapServerObjectInterface;
76 
77  KDSoapSocketList *m_owner;
78  QObject *m_serverObject;
79  bool m_delayedResponse;
80  bool m_doDebug;
81  bool m_socketEnabled;
82  bool m_receivedData;
83 
84  // Current request being assembled
85  bool m_useRawXML;
86  int m_bytesReceived;
87  int m_chunkStart;
88  QMap<QByteArray, QByteArray> m_httpHeaders;
89  QByteArray m_requestBuffer;
90  QByteArray m_decodedRequestBuffer; // used for chunked transfer encoding only
91 
92  // Data for the current call (stored here for delayed replies)
93  QString m_messageNamespace;
94  QString m_method;
95 };
96 
97 #endif // KDSOAPSERVERSOCKET_P_H
Definition: KDSoapMessage.h:187
Definition: KDSoapServerObjectInterface.h:67
Definition: KDSoapMessage.h:41

Klarälvdalens Datakonsult AB (KDAB)
Qt-related services and products
http://www.kdab.com/
http://www.kdab.com/products/kd-soap/