]> git.saurik.com Git - apple/security.git/blob - OSX/authd/rule.h
Security-57337.40.85.tar.gz
[apple/security.git] / OSX / authd / rule.h
1 /* Copyright (c) 2012-2013 Apple Inc. All Rights Reserved. */
2
3 #ifndef _SECURITY_AUTH_RULE_H_
4 #define _SECURITY_AUTH_RULE_H_
5
6 #include "authdb.h"
7 #include <CoreFoundation/CoreFoundation.h>
8 #include <Security/SecRequirement.h>
9
10 #if defined(__cplusplus)
11 extern "C" {
12 #endif
13
14 typedef bool (^mechanism_iterator_t)(mechanism_t mechanism);
15 typedef bool (^delegate_iterator_t)(rule_t delegate);
16
17 typedef enum {
18 RT_RIGHT = 1,
19 RT_RULE
20 } RuleType;
21
22 typedef enum {
23 RC_USER = 1,
24 RC_RULE,
25 RC_MECHANISM,
26 RC_ALLOW,
27 RC_DENY
28 } RuleClass;
29
30 enum {
31 RuleFlagShared = 1 << 0,
32 RuleFlagAllowRoot = 1 << 1,
33 RuleFlagSessionOwner = 1 << 2,
34 RuleFlagAuthenticateUser = 1 << 3,
35 RuleFlagExtractPassword = 1 << 4,
36 RuleFlagEntitled = 1 << 5,
37 RuleFlagEntitledAndGroup = 1 << 6,
38 RuleFlagRequireAppleSigned = 1 << 7,
39 RuleFlagVPNEntitledAndGroup = 1 << 8
40 };
41 typedef uint32_t RuleFlags;
42
43 AUTH_WARN_RESULT AUTH_MALLOC AUTH_NONNULL_ALL AUTH_RETURNS_RETAINED
44 rule_t rule_create_default(void);
45
46 AUTH_WARN_RESULT AUTH_MALLOC AUTH_NONNULL1 AUTH_RETURNS_RETAINED
47 rule_t rule_create_with_string(const char *,authdb_connection_t);
48
49 AUTH_WARN_RESULT AUTH_MALLOC AUTH_NONNULL_ALL AUTH_RETURNS_RETAINED
50 rule_t rule_create_with_plist(RuleType,CFStringRef,CFDictionaryRef,authdb_connection_t);
51
52 AUTH_NONNULL_ALL
53 size_t rule_get_mechanisms_count(rule_t);
54
55 AUTH_NONNULL_ALL
56 CFArrayRef rule_get_mechanisms(rule_t);
57
58 AUTH_NONNULL_ALL
59 bool rule_mechanisms_iterator(rule_t,mechanism_iterator_t iter);
60
61 AUTH_NONNULL_ALL
62 size_t rule_get_delegates_count(rule_t);
63
64 AUTH_NONNULL_ALL
65 bool rule_delegates_iterator(rule_t,delegate_iterator_t iter);
66
67 AUTH_NONNULL_ALL
68 bool rule_sql_fetch(rule_t,authdb_connection_t);
69
70 AUTH_NONNULL1 AUTH_NONNULL2
71 bool rule_sql_commit(rule_t,authdb_connection_t,CFAbsoluteTime,process_t);
72
73 AUTH_NONNULL_ALL
74 bool rule_sql_remove(rule_t,authdb_connection_t);
75
76 AUTH_NONNULL_ALL
77 CFMutableDictionaryRef rule_copy_to_cfobject(rule_t,authdb_connection_t);
78
79 AUTH_NONNULL_ALL
80 int64_t rule_get_id(rule_t);
81
82 AUTH_NONNULL_ALL
83 const char * rule_get_name(rule_t);
84
85 AUTH_NONNULL_ALL
86 RuleType rule_get_type(rule_t);
87
88 AUTH_NONNULL_ALL
89 RuleClass rule_get_class(rule_t);
90
91 AUTH_NONNULL_ALL
92 const char * rule_get_group(rule_t);
93
94 AUTH_NONNULL_ALL
95 int64_t rule_get_kofn(rule_t);
96
97 AUTH_NONNULL_ALL
98 int64_t rule_get_timeout(rule_t);
99
100 AUTH_NONNULL_ALL
101 bool rule_check_flags(rule_t,RuleFlags);
102
103 AUTH_NONNULL_ALL
104 bool rule_get_shared(rule_t);
105
106 AUTH_NONNULL_ALL
107 bool rule_get_allow_root(rule_t);
108
109 AUTH_NONNULL_ALL
110 bool rule_get_session_owner(rule_t);
111
112 AUTH_NONNULL_ALL
113 bool rule_get_authenticate_user(rule_t);
114
115 AUTH_NONNULL_ALL
116 bool rule_get_extract_password(rule_t);
117
118 AUTH_NONNULL_ALL
119 int64_t rule_get_tries(rule_t);
120
121 AUTH_NONNULL_ALL
122 const char * rule_get_comment(rule_t);
123
124 AUTH_NONNULL_ALL
125 int64_t rule_get_version(rule_t);
126
127 AUTH_NONNULL_ALL
128 double rule_get_created(rule_t);
129
130 AUTH_NONNULL_ALL
131 double rule_get_modified(rule_t);
132
133 AUTH_NONNULL_ALL
134 const char * rule_get_identifier(rule_t);
135
136 AUTH_NONNULL_ALL
137 CFDataRef rule_get_requirment_data(rule_t);
138
139 AUTH_NONNULL_ALL
140 SecRequirementRef rule_get_requirment(rule_t);
141
142 #if defined(__cplusplus)
143 }
144 #endif
145
146 #endif /* !_SECURITY_AUTH_RULE_H_ */