1 // Copyright (c) 2012 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 // A client specific QuicSession subclass.
7 #ifndef NET_TOOLS_QUIC_QUIC_CLIENT_SESSION_H_
8 #define NET_TOOLS_QUIC_QUIC_CLIENT_SESSION_H_
12 #include "base/basictypes.h"
13 #include "net/quic/quic_client_session_base.h"
14 #include "net/quic/quic_crypto_client_stream.h"
15 #include "net/quic/quic_protocol.h"
16 #include "net/tools/quic/quic_spdy_client_stream.h"
22 class ReliableQuicStream
;
26 class QuicClientSession
: public QuicClientSessionBase
{
28 QuicClientSession(const QuicConfig
& config
,
29 QuicConnection
* connection
,
30 const QuicServerId
& server_id
,
31 QuicCryptoClientConfig
* crypto_config
);
32 ~QuicClientSession() override
;
34 // QuicSession methods:
35 QuicSpdyClientStream
* CreateOutgoingDynamicStream() override
;
36 QuicCryptoClientStream
* GetCryptoStream() override
;
38 // QuicClientSessionBase methods:
39 void OnProofValid(const QuicCryptoClientConfig::CachedState
& cached
) override
;
40 void OnProofVerifyDetailsAvailable(
41 const ProofVerifyDetails
& verify_details
) override
;
43 // Performs a crypto handshake with the server.
46 // Returns the number of client hello messages that have been sent on the
47 // crypto stream. If the handshake has completed then this is one greater
48 // than the number of round-trips needed for the handshake.
49 int GetNumSentClientHellos() const;
51 void set_respect_goaway(bool respect_goaway
) {
52 respect_goaway_
= respect_goaway
;
56 // QuicSession methods:
57 QuicDataStream
* CreateIncomingDynamicStream(QuicStreamId id
) override
;
59 // Unlike CreateOutgoingDynamicStream, which applies a bunch of sanity checks,
60 // this simply returns a new QuicSpdyClientStream. This may be used by
61 // subclasses which want to use a subclass of QuicSpdyClientStream for streams
62 // but wish to use the sanity checks in CreateOutgoingDynamicStream.
63 virtual QuicSpdyClientStream
* CreateClientStream();
66 scoped_ptr
<QuicCryptoClientStream
> crypto_stream_
;
68 // If this is set to false, the client will ignore server GOAWAYs and allow
69 // the creation of streams regardless of the high chance they will fail.
72 DISALLOW_COPY_AND_ASSIGN(QuicClientSession
);
78 #endif // NET_TOOLS_QUIC_QUIC_CLIENT_SESSION_H_