2 * Copyright (c) Meta Platforms, Inc. and affiliates.
5 * This source code is licensed under both the BSD-style license (found in the
6 * LICENSE file in the root directory of this source tree) and the GPLv2 (found
7 * in the COPYING file in the root directory of this source tree).
8 * You may select, at your option, one of the above-listed licenses.
11 * Helper functions for fuzzing.
14 #ifndef ZSTD_HELPERS_H
15 #define ZSTD_HELPERS_H
17 #define ZSTD_STATIC_LINKING_ONLY
20 #include "zstd_errors.h"
21 #include "fuzz_data_producer.h"
28 extern const int kMinClevel;
29 extern const int kMaxClevel;
31 void FUZZ_setRandomParameters(ZSTD_CCtx *cctx, size_t srcSize, FUZZ_dataProducer_t *producer);
33 ZSTD_compressionParameters FUZZ_randomCParams(size_t srcSize, FUZZ_dataProducer_t *producer);
34 ZSTD_frameParameters FUZZ_randomFParams(FUZZ_dataProducer_t *producer);
35 ZSTD_parameters FUZZ_randomParams(size_t srcSize, FUZZ_dataProducer_t *producer);
42 /* Quickly train a dictionary from a source for fuzzing.
43 * NOTE: Don't use this to train production dictionaries, it is only optimized
44 * for speed, and doesn't care about dictionary quality.
46 FUZZ_dict_t FUZZ_train(void const* src, size_t srcSize, FUZZ_dataProducer_t *producer);
48 #ifdef FUZZ_THIRD_PARTY_SEQ_PROD
49 extern void* FUZZ_seqProdState;
56 #endif /* ZSTD_HELPERS_H */