FuzzerDefs.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. //===- FuzzerDefs.h - Internal header for the Fuzzer ------------*- C++ -* ===//
  2. //
  3. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  4. // See https://llvm.org/LICENSE.txt for license information.
  5. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  6. //
  7. //===----------------------------------------------------------------------===//
  8. // Basic definitions.
  9. //===----------------------------------------------------------------------===//
  10. #ifndef LLVM_FUZZER_DEFS_H
  11. #define LLVM_FUZZER_DEFS_H
  12. #include <cassert>
  13. #include <cstddef>
  14. #include <cstdint>
  15. #include <cstring>
  16. #include <memory>
  17. #include <set>
  18. #include <string>
  19. #include <vector>
  20. namespace fuzzer {
  21. template <class T> T Min(T a, T b) { return a < b ? a : b; }
  22. template <class T> T Max(T a, T b) { return a > b ? a : b; }
  23. class Random;
  24. class Dictionary;
  25. class DictionaryEntry;
  26. class MutationDispatcher;
  27. struct FuzzingOptions;
  28. class InputCorpus;
  29. struct InputInfo;
  30. struct ExternalFunctions;
  31. // Global interface to functions that may or may not be available.
  32. extern ExternalFunctions *EF;
  33. typedef std::vector<uint8_t> Unit;
  34. typedef std::vector<Unit> UnitVector;
  35. typedef int (*UserCallback)(const uint8_t *Data, size_t Size);
  36. #define exit(status) FuzzerExit(status)
  37. void FuzzerExit(int status);
  38. int FuzzerDriver(int *argc, char ***argv, UserCallback Callback);
  39. uint8_t *ExtraCountersBegin();
  40. uint8_t *ExtraCountersEnd();
  41. void ClearExtraCounters();
  42. extern bool RunningUserCallback;
  43. } // namespace fuzzer
  44. #endif // LLVM_FUZZER_DEFS_H