blob: ba3ebd6b949870861c0c2fe00bbe67da0ab930c0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// A server specific QuicSession subclass.
#ifndef NET_TOOLS_QUIC_QUIC_SERVER_SESSION_H_
#define NET_TOOLS_QUIC_QUIC_SERVER_SESSION_H_
#include <set>
#include <vector>
#include "base/containers/hash_tables.h"
#include "base/memory/scoped_ptr.h"
#include "net/quic/quic_crypto_server_stream.h"
#include "net/quic/quic_protocol.h"
#include "net/quic/quic_session.h"
namespace net {
class QuicConfig;
class QuicConnection;
class QuicCryptoServerConfig;
class ReliableQuicStream;
namespace tools {
// An interface from the session to the entity owning the session.
// This lets the session notify its owner (the Dispatcher) when the connection
// is closed.
class QuicSessionOwner {
public:
virtual ~QuicSessionOwner() {}
virtual void OnConnectionClose(QuicGuid guid, QuicErrorCode error) = 0;
};
class QuicServerSession : public QuicSession {
public:
QuicServerSession(const QuicConfig& config,
QuicConnection *connection,
QuicSessionOwner* owner);
// Override the base class to notify the owner of the connection close.
virtual void ConnectionClose(QuicErrorCode error, bool from_peer) OVERRIDE;
virtual ~QuicServerSession();
virtual void InitializeSession(const QuicCryptoServerConfig& crypto_config);
protected:
// QuicSession methods:
virtual ReliableQuicStream* CreateIncomingReliableStream(
QuicStreamId id) OVERRIDE;
virtual ReliableQuicStream* CreateOutgoingReliableStream() OVERRIDE;
virtual QuicCryptoServerStream* GetCryptoStream() OVERRIDE;
// If we should create an incoming stream, returns true. Otherwise
// does error handling, including communicating the error to the client and
// possibly closing the connection, and returns false.
virtual bool ShouldCreateIncomingReliableStream(QuicStreamId id);
virtual QuicCryptoServerStream* CreateQuicCryptoServerStream(
const QuicCryptoServerConfig& crypto_config);
private:
scoped_ptr<QuicCryptoServerStream> crypto_stream_;
QuicSessionOwner* owner_;
DISALLOW_COPY_AND_ASSIGN(QuicServerSession);
};
} // namespace tools
} // namespace net
#endif // NET_TOOLS_QUIC_QUIC_SERVER_SESSION_H_
|