1 /* 2 * Copyright 2016 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef __VTS_SYSFUZZER_COMMON_FUZZER_WRAPPER_H__ 18 #define __VTS_SYSFUZZER_COMMON_FUZZER_WRAPPER_H__ 19 20 #include "component_loader/DllLoader.h" 21 #include "fuzz_tester/FuzzerBase.h" 22 23 #include "test/vts/proto/ComponentSpecificationMessage.pb.h" 24 25 using namespace std; 26 27 namespace android { 28 namespace vts { 29 30 // Wrapper used to get the pointer to a FuzzerBase class which provides 31 // APIs to conduct fuzz testing on a loaded component. 32 class FuzzerWrapper { 33 public: 34 explicit FuzzerWrapper(); ~FuzzerWrapper()35 virtual ~FuzzerWrapper() {} 36 37 // Loads a given component file. 38 bool LoadInterfaceSpecificationLibrary(const char* spec_dll_path); 39 40 // Returns the pointer to a FuzzerBase class of the loaded component where 41 // the class is designed to do the testing using the given interface 42 // specification message. 43 FuzzerBase* GetFuzzer(const vts::ComponentSpecificationMessage& message); 44 45 private: 46 // loaded file path. 47 string spec_dll_path_; 48 49 // DLL Loader class. 50 DllLoader dll_loader_; 51 52 // loaded function name; 53 char* function_name_prefix_chars_; 54 55 // loaded FuzzerBase; 56 FuzzerBase* fuzzer_base_; 57 }; 58 59 } // namespace vts 60 } // namespace android 61 62 #endif // __VTS_SYSFUZZER_COMMON_FUZZER_WRAPPER_H__ 63