1 /* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
3 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
4 * Use is subject to license terms.
10 /* #pragma ident "@(#)kdb_log.h 1.3 04/02/23 SMI" */
12 #include <iprop_hdr.h>
24 #define INDEX(ulogaddr, i) ((unsigned long) ulogaddr + sizeof (kdb_hlog_t) + \
28 * Current DB version #
36 #define KDB_UNSTABLE 2
42 #define KDB_ULOG_MAGIC 0x6661212
43 #define KDB_ULOG_HDR_MAGIC 0x6662323
51 #define FKCOMMAND 4 /* Includes kadmin.local and kdb5_util */
54 * Default ulog file attributes
56 #define MAX_ULOGENTRIES 2500
57 #define DEF_ULOGENTRIES 1000
58 #define ULOG_IDLE_TIME 10 /* in seconds */
60 * Max size of update entry + update header
61 * We make this large since resizing can be costly.
63 #define ULOG_BLOCK 2048 /* Default size of principal record */
65 #define MAXLOGLEN 0x10000000 /* 256 MB log file */
68 * Prototype declarations
70 extern krb5_error_code ulog_map(krb5_context context,
71 const char *logname, uint32_t entries,
74 extern krb5_error_code ulog_add_update(krb5_context context,
75 kdb_incr_update_t *upd);
76 extern krb5_error_code ulog_delete_update(krb5_context context,
77 kdb_incr_update_t *upd);
78 extern krb5_error_code ulog_finish_update(krb5_context context,
79 kdb_incr_update_t *upd);
80 extern krb5_error_code ulog_get_entries(krb5_context context, kdb_last_t last,
81 kdb_incr_result_t *ulog_handle);
83 extern krb5_error_code
84 ulog_replay(krb5_context context, kdb_incr_result_t *incr_ret, char **db_args);
86 extern krb5_error_code
87 ulog_conv_2logentry(krb5_context context, krb5_db_entry *entry,
88 kdb_incr_update_t *update);
90 extern krb5_error_code
91 ulog_conv_2dbentry(krb5_context context, krb5_db_entry **entry,
92 kdb_incr_update_t *update);
94 extern void ulog_free_entries(kdb_incr_update_t *updates, int no_of_updates);
95 extern krb5_error_code ulog_set_role(krb5_context ctx, iprop_role role);
97 extern krb5_error_code ulog_lock(krb5_context ctx, int mode);
99 typedef struct kdb_hlog {
100 uint32_t kdb_hmagic; /* Log header magic # */
101 uint16_t db_version_num; /* Kerberos database version no. */
102 uint32_t kdb_num; /* # of updates in log */
103 kdbe_time_t kdb_first_time; /* Timestamp of first update */
104 kdbe_time_t kdb_last_time; /* Timestamp of last update */
105 kdb_sno_t kdb_first_sno; /* First serial # in the update log */
106 kdb_sno_t kdb_last_sno; /* Last serial # in the update log */
107 uint16_t kdb_state; /* State of update log */
108 uint16_t kdb_block; /* Block size of each element */
111 typedef struct kdb_ent_header {
112 uint32_t kdb_umagic; /* Update entry magic # */
113 kdb_sno_t kdb_entry_sno; /* Serial # of entry */
114 kdbe_time_t kdb_time; /* Timestamp of update */
115 bool_t kdb_commit; /* Is the entry committed or not */
116 uint32_t kdb_entry_size; /* Size of update entry */
117 uint8_t entry_data[4]; /* Address of kdb_incr_update_t */
120 typedef struct _kdb_log_context {
121 iprop_role iproprole;
123 uint32_t ulogentries;
131 #endif /* !_KDB_LOG_H */