]> git.ipfire.org Git - thirdparty/glibc.git/blob - nss/nss_db/dummy-db.h
600d51d9842cbd626b40ebdc83090de3e1bfc6dc
[thirdparty/glibc.git] / nss / nss_db / dummy-db.h
1 #include <stdint.h>
2
3 #include "nss_db.h"
4
5 /* This file contains dummy definitions of the DB structure of the
6 Berkeley DB. We are only interested in the function pointers since
7 this is the interface to the database. Unfortunately the structure
8 changed over time and we have to take this into account. */
9
10 /* The values to select the database type are unchanged over the version.
11 Define only what we really need. */
12 #define DB_BTREE (1)
13
14 /* Permission flags are also not changed. */
15 #define DB_RDONLY 0x010000
16
17 /* Access methods. */
18 #define DB24_FIRST 0x000020
19 #define DB24_NEXT 0x000800
20 #define DB24_NOOVERWRITE 0x001000
21
22
23 /* This is for the db-2.x version up to 2.x.y. We use the name `db24' since
24 this is the version which was shipped with glibc 2.1. */
25 struct db24
26 {
27 void *mutexp;
28 enum { dummy24 } type;
29 void *dbenv;
30 void *mp_dbenv;
31 void *master;
32 void *internal;
33 void *mp;
34 void *mpf;
35 struct
36 {
37 void *tqh_first;
38 void **tqh_last;
39 } curs_queue;
40 struct {
41 void *lh_first;
42 } handleq;
43 struct {
44 void *le_next;
45 void **le_prev;
46 } links;
47 uint32_t log_fileid;
48 void *txn;
49 uint32_t locker;
50 struct db24_dbt {
51 void *data;
52 uint32_t size;
53 uint32_t ulen;
54 uint32_t dlen;
55 uint32_t doff;
56 uint32_t flags;
57 } lock_dbt;
58 struct{
59 uint32_t pgno;
60 uint8_t fileid[20];
61 } lock;
62 size_t pgsize;
63 void *db_malloc;
64 /* Functions. */
65 int (*close) (void *, uint32_t);
66 int (*cursor) (void *, void *, void **);
67 int (*del) (void *, void *, DBT *, uint32_t);
68 int (*fd) (void *, int *);
69 int (*get) (void *, void *, DBT *, DBT *, uint32_t);
70 int (*put) (void *, void *, DBT *, DBT *, uint32_t);
71 int (*stat) (void *, void *, void *(*)(size_t), uint32_t);
72 int (*sync) (void *, uint32_t);
73 };
74
75
76 struct dbc24
77 {
78 void *dbp;
79 void *txn;
80 struct
81 {
82 void *tqe_next;
83 void **tqe_prev;
84 } links;
85 void *internal;
86 void *c_close;
87 void *c_del;
88 int (*c_get) (void *, void *, void *, uint32_t);
89 void *c_put;
90 };
91
92 /* Flags which changed. */
93 #define DB24_TRUNCATE 0x080000
94
95
96 /* Versions for 2.7, slightly incompatible with version 2.4. */
97 struct db27
98 {
99 void *mutexp;
100 enum { dummy27 } type;
101 int byteswapped;
102 void *dbenv;
103 void *mp_dbenv;
104 void *internal;
105 void *mp;
106 void *mpf;
107 struct
108 {
109 void *tqh_first;
110 void **tqh_last;
111 } free_queue;
112 struct
113 {
114 void *tqh_first;
115 void **tqh_last;
116 } active_queue;
117 struct {
118 void *lh_first;
119 } handleq;
120 uint8_t fileid[20];
121 uint32_t log_fileid;
122 size_t pgsize;
123 void *db_malloc;
124 void *dup_compare;
125 void *h_hash;
126 /* Functions. */
127 int (*am_close) (void *);
128 int (*close) (void *, uint32_t);
129 int (*cursor) (void *, void *, void **, uint32_t);
130 int (*del) (void *, void *, DBT *, uint32_t);
131 int (*fd) (void *, int *);
132 int (*get) (void *, void *, DBT *, DBT *, uint32_t);
133 int (*put) (void *, void *, DBT *, DBT *, uint32_t);
134 int (*stat) (void *, void *, void *(*)(size_t), uint32_t);
135 int (*sync) (void *, uint32_t);
136 };
137
138
139 struct dbc27
140 {
141 void *dbp;
142 void *txn;
143 struct
144 {
145 void *tqe_next;
146 void **tqe_prev;
147 } links;
148 uint32_t lid;
149 uint32_t locker;
150 DBT lock_dbt;
151 uint32_t lock[14];
152 size_t mylock;
153 DBT rkey;
154 DBT rdata;
155 void *c_am_close;
156 void *c_am_destroy;
157 void *c_close;
158 void *c_del;
159 int (*c_get) (void *, void *, void *, uint32_t);
160 void *c_put;
161 void *internal;
162 uint32_t flags;
163 };
164
165 /* Flags which changed. */
166 #define DB27_TRUNCATE 0x020000
167
168 /* Access methods. */
169 #define DB27_FIRST 7
170 #define DB27_NEXT 15
171 #define DB27_NOOVERWRITE 17