binder.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project
  2. // SPDX-FileCopyrightText: Copyright 2014 The Android Open Source Project
  3. // SPDX-License-Identifier: GPL-3.0-or-later
  4. // Parts of this implementation were based on:
  5. // https://cs.android.com/android/platform/superproject/+/android-5.1.1_r38:frameworks/native/include/binder/IBinder.h
  6. #pragma once
  7. #include <span>
  8. #include "common/common_types.h"
  9. namespace Kernel {
  10. class KReadableEvent;
  11. } // namespace Kernel
  12. namespace Service {
  13. class HLERequestContext;
  14. }
  15. namespace Service::android {
  16. enum class TransactionId {
  17. RequestBuffer = 1,
  18. SetBufferCount = 2,
  19. DequeueBuffer = 3,
  20. DetachBuffer = 4,
  21. DetachNextBuffer = 5,
  22. AttachBuffer = 6,
  23. QueueBuffer = 7,
  24. CancelBuffer = 8,
  25. Query = 9,
  26. Connect = 10,
  27. Disconnect = 11,
  28. AllocateBuffers = 13,
  29. SetPreallocatedBuffer = 14,
  30. GetBufferHistory = 17,
  31. };
  32. class IBinder {
  33. public:
  34. virtual ~IBinder() = default;
  35. virtual void Transact(android::TransactionId code, u32 flags, std::span<const u8> parcel_data,
  36. std::span<u8> parcel_reply) = 0;
  37. virtual Kernel::KReadableEvent& GetNativeHandle() = 0;
  38. };
  39. } // namespace Service::android