julhal01 | c3f4e9a | 2020-12-15 13:39:01 +0000 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (c) 2020-2021, Arm Limited and Contributors. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
| 7 | #ifndef PROTOCOLS_RPC_COMMON_HEADER_H |
| 8 | #define PROTOCOLS_RPC_COMMON_HEADER_H |
| 9 | |
| 10 | #include <stdint.h> |
| 11 | |
| 12 | /* |
| 13 | * Defines an RPC request header that may be used for a packed-c serialization |
| 14 | * of common RPC fields. Different RPC protocols my carry some or all of these |
| 15 | * fields in a protocol specific way. If a particular protocol does't, this |
| 16 | * structure provides a common definition that may be used. |
| 17 | */ |
| 18 | struct __attribute__ ((__packed__)) ts_rpc_req_hdr |
| 19 | { |
| 20 | /* |
| 21 | * A trustworthy identifier for the call originator. Used for access control, applied |
| 22 | * at the remote RPC interface. This ID will have been added by an intermediary running |
| 23 | * at a higher privilege level than the caller. Example caller_ids could be the UID |
| 24 | * or SELinux label associated with a calling process. The caller_id may be supplemented |
| 25 | * by a source identity from the messaging layer (e.g. the source partition ID). |
| 26 | */ |
| 27 | uint32_t caller_id; |
| 28 | |
| 29 | /* |
| 30 | * Identifies a particular RPC interface instance that is reachable at a messaging |
| 31 | * endpoint. Allows multiple services to be co-located at a single messaging endpoint. |
| 32 | */ |
| 33 | uint16_t interface_id; |
| 34 | |
| 35 | /* |
| 36 | * Identifies the requested operation to call. |
| 37 | */ |
| 38 | uint16_t opcode; |
| 39 | |
| 40 | /* |
| 41 | * Identifies the encoding scheme used to serialize request and response parameters. |
| 42 | * It is the responsibility of the caller to specify an encoding that the destination |
| 43 | * RPC interface can handle. Must be set to a meaningful value, even if there are |
| 44 | * no request parameters. This is because response parameters will beb serialized |
| 45 | * using the same encoding. |
| 46 | */ |
| 47 | uint16_t encoding; |
| 48 | |
| 49 | /* |
| 50 | * Specifies the length in bytes of the serialized parameters. |
| 51 | */ |
| 52 | uint16_t param_len; |
| 53 | }; |
| 54 | |
| 55 | /* |
| 56 | * Defines the coresponding response header, used for returning status and |
| 57 | * any output parameters, serialized using the same encoding as specified in |
| 58 | * the request header. |
| 59 | */ |
| 60 | struct __attribute__ ((__packed__)) ts_rpc_resp_hdr |
| 61 | { |
| 62 | /* |
| 63 | * Returns the RPC layer status. Only if a value of TS_RPC_CALL_ACCEPTED |
| 64 | * is returned should the opstatus value be consider. The RPC status is |
| 65 | * kept separate from the opstatus to allow a service specific status coding |
| 66 | * namespace to coexist with the RPC status namespace. |
| 67 | */ |
| 68 | int16_t rpc_status; |
| 69 | |
| 70 | /* |
| 71 | * Returns the status of the requested operation. The meaning of this status |
| 72 | * code will be service specific. |
| 73 | */ |
| 74 | int16_t op_status; |
| 75 | |
| 76 | /* |
| 77 | * Specifies the length in bytes of the serialized parameters. |
| 78 | */ |
| 79 | uint16_t param_len; |
| 80 | }; |
| 81 | |
| 82 | #endif /* PROTOCOLS_RPC_COMMON_HEADER_H */ |