QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 1 | // Copyright 2013 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_TEST_TOOLS_QUIC_DISPATCHER_PEER_H_ |
| 6 | #define QUICHE_QUIC_TEST_TOOLS_QUIC_DISPATCHER_PEER_H_ |
| 7 | |
| 8 | #include "base/macros.h" |
| 9 | #include "net/third_party/quiche/src/quic/core/quic_dispatcher.h" |
| 10 | |
| 11 | namespace quic { |
| 12 | |
| 13 | class QuicPacketWriterWrapper; |
| 14 | |
| 15 | namespace test { |
| 16 | |
| 17 | class QuicDispatcherPeer { |
| 18 | public: |
| 19 | QuicDispatcherPeer() = delete; |
| 20 | |
| 21 | static void SetTimeWaitListManager( |
| 22 | QuicDispatcher* dispatcher, |
| 23 | QuicTimeWaitListManager* time_wait_list_manager); |
| 24 | |
| 25 | // Injects |writer| into |dispatcher| as the shared writer. |
| 26 | static void UseWriter(QuicDispatcher* dispatcher, |
| 27 | QuicPacketWriterWrapper* writer); |
| 28 | |
| 29 | static QuicPacketWriter* GetWriter(QuicDispatcher* dispatcher); |
| 30 | |
| 31 | static QuicCompressedCertsCache* GetCache(QuicDispatcher* dispatcher); |
| 32 | |
| 33 | static QuicConnectionHelperInterface* GetHelper(QuicDispatcher* dispatcher); |
| 34 | |
| 35 | static QuicAlarmFactory* GetAlarmFactory(QuicDispatcher* dispatcher); |
| 36 | |
| 37 | static QuicDispatcher::WriteBlockedList* GetWriteBlockedList( |
| 38 | QuicDispatcher* dispatcher); |
| 39 | |
| 40 | // Get the dispatcher's record of the last error reported to its framer |
| 41 | // visitor's OnError() method. Then set that record to QUIC_NO_ERROR. |
| 42 | static QuicErrorCode GetAndClearLastError(QuicDispatcher* dispatcher); |
| 43 | |
| 44 | static QuicBufferedPacketStore* GetBufferedPackets( |
| 45 | QuicDispatcher* dispatcher); |
| 46 | |
| 47 | static const QuicDispatcher::SessionMap& session_map( |
| 48 | QuicDispatcher* dispatcher); |
| 49 | |
| 50 | static void set_new_sessions_allowed_per_event_loop( |
| 51 | QuicDispatcher* dispatcher, |
| 52 | size_t num_session_allowed); |
| 53 | |
| 54 | static void SendPublicReset( |
| 55 | QuicDispatcher* dispatcher, |
| 56 | const QuicSocketAddress& self_address, |
| 57 | const QuicSocketAddress& peer_address, |
| 58 | QuicConnectionId connection_id, |
| 59 | bool ietf_quic, |
| 60 | std::unique_ptr<QuicPerPacketContext> packet_context); |
| 61 | |
| 62 | static std::unique_ptr<QuicPerPacketContext> GetPerPacketContext( |
| 63 | QuicDispatcher* dispatcher); |
| 64 | |
| 65 | static void RestorePerPacketContext(QuicDispatcher* dispatcher, |
| 66 | std::unique_ptr<QuicPerPacketContext>); |
| 67 | }; |
| 68 | |
| 69 | } // namespace test |
| 70 | } // namespace quic |
| 71 | |
| 72 | #endif // QUICHE_QUIC_TEST_TOOLS_QUIC_DISPATCHER_PEER_H_ |