]> git.saurik.com Git - apple/security.git/blame_incremental - OSX/authd/rule.h
Security-57740.60.18.tar.gz
[apple/security.git] / OSX / authd / rule.h
... / ...
CommitLineData
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)
11extern "C" {
12#endif
13
14typedef bool (^mechanism_iterator_t)(mechanism_t mechanism);
15typedef bool (^delegate_iterator_t)(rule_t delegate);
16
17typedef enum {
18 RT_RIGHT = 1,
19 RT_RULE
20} RuleType;
21
22typedef enum {
23 RC_USER = 1,
24 RC_RULE,
25 RC_MECHANISM,
26 RC_ALLOW,
27 RC_DENY
28} RuleClass;
29
30enum {
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 RuleFlagPasswordOnly = 1 << 9
41};
42typedef uint32_t RuleFlags;
43
44AUTH_WARN_RESULT AUTH_MALLOC AUTH_NONNULL_ALL AUTH_RETURNS_RETAINED
45rule_t rule_create_default(void);
46
47AUTH_WARN_RESULT AUTH_MALLOC AUTH_NONNULL1 AUTH_RETURNS_RETAINED
48rule_t rule_create_with_string(const char *,authdb_connection_t);
49
50AUTH_WARN_RESULT AUTH_MALLOC AUTH_NONNULL_ALL AUTH_RETURNS_RETAINED
51rule_t rule_create_with_plist(RuleType,CFStringRef,CFDictionaryRef,authdb_connection_t);
52
53AUTH_NONNULL_ALL
54size_t rule_get_mechanisms_count(rule_t);
55
56AUTH_NONNULL_ALL
57CFArrayRef rule_get_mechanisms(rule_t);
58
59AUTH_NONNULL_ALL
60bool rule_mechanisms_iterator(rule_t,mechanism_iterator_t iter);
61
62AUTH_NONNULL_ALL
63size_t rule_get_delegates_count(rule_t);
64
65AUTH_NONNULL_ALL
66bool rule_delegates_iterator(rule_t,delegate_iterator_t iter);
67
68AUTH_NONNULL_ALL
69bool rule_sql_fetch(rule_t,authdb_connection_t);
70
71AUTH_NONNULL1 AUTH_NONNULL2
72bool rule_sql_commit(rule_t,authdb_connection_t,CFAbsoluteTime,process_t);
73
74AUTH_NONNULL_ALL
75bool rule_sql_remove(rule_t,authdb_connection_t);
76
77AUTH_NONNULL_ALL
78CFMutableDictionaryRef rule_copy_to_cfobject(rule_t,authdb_connection_t);
79
80AUTH_NONNULL_ALL
81int64_t rule_get_id(rule_t);
82
83AUTH_NONNULL_ALL
84const char * rule_get_name(rule_t);
85
86AUTH_NONNULL_ALL
87RuleType rule_get_type(rule_t);
88
89AUTH_NONNULL_ALL
90RuleClass rule_get_class(rule_t);
91
92AUTH_NONNULL_ALL
93const char * rule_get_group(rule_t);
94
95AUTH_NONNULL_ALL
96int64_t rule_get_kofn(rule_t);
97
98AUTH_NONNULL_ALL
99int64_t rule_get_timeout(rule_t);
100
101AUTH_NONNULL_ALL
102bool rule_check_flags(rule_t,RuleFlags);
103
104AUTH_NONNULL_ALL
105bool rule_get_shared(rule_t);
106
107AUTH_NONNULL_ALL
108bool rule_get_allow_root(rule_t);
109
110AUTH_NONNULL_ALL
111bool rule_get_session_owner(rule_t);
112
113AUTH_NONNULL_ALL
114bool rule_get_authenticate_user(rule_t);
115
116AUTH_NONNULL_ALL
117bool rule_get_extract_password(rule_t);
118
119AUTH_NONNULL_ALL
120bool rule_get_password_only(rule_t);
121
122AUTH_NONNULL_ALL
123int64_t rule_get_tries(rule_t);
124
125AUTH_NONNULL_ALL
126const char * rule_get_comment(rule_t);
127
128AUTH_NONNULL_ALL
129int64_t rule_get_version(rule_t);
130
131AUTH_NONNULL_ALL
132double rule_get_created(rule_t);
133
134AUTH_NONNULL_ALL
135double rule_get_modified(rule_t);
136
137AUTH_NONNULL_ALL
138const char * rule_get_identifier(rule_t);
139
140AUTH_NONNULL_ALL
141CFDataRef rule_get_requirement_data(rule_t);
142
143AUTH_NONNULL_ALL
144SecRequirementRef rule_get_requirement(rule_t);
145
146#if defined(__cplusplus)
147}
148#endif
149
150#endif /* !_SECURITY_AUTH_RULE_H_ */