vts sysfuzzer common lib - spec parser
Change-Id: I48946f8578d2841ddc202464a169f10baed95baf
diff --git a/sysfuzzer/common/specification_parser/SpecificationBuilder.h b/sysfuzzer/common/specification_parser/SpecificationBuilder.h
new file mode 100644
index 0000000..edeee13
--- /dev/null
+++ b/sysfuzzer/common/specification_parser/SpecificationBuilder.h
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __VTS_SYSFUZZER_COMMON_SPECPARSER_SPECBUILDER_H__
+#define __VTS_SYSFUZZER_COMMON_SPECPARSER_SPECBUILDER_H__
+
+#include <string>
+
+#include "test/vts/sysfuzzer/common/proto/InterfaceSpecificationMessage.pb.h"
+
+
+using namespace std;
+
+
+#define DEFAULT_SPEC_DIR_PATH "/system/etc/"
+#define SPEC_FILE_EXT ".vts"
+
+
+namespace android {
+namespace vts {
+
+class InterfaceSpecification;
+
+// Builder of an interface specification.
+class SpecificationBuilder {
+ public:
+ // Constructor where the first argument is the path of a dir which contains
+ // all available interface specification files.
+ SpecificationBuilder(const string dir_path);
+
+ // scans the dir and returns an interface specification for a requested
+ // component.
+ vts::InterfaceSpecificationMessage* FindInterfaceSpecification(
+ const int target_class, const int target_type, const float target_version);
+
+ // Main function for the VTS system fuzzer where dll_file_name is the path of
+ // a target component, spec_lib_file_path is the path of a specification
+ // library file, and the rest three arguments are the basic information of
+ // the target component.
+ bool Process(
+ const char* dll_file_name, const char* spec_lib_file_path,
+ int target_class, int target_type, float target_version);
+
+ private:
+ // the path of a dir which contains interface specification ASCII proto files.
+ const string dir_path_;
+};
+
+} // namespace vts
+} // namespace android
+
+#endif // __VTS_SYSFUZZER_COMMON_SPECPARSER_SPECBUILDER_H__