aboutsummaryrefslogtreecommitdiff
path: root/components/service/secure_storage/provider/mock_store/mock_store_provider.h
blob: 9d2c136e469c65cba310a74638a3d6632a81391a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
 * Copyright (c) 2020-2021, Arm Limited and Contributors. All rights reserved.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

#ifndef MOCK_STORE_PROVIDER_H
#define MOCK_STORE_PROVIDER_H

#include <stdbool.h>
#include <stdint.h>
#include <service/common/provider/service_provider.h>

#ifdef __cplusplus
extern "C" {
#endif

#define MOCK_STORE_NUM_SLOTS        (100)

struct mock_store_slot
{
    uint64_t id;
    uint32_t flags;
    size_t len;
    uint8_t *item;
};

struct mock_store_provider
{
    struct service_provider base_provider;
    struct mock_store_slot slots[MOCK_STORE_NUM_SLOTS];
};

struct rpc_interface *mock_store_provider_init(struct mock_store_provider *context);
void mock_store_provider_deinit(struct mock_store_provider *context);

/* Test support methods */
void mock_store_reset(struct mock_store_provider *context);
bool mock_store_exists(const struct mock_store_provider *context, uint32_t id);
size_t mock_store_num_items(const struct mock_store_provider *context);

#ifdef __cplusplus
} /* extern "C" */
#endif

#endif /* MOCK_STORE_PROVIDER_H */