File indexing completed on 2024-04-28 04:44:22

0001 /*
0002    SPDX-FileCopyrightText: 2015 (c) Matthieu Gallien <matthieu_gallien@yahoo.fr>
0003 
0004    SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005  */
0006 
0007 #ifndef UPNPSERVEREVENTOBJECT_H
0008 #define UPNPSERVEREVENTOBJECT_H
0009 
0010 #include "upnplibqt_export.h"
0011 
0012 #include <KDSoapServer/KDSoapServerCustomVerbRequestInterface.h>
0013 #include <KDSoapServer/KDSoapServerObjectInterface.h>
0014 
0015 #include <QObject>
0016 
0017 #include <memory>
0018 
0019 class UpnpControlAbstractService;
0020 class UpnpServerEventObjectPrivate;
0021 
0022 class UpnpServerEventObject : public QObject, public KDSoapServerCustomVerbRequestInterface
0023 {
0024     Q_OBJECT
0025 
0026     Q_INTERFACES(KDSoapServerCustomVerbRequestInterface)
0027 
0028 public:
0029     explicit UpnpServerEventObject(QObject *parent = nullptr);
0030 
0031     ~UpnpServerEventObject() override;
0032 
0033     /**
0034      * Process a request made with a custom HTTP verb
0035      * @param requestType HTTP verb other than GET and POST
0036      * @param requestData is the content of the request
0037      * @param httpHeaders the map of http headers (keys have been lowercased since they are case insensitive)
0038      * @param customAnswer allow to send back the answer to the client if the request has been handled
0039      * @return true if the request has been handled and if customAnswer is valid and will be sent back to the client.
0040      */
0041     bool processCustomVerbRequest(const QByteArray &requestType, const QByteArray &requestData,
0042         const QMap<QByteArray, QByteArray> &httpHeaders, QByteArray &customAnswer) override;
0043 
0044     void setService(UpnpControlAbstractService *service);
0045 
0046 private:
0047     std::unique_ptr<UpnpServerEventObjectPrivate> d;
0048 };
0049 
0050 #endif // UPNPSERVEREVENTOBJECT_H