blob: 0db6ed2cd0a4109893b7f793e567548fdedfd000 [file] [log] [blame]
QUICHE teama6ef0a62019-03-07 20:34:33 -05001// 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 team5be974e2020-12-29 18:35:24 -050014#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 teama6ef0a62019-03-07 20:34:33 -050022#include "net/quic/platform/impl/quic_epoll_clock.h"
23
24namespace quic {
25
26class QuicRandom;
27
28enum class QuicAllocator { SIMPLE, BUFFER_POOL };
29
dschinazif25169a2019-10-23 08:12:18 -070030class QUIC_EXPORT_PRIVATE QuicEpollConnectionHelper
31 : public QuicConnectionHelperInterface {
QUICHE teama6ef0a62019-03-07 20:34:33 -050032 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_