~ubuntu-branches/ubuntu/oneiric/likewise-open/oneiric

« back to all changes in this revision

Viewing changes to krb5/src/include/kdb_log.h

  • Committer: Bazaar Package Importer
  • Author(s): Scott Salley
  • Date: 2010-11-22 12:06:00 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20101122120600-8lba1fpceot71wlb
Tags: 6.0.0.53010-1
Likewise Open 6.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
 
3
 * Use is subject to license terms.
 
4
 */
 
5
 
 
6
#ifndef _KDB_LOG_H
 
7
#define _KDB_LOG_H
 
8
 
 
9
/* #pragma ident        "@(#)kdb_log.h  1.3     04/02/23 SMI" */
 
10
 
 
11
#include <iprop_hdr.h>
 
12
#include <iprop.h>
 
13
#include <limits.h>
 
14
#include "kdb.h"
 
15
 
 
16
#ifdef  __cplusplus
 
17
extern "C" {
 
18
#endif
 
19
 
 
20
/*
 
21
 * DB macros
 
22
 */
 
23
#define INDEX(ulogaddr, i) ((unsigned long) ulogaddr + sizeof (kdb_hlog_t) + \
 
24
        (i*ulog->kdb_block))
 
25
 
 
26
/*
 
27
 * Current DB version #
 
28
 */
 
29
#define KDB_VERSION     1
 
30
 
 
31
/*
 
32
 * DB log states
 
33
 */
 
34
#define KDB_STABLE      1
 
35
#define KDB_UNSTABLE    2
 
36
#define KDB_CORRUPT     3
 
37
 
 
38
/*
 
39
 * DB log constants
 
40
 */
 
41
#define KDB_ULOG_MAGIC          0x6661212
 
42
#define KDB_ULOG_HDR_MAGIC      0x6662323
 
43
 
 
44
/*
 
45
 * DB Flags
 
46
 */
 
47
#define FKADMIND        1
 
48
#define FKPROPLOG       2
 
49
#define FKPROPD         3
 
50
#define FKCOMMAND       4       /* Includes kadmin.local and kdb5_util */
 
51
 
 
52
/*
 
53
 * Default ulog file attributes
 
54
 */
 
55
#define MAX_ULOGENTRIES 2500
 
56
#define DEF_ULOGENTRIES 1000
 
57
#define ULOG_IDLE_TIME  10              /* in seconds */
 
58
/*
 
59
 * Max size of update entry + update header
 
60
 * We make this large since resizing can be costly.
 
61
 */
 
62
#define ULOG_BLOCK      2048            /* Default size of principal record */
 
63
 
 
64
#define MAXLOGLEN       0x10000000      /* 256 MB log file */
 
65
 
 
66
/*
 
67
 * Prototype declarations
 
68
 */
 
69
extern krb5_error_code ulog_map(krb5_context context,
 
70
                                const char *logname, uint32_t entries,
 
71
                                int caller,
 
72
                                char **db_args);
 
73
extern krb5_error_code ulog_add_update(krb5_context context,
 
74
        kdb_incr_update_t *upd);
 
75
extern krb5_error_code ulog_delete_update(krb5_context context,
 
76
        kdb_incr_update_t *upd);
 
77
extern krb5_error_code ulog_finish_update(krb5_context context,
 
78
        kdb_incr_update_t *upd);
 
79
extern krb5_error_code ulog_get_entries(krb5_context context, kdb_last_t last,
 
80
        kdb_incr_result_t *ulog_handle);
 
81
extern krb5_error_code ulog_replay(krb5_context context,
 
82
                                   kdb_incr_result_t *incr_ret, char **db_args);
 
83
extern krb5_error_code ulog_conv_2logentry(krb5_context context,
 
84
        krb5_db_entry *entries, kdb_incr_update_t *updates, int nentries);
 
85
extern krb5_error_code ulog_conv_2dbentry(krb5_context context,
 
86
        krb5_db_entry *entries, kdb_incr_update_t *updates, int nentries);
 
87
extern void ulog_free_entries(kdb_incr_update_t *updates, int no_of_updates);
 
88
extern krb5_error_code ulog_set_role(krb5_context ctx, iprop_role role);
 
89
 
 
90
extern krb5_error_code ulog_lock(krb5_context ctx, int mode);
 
91
 
 
92
typedef struct kdb_hlog {
 
93
        uint32_t        kdb_hmagic;     /* Log header magic # */
 
94
        uint16_t        db_version_num; /* Kerberos database version no. */
 
95
        uint32_t        kdb_num;        /* # of updates in log */
 
96
        kdbe_time_t     kdb_first_time; /* Timestamp of first update */
 
97
        kdbe_time_t     kdb_last_time;  /* Timestamp of last update */
 
98
        kdb_sno_t       kdb_first_sno;  /* First serial # in the update log */
 
99
        kdb_sno_t       kdb_last_sno;   /* Last serial # in the update log */
 
100
        uint16_t        kdb_state;      /* State of update log */
 
101
        uint16_t        kdb_block;      /* Block size of each element */
 
102
} kdb_hlog_t;
 
103
 
 
104
typedef struct kdb_ent_header {
 
105
        uint32_t        kdb_umagic;     /* Update entry magic # */
 
106
        kdb_sno_t       kdb_entry_sno;  /* Serial # of entry */
 
107
        kdbe_time_t     kdb_time;       /* Timestamp of update */
 
108
        bool_t          kdb_commit;     /* Is the entry committed or not */
 
109
        uint32_t        kdb_entry_size; /* Size of update entry */
 
110
        uint8_t         entry_data[4];  /* Address of kdb_incr_update_t */
 
111
} kdb_ent_header_t;
 
112
 
 
113
typedef struct _kdb_log_context {
 
114
        iprop_role      iproprole;
 
115
        kdb_hlog_t      *ulog;
 
116
        uint32_t        ulogentries;
 
117
        int             ulogfd;
 
118
} kdb_log_context;
 
119
 
 
120
#ifdef  __cplusplus
 
121
}
 
122
#endif
 
123
 
 
124
#endif  /* !_KDB_LOG_H */