1 #ifndef __VTS_DRIVER__android_hardware_tests_bar_V1_0_IBar__ 2 #define __VTS_DRIVER__android_hardware_tests_bar_V1_0_IBar__ 3 4 #undef LOG_TAG 5 #define LOG_TAG "FuzzerExtended_android_hardware_tests_bar_V1_0_IBar" 6 7 #include <log/log.h> 8 #include <stdarg.h> 9 #include <stdio.h> 10 #include <stdlib.h> 11 #include <string.h> 12 13 #include <driver_base/DriverBase.h> 14 #include <driver_base/DriverCallbackBase.h> 15 16 #include <VtsDriverCommUtil.h> 17 18 #include <android/hardware/tests/bar/1.0/IBar.h> 19 #include <hidl/HidlSupport.h> 20 #include <android/hardware/tests/foo/1.0/IFoo.h> 21 #include <android/hardware/tests/foo/1.0/Foo.vts.h> 22 #include <android/hardware/tests/foo/1.0/IFooCallback.h> 23 #include <android/hardware/tests/foo/1.0/FooCallback.vts.h> 24 #include <android/hardware/tests/foo/1.0/IMyTypes.h> 25 #include <android/hardware/tests/foo/1.0/MyTypes.vts.h> 26 #include <android/hardware/tests/foo/1.0/ISimple.h> 27 #include <android/hardware/tests/foo/1.0/Simple.vts.h> 28 #include <android/hardware/tests/foo/1.0/ITheirTypes.h> 29 #include <android/hardware/tests/foo/1.0/TheirTypes.vts.h> 30 #include <android/hardware/tests/foo/1.0/types.h> 31 #include <android/hardware/tests/foo/1.0/types.vts.h> 32 #include <android/hidl/base/1.0/types.h> 33 34 35 using namespace android::hardware::tests::bar::V1_0; 36 namespace android { 37 namespace vts { 38 extern "C" void MessageTo__android__hardware__tests__bar__V1_0__IBar__SomethingRelated(const VariableSpecificationMessage& var_msg, ::android::hardware::tests::bar::V1_0::IBar::SomethingRelated* arg, const string& callback_socket_name); 39 bool Verify__android__hardware__tests__bar__V1_0__IBar__SomethingRelated(const VariableSpecificationMessage& expected_result, const VariableSpecificationMessage& actual_result); 40 extern "C" void SetResult__android__hardware__tests__bar__V1_0__IBar__SomethingRelated(VariableSpecificationMessage* result_msg, ::android::hardware::tests::bar::V1_0::IBar::SomethingRelated result_value); 41 42 class Vts_android_hardware_tests_bar_V1_0_IBar : public ::android::hardware::tests::bar::V1_0::IBar, public DriverCallbackBase { 43 public: Vts_android_hardware_tests_bar_V1_0_IBar(const string & callback_socket_name)44 Vts_android_hardware_tests_bar_V1_0_IBar(const string& callback_socket_name) 45 : callback_socket_name_(callback_socket_name) {}; 46 47 virtual ~Vts_android_hardware_tests_bar_V1_0_IBar() = default; 48 49 ::android::hardware::Return<void> convertToBoolIfSmall( 50 ::android::hardware::tests::foo::V1_0::IFoo::Discriminator arg0, 51 const ::android::hardware::hidl_vec<::android::hardware::tests::foo::V1_0::IFoo::Union>& arg1, std::function<void(const ::android::hardware::hidl_vec<::android::hardware::tests::foo::V1_0::IFoo::ContainsUnion>& arg0)> cb) override; 52 53 ::android::hardware::Return<void> doThis( 54 float arg0) override; 55 56 ::android::hardware::Return<int32_t> doThatAndReturnSomething( 57 int64_t arg0) override; 58 59 ::android::hardware::Return<double> doQuiteABit( 60 int32_t arg0, 61 int64_t arg1, 62 float arg2, 63 double arg3) override; 64 65 ::android::hardware::Return<void> doSomethingElse( 66 const ::android::hardware::hidl_array<int32_t, 15>& arg0, std::function<void(const ::android::hardware::hidl_array<int32_t, 32>& arg0)> cb) override; 67 68 ::android::hardware::Return<void> doStuffAndReturnAString( 69 std::function<void(const ::android::hardware::hidl_string& arg0)> cb) override; 70 71 ::android::hardware::Return<void> mapThisVector( 72 const ::android::hardware::hidl_vec<int32_t>& arg0, std::function<void(const ::android::hardware::hidl_vec<int32_t>& arg0)> cb) override; 73 74 ::android::hardware::Return<void> callMe( 75 const sp<::android::hardware::tests::foo::V1_0::IFooCallback>& arg0) override; 76 77 ::android::hardware::Return<::android::hardware::tests::foo::V1_0::IFoo::SomeEnum> useAnEnum( 78 ::android::hardware::tests::foo::V1_0::IFoo::SomeEnum arg0) override; 79 80 ::android::hardware::Return<void> haveAGooberVec( 81 const ::android::hardware::hidl_vec<::android::hardware::tests::foo::V1_0::IFoo::Goober>& arg0) override; 82 83 ::android::hardware::Return<void> haveAGoober( 84 const ::android::hardware::tests::foo::V1_0::IFoo::Goober& arg0) override; 85 86 ::android::hardware::Return<void> haveAGooberArray( 87 const ::android::hardware::hidl_array<::android::hardware::tests::foo::V1_0::IFoo::Goober, 20>& arg0) override; 88 89 ::android::hardware::Return<void> haveATypeFromAnotherFile( 90 const ::android::hardware::tests::foo::V1_0::Abc& arg0) override; 91 92 ::android::hardware::Return<void> haveSomeStrings( 93 const ::android::hardware::hidl_array<::android::hardware::hidl_string, 3>& arg0, std::function<void(const ::android::hardware::hidl_array<::android::hardware::hidl_string, 2>& arg0)> cb) override; 94 95 ::android::hardware::Return<void> haveAStringVec( 96 const ::android::hardware::hidl_vec<::android::hardware::hidl_string>& arg0, std::function<void(const ::android::hardware::hidl_vec<::android::hardware::hidl_string>& arg0)> cb) override; 97 98 ::android::hardware::Return<void> transposeMe( 99 const ::android::hardware::hidl_array<float, 3, 5>& arg0, std::function<void(const ::android::hardware::hidl_array<float, 5, 3>& arg0)> cb) override; 100 101 ::android::hardware::Return<void> callingDrWho( 102 const ::android::hardware::tests::foo::V1_0::IFoo::MultiDimensional& arg0, std::function<void(const ::android::hardware::tests::foo::V1_0::IFoo::MultiDimensional& arg0)> cb) override; 103 104 ::android::hardware::Return<void> transpose( 105 const ::android::hardware::tests::foo::V1_0::IFoo::StringMatrix5x3& arg0, std::function<void(const ::android::hardware::tests::foo::V1_0::IFoo::StringMatrix3x5& arg0)> cb) override; 106 107 ::android::hardware::Return<void> transpose2( 108 const ::android::hardware::hidl_array<::android::hardware::hidl_string, 5, 3>& arg0, std::function<void(const ::android::hardware::hidl_array<::android::hardware::hidl_string, 3, 5>& arg0)> cb) override; 109 110 ::android::hardware::Return<void> sendVec( 111 const ::android::hardware::hidl_vec<uint8_t>& arg0, std::function<void(const ::android::hardware::hidl_vec<uint8_t>& arg0)> cb) override; 112 113 ::android::hardware::Return<void> sendVecVec( 114 std::function<void(const ::android::hardware::hidl_vec<::android::hardware::hidl_vec<uint8_t>>& arg0)> cb) override; 115 116 ::android::hardware::Return<void> haveAVectorOfInterfaces( 117 const ::android::hardware::hidl_vec<sp<::android::hardware::tests::foo::V1_0::ISimple>>& arg0, std::function<void(const ::android::hardware::hidl_vec<sp<::android::hardware::tests::foo::V1_0::ISimple>>& arg0)> cb) override; 118 119 ::android::hardware::Return<void> haveAVectorOfGenericInterfaces( 120 const ::android::hardware::hidl_vec<sp<::android::hidl::base::V1_0::IBase>>& arg0, std::function<void(const ::android::hardware::hidl_vec<sp<::android::hidl::base::V1_0::IBase>>& arg0)> cb) override; 121 122 ::android::hardware::Return<void> echoNullInterface( 123 const sp<::android::hardware::tests::foo::V1_0::IFooCallback>& arg0, std::function<void(bool arg0,const sp<::android::hardware::tests::foo::V1_0::IFooCallback>& arg1)> cb) override; 124 125 ::android::hardware::Return<void> createMyHandle( 126 std::function<void(const ::android::hardware::tests::foo::V1_0::IFoo::MyHandle& arg0)> cb) override; 127 128 ::android::hardware::Return<void> createHandles( 129 uint32_t arg0, std::function<void(const ::android::hardware::hidl_vec<::android::hardware::hidl_handle>& arg0)> cb) override; 130 131 ::android::hardware::Return<void> closeHandles( 132 ) override; 133 134 ::android::hardware::Return<void> repeatWithFmq( 135 const ::android::hardware::tests::foo::V1_0::IFoo::WithFmq& arg0, std::function<void(const ::android::hardware::tests::foo::V1_0::IFoo::WithFmq& arg0)> cb) override; 136 137 ::android::hardware::Return<void> thisIsNew( 138 ) override; 139 140 ::android::hardware::Return<void> expectNullHandle( 141 const ::android::hardware::hidl_handle& arg0, 142 const ::android::hardware::tests::foo::V1_0::Abc& arg1, std::function<void(bool arg0,bool arg1)> cb) override; 143 144 ::android::hardware::Return<void> takeAMask( 145 ::android::hardware::tests::foo::V1_0::IFoo::BitField arg0, 146 uint8_t arg1, 147 const ::android::hardware::tests::foo::V1_0::IFoo::MyMask& arg2, 148 uint8_t arg3, std::function<void(::android::hardware::tests::foo::V1_0::IFoo::BitField arg0,uint8_t arg1,uint8_t arg2,uint8_t arg3)> cb) override; 149 150 ::android::hardware::Return<sp<::android::hardware::tests::foo::V1_0::ISimple>> haveAInterface( 151 const sp<::android::hardware::tests::foo::V1_0::ISimple>& arg0) override; 152 153 154 private: 155 string callback_socket_name_; 156 }; 157 158 sp<::android::hardware::tests::bar::V1_0::IBar> VtsFuzzerCreateVts_android_hardware_tests_bar_V1_0_IBar(const string& callback_socket_name); 159 160 class FuzzerExtended_android_hardware_tests_bar_V1_0_IBar : public DriverBase { 161 public: FuzzerExtended_android_hardware_tests_bar_V1_0_IBar()162 FuzzerExtended_android_hardware_tests_bar_V1_0_IBar() : DriverBase(HAL_HIDL), hw_binder_proxy_() {} 163 FuzzerExtended_android_hardware_tests_bar_V1_0_IBar(::android::hardware::tests::bar::V1_0::IBar * hw_binder_proxy)164 explicit FuzzerExtended_android_hardware_tests_bar_V1_0_IBar(::android::hardware::tests::bar::V1_0::IBar* hw_binder_proxy) : DriverBase(HAL_HIDL), hw_binder_proxy_(hw_binder_proxy) {} GetHidlInterfaceProxy()165 uint64_t GetHidlInterfaceProxy() const { 166 return reinterpret_cast<uintptr_t>(hw_binder_proxy_.get()); 167 } 168 protected: 169 bool Fuzz(FunctionSpecificationMessage* func_msg, void** result, const string& callback_socket_name); 170 bool CallFunction(const FunctionSpecificationMessage& func_msg, const string& callback_socket_name, FunctionSpecificationMessage* result_msg); 171 bool VerifyResults(const FunctionSpecificationMessage& expected_result, const FunctionSpecificationMessage& actual_result); 172 bool GetAttribute(FunctionSpecificationMessage* func_msg, void** result); 173 bool GetService(bool get_stub, const char* service_name); 174 175 private: 176 sp<::android::hardware::tests::bar::V1_0::IBar> hw_binder_proxy_; 177 }; 178 179 180 extern "C" { 181 extern android::vts::DriverBase* vts_func_4_android_hardware_tests_bar_V1_0_IBar_(); 182 extern android::vts::DriverBase* vts_func_4_android_hardware_tests_bar_V1_0_IBar_with_arg(uint64_t hw_binder_proxy); 183 } 184 } // namespace vts 185 } // namespace android 186 #endif 187