Line data Source code
1 : #pragma once 2 : 3 : #include "source/common/quic/envoy_quic_clock.h" 4 : 5 : #include "quiche/common/simple_buffer_allocator.h" 6 : #include "quiche/quic/core/crypto/quic_random.h" 7 : #include "quiche/quic/core/quic_connection.h" 8 : 9 : namespace Envoy { 10 : namespace Quic { 11 : 12 : // Derived to provide EnvoyQuicClock and default random generator and buffer 13 : // allocator. 14 : class EnvoyQuicConnectionHelper : public quic::QuicConnectionHelperInterface { 15 : public: 16 : EnvoyQuicConnectionHelper(Event::Dispatcher& dispatcher) 17 1 : : clock_(dispatcher), random_generator_(quic::QuicRandom::GetInstance()) {} 18 : 19 1 : ~EnvoyQuicConnectionHelper() override = default; 20 : 21 : // QuicConnectionHelperInterface 22 3535 : const quic::QuicClock* GetClock() const override { return &clock_; } 23 515 : quic::QuicRandom* GetRandomGenerator() override { return random_generator_; } 24 4812 : quiche::QuicheBufferAllocator* GetStreamSendBufferAllocator() override { 25 4812 : return &buffer_allocator_; 26 4812 : } 27 : 28 : private: 29 : EnvoyQuicClock clock_; 30 : quic::QuicRandom* random_generator_ = nullptr; 31 : quiche::SimpleBufferAllocator buffer_allocator_; 32 : }; 33 : 34 : } // namespace Quic 35 : } // namespace Envoy