Loading libs/binder/libbinder_rpc_unstable.cpp +11 −1 Original line number Diff line number Diff line Loading @@ -20,8 +20,14 @@ #include <binder/RpcServer.h> #include <binder/RpcSession.h> #include <binder/unique_fd.h> #ifndef __TRUSTY__ #include <cutils/sockets.h> #endif #ifdef __linux__ #include <linux/vm_sockets.h> #endif // __linux__ using android::OK; using android::RpcServer; Loading Loading @@ -74,6 +80,7 @@ RpcSession::FileDescriptorTransportMode toTransportMode( extern "C" { #ifndef __TRUSTY__ ARpcServer* ARpcServer_newVsock(AIBinder* service, unsigned int cid, unsigned int port) { auto server = RpcServer::make(); Loading Loading @@ -147,6 +154,7 @@ ARpcServer* ARpcServer_newInet(AIBinder* service, const char* address, unsigned server->setRootObject(AIBinder_toPlatformBinder(service)); return createObjectHandle<ARpcServer>(server); } #endif // __TRUSTY__ void ARpcServer_setSupportedFileDescriptorTransportModes( ARpcServer* handle, const ARpcSession_FileDescriptorTransportMode modes[], Loading Loading @@ -187,6 +195,7 @@ void ARpcSession_free(ARpcSession* handle) { freeObjectHandle<RpcSession>(handle); } #ifndef __TRUSTY__ AIBinder* ARpcSession_setupVsockClient(ARpcSession* handle, unsigned int cid, unsigned int port) { auto session = handleToStrongPointer<RpcSession>(handle); if (status_t status = session->setupVsockClient(cid, port); status != OK) { Loading Loading @@ -234,13 +243,14 @@ AIBinder* ARpcSession_setupInet(ARpcSession* handle, const char* address, unsign } return AIBinder_fromPlatformBinder(session->getRootObject()); } #endif // __TRUSTY__ AIBinder* ARpcSession_setupPreconnectedClient(ARpcSession* handle, int (*requestFd)(void* param), void* param) { auto session = handleToStrongPointer<RpcSession>(handle); auto request = [=] { return unique_fd{requestFd(param)}; }; if (status_t status = session->setupPreconnectedClient(unique_fd{}, request); status != OK) { ALOGE("Failed to set up vsock client. error: %s", statusToString(status).c_str()); ALOGE("Failed to set up preconnected client. error: %s", statusToString(status).c_str()); return nullptr; } return AIBinder_fromPlatformBinder(session->getRootObject()); Loading libs/binder/trusty/binder_rpc_unstable/rules.mk 0 → 100644 +32 −0 Original line number Diff line number Diff line # Copyright (C) 2023 The Android Open Source Project # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # LOCAL_DIR := $(GET_LOCAL_DIR) LIBBINDER_DIR := $(LOCAL_DIR)/../.. MODULE := $(LOCAL_DIR) MODULE_SRCS := \ $(LIBBINDER_DIR)/libbinder_rpc_unstable.cpp \ MODULE_EXPORT_INCLUDES += \ $(LIBBINDER_DIR)/include_rpc_unstable \ MODULE_LIBRARY_DEPS += \ $(LIBBINDER_DIR)/trusty \ $(LIBBINDER_DIR)/trusty/ndk \ trusty/user/base/lib/libstdc++-trusty \ include make/library.mk libs/binder/trusty/rust/binder_rpc_unstable_bindgen/BinderBindings.hpp 0 → 100644 +17 −0 Original line number Diff line number Diff line /* * Copyright (C) 2023 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <binder_rpc_unstable.hpp> libs/binder/trusty/rust/binder_rpc_unstable_bindgen/lib.rs 0 → 100644 +24 −0 Original line number Diff line number Diff line /* * Copyright (C) 2023 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ //! Generated Rust bindings to binder_rpc_unstable #[allow(bad_style)] mod sys { include!(env!("BINDGEN_INC_FILE")); } pub use sys::*; libs/binder/trusty/rust/binder_rpc_unstable_bindgen/rules.mk 0 → 100644 +40 −0 Original line number Diff line number Diff line # Copyright (C) 2023 The Android Open Source Project # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # LOCAL_DIR := $(GET_LOCAL_DIR) LIBBINDER_DIR := $(LOCAL_DIR)/../../.. MODULE := $(LOCAL_DIR) MODULE_SRCS := $(LOCAL_DIR)/lib.rs MODULE_CRATE_NAME := binder_rpc_unstable_bindgen MODULE_LIBRARY_DEPS += \ $(LIBBINDER_DIR)/trusty \ $(LIBBINDER_DIR)/trusty/binder_rpc_unstable \ $(LIBBINDER_DIR)/trusty/ndk \ $(LIBBINDER_DIR)/trusty/rust/binder_ndk_sys \ trusty/user/base/lib/libstdc++-trusty \ trusty/user/base/lib/trusty-sys \ MODULE_BINDGEN_SRC_HEADER := $(LOCAL_DIR)/BinderBindings.hpp MODULE_BINDGEN_FLAGS += \ --blocklist-type="AIBinder" \ --raw-line="use binder_ndk_sys::AIBinder;" \ --rustified-enum="ARpcSession_FileDescriptorTransportMode" \ include make/library.mk Loading
libs/binder/libbinder_rpc_unstable.cpp +11 −1 Original line number Diff line number Diff line Loading @@ -20,8 +20,14 @@ #include <binder/RpcServer.h> #include <binder/RpcSession.h> #include <binder/unique_fd.h> #ifndef __TRUSTY__ #include <cutils/sockets.h> #endif #ifdef __linux__ #include <linux/vm_sockets.h> #endif // __linux__ using android::OK; using android::RpcServer; Loading Loading @@ -74,6 +80,7 @@ RpcSession::FileDescriptorTransportMode toTransportMode( extern "C" { #ifndef __TRUSTY__ ARpcServer* ARpcServer_newVsock(AIBinder* service, unsigned int cid, unsigned int port) { auto server = RpcServer::make(); Loading Loading @@ -147,6 +154,7 @@ ARpcServer* ARpcServer_newInet(AIBinder* service, const char* address, unsigned server->setRootObject(AIBinder_toPlatformBinder(service)); return createObjectHandle<ARpcServer>(server); } #endif // __TRUSTY__ void ARpcServer_setSupportedFileDescriptorTransportModes( ARpcServer* handle, const ARpcSession_FileDescriptorTransportMode modes[], Loading Loading @@ -187,6 +195,7 @@ void ARpcSession_free(ARpcSession* handle) { freeObjectHandle<RpcSession>(handle); } #ifndef __TRUSTY__ AIBinder* ARpcSession_setupVsockClient(ARpcSession* handle, unsigned int cid, unsigned int port) { auto session = handleToStrongPointer<RpcSession>(handle); if (status_t status = session->setupVsockClient(cid, port); status != OK) { Loading Loading @@ -234,13 +243,14 @@ AIBinder* ARpcSession_setupInet(ARpcSession* handle, const char* address, unsign } return AIBinder_fromPlatformBinder(session->getRootObject()); } #endif // __TRUSTY__ AIBinder* ARpcSession_setupPreconnectedClient(ARpcSession* handle, int (*requestFd)(void* param), void* param) { auto session = handleToStrongPointer<RpcSession>(handle); auto request = [=] { return unique_fd{requestFd(param)}; }; if (status_t status = session->setupPreconnectedClient(unique_fd{}, request); status != OK) { ALOGE("Failed to set up vsock client. error: %s", statusToString(status).c_str()); ALOGE("Failed to set up preconnected client. error: %s", statusToString(status).c_str()); return nullptr; } return AIBinder_fromPlatformBinder(session->getRootObject()); Loading
libs/binder/trusty/binder_rpc_unstable/rules.mk 0 → 100644 +32 −0 Original line number Diff line number Diff line # Copyright (C) 2023 The Android Open Source Project # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # LOCAL_DIR := $(GET_LOCAL_DIR) LIBBINDER_DIR := $(LOCAL_DIR)/../.. MODULE := $(LOCAL_DIR) MODULE_SRCS := \ $(LIBBINDER_DIR)/libbinder_rpc_unstable.cpp \ MODULE_EXPORT_INCLUDES += \ $(LIBBINDER_DIR)/include_rpc_unstable \ MODULE_LIBRARY_DEPS += \ $(LIBBINDER_DIR)/trusty \ $(LIBBINDER_DIR)/trusty/ndk \ trusty/user/base/lib/libstdc++-trusty \ include make/library.mk
libs/binder/trusty/rust/binder_rpc_unstable_bindgen/BinderBindings.hpp 0 → 100644 +17 −0 Original line number Diff line number Diff line /* * Copyright (C) 2023 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <binder_rpc_unstable.hpp>
libs/binder/trusty/rust/binder_rpc_unstable_bindgen/lib.rs 0 → 100644 +24 −0 Original line number Diff line number Diff line /* * Copyright (C) 2023 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ //! Generated Rust bindings to binder_rpc_unstable #[allow(bad_style)] mod sys { include!(env!("BINDGEN_INC_FILE")); } pub use sys::*;
libs/binder/trusty/rust/binder_rpc_unstable_bindgen/rules.mk 0 → 100644 +40 −0 Original line number Diff line number Diff line # Copyright (C) 2023 The Android Open Source Project # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # LOCAL_DIR := $(GET_LOCAL_DIR) LIBBINDER_DIR := $(LOCAL_DIR)/../../.. MODULE := $(LOCAL_DIR) MODULE_SRCS := $(LOCAL_DIR)/lib.rs MODULE_CRATE_NAME := binder_rpc_unstable_bindgen MODULE_LIBRARY_DEPS += \ $(LIBBINDER_DIR)/trusty \ $(LIBBINDER_DIR)/trusty/binder_rpc_unstable \ $(LIBBINDER_DIR)/trusty/ndk \ $(LIBBINDER_DIR)/trusty/rust/binder_ndk_sys \ trusty/user/base/lib/libstdc++-trusty \ trusty/user/base/lib/trusty-sys \ MODULE_BINDGEN_SRC_HEADER := $(LOCAL_DIR)/BinderBindings.hpp MODULE_BINDGEN_FLAGS += \ --blocklist-type="AIBinder" \ --raw-line="use binder_ndk_sys::AIBinder;" \ --rustified-enum="ARpcSession_FileDescriptorTransportMode" \ include make/library.mk