src/network/access/qnetworkreplyimpl_p.h
changeset 30 5dc02b23752f
parent 23 89e065397ea6
equal deleted inserted replaced
29:b72c6db6890b 30:5dc02b23752f
    75 public:
    75 public:
    76     QNetworkReplyImpl(QObject *parent = 0);
    76     QNetworkReplyImpl(QObject *parent = 0);
    77     ~QNetworkReplyImpl();
    77     ~QNetworkReplyImpl();
    78     virtual void abort();
    78     virtual void abort();
    79 
    79 
    80     // reimplemented from QNetworkReply
    80     // reimplemented from QNetworkReply / QIODevice
    81     virtual void close();
    81     virtual void close();
    82     virtual qint64 bytesAvailable() const;
    82     virtual qint64 bytesAvailable() const;
    83     virtual void setReadBufferSize(qint64 size);
    83     virtual void setReadBufferSize(qint64 size);
       
    84     virtual bool canReadLine () const;
    84 
    85 
    85     virtual qint64 readData(char *data, qint64 maxlen);
    86     virtual qint64 readData(char *data, qint64 maxlen);
    86     virtual bool event(QEvent *);
    87     virtual bool event(QEvent *);
    87 
    88 
    88 #ifndef QT_NO_OPENSSL
    89 #ifndef QT_NO_OPENSSL
    96     Q_PRIVATE_SLOT(d_func(), void _q_startOperation())
    97     Q_PRIVATE_SLOT(d_func(), void _q_startOperation())
    97     Q_PRIVATE_SLOT(d_func(), void _q_copyReadyRead())
    98     Q_PRIVATE_SLOT(d_func(), void _q_copyReadyRead())
    98     Q_PRIVATE_SLOT(d_func(), void _q_copyReadChannelFinished())
    99     Q_PRIVATE_SLOT(d_func(), void _q_copyReadChannelFinished())
    99     Q_PRIVATE_SLOT(d_func(), void _q_bufferOutgoingData())
   100     Q_PRIVATE_SLOT(d_func(), void _q_bufferOutgoingData())
   100     Q_PRIVATE_SLOT(d_func(), void _q_bufferOutgoingDataFinished())
   101     Q_PRIVATE_SLOT(d_func(), void _q_bufferOutgoingDataFinished())
       
   102 #ifndef QT_NO_BEARERMANAGEMENT
       
   103     Q_PRIVATE_SLOT(d_func(), void _q_networkSessionConnected())
       
   104     Q_PRIVATE_SLOT(d_func(), void _q_networkSessionFailed())
       
   105 #endif
   101 };
   106 };
   102 
   107 
   103 class QNetworkReplyImplPrivate: public QNetworkReplyPrivate
   108 class QNetworkReplyImplPrivate: public QNetworkReplyPrivate
   104 {
   109 {
   105 public:
   110 public:
   108         NotifyCloseDownstreamChannel,
   113         NotifyCloseDownstreamChannel,
   109         NotifyCopyFinished
   114         NotifyCopyFinished
   110     };
   115     };
   111 
   116 
   112     enum State {
   117     enum State {
   113         Idle,
   118         Idle,               // The reply is idle.
   114         Buffering,
   119         Buffering,          // The reply is buffering outgoing data.
   115         Working,
   120         Working,            // The reply is uploading/downloading data.
   116         Finished,
   121         Finished,           // The reply has finished.
   117         Aborted
   122         Aborted,            // The reply has been aborted.
       
   123         WaitingForSession,  // The reply is waiting for the session to open before connecting.
       
   124         Reconnecting        // The reply will reconnect to once roaming has completed.
   118     };
   125     };
   119 
   126 
   120     typedef QQueue<InternalNotifications> NotificationQueue;
   127     typedef QQueue<InternalNotifications> NotificationQueue;
   121 
   128 
   122     QNetworkReplyImplPrivate();
   129     QNetworkReplyImplPrivate();
   126     void _q_sourceReadChannelFinished();
   133     void _q_sourceReadChannelFinished();
   127     void _q_copyReadyRead();
   134     void _q_copyReadyRead();
   128     void _q_copyReadChannelFinished();
   135     void _q_copyReadChannelFinished();
   129     void _q_bufferOutgoingData();
   136     void _q_bufferOutgoingData();
   130     void _q_bufferOutgoingDataFinished();
   137     void _q_bufferOutgoingDataFinished();
       
   138 #ifndef QT_NO_BEARERMANAGEMENT
       
   139     void _q_networkSessionConnected();
       
   140     void _q_networkSessionFailed();
       
   141 #endif
   131 
   142 
   132     void setup(QNetworkAccessManager::Operation op, const QNetworkRequest &request,
   143     void setup(QNetworkAccessManager::Operation op, const QNetworkRequest &request,
   133                QIODevice *outgoingData);
   144                QIODevice *outgoingData);
   134 
   145 
   135     void pauseNotificationHandling();
   146     void pauseNotificationHandling();
   164     QIODevice *outgoingData;
   175     QIODevice *outgoingData;
   165     QRingBuffer *outgoingDataBuffer;
   176     QRingBuffer *outgoingDataBuffer;
   166     QIODevice *copyDevice;
   177     QIODevice *copyDevice;
   167     QAbstractNetworkCache *networkCache() const;
   178     QAbstractNetworkCache *networkCache() const;
   168 
   179 
       
   180     bool migrateBackend();
       
   181 
   169     bool cacheEnabled;
   182     bool cacheEnabled;
   170     QIODevice *cacheSaveDevice;
   183     QIODevice *cacheSaveDevice;
   171 
   184 
   172     NotificationQueue pendingNotifications;
   185     NotificationQueue pendingNotifications;
   173     bool notificationHandlingPaused;
   186     bool notificationHandlingPaused;
   180 
   193 
   181     QByteDataBuffer readBuffer;
   194     QByteDataBuffer readBuffer;
   182     qint64 bytesDownloaded;
   195     qint64 bytesDownloaded;
   183     qint64 lastBytesDownloaded;
   196     qint64 lastBytesDownloaded;
   184     qint64 bytesUploaded;
   197     qint64 bytesUploaded;
       
   198     qint64 preMigrationDownloaded;
   185 
   199 
   186     QString httpReasonPhrase;
   200     QString httpReasonPhrase;
   187     int httpStatusCode;
   201     int httpStatusCode;
   188 
   202 
   189     State state;
   203     State state;
   190 
   204 
   191     Q_DECLARE_PUBLIC(QNetworkReplyImpl)
   205     Q_DECLARE_PUBLIC(QNetworkReplyImpl)
   192 };
   206 };
   193 
   207 
       
   208 #ifndef QT_NO_BEARERMANAGEMENT
       
   209 class QDisabledNetworkReply : public QNetworkReply
       
   210 {
       
   211     Q_OBJECT
       
   212 
       
   213 public:
       
   214     QDisabledNetworkReply(QObject *parent, const QNetworkRequest &req,
       
   215                           QNetworkAccessManager::Operation op);
       
   216     ~QDisabledNetworkReply();
       
   217 
       
   218     void abort() { }
       
   219 protected:
       
   220     qint64 readData(char *, qint64) { return -1; }
       
   221 };
       
   222 #endif
       
   223 
   194 QT_END_NAMESPACE
   224 QT_END_NAMESPACE
   195 
   225 
   196 #endif
   226 #endif