Julian Hall | 32798ff | 2022-12-19 13:33:42 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2022, Arm Limited and Contributors. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
| 7 | #ifndef FWU_PROVIDER_H |
| 8 | #define FWU_PROVIDER_H |
| 9 | |
Gyorgy Szing | 3c44624 | 2023-03-31 01:53:15 +0200 | [diff] [blame] | 10 | #include "protocols/rpc/common/packed-c/encoding.h" |
Imre Kis | e584a98 | 2023-07-04 17:59:18 +0200 | [diff] [blame] | 11 | #include "rpc/common/endpoint/rpc_service_interface.h" |
Gyorgy Szing | 3c44624 | 2023-03-31 01:53:15 +0200 | [diff] [blame] | 12 | #include "service/common/provider/service_provider.h" |
Julian Hall | 32798ff | 2022-12-19 13:33:42 +0000 | [diff] [blame] | 13 | |
| 14 | #ifdef __cplusplus |
| 15 | extern "C" { |
| 16 | #endif |
| 17 | |
| 18 | /** |
| 19 | * Interface dependencies |
| 20 | */ |
| 21 | struct fwu_provider_serializer; |
| 22 | struct update_agent; |
| 23 | |
| 24 | /** |
| 25 | * \brief fwu_provider instance structure |
| 26 | * |
| 27 | * An instance of the fwu_provider presents the service level interface for |
| 28 | * remote access to the fwu service. In addition to handling incoming call |
| 29 | * requests, the fwu_provider is responsible for access control, call parameter |
| 30 | * serialization/deserialization and parameter sanitation. Request are delegated |
| 31 | * to the associated update_agent. |
| 32 | */ |
Gyorgy Szing | 3c44624 | 2023-03-31 01:53:15 +0200 | [diff] [blame] | 33 | struct fwu_provider { |
Julian Hall | 32798ff | 2022-12-19 13:33:42 +0000 | [diff] [blame] | 34 | struct service_provider base_provider; |
| 35 | const struct fwu_provider_serializer *serializers[TS_RPC_ENCODING_LIMIT]; |
Julian Hall | 32798ff | 2022-12-19 13:33:42 +0000 | [diff] [blame] | 36 | struct update_agent *update_agent; |
| 37 | }; |
| 38 | |
| 39 | /** |
| 40 | * \brief Initialise a fwu_provider |
| 41 | * |
| 42 | * \param[in] context The subject fwu_provider context |
| 43 | * \param[in] update_agent The associated update_agent |
| 44 | * |
| 45 | * \return A pointer to the exposed rpc_interface or NULL on failure |
| 46 | */ |
Imre Kis | e584a98 | 2023-07-04 17:59:18 +0200 | [diff] [blame] | 47 | struct rpc_service_interface *fwu_provider_init(struct fwu_provider *context, |
| 48 | struct update_agent *update_agent); |
Julian Hall | 32798ff | 2022-12-19 13:33:42 +0000 | [diff] [blame] | 49 | |
| 50 | /** |
| 51 | * \brief De-initialise a fwu_provider |
| 52 | * |
| 53 | * \param[in] context The subject fwu_provider context |
| 54 | */ |
Gyorgy Szing | 3c44624 | 2023-03-31 01:53:15 +0200 | [diff] [blame] | 55 | void fwu_provider_deinit(struct fwu_provider *context); |
Julian Hall | 32798ff | 2022-12-19 13:33:42 +0000 | [diff] [blame] | 56 | |
| 57 | /** |
| 58 | * \brief Register a serializer |
| 59 | * |
| 60 | * \param[in] context The subject fwu_provider context |
| 61 | * \param[in] encoding The encoding scheme |
| 62 | * \param[in] serializer The serializer |
| 63 | */ |
Gyorgy Szing | 3c44624 | 2023-03-31 01:53:15 +0200 | [diff] [blame] | 64 | void fwu_provider_register_serializer(struct fwu_provider *context, unsigned int encoding, |
| 65 | const struct fwu_provider_serializer *serializer); |
Julian Hall | 32798ff | 2022-12-19 13:33:42 +0000 | [diff] [blame] | 66 | |
| 67 | #ifdef __cplusplus |
| 68 | } /* extern "C" */ |
| 69 | #endif |
| 70 | |
| 71 | #endif /* FWU_PROVIDER_H */ |