blob: df55cd3a3baf7af4317d9b58cad9b49112437fce [file] [log] [blame]
QUICHE teama6ef0a62019-03-07 20:34:33 -05001// Copyright (c) 2017 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.
4
5#ifndef QUICHE_QUIC_QUARTC_QUARTC_FACTORY_H_
6#define QUICHE_QUIC_QUARTC_QUARTC_FACTORY_H_
7
8#include "net/third_party/quiche/src/quic/core/quic_alarm_factory.h"
9#include "net/third_party/quiche/src/quic/core/quic_connection.h"
10#include "net/third_party/quiche/src/quic/core/quic_simple_buffer_allocator.h"
11#include "net/third_party/quiche/src/quic/quartc/quartc_packet_writer.h"
12#include "net/third_party/quiche/src/quic/quartc/quartc_session.h"
13
14namespace quic {
15
QUICHE teama6ef0a62019-03-07 20:34:33 -050016struct QuartcSessionConfig {
17 // If a pre-shared cryptographic key is available for this session, specify it
18 // here. This value will only be used if non-empty.
vasilvvc48c8712019-03-11 13:38:16 -070019 std::string pre_shared_key;
QUICHE teama6ef0a62019-03-07 20:34:33 -050020
21 // The maximum size of the packet can be written with the packet writer.
22 // 1200 bytes by default.
23 QuicPacketLength max_packet_size = 1200;
24
25 // Timeouts for the crypto handshake. Set them to higher values to
26 // prevent closing the session before it started on a slow network.
27 // Zero entries are ignored and QUIC defaults are used in that case.
28 QuicTime::Delta max_idle_time_before_crypto_handshake =
29 QuicTime::Delta::Zero();
30 QuicTime::Delta max_time_before_crypto_handshake = QuicTime::Delta::Zero();
31 QuicTime::Delta idle_network_timeout = QuicTime::Delta::Zero();
32
33 // Tail loss probes (TLP) are enabled by default, but it may be useful to
34 // disable them in tests. We can also consider disabling them in production
35 // if we discover that tail loss probes add overhead in low bitrate audio.
36 bool enable_tail_loss_probe = true;
37};
38
QUICHE teamb1140922019-03-22 05:24:05 -070039// Creates a new QuartcClientSession using the given configuration.
40std::unique_ptr<QuartcSession> CreateQuartcClientSession(
41 const QuartcSessionConfig& quartc_session_config,
42 const QuicClock* clock,
43 QuicAlarmFactory* alarm_factory,
44 QuicConnectionHelperInterface* connection_helper,
45 const ParsedQuicVersionVector& supported_versions,
46 QuicStringPiece server_crypto_config,
47 QuartcPacketTransport* packet_transport);
QUICHE teama6ef0a62019-03-07 20:34:33 -050048
49// Configures global settings, such as supported quic versions.
50// Must execute on QUIC thread.
51void ConfigureGlobalQuicSettings();
52
53// Must execute on QUIC thread.
54QuicConfig CreateQuicConfig(const QuartcSessionConfig& quartc_session_config);
55
56std::unique_ptr<QuicConnection> CreateQuicConnection(
57 QuicConnectionId connection_id,
58 const QuicSocketAddress& peer_address,
59 QuicConnectionHelperInterface* connection_helper,
60 QuicAlarmFactory* alarm_factory,
61 QuicPacketWriter* packet_writer,
62 Perspective perspective,
63 ParsedQuicVersionVector supported_versions);
64
QUICHE teama6ef0a62019-03-07 20:34:33 -050065} // namespace quic
66
67#endif // QUICHE_QUIC_QUARTC_QUARTC_FACTORY_H_