blob: 3864ca6899efe076d1951a58d10d1b5f4af34ff1 [file] [log] [blame]
Julian Hall32798ff2022-12-19 13:33:42 +00001/*
Imre Kis6fd73d82024-07-04 13:36:10 +02002 * Copyright (c) 2022-2024, Arm Limited and Contributors. All rights reserved.
Julian Hall32798ff2022-12-19 13:33:42 +00003 *
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"
Imre Kis6fd73d82024-07-04 13:36:10 +020013#include "fwu_provider_shim.h"
Julian Hall32798ff2022-12-19 13:33:42 +000014
15#ifdef __cplusplus
16extern "C" {
17#endif
18
19/**
20 * Interface dependencies
21 */
22struct fwu_provider_serializer;
23struct update_agent;
24
25/**
26 * \brief fwu_provider instance structure
27 *
28 * An instance of the fwu_provider presents the service level interface for
29 * remote access to the fwu service. In addition to handling incoming call
30 * requests, the fwu_provider is responsible for access control, call parameter
31 * serialization/deserialization and parameter sanitation. Request are delegated
32 * to the associated update_agent.
33 */
Gyorgy Szing3c446242023-03-31 01:53:15 +020034struct fwu_provider {
Julian Hall32798ff2022-12-19 13:33:42 +000035 struct service_provider base_provider;
Imre Kis6fd73d82024-07-04 13:36:10 +020036 struct fwu_provider_shim shim;
Julian Hall32798ff2022-12-19 13:33:42 +000037 const struct fwu_provider_serializer *serializers[TS_RPC_ENCODING_LIMIT];
Julian Hall32798ff2022-12-19 13:33:42 +000038 struct update_agent *update_agent;
39};
40
41/**
42 * \brief Initialise a fwu_provider
43 *
44 * \param[in] context The subject fwu_provider context
45 * \param[in] update_agent The associated update_agent
46 *
47 * \return A pointer to the exposed rpc_interface or NULL on failure
48 */
Imre Kise584a982023-07-04 17:59:18 +020049struct rpc_service_interface *fwu_provider_init(struct fwu_provider *context,
50 struct update_agent *update_agent);
Julian Hall32798ff2022-12-19 13:33:42 +000051
52/**
53 * \brief De-initialise a fwu_provider
54 *
55 * \param[in] context The subject fwu_provider context
56 */
Gyorgy Szing3c446242023-03-31 01:53:15 +020057void fwu_provider_deinit(struct fwu_provider *context);
Julian Hall32798ff2022-12-19 13:33:42 +000058
59/**
60 * \brief Register a serializer
61 *
62 * \param[in] context The subject fwu_provider context
63 * \param[in] encoding The encoding scheme
64 * \param[in] serializer The serializer
65 */
Gyorgy Szing3c446242023-03-31 01:53:15 +020066void fwu_provider_register_serializer(struct fwu_provider *context, unsigned int encoding,
67 const struct fwu_provider_serializer *serializer);
Julian Hall32798ff2022-12-19 13:33:42 +000068
69#ifdef __cplusplus
70} /* extern "C" */
71#endif
72
73#endif /* FWU_PROVIDER_H */