blob: 7041454f907c8a70639b5a3248da8d7053b70419 [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
14#include "net/third_party/quiche/src/quic/core/quic_connection.h"
15#include "net/third_party/quiche/src/quic/core/quic_default_packet_writer.h"
16#include "net/third_party/quiche/src/quic/core/quic_packet_writer.h"
17#include "net/third_party/quiche/src/quic/core/quic_packets.h"
18#include "net/third_party/quiche/src/quic/core/quic_simple_buffer_allocator.h"
19#include "net/third_party/quiche/src/quic/core/quic_time.h"
20#include "net/third_party/quiche/src/quic/platform/api/quic_epoll.h"
21#include "net/third_party/quiche/src/quic/platform/api/quic_stream_buffer_allocator.h"
22#include "net/quic/platform/impl/quic_epoll_clock.h"
23
24namespace quic {
25
26class QuicRandom;
27
28enum class QuicAllocator { SIMPLE, BUFFER_POOL };
29
30class QuicEpollConnectionHelper : public QuicConnectionHelperInterface {
31 public:
32 QuicEpollConnectionHelper(QuicEpollServer* eps, QuicAllocator allocator);
33 QuicEpollConnectionHelper(const QuicEpollConnectionHelper&) = delete;
34 QuicEpollConnectionHelper& operator=(const QuicEpollConnectionHelper&) =
35 delete;
36 ~QuicEpollConnectionHelper() override;
37
38 // QuicConnectionHelperInterface
39 const QuicClock* GetClock() const override;
40 QuicRandom* GetRandomGenerator() override;
41 QuicBufferAllocator* GetStreamSendBufferAllocator() override;
42
43 private:
44 const QuicEpollClock clock_;
45 QuicRandom* random_generator_;
46 // Set up allocators. They take up minimal memory before use.
47 // Allocator for stream send buffers.
48 QuicStreamBufferAllocator stream_buffer_allocator_;
49 SimpleBufferAllocator simple_buffer_allocator_;
50 QuicAllocator allocator_type_;
51};
52
53} // namespace quic
54
55#endif // QUICHE_QUIC_CORE_QUIC_EPOLL_CONNECTION_HELPER_H_