| 1 | // For license of this file, see <project-root-folder>/LICENSE.md.cxx . . $ `<file>/src/librssguard/network-web/httpserver.h`/ |
| 2 | |
| 3 | #ifndef HTTPSERVER_H |
| 4 | #define HTTPSERVER_Hcxx . . $ `src/librssguard/network-web/httpserver.h:4:9`! |
| 5 | |
| 6 | #include <QHostAddress> |
| 7 | #include <QObject> |
| 8 | #include <QTcpServer> |
| 9 | #include <QTcpSocket> |
| 10 | #include <QUrl> |
| 11 | |
| 12 | class HttpServercxx . . $ HttpServer# : public QObjectcxx . . $ QObject# { |
| 13 | Q_OBJECTcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:133:9`! |
| 14 | |
| 15 | public: |
| 16 | explicit HttpServercxx . . $ HttpServer#HttpServer(749de1b6ae65bddd).(QObjectcxx . . $ QObject#* parent = nullptr); |
| 17 | virtual ~cxx . . $ HttpServer#`~HttpServer`(ced63f7c635d850d).HttpServercxx . . $ HttpServer#(); |
| 18 | |
| 19 | bool isListeningcxx . . $ HttpServer#isListening(50ce9a9e25b4a850).() const; |
| 20 | |
| 21 | // Stops server and clear all connections. |
| 22 | void stopcxx . . $ HttpServer#stop(49f6e7a06ebc5aa8).(); |
| 23 | |
| 24 | // Returns listening portnumber. |
| 25 | quint16cxx . . $ quint16# listenPortcxx . . $ HttpServer#listenPort(72085aa11f4b6e09).() const; |
| 26 | |
| 27 | // Returns listening IP address, usually something like "127.0.0.1". |
| 28 | QHostAddresscxx . . $ QHostAddress# listenAddresscxx . . $ HttpServer#listenAddress(324da51e91434ec8).() const; |
| 29 | |
| 30 | // Returns full URL string. |
| 31 | QStringcxx . . $ QString# listenAddressPortcxx . . $ HttpServer#listenAddressPort(6ef7b6c27b00b43d).() const; |
| 32 | |
| 33 | // Sets full URL string, for example "http://localhost:123456". |
| 34 | void setListenAddressPortcxx . . $ HttpServer#setListenAddressPort(37c160c81b6367f7).(const QStringcxx . . $ QString#& full_uri, bool start_handler); |
| 35 | |
| 36 | protected: |
| 37 | struct HttpHeadercxx . . $ HttpServer#HttpHeader# { |
| 38 | QStringcxx . . $ QString# m_namecxx . . $ HttpServer#HttpHeader#m_name.; |
| 39 | QStringcxx . . $ QString# m_valuecxx . . $ HttpServer#HttpHeader#m_value.; |
| 40 | }; |
| 41 | |
| 42 | QByteArraycxx . . $ QByteArray# generateHttpAnswercxx . . $ HttpServer#generateHttpAnswer(bd41d2748839d377).(int http_code, const QListcxx . . $ QList#<HttpHeadercxx . . $ HttpServer#HttpHeader#>& headers, const QByteArraycxx . . $ QByteArray#& body =cxx . . $ QByteArray#QByteArray(ced63f7c635d850d). {}) const; |
| 43 | |
| 44 | struct HttpRequestcxx . . $ HttpServer#HttpRequest# { |
| 45 | bool readMethodcxx . . $ HttpServer#HttpRequest#readMethod(25ee3d08cd9f19c0).(QTcpSocketcxx . . $ QTcpSocket#* socket); |
| 46 | bool readUrlcxx . . $ HttpServer#HttpRequest#readUrl(25ee3d08cd9f19c0).(QTcpSocketcxx . . $ QTcpSocket#* socket); |
| 47 | bool readStatuscxx . . $ HttpServer#HttpRequest#readStatus(25ee3d08cd9f19c0).(QTcpSocketcxx . . $ QTcpSocket#* socket); |
| 48 | bool readHeadercxx . . $ HttpServer#HttpRequest#readHeader(25ee3d08cd9f19c0).(QTcpSocketcxx . . $ QTcpSocket#* socket); |
| 49 | |
| 50 | enum class Statecxx . . $ HttpServer#HttpRequest#State# { |
| 51 | ReadingMethodcxx . . $ HttpServer#HttpRequest#State#ReadingMethod., |
| 52 | ReadingUrlcxx . . $ HttpServer#HttpRequest#State#ReadingUrl., |
| 53 | ReadingStatuscxx . . $ HttpServer#HttpRequest#State#ReadingStatus., |
| 54 | ReadingHeadercxx . . $ HttpServer#HttpRequest#State#ReadingHeader., |
| 55 | ReadingBodycxx . . $ HttpServer#HttpRequest#State#ReadingBody., |
| 56 | AllDonecxx . . $ HttpServer#HttpRequest#State#AllDone. |
| 57 | } m_statecxx . . $ HttpServer#HttpRequest#m_state. = Statecxx . . $ HttpServer#HttpRequest#State#::ReadingMethodcxx . . $ HttpServer#HttpRequest#State#ReadingMethod.; |
| 58 | |
| 59 | enum class Methodcxx . . $ HttpServer#HttpRequest#Method# { |
| 60 | Unknowncxx . . $ HttpServer#HttpRequest#Method#Unknown., |
| 61 | Headcxx . . $ HttpServer#HttpRequest#Method#Head., |
| 62 | Getcxx . . $ HttpServer#HttpRequest#Method#Get., |
| 63 | Putcxx . . $ HttpServer#HttpRequest#Method#Put., |
| 64 | Postcxx . . $ HttpServer#HttpRequest#Method#Post., |
| 65 | Deletecxx . . $ HttpServer#HttpRequest#Method#Delete., |
| 66 | Optionscxx . . $ HttpServer#HttpRequest#Method#Options. |
| 67 | } m_methodcxx . . $ HttpServer#HttpRequest#m_method. = Methodcxx . . $ HttpServer#HttpRequest#Method#::Unknowncxx . . $ HttpServer#HttpRequest#Method#Unknown.; |
| 68 | |
| 69 | QStringcxx . . $ QString# m_addresscxx . . $ HttpServer#HttpRequest#m_address.; |
| 70 | quint16cxx . . $ quint16# m_portcxx . . $ HttpServer#HttpRequest#m_port. = 0; |
| 71 | QByteArraycxx . . $ QByteArray# m_fragmentcxx . . $ HttpServer#HttpRequest#m_fragment.; |
| 72 | QUrlcxx . . $ QUrl# m_urlcxx . . $ HttpServer#HttpRequest#m_url.; |
| 73 | QPaircxx . . $ QPair#<quint8cxx . . $ quint8#, quint8cxx . . $ quint8#> m_versioncxx . . $ HttpServer#HttpRequest#m_version.; |
| 74 | QMapcxx . . $ QMap#<QByteArraycxx . . $ QByteArray#, QByteArraycxx . . $ QByteArray#> m_headerscxx . . $ HttpServer#HttpRequest#m_headers.; |
| 75 | }; |
| 76 | |
| 77 | virtual void answerClientcxx . . $ HttpServer#answerClient(3437f9300e7c8f28).(QTcpSocketcxx . . $ QTcpSocket#* socket, const HttpRequestcxx . . $ HttpServer#HttpRequest#& request) = 0; |
| 78 | |
| 79 | private slotscxx . . $ `<external>/4830994369567095248/qtmetamacros.h:42:14`!: |
| 80 | void clientConnectedcxx . . $ HttpServer#clientConnected(49f6e7a06ebc5aa8).(); |
| 81 | |
| 82 | private: |
| 83 | void readReceivedDatacxx . . $ HttpServer#readReceivedData(214e24de1d575aa3).(QTcpSocketcxx . . $ QTcpSocket#* socket); |
| 84 | |
| 85 | private: |
| 86 | QMapcxx . . $ QMap#<QTcpSocketcxx . . $ QTcpSocket#*, HttpRequestcxx . . $ HttpServer#HttpRequest#> m_connectedClientscxx . . $ HttpServer#m_connectedClients.; |
| 87 | QTcpServercxx . . $ QTcpServer# m_httpServercxx . . $ HttpServer#m_httpServer.; |
| 88 | QHostAddresscxx . . $ QHostAddress# m_listenAddresscxx . . $ HttpServer#m_listenAddress.; |
| 89 | quint16cxx . . $ quint16# m_listenPortcxx . . $ HttpServer#m_listenPort.; |
| 90 | QStringcxx . . $ QString# m_listenAddressPortcxx . . $ HttpServer#m_listenAddressPort.; |
| 91 | }; |
| 92 | |
| 93 | #endif // HTTPSERVER_H |