| 1 | // |
| 2 | // Errors.h |
| 3 | // CoreEntitlements |
| 4 | // |
| 5 | // |
| 6 | |
| 7 | #ifndef CORE_ENTITLEMENTS_ERRORS_H |
| 8 | #define CORE_ENTITLEMENTS_ERRORS_H |
| 9 | |
| 10 | #ifndef _CE_INDIRECT |
| 11 | #error "Please include <CoreEntitlements/CoreEntitlements.h> instead of this file" |
| 12 | #endif |
| 13 | |
| 14 | #include <sys/cdefs.h> |
| 15 | __ptrcheck_abi_assume_single(); |
| 16 | |
| 17 | /*! |
| 18 | * @typedef CEError_t |
| 19 | * A shared error type that is returned by CoreEntitlements APIs |
| 20 | */ |
| 21 | typedef const struct CEError *__single CEError_t; |
| 22 | |
| 23 | // Macro to define the error for export; |
| 24 | #define CE_DEF_ERROR(name) extern CEError_t name; |
| 25 | |
| 26 | // Returned on successful invocation |
| 27 | CE_DEF_ERROR(kCENoError); |
| 28 | |
| 29 | // Returned when the library encounters API misuse |
| 30 | CE_DEF_ERROR(kCEAPIMisuse); |
| 31 | |
| 32 | // Returned when an invalid argument has been passed in |
| 33 | CE_DEF_ERROR(kCEInvalidArgument); |
| 34 | |
| 35 | // Returned when we expected to have allocated data, but we couldn't |
| 36 | CE_DEF_ERROR(kCEAllocationFailed); |
| 37 | |
| 38 | // Returned when the passed in entitlements do not conform to any supported format |
| 39 | CE_DEF_ERROR(kCEMalformedEntitlements); |
| 40 | |
| 41 | // Returned when a group of queries does not generate a valid result on the current CEQueryContext |
| 42 | CE_DEF_ERROR(kCEQueryCannotBeSatisfied); |
| 43 | |
| 44 | // Returned when a context shouldn't be accelerated |
| 45 | CE_DEF_ERROR(kCENotEligibleForAcceleration); |
| 46 | |
| 47 | /*! |
| 48 | * @function CEGetErrorString |
| 49 | * Returns a string that describes the error |
| 50 | */ |
| 51 | const char *__unsafe_indexable CEGetErrorString(CEError_t error); |
| 52 | |
| 53 | #endif |
| 54 | |