blob: 23a44bdf9bed7c8d2def05a0113a5421a0a27454 [file] [log] [blame]
Steven Moreland2ef31d82016-12-21 14:38:23 -08001/*
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 /**
Pawin Vongmasaf4a58402017-03-01 16:30:23 -080026 * Register an interface. The server must keep a strong reference
27 * to the interface until the token is destroyed by calling unregister.
Steven Moreland2ef31d82016-12-21 14:38:23 -080028 *
Steven Moreland15716d52017-03-16 02:01:22 -070029 * Must return empty token on failure.
30 *
Steven Moreland2ef31d82016-12-21 14:38:23 -080031 * @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 */
Steven Moreland15716d52017-03-16 02:01:22 -070034 createToken(interface store) generates (vec<uint8_t>token);
Steven Moreland2ef31d82016-12-21 14:38:23 -080035
36 /**
Pawin Vongmasaf4a58402017-03-01 16:30:23 -080037 * Destory a token and the strong reference to the associated interface.
Steven Moreland2ef31d82016-12-21 14:38:23 -080038 *
Pawin Vongmasaf4a58402017-03-01 16:30:23 -080039 * @param token Token received from createToken
40 * @return success Whether or not the token was successfully unregistered.
Steven Moreland2ef31d82016-12-21 14:38:23 -080041 */
Steven Moreland15716d52017-03-16 02:01:22 -070042 unregister(vec<uint8_t> token) generates (bool success);
Steven Moreland2ef31d82016-12-21 14:38:23 -080043
44 /**
Pawin Vongmasaf4a58402017-03-01 16:30:23 -080045 * Fetch an interface from a provided token.
Steven Moreland2ef31d82016-12-21 14:38:23 -080046 *
Pawin Vongmasaf4a58402017-03-01 16:30:23 -080047 * @param token Token received from createToken
Steven Moreland2ef31d82016-12-21 14:38:23 -080048 * @return store Interface registered with createToken and the corresponding
49 * token or nullptr.
50 */
Steven Moreland15716d52017-03-16 02:01:22 -070051 get(vec<uint8_t> token) generates (interface store);
Steven Moreland2ef31d82016-12-21 14:38:23 -080052};