netwerk/protocol/http/SpdyPush31.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 // spdy/3.1
michael@0 7
michael@0 8 #ifndef mozilla_net_SpdyPush31_Internal_h
michael@0 9 #define mozilla_net_SpdyPush31_Internal_h
michael@0 10
michael@0 11 #include "mozilla/Attributes.h"
michael@0 12 #include "mozilla/TimeStamp.h"
michael@0 13 #include "nsHttpRequestHead.h"
michael@0 14 #include "nsILoadGroup.h"
michael@0 15 #include "nsString.h"
michael@0 16 #include "PSpdyPush.h"
michael@0 17 #include "SpdySession31.h"
michael@0 18 #include "SpdyStream31.h"
michael@0 19
michael@0 20 namespace mozilla {
michael@0 21 namespace net {
michael@0 22
michael@0 23 class SpdyPush31TransactionBuffer;
michael@0 24
michael@0 25 class SpdyPushedStream31 MOZ_FINAL : public SpdyStream31
michael@0 26 {
michael@0 27 public:
michael@0 28 SpdyPushedStream31(SpdyPush31TransactionBuffer *aTransaction,
michael@0 29 SpdySession31 *aSession,
michael@0 30 SpdyStream31 *aAssociatedStream,
michael@0 31 uint32_t aID);
michael@0 32 virtual ~SpdyPushedStream31() {}
michael@0 33
michael@0 34 bool GetPushComplete();
michael@0 35 SpdyStream31 *GetConsumerStream() { return mConsumerStream; };
michael@0 36 void SetConsumerStream(SpdyStream31 *aStream) { mConsumerStream = aStream; }
michael@0 37 bool GetHashKey(nsCString &key);
michael@0 38
michael@0 39 // override of SpdyStream31
michael@0 40 nsresult ReadSegments(nsAHttpSegmentReader *, uint32_t, uint32_t *);
michael@0 41 nsresult WriteSegments(nsAHttpSegmentWriter *, uint32_t, uint32_t *);
michael@0 42
michael@0 43 nsILoadGroupConnectionInfo *LoadGroupConnectionInfo() { return mLoadGroupCI; };
michael@0 44 void ConnectPushedStream(SpdyStream31 *consumer);
michael@0 45
michael@0 46 bool DeferCleanupOnSuccess() { return mDeferCleanupOnSuccess; }
michael@0 47 void SetDeferCleanupOnSuccess(bool val) { mDeferCleanupOnSuccess = val; }
michael@0 48
michael@0 49 bool IsOrphaned(TimeStamp now);
michael@0 50
michael@0 51 nsresult GetBufferedData(char *buf, uint32_t count, uint32_t *countWritten);
michael@0 52
michael@0 53 // overload of SpdyStream31
michael@0 54 virtual bool HasSink() { return !!mConsumerStream; }
michael@0 55
michael@0 56 private:
michael@0 57
michael@0 58 SpdyStream31 *mConsumerStream; // paired request stream that consumes from
michael@0 59 // real spdy one.. null until a match is made.
michael@0 60
michael@0 61 nsCOMPtr<nsILoadGroupConnectionInfo> mLoadGroupCI;
michael@0 62
michael@0 63 SpdyPush31TransactionBuffer *mBufferedPush;
michael@0 64 TimeStamp mLastRead;
michael@0 65
michael@0 66 nsCString mHashKey;
michael@0 67 nsresult mStatus;
michael@0 68 bool mPushCompleted; // server push FIN received
michael@0 69 bool mDeferCleanupOnSuccess;
michael@0 70 };
michael@0 71
michael@0 72 class SpdyPush31TransactionBuffer MOZ_FINAL : public nsAHttpTransaction
michael@0 73 {
michael@0 74 public:
michael@0 75 NS_DECL_ISUPPORTS
michael@0 76 NS_DECL_NSAHTTPTRANSACTION
michael@0 77
michael@0 78 SpdyPush31TransactionBuffer();
michael@0 79 virtual ~SpdyPush31TransactionBuffer();
michael@0 80
michael@0 81 nsresult GetBufferedData(char *buf, uint32_t count, uint32_t *countWritten);
michael@0 82 void SetPushStream(SpdyPushedStream31 *stream) { mPushStream = stream; }
michael@0 83
michael@0 84 private:
michael@0 85 const static uint32_t kDefaultBufferSize = 4096;
michael@0 86
michael@0 87 nsresult mStatus;
michael@0 88 nsHttpRequestHead *mRequestHead;
michael@0 89 SpdyPushedStream31 *mPushStream;
michael@0 90 bool mIsDone;
michael@0 91
michael@0 92 nsAutoArrayPtr<char> mBufferedHTTP1;
michael@0 93 uint32_t mBufferedHTTP1Size;
michael@0 94 uint32_t mBufferedHTTP1Used;
michael@0 95 uint32_t mBufferedHTTP1Consumed;
michael@0 96 };
michael@0 97
michael@0 98 } // namespace mozilla::net
michael@0 99 } // namespace mozilla
michael@0 100
michael@0 101 #endif // mozilla_net_SpdyPush3_Internal_h

mercurial