1 /* 2 * Copyright (c) 2022, Google, Inc. All rights reserved 3 * 4 * Permission is hereby granted, free of charge, to any person obtaining 5 * a copy of this software and associated documentation files 6 * (the "Software"), to deal in the Software without restriction, 7 * including without limitation the rights to use, copy, modify, merge, 8 * publish, distribute, sublicense, and/or sell copies of the Software, 9 * and to permit persons to whom the Software is furnished to do so, 10 * subject to the following conditions: 11 * 12 * The above copyright notice and this permission notice shall be 13 * included in all copies or substantial portions of the Software. 14 * 15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 19 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 20 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 21 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 */ 23 #pragma once 24 25 #include <binder/IBinder.h> 26 #include <lk/compiler.h> 27 28 /** 29 * binder_discover_get_service() - Get the root binder for a port from 30 * the discovery service. 31 * @port: Port to retrieve the binder for. 32 * @ib: Reference to store the binder into. 33 * 34 * Return: %OK in case of success, error code otherwise. 35 */ 36 int binder_discover_get_service(const char* port, 37 android::sp<android::IBinder>& ib); 38 39 /** 40 * binder_discover_add_service() - Add a binder to the discovery service. 41 * @port: Port for the new binder. 42 * @ib: Root binder for the service. 43 * 44 * Return: %OK in case of success, %ALREADY_EXISTS if the port name has already 45 * been added, another error code otherwise. 46 */ 47 int binder_discover_add_service(const char* port, 48 const android::sp<android::IBinder>& ib); 49 50 /** 51 * binder_discover_remove_service() - Remove a binder from the discovery 52 * service. 53 * @port: Port for binder to remove. 54 * 55 * Return: %OK in case of success, %NAME_NOT_FOUND if the port 56 * has not been added previously, error code otherwise. 57 */ 58 int binder_discover_remove_service(const char* port); 59