1 #ifndef ANDROID_PDX_CLIENT_CHANNEL_H_ 2 #define ANDROID_PDX_CLIENT_CHANNEL_H_ 3 4 #include <pdx/channel_handle.h> 5 #include <pdx/file_handle.h> 6 #include <pdx/status.h> 7 8 struct iovec; 9 10 namespace android { 11 namespace pdx { 12 13 class ClientChannel { 14 public: 15 virtual ~ClientChannel() = default; 16 17 // Returns a tag that uniquely identifies a specific underlying IPC transport. 18 virtual uint32_t GetIpcTag() const = 0; 19 20 virtual int event_fd() const = 0; 21 virtual Status<int> GetEventMask(int events) = 0; 22 23 virtual LocalChannelHandle& GetChannelHandle() = 0; 24 virtual void* AllocateTransactionState() = 0; 25 virtual void FreeTransactionState(void* state) = 0; 26 27 virtual Status<void> SendImpulse(int opcode, const void* buffer, 28 size_t length) = 0; 29 30 virtual Status<int> SendWithInt(void* transaction_state, int opcode, 31 const iovec* send_vector, size_t send_count, 32 const iovec* receive_vector, 33 size_t receive_count) = 0; 34 virtual Status<LocalHandle> SendWithFileHandle( 35 void* transaction_state, int opcode, const iovec* send_vector, 36 size_t send_count, const iovec* receive_vector, size_t receive_count) = 0; 37 virtual Status<LocalChannelHandle> SendWithChannelHandle( 38 void* transaction_state, int opcode, const iovec* send_vector, 39 size_t send_count, const iovec* receive_vector, size_t receive_count) = 0; 40 41 virtual FileReference PushFileHandle(void* transaction_state, 42 const LocalHandle& handle) = 0; 43 virtual FileReference PushFileHandle(void* transaction_state, 44 const BorrowedHandle& handle) = 0; 45 virtual ChannelReference PushChannelHandle( 46 void* transaction_state, const LocalChannelHandle& handle) = 0; 47 virtual ChannelReference PushChannelHandle( 48 void* transaction_state, const BorrowedChannelHandle& handle) = 0; 49 virtual bool GetFileHandle(void* transaction_state, FileReference ref, 50 LocalHandle* handle) const = 0; 51 virtual bool GetChannelHandle(void* transaction_state, ChannelReference ref, 52 LocalChannelHandle* handle) const = 0; 53 }; 54 55 } // namespace pdx 56 } // namespace android 57 58 #endif // ANDROID_PDX_CLIENT_CHANNEL_H_ 59