diff options
Diffstat (limited to 'libs/binder/include/binder/RpcSession.h')
-rw-r--r-- | libs/binder/include/binder/RpcSession.h | 60 |
1 files changed, 32 insertions, 28 deletions
diff --git a/libs/binder/include/binder/RpcSession.h b/libs/binder/include/binder/RpcSession.h index 11fbde9ace..e8d9829b5d 100644 --- a/libs/binder/include/binder/RpcSession.h +++ b/libs/binder/include/binder/RpcSession.h @@ -15,6 +15,7 @@ */ #pragma once +#include <binder/Common.h> #include <binder/IBinder.h> #include <binder/RpcThreads.h> #include <binder/RpcTransport.h> @@ -57,12 +58,13 @@ constexpr uint32_t RPC_WIRE_PROTOCOL_VERSION_RPC_HEADER_FEATURE_EXPLICIT_PARCEL_ class RpcSession final : public virtual RefBase { public: // Create an RpcSession with default configuration (raw sockets). - static sp<RpcSession> make(); + LIBBINDER_EXPORTED static sp<RpcSession> make(); // Create an RpcSession with the given configuration. |serverRpcCertificateFormat| and // |serverCertificate| must have values or be nullopt simultaneously. If they have values, set // server certificate. - static sp<RpcSession> make(std::unique_ptr<RpcTransportCtxFactory> rpcTransportCtxFactory); + LIBBINDER_EXPORTED static sp<RpcSession> make( + std::unique_ptr<RpcTransportCtxFactory> rpcTransportCtxFactory); /** * Set the maximum number of incoming threads allowed to be made (for things like callbacks). @@ -75,8 +77,8 @@ public: * * TODO(b/189955605): start these lazily - currently all are started */ - void setMaxIncomingThreads(size_t threads); - size_t getMaxIncomingThreads(); + LIBBINDER_EXPORTED void setMaxIncomingThreads(size_t threads); + LIBBINDER_EXPORTED size_t getMaxIncomingThreads(); /** * Set the maximum number of outgoing connections allowed to be made. @@ -90,15 +92,15 @@ public: * created. This API is used to limit the amount of resources a server can request you * create. */ - void setMaxOutgoingConnections(size_t connections); - size_t getMaxOutgoingThreads(); + LIBBINDER_EXPORTED void setMaxOutgoingConnections(size_t connections); + LIBBINDER_EXPORTED size_t getMaxOutgoingThreads(); /** * By default, the minimum of the supported versions of the client and the * server will be used. Usually, this API should only be used for debugging. */ - [[nodiscard]] bool setProtocolVersion(uint32_t version); - std::optional<uint32_t> getProtocolVersion(); + [[nodiscard]] LIBBINDER_EXPORTED bool setProtocolVersion(uint32_t version); + LIBBINDER_EXPORTED std::optional<uint32_t> getProtocolVersion(); enum class FileDescriptorTransportMode : uint8_t { NONE = 0, @@ -111,29 +113,30 @@ public: /** * Set the transport for sending and receiving file descriptors. */ - void setFileDescriptorTransportMode(FileDescriptorTransportMode mode); - FileDescriptorTransportMode getFileDescriptorTransportMode(); + LIBBINDER_EXPORTED void setFileDescriptorTransportMode(FileDescriptorTransportMode mode); + LIBBINDER_EXPORTED FileDescriptorTransportMode getFileDescriptorTransportMode(); /** * This should be called once per thread, matching 'join' in the remote * process. */ - [[nodiscard]] status_t setupUnixDomainClient(const char* path); + [[nodiscard]] LIBBINDER_EXPORTED status_t setupUnixDomainClient(const char* path); /** * Connects to an RPC server over a nameless Unix domain socket pair. */ - [[nodiscard]] status_t setupUnixDomainSocketBootstrapClient(binder::unique_fd bootstrap); + [[nodiscard]] LIBBINDER_EXPORTED status_t + setupUnixDomainSocketBootstrapClient(binder::unique_fd bootstrap); /** * Connects to an RPC server at the CVD & port. */ - [[nodiscard]] status_t setupVsockClient(unsigned int cvd, unsigned int port); + [[nodiscard]] LIBBINDER_EXPORTED status_t setupVsockClient(unsigned int cvd, unsigned int port); /** * Connects to an RPC server at the given address and port. */ - [[nodiscard]] status_t setupInetClient(const char* addr, unsigned int port); + [[nodiscard]] LIBBINDER_EXPORTED status_t setupInetClient(const char* addr, unsigned int port); /** * Starts talking to an RPC server which has already been connected to. This @@ -145,8 +148,8 @@ public: * * For future compatibility, 'request' should not reference any stack data. */ - [[nodiscard]] status_t setupPreconnectedClient(binder::unique_fd fd, - std::function<binder::unique_fd()>&& request); + [[nodiscard]] LIBBINDER_EXPORTED status_t + setupPreconnectedClient(binder::unique_fd fd, std::function<binder::unique_fd()>&& request); /** * For debugging! @@ -155,24 +158,24 @@ public: * response will never be satisfied. All data sent here will be * unceremoniously cast down the bottomless pit, /dev/null. */ - [[nodiscard]] status_t addNullDebuggingClient(); + [[nodiscard]] LIBBINDER_EXPORTED status_t addNullDebuggingClient(); /** * Query the other side of the session for the root object hosted by that * process's RpcServer (if one exists) */ - sp<IBinder> getRootObject(); + LIBBINDER_EXPORTED sp<IBinder> getRootObject(); /** * Query the other side of the session for the maximum number of threads * it supports (maximum number of concurrent non-nested synchronous transactions) */ - [[nodiscard]] status_t getRemoteMaxThreads(size_t* maxThreads); + [[nodiscard]] LIBBINDER_EXPORTED status_t getRemoteMaxThreads(size_t* maxThreads); /** * See RpcTransportCtx::getCertificate */ - std::vector<uint8_t> getCertificate(RpcCertificateFormat); + LIBBINDER_EXPORTED std::vector<uint8_t> getCertificate(RpcCertificateFormat); /** * Shuts down the service. @@ -188,33 +191,34 @@ public: * complete before returning. This will hang if it is called from the * session threadpool (when processing received calls). */ - [[nodiscard]] bool shutdownAndWait(bool wait); + [[nodiscard]] LIBBINDER_EXPORTED bool shutdownAndWait(bool wait); - [[nodiscard]] status_t transact(const sp<IBinder>& binder, uint32_t code, const Parcel& data, - Parcel* reply, uint32_t flags); + [[nodiscard]] LIBBINDER_EXPORTED status_t transact(const sp<IBinder>& binder, uint32_t code, + const Parcel& data, Parcel* reply, + uint32_t flags); /** * Generally, you should not call this, unless you are testing error * conditions, as this is called automatically by BpBinders when they are * deleted (this is also why a raw pointer is used here) */ - [[nodiscard]] status_t sendDecStrong(const BpBinder* binder); + [[nodiscard]] LIBBINDER_EXPORTED status_t sendDecStrong(const BpBinder* binder); /** * Whether any requests are currently being processed. */ - bool hasActiveRequests(); + LIBBINDER_EXPORTED bool hasActiveRequests(); - ~RpcSession(); + LIBBINDER_EXPORTED ~RpcSession(); /** * Server if this session is created as part of a server (symmetrical to * client servers). Otherwise, nullptr. */ - sp<RpcServer> server(); + LIBBINDER_EXPORTED sp<RpcServer> server(); // internal only - const std::unique_ptr<RpcState>& state() { return mRpcBinderState; } + LIBBINDER_EXPORTED const std::unique_ptr<RpcState>& state() { return mRpcBinderState; } private: friend sp<RpcSession>; |