blob: 381f2631e3421a2cff35ce3ab5e897e7a6c23601 [file] [log] [blame]
Julian Hall201ce462021-04-29 11:05:34 +01001/*
2 * Copyright (c) 2021, Arm Limited and Contributors. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef CLAIM_SOURCE_H
8#define CLAIM_SOURCE_H
9
Julian Hall1d313022021-05-07 14:27:55 +010010#include <stdint.h>
Julian Hall201ce462021-04-29 11:05:34 +010011
12#ifdef __cplusplus
13extern "C" {
14#endif
15
16struct claim;
17
18/**
19 * An abstract interface for getting a claim from some source. The source
20 * may return any type of claim variant so it could be a single claim or a
21 * collection.
22 */
23struct claim_source
24{
25 bool (*get_claim)(void *context, struct claim *claim);
26 void *context;
27
Julian Hall1d313022021-05-07 14:27:55 +010028 /**
29 * A bitmap of claim categories that this claim_source provides claims for.
30 * Claim categories are enumerated by enum claim_category.
31 */
32 uint32_t category_map;
33
Julian Hall201ce462021-04-29 11:05:34 +010034};
35
36/**
37 * \brief Get a claim from the claim source
38 *
39 * \param[in] cs The claim source
40 * \param[out] claim The returned claim
41 *
42 * \return Returns true if a claim is returned.
43 */
44static inline bool claim_source_get_claim(struct claim_source *cs, struct claim *claim)
45{
46 return cs->get_claim(cs->context, claim);
47}
48
49#ifdef __cplusplus
50} /* extern "C" */
51#endif
52
53#endif /* CLAIM_SOURCE_H */