xref: /aosp_15_r20/external/cronet/net/filter/zstd_source_stream.h (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2023 The Chromium Authors
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 NET_FILTER_ZSTD_SOURCE_STREAM_H_
6 #define NET_FILTER_ZSTD_SOURCE_STREAM_H_
7 
8 #include <memory>
9 
10 #include "base/memory/scoped_refptr.h"
11 #include "net/base/io_buffer.h"
12 #include "net/base/net_export.h"
13 #include "net/filter/filter_source_stream.h"
14 #include "net/filter/source_stream.h"
15 
16 namespace net {
17 
18 NET_EXPORT_PRIVATE std::unique_ptr<FilterSourceStream> CreateZstdSourceStream(
19     std::unique_ptr<SourceStream> previous);
20 
21 NET_EXPORT_PRIVATE std::unique_ptr<FilterSourceStream>
22 CreateZstdSourceStreamWithDictionary(std::unique_ptr<SourceStream> upstream,
23                                      scoped_refptr<IOBuffer> dictionary,
24                                      size_t dictionary_size);
25 
26 // These values are persisted to logs. Entries should not be renumbered and
27 // numeric values should never be reused.
28 enum class ZstdDecodingStatus {
29   kDecodingInProgress = 0,
30   kEndOfFrame = 1,
31   kDecodingError = 2,
32   kMaxValue = kDecodingError,
33 };
34 
35 }  // namespace net
36 
37 #endif  // NET_FILTER_ZSTD_SOURCE_STREAM_H_
38