1 /*! 2 * @header 3 * Umbrella header for CoreEntitlements 4 */ 5 #ifndef CORE_ENTITLEMENTS_H 6 #define CORE_ENTITLEMENTS_H 7 8 #ifdef __cplusplus 9 extern "C" { 10 #endif 11 12 typedef const struct CERuntime* CERuntime_t; 13 typedef struct CEQueryContext* CEQueryContext_t; 14 15 #define _CE_INDIRECT 1 16 17 #ifdef TXM 18 #include <attributes.h> 19 #include <ptrcheck.h> 20 #endif 21 22 #if defined(__has_feature) && __has_feature(bounds_attributes) 23 #define CE_HEADER_INDEXABLE __attribute__((__indexable__)) 24 #else 25 #define CE_HEADER_INDEXABLE 26 #endif 27 28 #include <os/base.h> 29 #include <CoreEntitlements/Errors.h> 30 #include <CoreEntitlements/Result.h> 31 #include <CoreEntitlements/Runtime.h> 32 #include <CoreEntitlements/Entitlements.h> 33 #include <CoreEntitlements/Serialization.h> 34 #include <CoreEntitlements/Index.h> 35 36 __ptrcheck_abi_assume_single(); 37 38 /*! 39 * @typedef CEType_t 40 * @brief Represents a type of element supported by CoreEntitlements 41 * 42 * @const kCETypeUnknown 43 * An unknown type 44 * 45 * @const kCETypeDictionary 46 * A dictionary container 47 * 48 * @const kCETypeSequence 49 * An ordered sequence container 50 * 51 * @const kCETypeInteger 52 * An integer. 53 * 54 * @const kCETypeString 55 * A string of bytes. 56 * 57 * @const kCETypeBool 58 * A boolean. 59 */ 60 OS_CLOSED_ENUM(CEType, uint32_t, 61 kCETypeUnknown = 0, 62 kCETypeDictionary = 1, 63 kCETypeSequence = 2, 64 kCETypeInteger = 3, 65 kCETypeString = 4, 66 kCETypeBool = 5, 67 kCETypeData = 6); 68 69 /*! 70 * @function CE_RT_LOG 71 * Log a single message via the current runtime 72 * Only called if the runtime supports logging. 73 */ 74 #define CE_RT_LOG(msg) do { if (rt->log) { rt->log(rt, "[%s]: %s\n", __FUNCTION__, msg); } } while(0) 75 76 /*! 77 * @function CE_RT_LOGF 78 * Logs using the passed in format. Printf like. 79 * Only called if the runtime supports logging. 80 */ 81 #define CE_RT_LOGF(fmt, ...) do { if (rt->log) { rt->log(rt, "[%s]: " fmt, __FUNCTION__, __VA_ARGS__); } } while(0) 82 83 /*! 84 * @function CE_RT_ABORT 85 * Invokes the runtime abort function with a passed in message. 86 * This function should not return. 87 */ 88 #define CE_RT_ABORT(...) do { rt->abort(rt, "[%s]: %s\n", __FUNCTION__, __VA_ARGS__); } while(0) 89 90 #ifdef __cplusplus 91 } 92 #endif 93 94 #endif 95