Keun Soo Yim | 0840037 | 2016-03-03 13:28:51 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 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_SPECPARSER_SPECBUILDER_H__ |
| 18 | #define __VTS_SYSFUZZER_COMMON_SPECPARSER_SPECBUILDER_H__ |
| 19 | |
| 20 | #include <string> |
| 21 | |
| 22 | #include "test/vts/sysfuzzer/common/proto/InterfaceSpecificationMessage.pb.h" |
| 23 | |
| 24 | |
| 25 | using namespace std; |
| 26 | |
| 27 | |
| 28 | #define DEFAULT_SPEC_DIR_PATH "/system/etc/" |
| 29 | #define SPEC_FILE_EXT ".vts" |
| 30 | |
| 31 | |
| 32 | namespace android { |
| 33 | namespace vts { |
| 34 | |
| 35 | class InterfaceSpecification; |
| 36 | |
| 37 | // Builder of an interface specification. |
| 38 | class SpecificationBuilder { |
| 39 | public: |
| 40 | // Constructor where the first argument is the path of a dir which contains |
| 41 | // all available interface specification files. |
Keun Soo Yim | 8103c91 | 2016-04-22 20:07:13 -0700 | [diff] [blame^] | 42 | SpecificationBuilder(const string dir_path, int epoch_count); |
Keun Soo Yim | 0840037 | 2016-03-03 13:28:51 -0800 | [diff] [blame] | 43 | |
| 44 | // scans the dir and returns an interface specification for a requested |
| 45 | // component. |
| 46 | vts::InterfaceSpecificationMessage* FindInterfaceSpecification( |
| 47 | const int target_class, const int target_type, const float target_version); |
| 48 | |
| 49 | // Main function for the VTS system fuzzer where dll_file_name is the path of |
| 50 | // a target component, spec_lib_file_path is the path of a specification |
| 51 | // library file, and the rest three arguments are the basic information of |
| 52 | // the target component. |
| 53 | bool Process( |
| 54 | const char* dll_file_name, const char* spec_lib_file_path, |
| 55 | int target_class, int target_type, float target_version); |
| 56 | |
| 57 | private: |
| 58 | // the path of a dir which contains interface specification ASCII proto files. |
| 59 | const string dir_path_; |
Keun Soo Yim | 8103c91 | 2016-04-22 20:07:13 -0700 | [diff] [blame^] | 60 | // the total number of epochs |
| 61 | const int epoch_count_; |
Keun Soo Yim | 0840037 | 2016-03-03 13:28:51 -0800 | [diff] [blame] | 62 | }; |
| 63 | |
| 64 | } // namespace vts |
| 65 | } // namespace android |
| 66 | |
| 67 | #endif // __VTS_SYSFUZZER_COMMON_SPECPARSER_SPECBUILDER_H__ |