• 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   virtual int32_t LoadHal(const string& path, int target_class, int target_type,
54                           float target_version, const string& module_name) = 0;
55 
56   // Requests to return the specified status.
57   virtual int32_t Status(int32_t type) = 0;
58 
59   // Requests to call the specified function using the provided arguments.
60   virtual const char* Call(const string& call_payload) = 0;
61 
62   virtual const char* GetFunctions() = 0;
63 
64   DECLARE_META_INTERFACE(VtsFuzzer);
65 };
66 
67 // For client
68 class BpVtsFuzzer : public BpInterface<IVtsFuzzer> {
69  public:
BpVtsFuzzer(const sp<IBinder> & impl)70   BpVtsFuzzer(const sp<IBinder>& impl) : BpInterface<IVtsFuzzer>(impl) {}
71 
72   void Exit();
73   int32_t LoadHal(const string& path, int target_class, int target_type,
74                   float target_version, const string& module_name);
75   int32_t Status(int32_t type);
76   const char* Call(const string& call_payload);
77   const char* GetFunctions();
78 };
79 
80 }  // namespace vts
81 }  // namespace android
82 
83 #endif
84