QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 1 | // Copyright (c) 2012 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 | // The epoll-specific helper for QuicConnection which uses |
| 6 | // EpollAlarm for alarms, and used an int fd_ for writing data. |
| 7 | |
| 8 | #ifndef QUICHE_QUIC_CORE_QUIC_EPOLL_CONNECTION_HELPER_H_ |
| 9 | #define QUICHE_QUIC_CORE_QUIC_EPOLL_CONNECTION_HELPER_H_ |
| 10 | |
| 11 | #include <sys/types.h> |
| 12 | #include <set> |
| 13 | |
QUICHE team | 5be974e | 2020-12-29 18:35:24 -0500 | [diff] [blame] | 14 | #include "quic/core/quic_connection.h" |
| 15 | #include "quic/core/quic_default_packet_writer.h" |
| 16 | #include "quic/core/quic_packet_writer.h" |
| 17 | #include "quic/core/quic_packets.h" |
| 18 | #include "quic/core/quic_simple_buffer_allocator.h" |
| 19 | #include "quic/core/quic_time.h" |
| 20 | #include "quic/platform/api/quic_epoll.h" |
| 21 | #include "quic/platform/api/quic_stream_buffer_allocator.h" |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 22 | #include "net/quic/platform/impl/quic_epoll_clock.h" |
| 23 | |
| 24 | namespace quic { |
| 25 | |
| 26 | class QuicRandom; |
| 27 | |
| 28 | enum class QuicAllocator { SIMPLE, BUFFER_POOL }; |
| 29 | |
dschinazi | f25169a | 2019-10-23 08:12:18 -0700 | [diff] [blame] | 30 | class QUIC_EXPORT_PRIVATE QuicEpollConnectionHelper |
| 31 | : public QuicConnectionHelperInterface { |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 32 | public: |
| 33 | QuicEpollConnectionHelper(QuicEpollServer* eps, QuicAllocator allocator); |
| 34 | QuicEpollConnectionHelper(const QuicEpollConnectionHelper&) = delete; |
| 35 | QuicEpollConnectionHelper& operator=(const QuicEpollConnectionHelper&) = |
| 36 | delete; |
| 37 | ~QuicEpollConnectionHelper() override; |
| 38 | |
| 39 | // QuicConnectionHelperInterface |
| 40 | const QuicClock* GetClock() const override; |
| 41 | QuicRandom* GetRandomGenerator() override; |
| 42 | QuicBufferAllocator* GetStreamSendBufferAllocator() override; |
| 43 | |
| 44 | private: |
| 45 | const QuicEpollClock clock_; |
| 46 | QuicRandom* random_generator_; |
| 47 | // Set up allocators. They take up minimal memory before use. |
| 48 | // Allocator for stream send buffers. |
| 49 | QuicStreamBufferAllocator stream_buffer_allocator_; |
| 50 | SimpleBufferAllocator simple_buffer_allocator_; |
| 51 | QuicAllocator allocator_type_; |
| 52 | }; |
| 53 | |
| 54 | } // namespace quic |
| 55 | |
| 56 | #endif // QUICHE_QUIC_CORE_QUIC_EPOLL_CONNECTION_HELPER_H_ |