PageRenderTime 153ms CodeModel.GetById 40ms app.highlight 42ms RepoModel.GetById 68ms app.codeStats 0ms

/thirdparty/qxt/qxtweb-standalone/qxtweb/qxthttpsessionmanager.h

http://github.com/tomahawk-player/tomahawk
C++ Header | 91 lines | 49 code | 18 blank | 24 comment | 0 complexity | 0a6249737d37fee5914c766cf4c79b9b MD5 | raw file
 1/****************************************************************************
 2 **
 3 ** Copyright (C) Qxt Foundation. Some rights reserved.
 4 **
 5 ** This file is part of the QxtWeb module of the Qxt library.
 6 **
 7 ** This library is free software; you can redistribute it and/or modify it
 8 ** under the terms of the Common Public License, version 1.0, as published
 9 ** by IBM, and/or under the terms of the GNU Lesser General Public License,
10 ** version 2.1, as published by the Free Software Foundation.
11 **
12 ** This file is provided "AS IS", without WARRANTIES OR CONDITIONS OF ANY
13 ** KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY
14 ** WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR
15 ** FITNESS FOR A PARTICULAR PURPOSE.
16 **
17 ** You should have received a copy of the CPL and the LGPL along with this
18 ** file. See the LICENSE file and the cpl1.0.txt/lgpl-2.1.txt files
19 ** included with the source distribution for more information.
20 ** If you did not receive a copy of the licenses, contact the Qxt Foundation.
21 **
22 ** <http://libqxt.org>  <foundation@libqxt.org>
23 **
24 ****************************************************************************/
25
26#ifndef QXTHTTPSESSIONMANAGER_H
27#define QXTHTTPSESSIONMANAGER_H
28
29#include "qxtabstractwebsessionmanager.h"
30#include "qxtabstracthttpconnector.h"
31#include <QHostAddress>
32#include <QHttpHeader>
33#include <QSharedPointer>
34
35class QxtWebEvent;
36class QxtWebContent;
37
38class QxtHttpSessionManagerPrivate;
39class QXT_WEB_EXPORT QxtHttpSessionManager : public QxtAbstractWebSessionManager
40{
41    friend class QxtAbstractHttpConnector;
42    Q_OBJECT
43public:
44    enum Connector { HttpServer, Scgi, Fcgi };
45
46    QxtHttpSessionManager(QObject* parent = 0);
47
48    virtual void postEvent(QxtWebEvent*);
49
50    QHostAddress listenInterface() const;
51    void setListenInterface(const QHostAddress& iface);
52
53    quint16 port() const;
54    void setPort(quint16 port);
55
56    QByteArray sessionCookieName() const;
57    void setSessionCookieName(const QByteArray& name);
58
59    bool autoCreateSession() const;
60    void setAutoCreateSession(bool enable);
61
62    QxtAbstractWebService* staticContentService() const;
63    void setStaticContentService(QxtAbstractWebService* service);
64
65    void setConnector(QxtAbstractHttpConnector* connector);
66    void setConnector(Connector connector);
67    QxtAbstractHttpConnector* connector() const;
68
69    virtual bool start();
70
71protected:
72    virtual int newSession();
73    virtual void incomingRequest(quint32 requestID, const QHttpRequestHeader& header, QxtWebContent* device);
74
75protected Q_SLOTS:
76    virtual void processEvents();
77
78private Q_SLOTS:
79    void closeConnection(int requestID);
80    void chunkReadyRead(int requestID);
81    void sendNextChunk(int requestID);
82    void sendEmptyChunk(int requestID);
83    void blockReadyRead(int requestID);
84    void sendNextBlock(int requestID);
85
86private:
87    void disconnected(QIODevice* device);
88    QXT_DECLARE_PRIVATE(QxtHttpSessionManager)
89};
90
91#endif