blob: 3141f54f226d524fd84295d7a50295f88728b466 [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
10#include <rpc/common/endpoint/rpc_interface.h>
11#include <service/common/provider/service_provider.h>
12#include <service/discovery/provider/discovery_provider.h>
13#include <protocols/rpc/common/packed-c/encoding.h>
14
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 */
34struct fwu_provider
35{
36 struct service_provider base_provider;
37 const struct fwu_provider_serializer *serializers[TS_RPC_ENCODING_LIMIT];
38 struct discovery_provider discovery_provider;
39 struct update_agent *update_agent;
40};
41
42/**
43 * \brief Initialise a fwu_provider
44 *
45 * \param[in] context The subject fwu_provider context
46 * \param[in] update_agent The associated update_agent
47 *
48 * \return A pointer to the exposed rpc_interface or NULL on failure
49 */
50struct rpc_interface *fwu_provider_init(
51 struct fwu_provider *context,
52 struct update_agent *update_agent);
53
54/**
55 * \brief De-initialise a fwu_provider
56 *
57 * \param[in] context The subject fwu_provider context
58 */
59void fwu_provider_deinit(
60 struct fwu_provider *context);
61
62/**
63 * \brief Register a serializer
64 *
65 * \param[in] context The subject fwu_provider context
66 * \param[in] encoding The encoding scheme
67 * \param[in] serializer The serializer
68 */
69void fwu_provider_register_serializer(
70 struct fwu_provider *context,
71 unsigned int encoding,
72 const struct fwu_provider_serializer *serializer);
73
74#ifdef __cplusplus
75} /* extern "C" */
76#endif
77
78#endif /* FWU_PROVIDER_H */