blob: 3f35bab714d6c4bdcff4e40135e0df2f12095843 [file] [log] [blame]
QUICHE team82dee2f2019-01-18 12:35:12 -05001// Copyright 2017 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_SPDY_CORE_ZERO_COPY_OUTPUT_BUFFER_H_
6#define QUICHE_SPDY_CORE_ZERO_COPY_OUTPUT_BUFFER_H_
7
8#include <cstdint>
9
10namespace spdy {
11
12class ZeroCopyOutputBuffer {
13 public:
14 virtual ~ZeroCopyOutputBuffer() {}
15
16 // Returns the next available segment of memory to write. Will always return
17 // the same segment until AdvanceWritePtr is called.
18 virtual void Next(char** data, int* size) = 0;
19
20 // After writing to a buffer returned from Next(), the caller should call
21 // this method to indicate how many bytes were written.
22 virtual void AdvanceWritePtr(int64_t count) = 0;
23
24 // Returns the available capacity of the buffer.
25 virtual uint64_t BytesFree() const = 0;
26};
27
28} // namespace spdy
29
30#endif // QUICHE_SPDY_CORE_ZERO_COPY_OUTPUT_BUFFER_H_