1 // Copyright (c) 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef NET_QUIC_QUIC_SPDY_SESSION_H_
6 #define NET_QUIC_QUIC_SPDY_SESSION_H_
8 #include "base/basictypes.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "net/quic/quic_data_stream.h"
11 #include "net/quic/quic_headers_stream.h"
12 #include "net/quic/quic_session.h"
17 class QuicSpdySessionPeer
;
20 // A QUIC session with a headers stream.
21 class NET_EXPORT_PRIVATE QuicSpdySession
: public QuicSession
{
23 QuicSpdySession(QuicConnection
* connection
, const QuicConfig
& config
);
25 ~QuicSpdySession() override
;
27 void Initialize() override
;
29 // Called by |headers_stream_| when headers have been received for a stream.
30 virtual void OnStreamHeaders(QuicStreamId stream_id
,
31 StringPiece headers_data
);
32 // Called by |headers_stream_| when headers with a priority have been
33 // received for this stream. This method will only be called for server
35 virtual void OnStreamHeadersPriority(QuicStreamId stream_id
,
36 QuicPriority priority
);
37 // Called by |headers_stream_| when headers have been completely received
38 // for a stream. |fin| will be true if the fin flag was set in the headers
40 virtual void OnStreamHeadersComplete(QuicStreamId stream_id
,
44 // Writes |headers| for the stream |id| to the dedicated headers stream.
45 // If |fin| is true, then no more data will be sent for the stream |id|.
46 // If provided, |ack_notifier_delegate| will be registered to be notified when
47 // we have seen ACKs for all packets resulting from this call.
50 const SpdyHeaderBlock
& headers
,
52 QuicPriority priority
,
53 QuicAckNotifier::DelegateInterface
* ack_notifier_delegate
);
55 QuicHeadersStream
* headers_stream() { return headers_stream_
.get(); }
58 // Override CreateIncomingDynamicStream() and CreateOutgoingDynamicStream()
59 // with QuicDataStream return type to make sure that all data streams are
61 QuicDataStream
* CreateIncomingDynamicStream(QuicStreamId id
) override
= 0;
62 QuicDataStream
* CreateOutgoingDynamicStream() override
= 0;
64 QuicDataStream
* GetSpdyDataStream(const QuicStreamId stream_id
);
67 friend class test::QuicSpdySessionPeer
;
69 scoped_ptr
<QuicHeadersStream
> headers_stream_
;
71 DISALLOW_COPY_AND_ASSIGN(QuicSpdySession
);
76 #endif // NET_QUIC_QUIC_SPDY_SESSION_H_