michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: // SPDY Server Push michael@0: michael@0: /* michael@0: A pushed stream is put into a memory buffer (The SpdyPushTransactionBuffer) michael@0: and spooled there until a GET is made that can be matched up with it. At michael@0: that time we have two spdy streams - the GET (aka the sink) and the PUSH michael@0: (aka the source). Data is copied between those two streams for the lifetime michael@0: of the transaction. This is true even if the transaction buffer is empty, michael@0: partly complete, or totally loaded at the time the GET correspondence is made. michael@0: michael@0: correspondence is done through a hash table of the full url, the spdy session, michael@0: and the load group. The load group is implicit because that's where the michael@0: hash is stored, the other items comprise the hash key. michael@0: michael@0: Pushed streams are subject to aggressive flow control before they are matched michael@0: with a GET at which point flow control is effectively disabled to match the michael@0: client pull behavior. michael@0: */ michael@0: michael@0: #ifndef mozilla_net_SpdyPush_Public_h michael@0: #define mozilla_net_SpdyPush_Public_h michael@0: michael@0: #include "nsAutoPtr.h" michael@0: #include "nsDataHashtable.h" michael@0: #include "nsISupports.h" michael@0: michael@0: class nsCString; michael@0: michael@0: namespace mozilla { michael@0: namespace net { michael@0: michael@0: class SpdyPushedStream3; michael@0: class SpdyPushedStream31; michael@0: class Http2PushedStream; michael@0: michael@0: // One cache per load group michael@0: class SpdyPushCache michael@0: { michael@0: public: michael@0: // The cache holds only weak pointers - no references michael@0: SpdyPushCache(); michael@0: virtual ~SpdyPushCache(); michael@0: michael@0: // for spdy/3 michael@0: public: michael@0: bool RegisterPushedStreamSpdy3(nsCString key, michael@0: SpdyPushedStream3 *stream); michael@0: SpdyPushedStream3 *RemovePushedStreamSpdy3(nsCString key); michael@0: michael@0: private: michael@0: nsDataHashtable mHashSpdy3; michael@0: michael@0: // for spdy/3.1 michael@0: public: michael@0: bool RegisterPushedStreamSpdy31(nsCString key, michael@0: SpdyPushedStream31 *stream); michael@0: SpdyPushedStream31 *RemovePushedStreamSpdy31(nsCString key); michael@0: private: michael@0: nsDataHashtable mHashSpdy31; michael@0: michael@0: // for http/2 michael@0: public: michael@0: bool RegisterPushedStreamHttp2(nsCString key, michael@0: Http2PushedStream *stream); michael@0: Http2PushedStream *RemovePushedStreamHttp2(nsCString key); michael@0: private: michael@0: nsDataHashtable mHashHttp2; michael@0: }; michael@0: michael@0: } // namespace mozilla::net michael@0: } // namespace mozilla michael@0: michael@0: #endif // mozilla_net_SpdyPush_Public_h