blob: d762bce3df58a8a15756b950a239d536b133162d [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 struct update_agent *update_agent;
38};
39
40/**
41 * \brief Initialise a fwu_provider
42 *
43 * \param[in] context The subject fwu_provider context
44 * \param[in] update_agent The associated update_agent
45 *
46 * \return A pointer to the exposed rpc_interface or NULL on failure
47 */
Imre Kise584a982023-07-04 17:59:18 +020048struct rpc_service_interface *fwu_provider_init(struct fwu_provider *context,
49 struct update_agent *update_agent);
Julian Hall32798ff2022-12-19 13:33:42 +000050
51/**
52 * \brief De-initialise a fwu_provider
53 *
54 * \param[in] context The subject fwu_provider context
55 */
Gyorgy Szing3c446242023-03-31 01:53:15 +020056void fwu_provider_deinit(struct fwu_provider *context);
Julian Hall32798ff2022-12-19 13:33:42 +000057
Julian Hall32798ff2022-12-19 13:33:42 +000058#ifdef __cplusplus
59} /* extern "C" */
60#endif
61
62#endif /* FWU_PROVIDER_H */