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