blob: 037889a4bdf397245b2681be44bfd7546085abb1 [file] [log] [blame]
Julian Hall32798ff2022-12-19 13:33:42 +00001/*
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 Szing3c446242023-03-31 01:53:15 +020010#include "protocols/rpc/common/packed-c/encoding.h"
Imre Kise584a982023-07-04 17:59:18 +020011#include "rpc/common/endpoint/rpc_service_interface.h"
Gyorgy Szing3c446242023-03-31 01:53:15 +020012#include "service/common/provider/service_provider.h"
Julian Hall32798ff2022-12-19 13:33:42 +000013
14#ifdef __cplusplus
15extern "C" {
16#endif
17
18/**
19 * Interface dependencies
20 */
21struct fwu_provider_serializer;
22struct 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 Szing3c446242023-03-31 01:53:15 +020033struct fwu_provider {
Julian Hall32798ff2022-12-19 13:33:42 +000034 struct service_provider base_provider;
35 const struct fwu_provider_serializer *serializers[TS_RPC_ENCODING_LIMIT];
Julian Hall32798ff2022-12-19 13:33:42 +000036 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 Kise584a982023-07-04 17:59:18 +020047struct rpc_service_interface *fwu_provider_init(struct fwu_provider *context,
48 struct update_agent *update_agent);
Julian Hall32798ff2022-12-19 13:33:42 +000049
50/**
51 * \brief De-initialise a fwu_provider
52 *
53 * \param[in] context The subject fwu_provider context
54 */
Gyorgy Szing3c446242023-03-31 01:53:15 +020055void fwu_provider_deinit(struct fwu_provider *context);
Julian Hall32798ff2022-12-19 13:33:42 +000056
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 Szing3c446242023-03-31 01:53:15 +020064void fwu_provider_register_serializer(struct fwu_provider *context, unsigned int encoding,
65 const struct fwu_provider_serializer *serializer);
Julian Hall32798ff2022-12-19 13:33:42 +000066
67#ifdef __cplusplus
68} /* extern "C" */
69#endif
70
71#endif /* FWU_PROVIDER_H */