blob: 26f21b591c35a36e5ced4778dbabf61bd050b845 [file] [log] [blame]
Julian Hall700aa362021-05-13 15:30:39 +01001/*
2 * Copyright (c) 2021, Arm Limited and Contributors. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef ATTEST_PROVIDER_H
8#define ATTEST_PROVIDER_H
9
10#include <rpc/common/endpoint/rpc_interface.h>
11#include <rpc_caller.h>
12#include <service/common/provider/service_provider.h>
13#include <service/attestation/provider/serializer/attest_provider_serializer.h>
14#include <service/attestation/key_mngr/attest_key_mngr.h>
15#include <protocols/rpc/common/packed-c/encoding.h>
16
17#ifdef __cplusplus
18extern "C" {
19#endif
20
21/**
22 * The attest_provider is a service provider that implements an RPC interface
23 * for an instance of the attestation service.
24 */
25struct attest_provider
26{
27 struct service_provider base_provider;
28 const struct attest_provider_serializer *serializers[TS_RPC_ENCODING_LIMIT];
29};
30
31/**
32 * \brief Initialize an instance of the service provider
33 *
34 * Initializes a an attestation service provider. Returns an rpc_interface
35 * that should be associated with a suitable rpc endpoint.
36 *
37 * \param[in] context The instance to initialize
Julian Hall700aa362021-05-13 15:30:39 +010038 *
39 * \return An rpc_interface or NULL on failure
40 */
Julian Hall644b57a2021-06-30 08:45:19 +010041struct rpc_interface *attest_provider_init(struct attest_provider *context);
Julian Hall700aa362021-05-13 15:30:39 +010042
43/**
44 * \brief Cleans up when the instance is no longer needed
45 *
46 * \param[in] context The instance to de-initialize
47 */
48void attest_provider_deinit(struct attest_provider *context);
49
50/**
51 * \brief Register a protocol serializer
52 *
53 * \param[in] context The instance
54 * \param[in] encoding Serialization encoding e.g. packed-c
55 * \param[in] serializer A concrete serializer
56 */
57void attest_provider_register_serializer(struct attest_provider *context,
58 unsigned int encoding, const struct attest_provider_serializer *serializer);
59
60#ifdef __cplusplus
61} /* extern "C" */
62#endif
63
64#endif /* ATTEST_PROVIDER_H */