• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_FUZZER_BINDER_SERVICE_H__
18 #define __VTS_FUZZER_BINDER_SERVICE_H__
19 
20 #include <string>
21 
22 #include <utils/RefBase.h>
23 #include <utils/String8.h>
24 
25 #include <binder/IBinder.h>
26 #include <binder/IInterface.h>
27 #include <binder/ProcessState.h>
28 
29 // #ifdef VTS_FUZZER_BINDER_DEBUG
30 
31 #define VTS_FUZZER_BINDER_SERVICE_NAME "VtsFuzzer"
32 
33 using namespace std;
34 
35 namespace android {
36 namespace vts {
37 
38 // VTS Fuzzer Binder Interface
39 class IVtsFuzzer : public IInterface {
40  public:
41   enum {
42     EXIT = IBinder::FIRST_CALL_TRANSACTION,
43     LOAD_HAL,
44     STATUS,
45     CALL,
46     GET_FUNCTIONS
47   };
48 
49   // Sends an exit command.
50   virtual void Exit() = 0;
51 
52   // Requests to load a HAL.
53   // Notes on args:
54   //   target_version_major:
55   //     int, the target component major HAL version
56   //   target_version_minor:
57   //     int, the target component minor HAL version
58   virtual int32_t LoadHal(const string& path, int target_class, int target_type,
59                           int target_version_major, int target_version_minor,
60                           const string& module_name) = 0;
61 
62   // Requests to return the specified status.
63   virtual int32_t Status(int32_t type) = 0;
64 
65   // Requests to call the specified function using the provided arguments.
66   virtual string Call(const string& call_payload) = 0;
67 
68   virtual const char* GetFunctions() = 0;
69 
70   DECLARE_META_INTERFACE(VtsFuzzer);
71 };
72 
73 // For client
74 class BpVtsFuzzer : public BpInterface<IVtsFuzzer> {
75  public:
BpVtsFuzzer(const sp<IBinder> & impl)76   explicit BpVtsFuzzer(const sp<IBinder>& impl)
77       : BpInterface<IVtsFuzzer>(impl) {}
78 
79   void Exit();
80 
81   // Notes on args:
82   //   target_version_major:
83   //     int, the target component major HAL version
84   //   target_version_minor:
85   //     int, the target component minor HAL version
86   int32_t LoadHal(const string& path, int target_class, int target_type,
87                   int target_version_major, int target_version_minor,
88                   const string& module_name);
89   int32_t Status(int32_t type);
90   string Call(const string& call_payload);
91   const char* GetFunctions();
92 };
93 
94 }  // namespace vts
95 }  // namespace android
96 
97 #endif
98