1 /* Copyright (c) 2012 Apple Inc. All Rights Reserved. */
3 #ifndef _SECURITY_AUTH_AUTHDB_H_
4 #define _SECURITY_AUTH_AUTHDB_H_
7 #include <CoreFoundation/CoreFoundation.h>
10 AuthDBTransactionNone
= 0,
11 AuthDBTransactionImmediate
,
12 AuthDBTransactionExclusive
,
13 AuthDBTransactionNormal
15 typedef uint32_t AuthDBTransactionType
;
17 #if defined(__cplusplus)
24 typedef bool (^authdb_iterator_t
)(auth_items_t data
);
26 AUTH_WARN_RESULT AUTH_NONNULL_ALL
27 char * authdb_copy_sql_string(sqlite3_stmt
*,int32_t);
29 AUTH_WARN_RESULT AUTH_MALLOC AUTH_RETURNS_RETAINED
30 authdb_t
authdb_create(void);
32 AUTH_WARN_RESULT AUTH_NONNULL_ALL
33 authdb_connection_t
authdb_connection_acquire(authdb_t
);
36 void authdb_connection_release(authdb_connection_t
*);
39 bool authdb_maintenance(authdb_connection_t
);
42 int32_t authdb_exec(authdb_connection_t
, const char *);
45 bool authdb_transaction(authdb_connection_t
, AuthDBTransactionType
, bool (^t
)(void));
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
);
51 int32_t authdb_get_key_value(authdb_connection_t
, const char * table
, auth_items_t
* out_items
);
54 int32_t authdb_set_key_value(authdb_connection_t
, const char * table
, auth_items_t items
);
57 void authdb_checkpoint(authdb_connection_t
);
60 bool authdb_import_plist(authdb_connection_t
,CFDictionaryRef
,bool);
63 #pragma mark authdb_connection_t
66 authdb_connection_t
authdb_connection_create(authdb_t
);
68 #if defined(__cplusplus)
72 #endif /* !_SECURITY_AUTH_AUTHDB_H_ */