1/* 2 * Copyright (C) 2016 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17package android.hidl.token@1.0; 18 19/** 20 * This facilitates converting hidl interfaces into something that 21 * are more easily transferrable to other processes. 22 */ 23interface ITokenManager { 24 25 /** 26 * Register an interface. The server must keep a strong reference 27 * to the interface until the token is destroyed by calling unregister. 28 * 29 * Must return empty token on failure. 30 * 31 * @param store Interface which can later be fetched with the returned token. 32 * @return token Opaque value which may be used as inputs to other functions. 33 */ 34 createToken(interface store) generates (vec<uint8_t>token); 35 36 /** 37 * Destory a token and the strong reference to the associated interface. 38 * 39 * @param token Token received from createToken 40 * @return success Whether or not the token was successfully unregistered. 41 */ 42 unregister(vec<uint8_t> token) generates (bool success); 43 44 /** 45 * Fetch an interface from a provided token. 46 * 47 * @param token Token received from createToken 48 * @return store Interface registered with createToken and the corresponding 49 * token or nullptr. 50 */ 51 get(vec<uint8_t> token) generates (interface store); 52}; 53