]> git.saurik.com Git - apple/security.git/blob - Security/authd/authdb.h
Security-57031.40.6.tar.gz
[apple/security.git] / Security / authd / authdb.h
1 /* Copyright (c) 2012 Apple Inc. All Rights Reserved. */
2
3 #ifndef _SECURITY_AUTH_AUTHDB_H_
4 #define _SECURITY_AUTH_AUTHDB_H_
5
6 #include <sqlite3.h>
7 #include <CoreFoundation/CoreFoundation.h>
8
9 enum {
10 AuthDBTransactionNone = 0,
11 AuthDBTransactionImmediate,
12 AuthDBTransactionExclusive,
13 AuthDBTransactionNormal
14 };
15 typedef uint32_t AuthDBTransactionType;
16
17 #if defined(__cplusplus)
18 extern "C" {
19 #endif
20
21 #pragma mark -
22 #pragma mark authdb_t
23
24 typedef bool (^authdb_iterator_t)(auth_items_t data);
25
26 AUTH_WARN_RESULT AUTH_NONNULL_ALL
27 char * authdb_copy_sql_string(sqlite3_stmt*,int32_t);
28
29 AUTH_WARN_RESULT AUTH_MALLOC AUTH_RETURNS_RETAINED
30 authdb_t authdb_create(void);
31
32 AUTH_WARN_RESULT AUTH_NONNULL_ALL
33 authdb_connection_t authdb_connection_acquire(authdb_t);
34
35 AUTH_NONNULL_ALL
36 void authdb_connection_release(authdb_connection_t*);
37
38 AUTH_NONNULL_ALL
39 bool authdb_maintenance(authdb_connection_t);
40
41 AUTH_NONNULL_ALL
42 int32_t authdb_exec(authdb_connection_t, const char *);
43
44 AUTH_NONNULL_ALL
45 bool authdb_transaction(authdb_connection_t, AuthDBTransactionType, bool (^t)(void));
46
47 AUTH_NONNULL1 AUTH_NONNULL2 AUTH_NONNULL3
48 bool authdb_step(authdb_connection_t, const char * sql, void (^bind_stmt)(sqlite3_stmt* stmt), authdb_iterator_t iter);
49
50 AUTH_NONNULL_ALL
51 int32_t authdb_get_key_value(authdb_connection_t, const char * table, auth_items_t * out_items);
52
53 AUTH_NONNULL_ALL
54 int32_t authdb_set_key_value(authdb_connection_t, const char * table, auth_items_t items);
55
56 AUTH_NONNULL_ALL
57 void authdb_checkpoint(authdb_connection_t);
58
59 AUTH_NONNULL_ALL
60 bool authdb_import_plist(authdb_connection_t,CFDictionaryRef,bool);
61
62 #pragma mark -
63 #pragma mark authdb_connection_t
64
65 AUTH_NONNULL_ALL
66 authdb_connection_t authdb_connection_create(authdb_t);
67
68 #if defined(__cplusplus)
69 }
70 #endif
71
72 #endif /* !_SECURITY_AUTH_AUTHDB_H_ */