Julian Hall | f7f8495 | 2020-11-23 17:55:51 +0100 | [diff] [blame] | 1 | /* |
julhal01 | c3f4e9a | 2020-12-15 13:39:01 +0000 | [diff] [blame^] | 2 | * Copyright (c) 2020-2021, Arm Limited and Contributors. All rights reserved. |
Julian Hall | f7f8495 | 2020-11-23 17:55:51 +0100 | [diff] [blame] | 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
| 7 | #ifndef DIRECT_CALLER_H |
| 8 | #define DIRECT_CALLER_H |
| 9 | |
| 10 | #include <rpc_caller.h> |
| 11 | #include <stdint.h> |
| 12 | #include <stdbool.h> |
| 13 | #include <stddef.h> |
| 14 | |
| 15 | #ifdef __cplusplus |
| 16 | extern "C" { |
| 17 | #endif |
| 18 | |
julhal01 | c3f4e9a | 2020-12-15 13:39:01 +0000 | [diff] [blame^] | 19 | struct rpc_interface; |
Julian Hall | f7f8495 | 2020-11-23 17:55:51 +0100 | [diff] [blame] | 20 | |
| 21 | /** An rpc_caller that calls methods associated with a specific endpoint |
| 22 | * directly. Used when the caller and endpoint are running in the same |
| 23 | * execution context. |
| 24 | **/ |
| 25 | struct direct_caller |
| 26 | { |
| 27 | struct rpc_caller rpc_caller; |
julhal01 | c3f4e9a | 2020-12-15 13:39:01 +0000 | [diff] [blame^] | 28 | struct rpc_interface *rpc_interface; |
Julian Hall | f7f8495 | 2020-11-23 17:55:51 +0100 | [diff] [blame] | 29 | uint32_t caller_id; |
| 30 | bool is_call_transaction_in_progess; |
| 31 | size_t req_len; |
| 32 | size_t req_buf_size; |
| 33 | size_t resp_buf_size; |
| 34 | uint8_t *req_buf; |
| 35 | uint8_t *resp_buf; |
| 36 | }; |
| 37 | |
julhal01 | c3f4e9a | 2020-12-15 13:39:01 +0000 | [diff] [blame^] | 38 | struct rpc_caller *direct_caller_init(struct direct_caller *s, struct rpc_interface *iface, |
Julian Hall | f7f8495 | 2020-11-23 17:55:51 +0100 | [diff] [blame] | 39 | size_t req_buf_size, size_t resp_buf_size); |
| 40 | |
julhal01 | c3f4e9a | 2020-12-15 13:39:01 +0000 | [diff] [blame^] | 41 | struct rpc_caller *direct_caller_init_default(struct direct_caller *s, struct rpc_interface *iface); |
Julian Hall | f7f8495 | 2020-11-23 17:55:51 +0100 | [diff] [blame] | 42 | |
| 43 | void direct_caller_deinit(struct direct_caller *s); |
| 44 | |
| 45 | #ifdef __cplusplus |
| 46 | } |
| 47 | #endif |
| 48 | |
| 49 | #endif /* DIRECT_CALLER_H */ |