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