QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 1 | // 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 | |
| 14 | namespace quic { |
| 15 | |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 16 | struct 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. |
vasilvv | c48c871 | 2019-03-11 13:38:16 -0700 | [diff] [blame] | 19 | std::string pre_shared_key; |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 20 | |
| 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 team | b114092 | 2019-03-22 05:24:05 -0700 | [diff] [blame] | 39 | // Creates a new QuartcClientSession using the given configuration. |
| 40 | std::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 team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 48 | |
| 49 | // Configures global settings, such as supported quic versions. |
| 50 | // Must execute on QUIC thread. |
| 51 | void ConfigureGlobalQuicSettings(); |
| 52 | |
| 53 | // Must execute on QUIC thread. |
| 54 | QuicConfig CreateQuicConfig(const QuartcSessionConfig& quartc_session_config); |
| 55 | |
| 56 | std::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 team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 65 | } // namespace quic |
| 66 | |
| 67 | #endif // QUICHE_QUIC_QUARTC_QUARTC_FACTORY_H_ |