Chromium Code Reviews| 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. Only one | |
| 15 // QuartcFactory is expected to be created. | |
|
pthatcher2
2016/10/24 17:42:49
This comment should be on the QuartcFactory, not t
zhihuang1
2016/10/24 19:08:10
Done.
| |
| 16 class QuartcFactoryInterface { | |
| 17 public: | |
| 18 virtual ~QuartcFactoryInterface() {} | |
| 19 | |
| 20 struct QuartcSessionConfig { | |
| 21 // When using Quartc, there are two endpoints. The QuartcSession on one | |
| 22 // endpoint must act as a server and the one on the other side must act as a | |
| 23 // client. | |
| 24 bool is_server = false; | |
| 25 // This is only needed when is_server = false. It must be unique | |
| 26 // for each endpoint the local endpoint may communicate with. For example, | |
| 27 // a WebRTC client could use the remote endpoint's crypto fingerprint | |
| 28 std::string unique_remote_server_id; | |
| 29 // The way the QuicConnection will send and receive packets, like a virtual | |
| 30 // UDP socket. For WebRTC, this will typically be an IceTransport. | |
| 31 QuartcSessionInterface::PacketTransport* packet_transport = nullptr; | |
| 32 // The maximum size of the packet can be written with the packet writer. | |
| 33 // 1200 bytes by default. | |
| 34 uint64_t max_packet_size = 1200; | |
| 35 }; | |
| 36 | |
| 37 virtual std::unique_ptr<QuartcSessionInterface> CreateQuartcSession( | |
| 38 const QuartcSessionConfig& quartc_config) = 0; | |
| 39 }; | |
| 40 | |
| 41 // The configuration for creating a QuartcFactory. | |
| 42 struct QuartcFactoryConfig { | |
| 43 // The task runner used by the QuartcAlarm. Implemented by the Quartc user | |
| 44 // with different mechanism. For example in WebRTC, it is implemented with | |
| 45 // rtc::Thread. | |
| 46 QuartcTaskRunnerInterface* task_runner = nullptr; | |
| 47 // If create_at_exit_manager = true, an AtExitManager will be created and | |
| 48 // owned by the QuartcFactory. In some scenarios, such as unit tests, this | |
| 49 // value could be false and no AtExitManager will be created. | |
| 50 bool create_at_exit_manager = true; | |
| 51 }; | |
| 52 | |
| 53 // Creates a new instance of QuartcFactoryInterface. | |
| 54 NET_EXPORT_PRIVATE std::unique_ptr<QuartcFactoryInterface> CreateQuartcFactory( | |
| 55 const QuartcFactoryConfig& factory_config); | |
| 56 | |
| 57 } // namepace net | |
| 58 | |
| 59 #endif // NET_QUIC_QUARTC_QUARTC_FACTORY_INTERFACE_H_ | |
| OLD | NEW |