xref: /aosp_15_r20/external/cronet/net/third_party/quiche/src/quiche/spdy/core/zero_copy_output_buffer.h (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // 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 
10 #include "quiche/common/platform/api/quiche_export.h"
11 
12 namespace spdy {
13 
14 class QUICHE_EXPORT ZeroCopyOutputBuffer {
15  public:
~ZeroCopyOutputBuffer()16   virtual ~ZeroCopyOutputBuffer() {}
17 
18   // Returns the next available segment of memory to write. Will always return
19   // the same segment until AdvanceWritePtr is called.
20   virtual void Next(char** data, int* size) = 0;
21 
22   // After writing to a buffer returned from Next(), the caller should call
23   // this method to indicate how many bytes were written.
24   virtual void AdvanceWritePtr(int64_t count) = 0;
25 
26   // Returns the available capacity of the buffer.
27   virtual uint64_t BytesFree() const = 0;
28 };
29 
30 }  // namespace spdy
31 
32 #endif  // QUICHE_SPDY_CORE_ZERO_COPY_OUTPUT_BUFFER_H_
33