Julian Hall | 201ce46 | 2021-04-29 11:05:34 +0100 | [diff] [blame^] | 1 | /* |
| 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 | |
| 10 | |
| 11 | #ifdef __cplusplus |
| 12 | extern "C" { |
| 13 | #endif |
| 14 | |
| 15 | struct claim; |
| 16 | |
| 17 | /** |
| 18 | * An abstract interface for getting a claim from some source. The source |
| 19 | * may return any type of claim variant so it could be a single claim or a |
| 20 | * collection. |
| 21 | */ |
| 22 | struct claim_source |
| 23 | { |
| 24 | bool (*get_claim)(void *context, struct claim *claim); |
| 25 | void *context; |
| 26 | |
| 27 | /* Generic claim source properties to be added */ |
| 28 | }; |
| 29 | |
| 30 | /** |
| 31 | * \brief Get a claim from the claim source |
| 32 | * |
| 33 | * \param[in] cs The claim source |
| 34 | * \param[out] claim The returned claim |
| 35 | * |
| 36 | * \return Returns true if a claim is returned. |
| 37 | */ |
| 38 | static inline bool claim_source_get_claim(struct claim_source *cs, struct claim *claim) |
| 39 | { |
| 40 | return cs->get_claim(cs->context, claim); |
| 41 | } |
| 42 | |
| 43 | #ifdef __cplusplus |
| 44 | } /* extern "C" */ |
| 45 | #endif |
| 46 | |
| 47 | #endif /* CLAIM_SOURCE_H */ |