summaryrefslogtreecommitdiff
path: root/trusty/confirmationui/include/TrustyIpc.h
blob: eb764bc467bc6160584972de66292eaaca984fb7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/*
 * Copyright 2021 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.
 */

#pragma once

#include <stdint.h>

/*
 * This interface is shared between Android and Trusty. There is a copy in each
 * repository. They must be kept in sync.
 */

#define CONFIRMATIONUI_PORT "com.android.trusty.confirmationui"

/**
 * enum confirmationui_cmd - command identifiers for ConfirmationUI interface
 * @CONFIRMATIONUI_RESP_BIT:  response bit set as part of response
 * @CONFIRMATIONUI_REQ_SHIFT: number of bits used by response bit
 * @CONFIRMATIONUI_CMD_INIT:  command to initialize session
 * @CONFIRMATIONUI_CMD_MSG:   command to send ConfirmationUI messages
 */
enum confirmationui_cmd : uint32_t {
    CONFIRMATIONUI_RESP_BIT = 1,
    CONFIRMATIONUI_REQ_SHIFT = 1,

    CONFIRMATIONUI_CMD_INIT = (1 << CONFIRMATIONUI_REQ_SHIFT),
    CONFIRMATIONUI_CMD_MSG = (2 << CONFIRMATIONUI_REQ_SHIFT),
};

/**
 * struct confirmationui_hdr - header for ConfirmationUI messages
 * @cmd: command identifier
 *
 * Note that no messages return a status code. Any error on the server side
 * results in the connection being closed. So, operations can be assumed to be
 * successful if they return a response.
 */
struct confirmationui_hdr {
    uint32_t cmd;
};

/**
 * struct confirmationui_init_req - arguments for request to initialize a
 *                                  session
 * @shm_len: length of memory region being shared
 *
 * A handle to a memory region must be sent along with this message. This memory
 * is send to ConfirmationUI messages.
 */
struct confirmationui_init_req {
    uint32_t shm_len;
};

/**
 * struct confirmationui_msg_args - arguments for sending a message
 * @msg_len: length of message being sent
 *
 * Contents of the message are located in the shared memory region that is
 * established using %CONFIRMATIONUI_CMD_INIT.
 *
 * ConfirmationUI messages can travel both ways.
 */
struct confirmationui_msg_args {
    uint32_t msg_len;
};

#define CONFIRMATIONUI_MAX_MSG_SIZE 0x2000