1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 * * This Source Code Form is subject to the terms of the Mozilla Public
3 * * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef _FuzzerRegistry_h__
7 #define _FuzzerRegistry_h__
14 #include "mozilla/Attributes.h"
15 #include "mozilla/Types.h"
17 typedef int (*FuzzerInitFunc
)(int*, char***);
18 typedef int (*FuzzerTestingFunc
)(const uint8_t*, size_t);
20 typedef int (*LibFuzzerDriver
)(int*, char***, FuzzerTestingFunc
);
24 typedef std::pair
<FuzzerInitFunc
, FuzzerTestingFunc
> FuzzerFunctions
;
26 class FuzzerRegistry
{
28 MOZ_EXPORT
static FuzzerRegistry
& getInstance();
29 MOZ_EXPORT
void registerModule(std::string moduleName
,
30 FuzzerInitFunc initFunc
,
31 FuzzerTestingFunc testingFunc
);
32 MOZ_EXPORT FuzzerFunctions
getModuleFunctions(std::string
& moduleName
);
34 FuzzerRegistry(FuzzerRegistry
const&) = delete;
35 void operator=(FuzzerRegistry
const&) = delete;
39 std::map
<std::string
, FuzzerFunctions
> moduleMap
;
42 } // namespace mozilla
44 #endif // _FuzzerRegistry_h__