OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2016 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 NET_QUIC_QUARTC_QUARTC_FACTORY_INTERFACE_H_ |
| 6 #define NET_QUIC_QUARTC_QUARTC_FACTORY_INTERFACE_H_ |
| 7 |
| 8 #include "net/base/net_export.h" |
| 9 #include "net/quic/quartc/quartc_session_interface.h" |
| 10 #include "net/quic/quartc/quartc_task_runner_interface.h" |
| 11 |
| 12 namespace net { |
| 13 |
| 14 // Used to create instances for Quartc objects such as QuartcSession. |
| 15 class QuartcFactoryInterface { |
| 16 public: |
| 17 virtual ~QuartcFactoryInterface() {} |
| 18 |
| 19 struct QuartcSessionConfig { |
| 20 // When using Quartc, there are two endpoints. The QuartcSession on one |
| 21 // endpoint must act as a server and the one on the other side must act as a |
| 22 // client. |
| 23 bool is_server = false; |
| 24 // This is only needed when is_server = false. It must be unique |
| 25 // for each endpoint the local endpoint may communicate with. For example, |
| 26 // a WebRTC client could use the remote endpoint's crypto fingerprint |
| 27 std::string unique_remote_server_id; |
| 28 // The way the QuicConnection will send and receive packets, like a virtual |
| 29 // UDP socket. For WebRTC, this will typically be an IceTransport. |
| 30 QuartcSessionInterface::PacketTransport* packet_transport = nullptr; |
| 31 // The maximum size of the packet can be written with the packet writer. |
| 32 // 1200 bytes by default. |
| 33 uint64_t max_packet_size = 1200; |
| 34 }; |
| 35 |
| 36 virtual std::unique_ptr<QuartcSessionInterface> CreateQuartcSession( |
| 37 const QuartcSessionConfig& quartc_config) = 0; |
| 38 }; |
| 39 |
| 40 // The configuration for creating a QuartcFactory. |
| 41 struct QuartcFactoryConfig { |
| 42 // The task runner used by the QuartcAlarm. Implemented by the Quartc user |
| 43 // with different mechanism. For example in WebRTC, it is implemented with |
| 44 // rtc::Thread. |
| 45 QuartcTaskRunnerInterface* task_runner = nullptr; |
| 46 }; |
| 47 |
| 48 // Creates a new instance of QuartcFactoryInterface. |
| 49 NET_EXPORT_PRIVATE std::unique_ptr<QuartcFactoryInterface> CreateQuartcFactory( |
| 50 const QuartcFactoryConfig& factory_config); |
| 51 |
| 52 } // namepace net |
| 53 |
| 54 #endif // NET_QUIC_QUARTC_QUARTC_FACTORY_INTERFACE_H_ |
OLD | NEW |