1 %module libdb_csharp
2 %{
3 #include "db_config.h"
4 #include "db_int.h"
5 #include "dbinc/txn.h"
6 #include "db.h"
7 %}
8 
9 typedef long time_t;
10 typedef unsigned int u_int;
11 typedef unsigned long u_int32_t;
12 typedef u_int32_t size_t;
13 typedef unsigned long db_pgno_t;
14 typedef unsigned long db_recno_t;
15 typedef u_int32_t db_mutex_t;
16 typedef u_int32_t db_threadid_t;
17 typedef unsigned long db_timeout_t;
18 typedef int pid_t;
19 typedef	uintptr_t	roff_t;
20 typedef u_int32_t uintptr_t;
21 typedef int int32_t;
22 typedef int64_t db_seq_t;
23 typedef int64_t db_off_t;
24 typedef int64_t off_t;
25 typedef long long int int64_t;
26 typedef u_int32_t DB_BACKUP_CONFIG;
27 typedef u_int32_t DB_CACHE_PRIORITY;
28 typedef u_int32_t DB_MEM_CONFIG;
29 
30 %csmethodmodifiers "internal";
31 %typemap(csclassmodifiers) SWIGTYPE "internal class"
32 %pragma(csharp) moduleclassmodifiers="internal class"
33 %typemap(csclassmodifiers) DBTYPE "internal enum"
34 %typemap(csclassmodifiers) db_lockmode_t "internal enum"
35 %typemap(csclassmodifiers) db_lockop_t "internal enum"
36 %typemap(csclassmodifiers) db_recops "internal enum"
37 
38 typedef enum {
39 	DB_BTREE=1,
40 	DB_HASH=2,
41 	DB_HEAP=6,
42 	DB_RECNO=3,
43 	DB_QUEUE=4,
44 	DB_UNKNOWN=5                    /* Figure it out on open. */
45 } DBTYPE;
46 
47 typedef enum {
48 	DB_LOCK_NG=0,			/* Not granted. */
49 	DB_LOCK_READ=1,			/* Shared/read. */
50 	DB_LOCK_WRITE=2,		/* Exclusive/write. */
51 	DB_LOCK_WAIT=3,			/* Wait for event */
52 	DB_LOCK_IWRITE=4,		/* Intent exclusive/write. */
53 	DB_LOCK_IREAD=5,		/* Intent to share/read. */
54 	DB_LOCK_IWR=6,			/* Intent to read and write. */
55 	DB_LOCK_READ_UNCOMMITTED=7,	/* Degree 1 isolation. */
56 	DB_LOCK_WWRITE=8		/* Was Written. */
57 } db_lockmode_t;
58 
59 typedef enum {
60 	DB_LOCK_DUMP=0,			/* Display held locks. */
61 	DB_LOCK_GET=1,			/* Get the lock. */
62 	DB_LOCK_GET_TIMEOUT=2,		/* Get lock with a timeout. */
63 	DB_LOCK_INHERIT=3,		/* Pass locks to parent. */
64 	DB_LOCK_PUT=4,			/* Release the lock. */
65 	DB_LOCK_PUT_ALL=5,		/* Release locker's locks. */
66 	DB_LOCK_PUT_OBJ=6,		/* Release locker's locks on obj. */
67 	DB_LOCK_PUT_READ=7,		/* Release locker's read locks. */
68 	DB_LOCK_TIMEOUT=8,		/* Force a txn to timeout. */
69 	DB_LOCK_TRADE=9,		/* Trade locker ids on a lock. */
70 	DB_LOCK_UPGRADE_WRITE=10	/* Upgrade writes for dirty reads. */
71 } db_lockop_t;
72 
73 typedef enum {
74 	DB_TXN_ABORT=0,			/* Public. */
75 	DB_TXN_APPLY=1,			/* Public. */
76 	DB_TXN_BACKWARD_ROLL=3,		/* Public. */
77 	DB_TXN_FORWARD_ROLL=4,		/* Public. */
78 	DB_TXN_OPENFILES=5,		/* Internal. */
79 	DB_TXN_POPENFILES=6,		/* Internal. */
80 	DB_TXN_PRINT=7			/* Public. */
81 } db_recops;
82 
83 %typemap(cstype) char ** "out IntPtr"
84 %typemap(imtype) char ** "out IntPtr"
85 %typemap(csin) char ** "out $csinput"
86 %typemap(cstype) char *** "ref string[]"
87 %typemap(imtype) char *** "ref string[]"
88 %typemap(csin) char *** "ref $csinput"
89 %typemap(cstype) int * "ref int"
90 %typemap(imtype) int * "ref int"
91 %typemap(csin) int * "ref $csinput"
92 %typemap(cstype) long * "ref long"
93 %typemap(imtype) long * "ref long"
94 %typemap(csin) long * "ref $csinput"
95 %typemap(cstype) u_int32_t * "ref uint"
96 %typemap(imtype) u_int32_t * "ref uint"
97 %typemap(csin) u_int32_t * "ref $csinput"
98 %typemap(cstype) u_int * "ref uint"
99 %typemap(imtype) u_int * "ref uint"
100 %typemap(csin) u_int * "ref $csinput"
101 %typemap(cstype) db_pgno_t * "ref uint"
102 %typemap(imtype) db_pgno_t * "ref uint"
103 %typemap(csin) db_pgno_t * "ref $csinput"
104 %typemap(cstype) time_t "long"
105 %typemap(imtype) time_t "long"
106 %typemap(csin) time_t  "$csinput"
107 %typemap(cstype) time_t * "ref long"
108 %typemap(imtype) time_t * "ref long"
109 %typemap(csin) time_t * "ref $csinput"
110 %typemap(cstype) db_timeout_t * "ref uint"
111 %typemap(imtype) db_timeout_t * "ref uint"
112 %typemap(csin) db_timeout_t * "ref $csinput"
113 %typemap(cstype) db_seq_t "Int64"
114 %typemap(imtype) db_seq_t "Int64"
115 %typemap(csin) db_seq_t "$csinput"
116 %typemap(cstype) db_seq_t * "ref Int64"
117 %typemap(imtype) db_seq_t * "ref Int64"
118 %typemap(csin) db_seq_t * "ref $csinput"
119 %typemap(cstype) db_off_t "Int64"
120 %typemap(imtype) db_off_t "Int64"
121 %typemap(csin) db_off_t "$csinput"
122 %typemap(cstype) db_off_t * "ref Int64"
123 %typemap(imtype) db_off_t * "ref Int64"
124 %typemap(csin) db_off_t * "ref $csinput"
125 %typemap(cstype) u_int8_t [DB_GID_SIZE] "byte[]"
126 %typemap(imtype) u_int8_t [DB_GID_SIZE] "byte[]"
127 %typemap(csin) u_int8_t [DB_GID_SIZE] "$csinput"
128 %typemap(cstype) u_int8_t * "byte[,]"
129 %typemap(imtype) u_int8_t * "byte[,]"
130 %typemap(csin) u_int8_t * "$csinput"
131 %typemap(cstype) void * "IntPtr"
132 %typemap(csin) void * "$csinput"
133 %typemap(csout, excode=SWIGEXCODE) void * "{IntPtr res = $imcall; $excode; return res;}"
134 
135 %typemap(cstype) DBT * "DatabaseEntry"
136 %typemap(csin, post="      GC.KeepAlive($csinput);") DBT * "$csclassname.getCPtr(DatabaseEntry.getDBT($csinput))"
137 
138 %typemap(csfinalize) DB, DB_ENV, DB_SEQUENCE ""
139 %typemap(csdestruct, methodname="Dispose", methodmodifiers="public") DB, DB_ENV, DB_SEQUENCE %{ {
lock(this)140     lock(this) {
141       if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
142         swigCMemOwn = false;
143       }
144       swigCPtr = new HandleRef(null, IntPtr.Zero);
145       GC.SuppressFinalize(this);
146     }
147 } %}
148 
149 %typemap(csout) int close(u_int32_t flags) {
150 		int ret = $imcall;
151 		if (ret == 0)
152 			/* Close is a db handle destructor.  Reflect that in the wrapper class. */
153 			swigCPtr = new HandleRef(null, IntPtr.Zero);
154 		else
155 			DatabaseException.ThrowException(ret);
156 		return ret;
157 }
158 
159 %typemap(csout) int get_transactional{
160 		return $imcall;
161 }
162 
163 %typemap(csout) int get_multiple{
164 		return $imcall;
165 }
166 
167 %typemap(csout) char **log_archive {
168 	IntPtr cPtr = $imcall;
169 	List<string> ret = new List<string>();
170 	if (cPtr == IntPtr.Zero)
171 		return ret;
172 
173 	IntPtr[] strs = new IntPtr[cntp];
174 	Marshal.Copy(cPtr, strs, 0, cntp);
175 
176 	for (int i =0; i < cntp; i++)
177 		ret.Add(Marshal.PtrToStringAnsi(strs[i]));
178 	libdb_csharp.__os_ufree(this, cPtr);
179 	return ret;
180 }
181 
182 %typemap(csout) char **get_data_dirs {
183 	IntPtr cPtr = $imcall;
184 	List<string> ret = new List<string>();
185 	if (cPtr == IntPtr.Zero)
186 		return ret;
187 
188 	IntPtr[] strs = new IntPtr[cntp];
189 	Marshal.Copy(cPtr, strs, 0, cntp);
190 
191 	for (int i =0; i < cntp; i++)
192 		ret.Add(Marshal.PtrToStringAnsi(strs[i]));
193 
194 	return ret;
195 }
196 
197 %typemap(csout) DBT *get_partition_keys(u_int *countp, u_int *sizep, int *err) {
198 	IntPtr cPtr = $imcall;
199 	if (cPtr == IntPtr.Zero)
200 		return null;
201 
202 	DatabaseEntry[] ret = new DatabaseEntry[countp - 1];
203 	IntPtr val;
204 	for (int i = 0; i < (countp - 1); i++) {
205 		val = new IntPtr((IntPtr.Size == 4 ? cPtr.ToInt32() : cPtr.ToInt64()) + i * sizep);
206 		ret[i] = DatabaseEntry.fromDBT(new DBT(val, false));
207 	}
208 	return ret;
209 }
210 %typemap(csout) int is_transaction_applied{
211 		return $imcall;
212 }
213 %typemap(csout) int log_compare{
214 		return $imcall;
215 }
216 %typemap(csout) int log_file{
217 		return $imcall;
218 }
219 %typemap(csout) void *wrap_umalloc {
220 	return $imcall;
221 }
222 
223 
224 %typemap(csout) int open {
225 	int ret;
226 	ret = $imcall;
227 	if (ret != 0)
228 		close(0);
229 	DatabaseException.ThrowException(ret);
230 	return ret;
231 }
232 
233 %typemap(csout) int remove {
234 	int ret;
235 	ret = $imcall;
236 	/*
237 	 * remove is a handle destructor, regardless of whether the remove
238 	 * succeeds.  Reflect that in the wrapper class.
239 	 */
240 	swigCPtr = new HandleRef(null, IntPtr.Zero);
241 	DatabaseException.ThrowException(ret);
242 	return ret;
243 }
244 
245 %typemap(csout) int rename {
246 	int ret;
247 	ret = $imcall;
248 	/*
249 	 * rename is a handle destructor, regardless of whether the rename
250 	 * succeeds.  Reflect that in the wrapper class.
251 	 */
252 	swigCPtr = new HandleRef(null, IntPtr.Zero);
253 	DatabaseException.ThrowException(ret);
254 	return ret;
255 }
256 
257 %typemap(csout) DB_REPMGR_SITE *repmgr_site_list(u_int *countp, u_int *sizep, int *err) {
258 	IntPtr cPtr = $imcall;
259 	if (cPtr == IntPtr.Zero)
260 		return null;
261 	/*
262 	 * This is a big kludgy, but we need to free the memory that
263 	 * repmgr_site_list mallocs.  The RepMgrSite constructors will copy all
264 	 * the data out of that malloc'd area and we can free it right away.
265 	 * This is easier than trying to construct a SWIG generated object that
266 	 * will copy everything in it's constructor, because SWIG generated
267 	 * classes come with a lot of baggage.
268 	 */
269 	RepMgrSite[] ret = new RepMgrSite[countp];
270 	for (int i = 0; i < countp; i++) {
271 		/*
272 		 * We're copying data out of an array of countp DB_REPMGR_SITE
273 		 * structures, whose size varies between 32- and 64-bit
274 		 * platforms.
275 		 */
276 		IntPtr val = new IntPtr((IntPtr.Size == 4 ? cPtr.ToInt32() : cPtr.ToInt64()) + i * sizep);
277 		ret[i] = new RepMgrSite(new DB_REPMGR_SITE(val, false));
278 	}
279 	libdb_csharp.__os_ufree(this, cPtr);
280 	return ret;
281 }
282 
283 
284 %typemap(csout) void *stat {
285 	return $imcall;
286 }
287 %typemap(csout) void *lock_stat(u_int32_t flags, int *err) {
288 	return $imcall;
289 }
290 %typemap(csout) void *log_stat(u_int32_t flags, int *err) {
291 	return $imcall;
292 }
293 %typemap(csout) void *memp_stat(u_int32_t flags, int *err) {
294 	return $imcall;
295 }
296 %typemap(csout) void *mutex_stat(u_int32_t flags, int *err) {
297 	return $imcall;
298 }
299 %typemap(csout) void *repmgr_stat(u_int32_t flags, int *err) {
300 	return $imcall;
301 }
302 %typemap(csout) void *rep_stat(u_int32_t flags, int *err) {
303 	return $imcall;
304 }
305 %typemap(csout) void *txn_stat(u_int32_t flags, uint *size, int *err) {
306 	return $imcall;
307 }
308 
309 %typemap(csout) int verify(const char *file, const char *database, FILE *handle, int (*callback)(void *handle, const void *str), u_int32_t flags) {
310 		int ret;
311 		ret = $imcall;
312 		/* Verify is a db handle destructor.  Reflect that in the wrapper class. */
313 		swigCMemOwn = false;
314 		swigCPtr = new HandleRef(null, IntPtr.Zero);
315 		DatabaseException.ThrowException(ret);
316 		return ret;
317 }
318 
319 %typemap(csout) int {
320 		int ret;
321 		ret = $imcall;
322 		DatabaseException.ThrowException(ret);
323 		return ret;
324 }
325 
326 typedef struct
327 {
328 %extend {
close__anonbd25f9e50508329 	int close(u_int32_t flags) {
330 		return self->close(self, flags);
331 	}
332 
333 	%typemap(cstype) DBT *msg "IntPtr[]"
334 	%typemap(imtype) DBT *msg "IntPtr[]"
335 	%typemap(csin) DBT *msg "$csinput"
336 	int send_msg(DBT *msg, u_int32_t nmsg, u_int32_t flags) {
337 		return self->send_msg(self, msg, nmsg, flags);
338 	}
339 
340 	%typemap(cstype) DBT *request "IntPtr[]"
341 	%typemap(imtype) DBT *request "IntPtr[]"
342 	%typemap(csin) DBT *request "$csinput"
343 
344 	%typemap(cstype) DBT *response "DatabaseEntry"
345 	%typemap(imtype) DBT *response "IntPtr"
346 	%typemap(csin, post="      GC.KeepAlive($csinput);") DBT *response "$csclassname.getCPtr(DatabaseEntry.getDBT($csinput)).Handle"
347 	int send_request(DBT * request, u_int32_t nrequest, DBT *response, db_timeout_t timeout, u_int32_t flags) {
348 		return self->send_request(self, request, nrequest, response, timeout, flags);
349 	}
350 
set_timeout__anonbd25f9e50508351 	int set_timeout(db_timeout_t timeout) {
352 		return self->set_timeout(self, timeout);
353 	}
354 }
355 } DB_CHANNEL;
356 
357 typedef struct {
358 	/* Input Parameters. */
359 	%typemap(csvarout) u_int32_t compact_fillpercent %{%}
360 	u_int32_t	compact_fillpercent;	/* Desired fillfactor: 1-100 */
361 	%typemap(csvarout) db_timeout_t    compact_timeout %{%}
362 	db_timeout_t	compact_timeout;	/* Lock timeout. */
363 	%typemap(csvarout) u_int32_t compact_pages %{%}
364 	u_int32_t	compact_pages;		/* Max pages to process. */
365 	/* Output Stats. */
366 	%typemap(csvarin) u_int32_t compact_empty_buckets %{%}
367 	u_int32_t	compact_empty_buckets;	/* Empty hash buckets found. */
368 	%typemap(csvarin) u_int32_t compact_pages_free %{%}
369 	u_int32_t	compact_pages_free;	/* Number of pages freed. */
370 	%typemap(csvarin) u_int32_t compact_pages_examine %{%}
371 	u_int32_t	compact_pages_examine;	/* Number of pages examine. */
372 	%typemap(csvarin) u_int32_t compact_levels %{%}
373 	u_int32_t	compact_levels;		/* Number of levels removed. */
374 	%typemap(csvarin) u_int32_t compact_deadlock %{%}
375 	u_int32_t	compact_deadlock;	/* Number of deadlocks. */
376 	%typemap(csvarin) u_int32_t compact_pages_truncated %{%}
377 	db_pgno_t	compact_pages_truncated; /* Pages truncated to OS. */
378 } DB_COMPACT;
379 
380 typedef struct {
381 	u_int32_t file;
382 	u_int32_t offset;
383 } DB_LSN;
384 
385 %typemap(cscode) DB %{
get_partition_keys()386 	internal DatabaseEntry[] get_partition_keys() {
387 		uint count = 0;
388 		int err = 0;
389 		uint size = 0;
390 		DatabaseEntry[] ret = get_partition_keys(ref count, ref size, ref err);
391 		DatabaseException.ThrowException(err);
392 		return ret;
393 	}
cursor(DB_TXN txn,uint flags)394 	internal DBC cursor(DB_TXN txn, uint flags) {
395 		int err = 0;
396 		DBC ret = cursor(txn, flags, ref err);
397 		DatabaseException.ThrowException(err);
398 		return ret;
399 	}
400 
join(IntPtr[]curslist,uint flags)401 	internal DBC join(IntPtr[] curslist, uint flags) {
402 		int err = 0;
403 		DBC ret = join(curslist, flags, ref err);
404 		DatabaseException.ThrowException(err);
405 		return ret;
406 	}
407 
stat_bt(DB_TXN txn,uint flags)408 	internal BTreeStatStruct stat_bt(DB_TXN txn, uint flags) {
409 		int err = 0;
410 		IntPtr ptr = stat(txn, flags, ref err);
411 		DatabaseException.ThrowException(err);
412 		BTreeStatStruct ret = (BTreeStatStruct)Marshal.PtrToStructure(ptr, typeof(BTreeStatStruct));
413 		libdb_csharp.__os_ufree(null, ptr);
414 		return ret;
415 	}
stat_hash(DB_TXN txn,uint flags)416 	internal HashStatStruct stat_hash(DB_TXN txn, uint flags) {
417 		int err = 0;
418 		IntPtr ptr = stat(txn, flags, ref err);
419 		DatabaseException.ThrowException(err);
420 		HashStatStruct ret = (HashStatStruct)Marshal.PtrToStructure(ptr, typeof(HashStatStruct));
421 		libdb_csharp.__os_ufree(null, ptr);
422 		return ret;
423 	}
stat_heap(DB_TXN txn,uint flags)424 	internal HeapStatStruct stat_heap(DB_TXN txn, uint flags) {
425 		int err = 0;
426 		IntPtr ptr = stat(txn, flags, ref err);
427 		DatabaseException.ThrowException(err);
428 		HeapStatStruct ret = (HeapStatStruct)Marshal.PtrToStructure(ptr, typeof(HeapStatStruct));
429 		libdb_csharp.__os_ufree(null, ptr);
430 		return ret;
431 	}
stat_qam(DB_TXN txn,uint flags)432 	internal QueueStatStruct stat_qam(DB_TXN txn, uint flags) {
433 		int err = 0;
434 		IntPtr ptr = stat(txn, flags, ref err);
435 		DatabaseException.ThrowException(err);
436 		QueueStatStruct ret = (QueueStatStruct)Marshal.PtrToStructure(ptr, typeof(QueueStatStruct));
437 		libdb_csharp.__os_ufree(null, ptr);
438 		return ret;
439 	}
440 
get_blob_sub_dir(out string dir)441 	internal int get_blob_sub_dir(out string dir) {
442 		int ret;
443 		IntPtr dirp;
444 		ret = get_blob_sub_dir(out dirp);
445 		dir = Marshal.PtrToStringAnsi(dirp);
446 		return ret;
447 	}
448 
get_dbname(out string filenamep,out string dbnamep)449 	internal int get_dbname(out string filenamep, out string dbnamep) {
450 		int ret;
451 		IntPtr fp, dp;
452 		filenamep = dbnamep = null;
453 		ret = get_dbname(out fp, out dp);
454 		filenamep = Marshal.PtrToStringAnsi(fp);
455 		dbnamep = Marshal.PtrToStringAnsi(dp);
456 		return ret;
457 	}
458 
get_ext_file_dir(out string dir)459 	internal int get_ext_file_dir(out string dir) {
460 		int ret;
461 		IntPtr dirp;
462 		ret = get_ext_file_dir(out dirp);
463 		dir = Marshal.PtrToStringAnsi(dirp);
464 		return ret;
465 	}
466 
get_re_source(out string source)467 	internal int get_re_source(out string source) {
468 		int ret;
469 		IntPtr sp;
470 		ret = get_re_source(out sp);
471 		source = Marshal.PtrToStringAnsi(sp);
472 		return ret;
473 	}
474 %}
475 typedef struct
476 {
477 	%typemap(cstype) void *api_internal "BaseDatabase"
478 	%typemap(imtype) void *api_internal "BaseDatabase"
479 	%typemap(csin) void *api_internal "value"
480 	%typemap(csvarout) void *api_internal %{
481 		get { return $imcall; }
482 	%}
483 	void *api_internal;
484 
485 %extend {
486 	%typemap(cstype) int (*dbt_usercopy)(DBT*, u_int32_t, void *, u_int32_t, u_int32_t) "DBTCopyDelegate"
487 	%typemap(imtype) int (*dbt_usercopy)(DBT*, u_int32_t, void *, u_int32_t, u_int32_t) "DBTCopyDelegate"
488 	%typemap(csin) int (*dbt_usercopy)(DBT*, u_int32_t, void *, u_int32_t, u_int32_t) "dbt_usercopy"
489 	int set_usercopy(int (*dbt_usercopy)(DBT *, u_int32_t, void *, u_int32_t, u_int32_t)) {
490 		self->env->dbt_usercopy = dbt_usercopy;
491 		return 0;
492 	}
493 
DB__anonbd25f9e50808494 	DB(DB_ENV *env, u_int32_t flags) {
495 		DB *self = NULL;
496 		errno = db_create(&self, env, flags);
497 		return self;
498 	}
499 
~DB__anonbd25f9e50808500 	~DB() { }
501 
502 	%typemap(cstype) int (*)(DB*, const DBT*, const DBT*, DBT*) "BDB_AssociateDelegate"
503 	%typemap(imtype) int (*)(DB*, const DBT*, const DBT*, DBT*) "BDB_AssociateDelegate"
504 	%typemap(csin) int (*callback)(DB *secondary, const DBT *key, const DBT *data, DBT *result) "callback"
505 	int associate(DB_TXN *txn, DB *sec, int (*callback)(DB *secondary, const DBT *key, const DBT *data, DBT *result), u_int32_t flags) {
506 		return self->associate(self, txn, sec, callback, flags);
507 	}
508 
509 	%typemap(cstype) int (*)(DB*, const DBT*, DBT*, const DBT*, int *) "BDB_AssociateForeignDelegate"
510 	%typemap(imtype) int (*)(DB*, const DBT*, DBT*, const DBT*, int *) "BDB_AssociateForeignDelegate"
511 	%typemap(csin) int (*callback)(DB *foreign, const DBT *key, DBT *data, const DBT *result, int *changed) "callback"
512 	int associate_foreign(DB *dbp, int (*callback)(DB *secondary, const DBT *key, DBT *data, const DBT *foreign, int *changed), u_int32_t flags) {
513 		return self->associate_foreign(self, dbp, callback, flags);
514 	}
515 
close__anonbd25f9e50808516 	int close(u_int32_t flags) {
517 		return self->close(self, flags);
518 	}
519 
compact__anonbd25f9e50808520 	int compact(DB_TXN *txn, DBT *start, DBT *stop, DB_COMPACT *cdata, u_int32_t flags, DBT *end) {
521 		return self->compact(self, txn, start, stop, cdata, flags, end);
522 	}
523 
convert__anonbd25f9e50808524 	int convert(const char *file, int lorder) {
525 		return self->convert(self, file, lorder);
526 	}
527 
528 	%csmethodmodifiers cursor "private"
529 	DBC *cursor(DB_TXN *txn, u_int32_t flags, int *err) {
530 		DBC *cursor = NULL;
531 
532 		*err = self->cursor(self, txn, &cursor, flags);
533 		return cursor;
534 	}
535 
del__anonbd25f9e50808536 	int del(DB_TXN *txn, DBT *key, u_int32_t flags) {
537 		return self->del(self, txn, key, flags);
538 	}
539 
env__anonbd25f9e50808540 	DB_ENV *env() {
541 		return self->dbenv;
542 	}
543 
exists__anonbd25f9e50808544 	int exists(DB_TXN *txn, DBT *key, u_int32_t flags) {
545 		return self->exists(self, txn, key, flags);
546 	}
547 
get__anonbd25f9e50808548 	int get(DB_TXN *txn, DBT *key, DBT *data, u_int32_t flags) {
549 		return self->get(self, txn, key, data, flags);
550 	}
551 
get_byteswapped__anonbd25f9e50808552 	int get_byteswapped(int *isswapped) {
553 		return self->get_byteswapped(self, isswapped);
554 	}
555 
get_dbname__anonbd25f9e50808556 	int get_dbname(const char **filenamep, const char **dbnamep) {
557 		return self->get_dbname(self, filenamep, dbnamep);
558 	}
559 
get_multiple__anonbd25f9e50808560 	int get_multiple() {
561 		return self->get_multiple(self);
562 	}
563 
get_open_flags__anonbd25f9e50808564 	int get_open_flags(u_int32_t *flags) {
565 		return self->get_open_flags(self, flags);
566 	}
567 
get_transactional__anonbd25f9e50808568 	int get_transactional() {
569 		return self->get_transactional(self);
570 	}
571 
572 	%typemap(cstype) DBTYPE * "ref DBTYPE"
573 	%typemap(imtype) DBTYPE * "ref DBTYPE"
574 	%typemap(csin) DBTYPE * "ref $csinput"
575 	int get_type(DBTYPE *type) {
576 		return self->get_type(self, type);
577 	}
578 
579 	%csmethodmodifiers join "private"
580 	%typemap(cstype) DBC ** "IntPtr[]"
581 	%typemap(imtype) DBC ** "IntPtr[]"
582 	%typemap(csin) DBC ** "$csinput"
583 	DBC *join(DBC **curslist, u_int32_t flags, int *err) {
584 		DBC *dbc = NULL;
585 
586 		*err = self->join(self, curslist, &dbc, flags);
587 		return dbc;
588 	}
589 
key_range__anonbd25f9e50808590 	int key_range(DB_TXN *txn, DBT *key, DB_KEY_RANGE *range, u_int32_t flags) {
591 		return self->key_range(self, txn, key, range, flags);
592 	}
593 
open__anonbd25f9e50808594 	int open(DB_TXN *txn, const char *file, const char *database, DBTYPE type, u_int32_t flags, int mode) {
595 		return self->open(self, txn, file, database, type, flags, mode);
596 	}
597 
pget__anonbd25f9e50808598 	int pget(DB_TXN *txn, DBT *key, DBT *pkey, DBT *data, u_int32_t flags) {
599 		return self->pget(self, txn, key, pkey, data, flags);
600 	}
601 
put__anonbd25f9e50808602 	int put(DB_TXN *txn, DBT *key, DBT *data, u_int32_t flags) {
603 		return self->put(self, txn, key, data, flags);
604 	}
605 
remove__anonbd25f9e50808606 	int remove(const char *file, const char *database, u_int32_t flags) {
607 		return self->remove(self, file, database, flags);
608 	}
609 
rename__anonbd25f9e50808610 	int rename(const char *file, const char *database, const char *newname, u_int32_t flags) {
611 		return self->rename(self, file, database, newname, flags);
612 	}
613 
614 	%typemap(cstype) int (*)(DB*, DBT*, db_recno_t) "BDB_AppendRecnoDelegate"
615 	%typemap(imtype) int (*)(DB*, DBT*, db_recno_t) "BDB_AppendRecnoDelegate"
616 	%typemap(csin) int (*callback)(DB *dbp, DBT*, db_recno_t) "callback"
617 	int set_append_recno(int (*callback)(DB *dbp, DBT*, db_recno_t)) {
618 		return self->set_append_recno(self, callback);
619 	}
620 
get_blob_sub_dir__anonbd25f9e50808621 	int get_blob_sub_dir(const char **dir) {
622 		return self->get_blob_sub_dir(self, dir);
623 	}
624 
625 	%typemap(cstype) int (*)(DB*, const DBT*, const DBT*, size_t *) "BDB_CompareDelegate"
626 	%typemap(imtype) int (*)(DB*, const DBT*, const DBT*, size_t *) "BDB_CompareDelegate"
627 	%typemap(csin) int (*callback)(DB *dbp, const DBT *dbt1, const DBT *dbt2, size_t *locp) "callback"
628 	int set_bt_compare(int (*callback)(DB *dbp, const DBT *dbt1, const DBT *dbt2, size_t *locp)) {
629 		return self->set_bt_compare(self, callback);
630 	}
631 
632 	%typemap(cstype) int (*)(DB *dbp, const DBT *prevKey, const DBT *prevData, const DBT *key, const DBT *data, DBT *dest) "BDB_CompressDelegate"
633 	%typemap(imtype) int (*)(DB *dbp, const DBT *prevKey, const DBT *prevData, const DBT *key, const DBT *data, DBT *dest) "BDB_CompressDelegate"
634 	%typemap(csin) int (*compress)(DB *dbp, const DBT *prevKey, const DBT *prevData, const DBT *key, const DBT *data, DBT *dest) "compress"
635 	%typemap(cstype) int (*)(DB *dbp, const DBT *prevKey, const DBT *prevData, DBT *compressed, DBT *destKey, DBT *destData) "BDB_DecompressDelegate"
636 	%typemap(imtype) int (*)(DB *dbp, const DBT *prevKey, const DBT *prevData, DBT *compressed, DBT *destKey, DBT *destData) "BDB_DecompressDelegate"
637 	%typemap(csin) int (*decompress)(DB *dbp, const DBT *prevKey, const DBT *prevData, DBT *compressed, DBT *destKey, DBT *destData) "decompress"
638 	int set_bt_compress(int (*compress)(DB *dbp, const DBT *prevKey, const DBT *prevData, const DBT *key, const DBT *data, DBT *dest), int (*decompress)(DB *dbp, const DBT *prevKey, const DBT *prevData, DBT *compressed, DBT *destKey, DBT *destData)) {
639 		return self->set_bt_compress(self, compress, decompress);
640 	}
641 
get_bt_minkey__anonbd25f9e50808642 	int get_bt_minkey(u_int32_t *bt_minkey) {
643 		return self->get_bt_minkey(self, bt_minkey);
644 	}
set_bt_minkey__anonbd25f9e50808645 	int set_bt_minkey(u_int32_t bt_minkey) {
646 		return self->set_bt_minkey(self, bt_minkey);
647 	}
648 
649 	%typemap(cstype) u_int32_t (*)(DB*, const DBT*, const DBT*) "BDB_PrefixCompareDelegate"
650 	%typemap(imtype) u_int32_t (*)(DB*, const DBT*, const DBT*) "BDB_PrefixCompareDelegate"
651 	%typemap(csin) u_int32_t (*callback)(DB *dbp, const DBT *dbt1, const DBT *dbt2) "callback"
652 	int set_bt_prefix(size_t (*callback)(DB *dbp, const DBT *dbt1, const DBT *dbt2)) {
653 		return self->set_bt_prefix(self, callback);
654 	}
655 
get_cachesize__anonbd25f9e50808656 	int get_cachesize(u_int32_t *gbytes, u_int32_t *bytes, int *ncache) {
657 		return self->get_cachesize(self, gbytes, bytes, ncache);
658 	}
set_cachesize__anonbd25f9e50808659 	int set_cachesize(u_int32_t gbytes, u_int32_t bytes, int ncache) {
660 		return self->set_cachesize(self, gbytes, bytes, ncache);
661 	}
662 
set_dup_compare__anonbd25f9e50808663 	int set_dup_compare(int (*callback)(DB *dbp, const DBT *dbt1, const DBT *dbt2, size_t *locp)) {
664 		return self->set_dup_compare(self, callback);
665 	}
666 
get_encrypt_flags__anonbd25f9e50808667 	int get_encrypt_flags(u_int32_t *flags) {
668 		return self->get_encrypt_flags(self, flags);
669 	}
set_encrypt__anonbd25f9e50808670 	int set_encrypt(const char *pwd, u_int32_t flags) {
671 		return self->set_encrypt(self, pwd, flags);
672 	}
673 
674 	%typemap(cstype) void (*)(const DB_ENV *, const char *, const char *) "BDB_ErrcallDelegate"
675 	%typemap(imtype) void (*)(const DB_ENV *, const char *, const char *) "BDB_ErrcallDelegate"
676 	%typemap(csin) void (*db_errcall_fcn)(const DB_ENV *dbenv, const char *errpfx, const char *errmsg) "db_errcall_fcn"
677 	void set_errcall(void (*db_errcall_fcn)(const DB_ENV *dbenv, const char *errpfx, const char *errmsg)) {
678 		self->set_errcall(self, db_errcall_fcn);
679 	}
680 
get_ext_file_dir__anonbd25f9e50808681 	int get_ext_file_dir(const char **dir) {
682 		return self->get_ext_file_dir(self, dir);
683 	}
set_ext_file_dir__anonbd25f9e50808684 	int set_ext_file_dir(const char *dir) {
685 		return self->set_ext_file_dir(self, dir);
686 	}
get_ext_file_threshold__anonbd25f9e50808687 	int get_ext_file_threshold(u_int32_t *bytes) {
688 		return self->get_ext_file_threshold(self, bytes);
689 	}
set_ext_file_threshold__anonbd25f9e50808690 	int set_ext_file_threshold(u_int32_t bytes, u_int32_t flags) {
691 		return self->set_ext_file_threshold(self, bytes, flags);
692 	}
693 
694 	%typemap(cstype) int (*)(DB*, int, int) "BDB_DbFeedbackDelegate"
695 	%typemap(imtype) int (*)(DB*, int, int) "BDB_DbFeedbackDelegate"
696 	%typemap(csin) int (*callback)(DB *dbp, int opcode, int percent) "callback"
697 	int set_feedback(int (*callback)(DB *dbp, int opcode, int percent)) {
698 		return self->set_feedback(self, callback);
699 	}
700 
get_flags__anonbd25f9e50808701 	int get_flags(u_int32_t *flags) {
702 		return self->get_flags(self, flags);
703 	}
set_flags__anonbd25f9e50808704 	int set_flags(u_int32_t flags) {
705 		return self->set_flags(self, flags);
706 	}
707 
get_heapsize__anonbd25f9e50808708 	int get_heapsize(u_int32_t *gbytes, u_int32_t *bytes) {
709 		return self->get_heapsize(self, gbytes, bytes);
710 	}
set_heapsize__anonbd25f9e50808711 	int set_heapsize(u_int32_t gbytes, u_int32_t bytes) {
712 		return self->set_heapsize(self, gbytes, bytes, 0);
713 	}
714 
get_heap_regionsize__anonbd25f9e50808715 	int get_heap_regionsize(u_int32_t *npages) {
716 		return self->get_heap_regionsize(self, npages);
717 	}
set_heap_regionsize__anonbd25f9e50808718 	int set_heap_regionsize(u_int32_t npages) {
719 		return self->set_heap_regionsize(self, npages);
720 	}
721 
set_h_compare__anonbd25f9e50808722 	int set_h_compare(int (*callback)(DB *dbp, const DBT *dbt1, const DBT *dbt2, size_t *locp)) {
723 		return self->set_h_compare(self, callback);
724 	}
725 
get_h_ffactor__anonbd25f9e50808726 	int get_h_ffactor(u_int32_t *ffactor) {
727 		return self->get_h_ffactor(self, ffactor);
728 	}
set_h_ffactor__anonbd25f9e50808729 	int set_h_ffactor(u_int32_t ffactor) {
730 		return self->set_h_ffactor(self, ffactor);
731 	}
732 
733 	%typemap(cstype) u_int32_t (*)(DB*, const void*, u_int32_t) "BDB_HashDelegate"
734 	%typemap(imtype) u_int32_t (*)(DB*, const void*, u_int32_t) "BDB_HashDelegate"
735 	%typemap(csin) u_int32_t (*callback)(DB *dbp, const void *bytes, u_int32_t length) "callback"
736 	int set_h_hash(u_int32_t (*callback)(DB *dbp, const void *bytes, u_int32_t length)) {
737 		return self->set_h_hash(self, callback);
738 	}
739 
get_h_nelem__anonbd25f9e50808740 	int get_h_nelem(u_int32_t *nelem) {
741 		return self->get_h_nelem(self, nelem);
742 	}
set_h_nelem__anonbd25f9e50808743 	int set_h_nelem(u_int32_t nelem) {
744 		return self->set_h_nelem(self, nelem);
745 	}
746 
get_lk_exclusive__anonbd25f9e50808747 	int get_lk_exclusive(int *onoff, int *nowait) {
748 		return self->get_lk_exclusive(self, onoff, nowait);
749 	}
set_lk_exclusive__anonbd25f9e50808750 	int set_lk_exclusive(int nowait) {
751 		return self->set_lk_exclusive(self, nowait);
752 	}
753 
get_lorder__anonbd25f9e50808754 	int get_lorder(int *lorder) {
755 		return self->get_lorder(self, lorder);
756 	}
set_lorder__anonbd25f9e50808757 	int set_lorder(int lorder) {
758 		return self->set_lorder(self, lorder);
759 	}
760 
get_pagesize__anonbd25f9e50808761 	int get_pagesize(u_int32_t *pgsz) {
762 		return self->get_pagesize(self, pgsz);
763 	}
set_pagesize__anonbd25f9e50808764 	int set_pagesize(u_int32_t pgsz) {
765 		return self->set_pagesize(self, pgsz);
766 	}
767 
768 	%typemap(cstype) void (*)(const DB_ENV *, const char *, const char *) "BDB_MsgcallDelegate"
769 	%typemap(imtype) void (*)(const DB_ENV *, const char *, const char *) "BDB_MsgcallDelegate"
770 	%typemap(csin) void (*db_msgcall_fcn)(const DB_ENV *dbenv, const char *msgpfx, const char *msg) "db_msgcall_fcn"
771 	void set_msgcall(void (*db_msgcall_fcn)(const DB_ENV *dbenv, const char *msgpfx, const char *msg)) {
772 		self->set_msgcall(self, db_msgcall_fcn);
773 	}
774 
set_msgfile__anonbd25f9e50808775 	int set_msgfile(char *msgfile) {
776 		int ret;
777 		FILE *fmsg;
778 		ret = 0;
779 		fmsg = NULL;
780 		self->get_msgfile(self, &fmsg);
781 		if (fmsg != NULL && fmsg != stdout && fmsg != stderr) {
782 			fclose(fmsg);
783 			fmsg = NULL;
784 		}
785 		if (strcmp(msgfile, "") == 0 || msgfile == NULL)
786 			self->set_msgfile(self, NULL);
787 		else if (strcmp(msgfile, "stdout") == 0)
788 			self->set_msgfile(self, stdout);
789 		else if (strcmp(msgfile, "stderr") == 0)
790 			self->set_msgfile(self, stderr);
791 		else {
792 			fmsg = fopen(msgfile, "a");
793 			if (fmsg != NULL) {
794 				self->set_msgfile(self, fmsg);
795 			}
796 			else
797 				ret = 1;
798 		}
799 		return ret;
800 	}
801 
802 	%typemap(cstype) DBT *get_partition_keys "DatabaseEntry[]"
803 	%typemap(imtype) DBT *get_partition_keys "IntPtr"
804 	%csmethodmodifiers get_partition_keys "private"
805 	DBT *get_partition_keys(u_int *countp, u_int32_t *sizep, int *err) {
806 		DBT *keys = NULL;
807 		*err = self->get_partition_keys(self, countp, &keys);
808 		*sizep = sizeof(DBT);
809 		return keys;
810 	}
get_partition_parts__anonbd25f9e50808811 	int get_partition_parts(u_int32_t *parts) {
812 		int ret;
813 		ret = self->get_partition_keys(self, parts, NULL);
814 		if (*parts == 0)
815 			ret = self->get_partition_callback(self, parts, NULL);
816 		return ret;
817 	}
818 	%typemap(cstype) DBT *keys "IntPtr[]"
819 	%typemap(imtype) DBT *keys "IntPtr[]"
820 	%typemap(csin) DBT *keys "$csinput"
821 	%typemap(cstype) u_int32_t (*)(DB *dbp, DBT *key) "BDB_PartitionDelegate"
822 	%typemap(imtype) u_int32_t (*)(DB *dbp, DBT *key) "BDB_PartitionDelegate"
823 	%typemap(csin) u_int32_t (*partition)(DB *dbp, DBT *key) "partition"
824 	int set_partition(u_int32_t parts, DBT *keys, u_int32_t (*partition)(DB *dbp, DBT *key)) {
825 		DBT *dbt;
826 		DBT **ptr;
827 		size_t dbt_size;
828 		int i, ret;
829 
830 		i = 0;
831 		dbt = NULL;
832 		ptr = (DBT **)keys;
833 		if (keys != NULL) {
834 			dbt_size = sizeof(DBT);
835 			if ((ret = __os_malloc(NULL, (parts - 1) * dbt_size, &dbt)) != 0)
836 				return ret;
837 			do {
838 				if ((ret = __dbt_usercopy(self->env, ptr[i])) != 0)
839 					goto err;
840 				memcpy(&dbt[i], ptr[i], dbt_size);
841 			} while (++i < (int)(parts - 1));
842 		}
843 		ret = self->set_partition(self, parts, dbt, partition);
844 
845 	err:	while (--i >= 0)
846 			__os_ufree(self->env, ptr[i]->data);
847 		__os_free(NULL, dbt);
848 		return ret;
849 	}
850 
get_priority__anonbd25f9e50808851 	int get_priority(DB_CACHE_PRIORITY *flags) {
852 		return self->get_priority(self, flags);
853 	}
set_priority__anonbd25f9e50808854 	int set_priority(DB_CACHE_PRIORITY flags) {
855 		return self->set_priority(self, flags);
856 	}
857 
get_q_extentsize__anonbd25f9e50808858 	int get_q_extentsize(u_int32_t *extentsz) {
859 		return self->get_q_extentsize(self, extentsz);
860 	}
set_q_extentsize__anonbd25f9e50808861 	int set_q_extentsize(u_int32_t extentsz) {
862 		return self->set_q_extentsize(self, extentsz);
863 	}
864 
get_re_delim__anonbd25f9e50808865 	int get_re_delim(int *delim) {
866 		return self->get_re_delim(self, delim);
867 	}
set_re_delim__anonbd25f9e50808868 	int set_re_delim(int delim) {
869 		return self->set_re_delim(self, delim);
870 	}
871 
get_re_len__anonbd25f9e50808872 	int get_re_len(u_int32_t *len) {
873 		return self->get_re_len(self, len);
874 	}
set_re_len__anonbd25f9e50808875 	int set_re_len(u_int32_t len) {
876 		return self->set_re_len(self, len);
877 	}
878 
get_re_pad__anonbd25f9e50808879 	int get_re_pad(int *pad) {
880 		return self->get_re_pad(self, pad);
881 	}
set_re_pad__anonbd25f9e50808882 	int set_re_pad(int pad) {
883 		return self->set_re_pad(self, pad);
884 	}
885 
get_re_source__anonbd25f9e50808886 	int get_re_source(const char **source) {
887 		return self->get_re_source(self, source);
888 	}
set_re_source__anonbd25f9e50808889 	int set_re_source(char *source) {
890 		return self->set_re_source(self, source);
891 	}
892 
893 	%csmethodmodifiers stat "private"
894 	%typemap(cstype, out="IntPtr") void * "IntPtr"
895 	void *stat(DB_TXN *txnid, u_int32_t flags, int *err) {
896 		void *ret = NULL;
897 
898 		*err = self->stat(self, txnid, &ret, flags);
899 		return ret;
900 	}
901 
stat_print__anonbd25f9e50808902 	int stat_print(u_int32_t flags) {
903 		return self->stat_print(self, flags);
904 	}
905 
sync__anonbd25f9e50808906 	int sync(u_int32_t flags) {
907 		return self->sync(self, flags);
908 	}
909 
truncate__anonbd25f9e50808910 	int truncate(DB_TXN *txn, u_int32_t *countp, u_int32_t flags) {
911 		return self->truncate(self, txn, countp, flags);
912 	}
913 
upgrade__anonbd25f9e50808914 	int upgrade(const char *file, u_int32_t flags) {
915 		return self->upgrade(self, file, flags);
916 	}
917 
918 	%typemap(cstype) FILE * "System.IO.TextWriter"
919 	%typemap(imtype) FILE * "System.IO.TextWriter"
920 	%typemap(csin) FILE * "$csinput"
921 	%typemap(cstype) int (*)(void*, const void*) "BDB_FileWriteDelegate"
922 	%typemap(imtype) int (*)(void*, const void*) "BDB_FileWriteDelegate"
923 	%typemap(csin) int (*callback)(void *handle, const void *str) "callback"
924 	int verify(const char *file, const char *database, FILE *handle, int (*callback)(void *handle, const void *str), u_int32_t flags) {
925 		/*
926 		 * We can't easily #include "dbinc/db_ext.h" because of name
927 		 * clashes, so we declare this explicitly.
928 		 */
929 		extern int __db_verify_internal __P((DB *, const char *, const
930 		    char *, void *, int (*)(void *, const void *), u_int32_t));
931 		return __db_verify_internal(self, file, database, (void *)handle, callback, flags);
932 	}
933 }
934 } DB;
935 
936 %typemap(cscode) DBC %{
dup(uint flags)937 	internal DBC dup(uint flags) {
938 		int err = 0;
939 		DBC ret = dup(flags, ref err);
940 		DatabaseException.ThrowException(err);
941 		return ret;
942 	}
db_stream(uint flags)943 	internal DB_STREAM db_stream(uint flags) {
944 		int err = 0;
945 		DB_STREAM ret = db_stream(flags, ref err);
946 		DatabaseException.ThrowException(err);
947 		return ret;
948 	}
949 %}
950 typedef struct
951 {
952 %extend {
close__anonbd25f9e50908953 	int close() {
954 		return self->close(self);
955 	}
956 
957 	%typemap(cstype) db_recno_t * "ref uint"
958 	%typemap(imtype) db_recno_t * "ref uint"
959 	%typemap(csin) db_recno_t * "ref $csinput"
960 
961 	int cmp(DBC *other_dbc, int *result, u_int32_t flags) {
962 		return self->cmp(self, other_dbc, result, flags);
963 	}
964 
count__anonbd25f9e50908965 	int count(db_recno_t *cnt, u_int32_t flags) {
966 		return self->count(self, cnt, flags);
967 	}
968 
969 	%csmethodmodifiers db_stream "private"
970 	DB_STREAM *db_stream(u_int32_t flags, int *err) {
971 		DB_STREAM *dbs = NULL;
972 		*err = self->db_stream(self, &dbs, flags);
973 		return dbs;
974 	}
975 
del__anonbd25f9e50908976 	int del(u_int32_t flags) {
977 		return self->del(self, flags);
978 	}
979 
980 	%csmethodmodifiers dup "private"
981 	DBC *dup(u_int32_t flags, int *err) {
982 		DBC *cursor = NULL;
983 
984 		*err = self->dup(self, &cursor, flags);
985 		return cursor;
986 	}
987 
get__anonbd25f9e50908988 	int get(DBT *key, DBT *data, u_int32_t flags) {
989 		return self->get(self, key, data, flags);
990 	}
991 
pget__anonbd25f9e50908992 	int pget(DBT *key, DBT *pkey, DBT *data, u_int32_t flags) {
993 		return self->pget(self, key, pkey, data, flags);
994 	}
995 
put__anonbd25f9e50908996 	int put(DBT *key, DBT *data, u_int32_t flags) {
997 		return self->put(self, key, data, flags);
998 	}
999 
get_priority__anonbd25f9e509081000 	int get_priority(DB_CACHE_PRIORITY *flags) {
1001 		return self->get_priority(self, flags);
1002 	}
set_priority__anonbd25f9e509081003 	int set_priority(DB_CACHE_PRIORITY flags) {
1004 		return self->set_priority(self, flags);
1005 	}
1006 
1007 }
1008 } DBC;
1009 
1010 %typemap (cscode) DB_TXN_TOKEN %{
DB_TXN_TOKEN(byte[]token)1011 	internal DB_TXN_TOKEN(byte[] token) : this() {
1012 		buf = token;
1013 }
1014 %}
1015 
1016 typedef struct
1017 {
1018 %typemap(cstype) u_int8_t [DB_TXN_TOKEN_SIZE] "byte[]"
1019 %typemap(imtype, out = "IntPtr") u_int8_t [DB_TXN_TOKEN_SIZE] "byte[]"
1020 %typemap(csin) u_int8_t [DB_TXN_TOKEN_SIZE] "$csinput"
1021 %typemap(csout, excode=SWIGEXCODE) u_int8_t [DB_TXN_TOKEN_SIZE] "{byte[] res = (byte [])($imcall); $excode; return res;}"
1022 %typemap(csvarout) u_int8_t [DB_TXN_TOKEN_SIZE] %{
1023 	get {
1024 		byte[] ret = new byte[DbConstants.DB_TXN_TOKEN_SIZE];
1025 		IntPtr cPtr = $imcall;
1026 		Marshal.Copy(cPtr, ret, 0, ret.Length);
1027 		return ret;
1028 	}
1029 %}
1030 u_int8_t buf[DB_TXN_TOKEN_SIZE];
1031 } DB_TXN_TOKEN;
1032 
1033 %typemap(cscode) DBT %{
1034 	internal IntPtr dataPtr {
1035 		get {
1036 			return $imclassname.DBT_data_get(swigCPtr);
1037 		}
1038 		set {
1039 			$imclassname.DBT_data_set(swigCPtr, value);
1040 		}
1041 	}
1042 %}
1043 typedef struct
1044 {
1045 	u_int32_t dlen;
1046 	u_int32_t doff;
1047 	u_int32_t flags;
1048 	u_int32_t size;
1049 	u_int32_t ulen;
1050 
1051 %typemap(cstype) void * "byte[]"
1052 %typemap(imtype) void * "IntPtr"
1053 %typemap(csvarin) void *data %{
1054 	set {
1055 		IntPtr _data = Marshal.AllocHGlobal(value.Length);
1056         Marshal.Copy(value, 0, _data, value.Length);
1057         $imclassname.DBT_data_set(swigCPtr, _data);
1058         size = (uint)value.Length;
1059 	}
1060 %}
1061 %typemap(csvarout) void *data %{
1062 	get {
1063 		IntPtr datap = $imcall;
1064 		int sz = (int)size;
1065 		byte[] ret = new byte[sz];
1066 		Marshal.Copy(datap, ret, 0, sz);
1067 		return ret;
1068 	}
1069 %}
1070 	void *data;
1071 
1072 	%typemap(cstype) void *app_data "DatabaseEntry"
1073 	%typemap(imtype) void *app_data "DatabaseEntry"
1074 	%typemap(csin) void *app_data "value"
1075 	%typemap(csvarout) void *app_data %{
1076 		get { return $imcall; }
1077 	%}
1078 	void *app_data;
1079 
1080 %extend {
this__anonbd25f9e50b081081 	%typemap(csconstruct) DBT %{: this($imcall, true) {
1082 		flags = DbConstants.DB_DBT_USERCOPY;
1083 	} %}
1084 
DBT__anonbd25f9e50b081085 	DBT() {
1086 		DBT *self = NULL;
1087 		self = malloc(sizeof(DBT));
1088 		memset(self, 0, sizeof(DBT));
1089 		return self;
1090 	}
1091 }
1092 } DBT;
1093 
1094 %typemap(cscode) DB_SITE %{
get_address(out string hostp,ref uint port)1095 	internal int get_address(out string hostp, ref uint port) {
1096 		int ret;
1097 		IntPtr hp;
1098 		ret = get_address(out hp, ref port);
1099 		hostp = Marshal.PtrToStringAnsi(hp);
1100 		DatabaseException.ThrowException(ret);
1101 		return ret;
1102 	}
1103 %}
1104 
1105 typedef struct
1106 {
1107 %extend {
close__anonbd25f9e50c081108 	int close() {
1109 		return self->close(self);
1110 	}
1111 
get_address__anonbd25f9e50c081112 	int get_address(const char **hostp, u_int *port) {
1113 		return self->get_address(self, hostp, port);
1114 	}
1115 
get_config__anonbd25f9e50c081116 	int get_config(u_int32_t which, u_int32_t *onp) {
1117 		return self->get_config(self, which, onp);
1118 	}
1119 
get_eid__anonbd25f9e50c081120 	int get_eid(int *eidp) {
1121 		return self->get_eid(self, eidp);
1122 	}
1123 
remove__anonbd25f9e50c081124 	int remove() {
1125 		return self->remove(self);
1126 	}
1127 
set_config__anonbd25f9e50c081128 	int set_config(u_int32_t which, u_int32_t value) {
1129 		return self->set_config(self, which, value);
1130 	}
1131 }
1132 } DB_SITE;
1133 
1134 typedef struct
1135 {
1136 %extend {
close__anonbd25f9e50d081137 	int close(u_int32_t flags) {
1138 		return self->close(self, flags);
1139 	}
1140 
read__anonbd25f9e50d081141 	int read(DBT *data, db_off_t offset, u_int32_t size, u_int32_t flags) {
1142 		return self->read(self, data, offset, size, flags);
1143 	}
1144 
size__anonbd25f9e50d081145 	int size(db_off_t *size, u_int32_t flags) {
1146 		return self->size(self, size, flags);
1147 	}
1148 
write__anonbd25f9e50d081149 	int write(DBT *data, db_off_t offset, u_int32_t flags) {
1150 		return self->write(self, data, offset, flags);
1151 	}
1152 }
1153 } DB_STREAM;
1154 
1155 typedef struct
1156 {
1157 	%typemap(csvarin) int eid %{%}
1158 	int eid;
1159 	%typemap(csvarin) char host[] %{%}
1160 	char host[];
1161 	%typemap(csvarin) u_int port %{%}
1162 	u_int port;
1163 	%typemap(csvarin) u_int32_t status %{%}
1164 	u_int32_t status;
1165 	%typemap(csvarin) u_int32_t flags %{%}
1166 	u_int32_t flags;
1167 	%typemap(csvarin) DB_LSN max_ack_lsn %{%}
1168 	DB_LSN max_ack_lsn;
1169 } DB_REPMGR_SITE;
1170 
1171 %typemap(cscode) DB_TXN %{
get_name(out string name)1172 	internal int get_name(out string name) {
1173 		int ret;
1174 		IntPtr namep;
1175 		ret = get_name(out namep);
1176 		name = Marshal.PtrToStringAnsi(namep);
1177 		return ret;
1178 	}
1179 %}
1180 
1181 typedef struct
1182 {
1183 %extend {
abort__anonbd25f9e50f081184 	int abort() {
1185 		return self->abort(self);
1186 	}
1187 
1188 	%typemap(cstype) int is_commit_token_enabled "bool"
1189 	%typemap(csout) int is_commit_token_enabled {
1190 		int ret;
1191 		ret = $imcall;
1192 		return (ret > 0 ? true : false);
1193 	}
is_commit_token_enabled__anonbd25f9e50f081194 	int is_commit_token_enabled() {
1195 		int is_nested, is_logging_enabled, is_rep_client;
1196 		ENV *env = self->mgrp->env;
1197 		is_nested = self->parent != NULL;
1198 		is_logging_enabled = env->lg_handle != NULL;
1199 		is_rep_client = (env->rep_handle != NULL &&
1200                     env->rep_handle->region != NULL &&
1201                     F_ISSET((env->rep_handle->region), REP_F_CLIENT));
1202 		return (!is_nested && is_logging_enabled && !is_rep_client);
1203 	}
1204 
set_commit_token__anonbd25f9e50f081205 	int set_commit_token(DB_TXN_TOKEN* token) {
1206 		return self->set_commit_token(self, token);
1207 	}
1208 
commit__anonbd25f9e50f081209 	int commit(u_int32_t flags) {
1210 		return self->commit(self, flags);
1211 	}
1212 
discard__anonbd25f9e50f081213 	int discard(u_int32_t flags) {
1214 		return self->discard(self, flags);
1215 	}
1216 
id__anonbd25f9e50f081217 	u_int32_t id() {
1218 		return self->id(self);
1219 	}
1220 
prepare__anonbd25f9e50f081221 	int prepare(u_int8_t globalID[DB_GID_SIZE]) {
1222 		return self->prepare(self, globalID);
1223 	}
1224 
get_name__anonbd25f9e50f081225 	int get_name(const char **name) {
1226 		return self->get_name(self, name);
1227 	}
set_name__anonbd25f9e50f081228 	int set_name(const char *name) {
1229 		return self->set_name(self, name);
1230 	}
1231 
get_priority__anonbd25f9e50f081232 	int get_priority(u_int32_t *priorityp) {
1233 		return self->get_priority(self, priorityp);
1234 	}
set_priority__anonbd25f9e50f081235 	int set_priority(u_int32_t priority) {
1236 		return self->set_priority(self, priority);
1237 	}
1238 
set_timeout__anonbd25f9e50f081239 	int set_timeout(db_timeout_t timeout, u_int32_t flags) {
1240 		return self->set_timeout(self, timeout, flags);
1241 	}
1242 }
1243 } DB_TXN;
1244 
1245 %typemap(cscode) DB_ENV %{
cdsgroup_begin()1246 	internal DB_TXN cdsgroup_begin() {
1247 		int err = 0;
1248 		DB_TXN ret = cdsgroup_begin(ref err);
1249 		DatabaseException.ThrowException(err);
1250 		return ret;
1251 	}
get_data_dirs()1252 	internal List<string> get_data_dirs() {
1253 		int err = 0;
1254 		int cnt = 0;
1255 		List<string> ret = get_data_dirs(ref err, ref cnt);
1256 		DatabaseException.ThrowException(err);
1257 		return ret;
1258 	}
lock_get(uint locker,uint flags,DatabaseEntry arg2,db_lockmode_t mode)1259 	internal DB_LOCK lock_get(uint locker, uint flags, DatabaseEntry arg2, db_lockmode_t mode) {
1260 		int err = 0;
1261 		DB_LOCK ret = lock_get(locker, flags, arg2, mode, ref err);
1262 		DatabaseException.ThrowException(err);
1263 		return ret;
1264 	}
lock_stat(uint flags)1265 	internal LockStatStruct lock_stat(uint flags) {
1266 		int err = 0;
1267 		IntPtr ptr = lock_stat(flags, ref err);
1268 		DatabaseException.ThrowException(err);
1269 		LockStatStruct ret = (LockStatStruct)Marshal.PtrToStructure(ptr, typeof(LockStatStruct));
1270 		libdb_csharp.__os_ufree(null, ptr);
1271 		return ret;
1272 	}
log_archive(uint flags)1273 	internal List<string> log_archive(uint flags) {
1274 		int err = 0;
1275 		int cnt = 0;
1276 		List<string> ret = log_archive(flags, ref err, ref cnt);
1277 		DatabaseException.ThrowException(err);
1278 		return ret;
1279 	}
log_file(DB_LSN dblsn)1280 	internal string log_file(DB_LSN dblsn) {
1281 		int err = 0;
1282 		int len = 100;
1283 		IntPtr namep;
1284 		while (true) {
1285 			namep = Marshal.AllocHGlobal(len);
1286 			err = log_file(dblsn, namep, (uint)len);
1287 			if (err != DbConstants.DB_BUFFER_SMALL)
1288 				break;
1289 			Marshal.FreeHGlobal(namep);
1290 			len *= 2;
1291 		}
1292 		DatabaseException.ThrowException(err);
1293 		string ret = Marshal.PtrToStringAnsi(namep);
1294 		Marshal.FreeHGlobal(namep);
1295 		return ret;
1296 	}
log_stat(uint flags)1297 	internal LogStatStruct log_stat(uint flags) {
1298 		int err = 0;
1299 		IntPtr ptr = log_stat(flags, ref err);
1300 		DatabaseException.ThrowException(err);
1301 		LogStatStruct ret = (LogStatStruct)Marshal.PtrToStructure(ptr, typeof(LogStatStruct));
1302 		libdb_csharp.__os_ufree(null, ptr);
1303 		return ret;
1304 	}
memp_stat(uint flags)1305 	internal MempStatStruct memp_stat(uint flags) {
1306 		int err = 0;
1307 	        int cnt = 0;
1308         	IntPtr mpf = new IntPtr();
1309 	        IntPtr ptr = memp_stat(ref mpf, flags, ref err, ref cnt);
1310 		DatabaseException.ThrowException(err);
1311         	IntPtr[] files = new IntPtr[cnt];
1312 		if (cnt > 0)
1313 	        	Marshal.Copy(mpf, files, 0, cnt);
1314 
1315 	        MempStatStruct ret = new MempStatStruct();
1316 		ret.st = (MPoolStatStruct)Marshal.PtrToStructure(ptr, typeof(MPoolStatStruct));
1317         	ret.files = new MPoolFileStatStruct[cnt];
1318 	        for (int i = 0; i < cnt; i++)
1319         	    ret.files[i] = (MPoolFileStatStruct)Marshal.PtrToStructure(files[i], typeof(MPoolFileStatStruct));
1320 
1321 		libdb_csharp.__os_ufree(null, ptr);
1322 		libdb_csharp.__os_ufree(null, mpf);
1323 		return ret;
1324 	}
mutex_stat(uint flags)1325 	internal MutexStatStruct mutex_stat(uint flags) {
1326 		int err = 0;
1327 		IntPtr ptr = mutex_stat(flags, ref err);
1328 		DatabaseException.ThrowException(err);
1329 		MutexStatStruct ret = (MutexStatStruct)Marshal.PtrToStructure(ptr, typeof(MutexStatStruct));
1330 		libdb_csharp.__os_ufree(null, ptr);
1331 		return ret;
1332 	}
repmgr_channel(int eid,uint flags)1333 	internal DB_CHANNEL repmgr_channel(int eid, uint flags) {
1334 		int err = 0;
1335 		DB_CHANNEL ret = repmgr_channel(eid, flags, ref err);
1336 		DatabaseException.ThrowException(err);
1337 		return ret;
1338 	}
repmgr_local_site()1339 	internal DB_SITE repmgr_local_site() {
1340 		int err = 0;
1341 		DB_SITE ret = repmgr_local_site(ref err);
1342 		DatabaseException.ThrowException(err);
1343 		return ret;
1344 	}
repmgr_site(string host,uint port)1345 	internal DB_SITE repmgr_site(string host, uint port) {
1346 		int err = 0;
1347 		DB_SITE ret = repmgr_site(host, port, ref err);
1348 		DatabaseException.ThrowException(err);
1349 		return ret;
1350 	}
repmgr_site_by_eid(int eid)1351 	internal DB_SITE repmgr_site_by_eid(int eid) {
1352 		int err = 0;
1353 		DB_SITE ret = repmgr_site_by_eid(eid, ref err);
1354 		DatabaseException.ThrowException(err);
1355 		return ret;
1356 	}
repmgr_site_list()1357 	internal RepMgrSite[] repmgr_site_list() {
1358 		uint count = 0;
1359 		int err = 0;
1360 		uint size = 0;
1361 		RepMgrSite[] ret = repmgr_site_list(ref count, ref size, ref err);
1362 		DatabaseException.ThrowException(err);
1363 		return ret;
1364 	}
repmgr_stat(uint flags)1365 	internal RepMgrStatStruct repmgr_stat(uint flags) {
1366 		int err = 0;
1367 		IntPtr ptr = repmgr_stat(flags, ref err);
1368 		DatabaseException.ThrowException(err);
1369 		RepMgrStatStruct ret = (RepMgrStatStruct)Marshal.PtrToStructure(ptr, typeof(RepMgrStatStruct));
1370 		libdb_csharp.__os_ufree(null, ptr);
1371 		return ret;
1372 	}
rep_stat(uint flags)1373 	internal ReplicationStatStruct rep_stat(uint flags) {
1374 		int err = 0;
1375 		IntPtr ptr = rep_stat(flags, ref err);
1376 		DatabaseException.ThrowException(err);
1377 		ReplicationStatStruct ret = (ReplicationStatStruct)Marshal.PtrToStructure(ptr, typeof(ReplicationStatStruct));
1378 		libdb_csharp.__os_ufree(null, ptr);
1379 		return ret;
1380 	}
txn_begin(DB_TXN parent,uint flags)1381 	internal DB_TXN txn_begin(DB_TXN parent, uint flags) {
1382 		int err = 0;
1383 		DB_TXN ret = txn_begin(parent, flags, ref err);
1384 		DatabaseException.ThrowException(err);
1385 		return ret;
1386 	}
txn_recover(int count,uint flags)1387 	internal PreparedTransaction[] txn_recover(int count, uint flags) {
1388 		int err = 0;
1389 		IntPtr prepp = Marshal.AllocHGlobal((int)(count * (IntPtr.Size + DbConstants.DB_GID_SIZE)));
1390 		long sz = 0;
1391 		err = txn_recover(prepp, count, ref sz, flags);
1392 		DatabaseException.ThrowException(err);
1393 		PreparedTransaction[] ret = new PreparedTransaction[sz];
1394 		for (long i = 0; i < sz; i++) {
1395 			IntPtr cPtr = new IntPtr((IntPtr.Size == 4 ? prepp.ToInt32() : prepp.ToInt64()) + i * (IntPtr.Size + DbConstants.DB_GID_SIZE));
1396 			DB_PREPLIST prep = new DB_PREPLIST(cPtr, false);
1397 			ret[i] = new PreparedTransaction(prep);
1398 		}
1399 		Marshal.FreeHGlobal(prepp);
1400 		return ret;
1401 	}
txn_stat(uint flags)1402 	internal TxnStatStruct txn_stat(uint flags) {
1403 		int err = 0;
1404 		uint size = 0;
1405 		int offset = Marshal.SizeOf(typeof(DB_TXN_ACTIVE));
1406 		IntPtr ptr = txn_stat(flags, ref size, ref err);
1407 		DatabaseException.ThrowException(err);
1408 	        TxnStatStruct ret = new TxnStatStruct();
1409 		ret.st = (TransactionStatStruct)Marshal.PtrToStructure(ptr, typeof(TransactionStatStruct));
1410         	ret.st_txnarray = new DB_TXN_ACTIVE[ret.st.st_nactive];
1411 	        ret.st_txngids = new byte[ret.st.st_nactive][];
1412         	ret.st_txnnames = new string[ret.st.st_nactive];
1413 
1414 	        for (int i = 0; i < ret.st.st_nactive; i++) {
1415         	    IntPtr activep = new IntPtr((IntPtr.Size == 4 ? ret.st.st_txnarray.ToInt32() : ret.st.st_txnarray.ToInt64()) + i * size);
1416 	            ret.st_txnarray[i] = (DB_TXN_ACTIVE)Marshal.PtrToStructure(activep, typeof(DB_TXN_ACTIVE));
1417         	    ret.st_txngids[i] = new byte[DbConstants.DB_GID_SIZE];
1418 	            IntPtr gidp = new IntPtr((IntPtr.Size == 4 ? activep.ToInt32() : activep.ToInt64()) + offset);
1419         	    Marshal.Copy(gidp, ret.st_txngids[i], 0, (int)DbConstants.DB_GID_SIZE);
1420 	            IntPtr namep = new IntPtr((IntPtr.Size == 4 ? gidp.ToInt32() : gidp.ToInt64()) + DbConstants.DB_GID_SIZE);
1421         	    ret.st_txnnames[i] = Marshal.PtrToStringAnsi(namep);
1422 	        }
1423         	libdb_csharp.__os_ufree(null, ptr);
1424 
1425 		return ret;
1426 	}
get_ext_file_dir(out string dir)1427 	internal int get_ext_file_dir(out string dir) {
1428 		int ret;
1429 		IntPtr dirp;
1430 		ret = get_ext_file_dir(out dirp);
1431 		dir = Marshal.PtrToStringAnsi(dirp);
1432 		return ret;
1433 	}
get_home(out string file)1434 	internal int get_home(out string file) {
1435 		int ret;
1436 		IntPtr fp;
1437 		ret = get_home(out fp);
1438 		file = Marshal.PtrToStringAnsi(fp);
1439 		return ret;
1440 	}
get_intermediate_dir_mode(out string mode)1441 	internal int get_intermediate_dir_mode(out string mode) {
1442 		int ret;
1443 		IntPtr mp;
1444 		ret = get_intermediate_dir_mode(out mp);
1445 		mode = Marshal.PtrToStringAnsi(mp);
1446 		return ret;
1447 	}
get_lg_dir(out string dir)1448 	internal int get_lg_dir(out string dir) {
1449 		int ret;
1450 		IntPtr dirp;
1451 		ret = get_lg_dir(out dirp);
1452 		dir = Marshal.PtrToStringAnsi(dirp);
1453 		return ret;
1454 	}
get_metadata_dir(out string dir)1455 	internal int get_metadata_dir(out string dir) {
1456 		int ret;
1457 		IntPtr dirp;
1458 		ret = get_metadata_dir(out dirp);
1459 		dir = Marshal.PtrToStringAnsi(dirp);
1460 		return ret;
1461 	}
get_region_dir(out string dir)1462 	internal int get_region_dir(out string dir) {
1463 		int ret;
1464 		IntPtr dirp;
1465 		ret = get_region_dir(out dirp);
1466 		dir = Marshal.PtrToStringAnsi(dirp);
1467 		return ret;
1468 	}
get_tmp_dir(out string dir)1469 	internal int get_tmp_dir(out string dir) {
1470 		int ret;
1471 		IntPtr dirp;
1472 		ret = get_tmp_dir(out dirp);
1473 		dir = Marshal.PtrToStringAnsi(dirp);
1474 		return ret;
1475 	}
1476 
1477 %}
1478 %typemap(csimports) DB_ENV "using System;
1479 using System.Runtime.InteropServices;
1480 using System.Collections.Generic;"
1481 typedef struct
1482 {
1483 
1484 %typemap(cstype) void *api2_internal "DatabaseEnvironment"
1485 %typemap(imtype) void *api2_internal "DatabaseEnvironment"
1486 %typemap(csin) void *api2_internal "value"
1487 %typemap(csvarout) void *api2_internal %{
1488 		get { return $imcall; }
1489 %}
1490 	void *api2_internal;
1491 
1492 %extend {
1493 	%typemap(cstype) int (*dbt_usercopy)(DBT*, u_int32_t, void *, u_int32_t, u_int32_t) "DBTCopyDelegate"
1494 	%typemap(imtype) int (*dbt_usercopy)(DBT*, u_int32_t, void *, u_int32_t, u_int32_t) "DBTCopyDelegate"
1495 	%typemap(csin) int (*dbt_usercopy)(DBT*, u_int32_t, void *, u_int32_t, u_int32_t) "dbt_usercopy"
1496 	int set_usercopy(int (*dbt_usercopy)(DBT *, u_int32_t, void *, u_int32_t, u_int32_t)) {
1497 		self->env->dbt_usercopy = dbt_usercopy;
1498 		return 0;
1499 	}
1500 
DB_ENV__anonbd25f9e510081501 	DB_ENV(u_int32_t flags) {
1502 		DB_ENV *self = NULL;
1503 		errno = db_env_create(&self, flags);
1504 		return self;
1505 	}
1506 
~DB_ENV__anonbd25f9e510081507 	~DB_ENV() { }
1508 
backup__anonbd25f9e510081509 	int backup(const char *target, u_int32_t flags) {
1510 		return self->backup(self, target, flags);
1511 	}
1512 
1513 	%csmethodmodifiers cdsgroup_begin "private"
1514 	DB_TXN *cdsgroup_begin(int *err) {
1515 		DB_TXN *group;
1516 
1517 		*err = self->cdsgroup_begin(self, &group);
1518 		return group;
1519 	}
1520 
close__anonbd25f9e510081521 	int close(u_int32_t flags) {
1522 		return self->close(self, flags);
1523 	}
1524 
dbbackup__anonbd25f9e510081525 	int dbbackup(const char *dbfile, const char *target, u_int32_t flags) {
1526 		return self->dbbackup(self, dbfile, target, flags);
1527 	}
1528 
dbremove__anonbd25f9e510081529 	int dbremove(DB_TXN *txn, const char *file, const char *database, u_int32_t flags) {
1530 		return self->dbremove(self, txn, file, database, flags);
1531 	}
1532 
dbrename__anonbd25f9e510081533 	int dbrename(DB_TXN *txn, const char *file, const char *database, const char *newname, u_int32_t flags) {
1534 		return self->dbrename(self, txn, file, database, newname, flags);
1535 	}
1536 
failchk__anonbd25f9e510081537 	int failchk(u_int32_t flags) {
1538 		return self->failchk(self, flags);
1539 	}
1540 
fileid_reset__anonbd25f9e510081541 	int fileid_reset(const char *file, u_int32_t flags) {
1542 		return self->fileid_reset(self, file, flags);
1543 	}
1544 
get_home__anonbd25f9e510081545 	int get_home(const char **file) {
1546 		return self->get_home(self, file);
1547 	}
1548 
is_transaction_applied__anonbd25f9e510081549 	int is_transaction_applied(DB_TXN_TOKEN *token, db_timeout_t timeout, u_int32_t flags) {
1550 		return self->txn_applied(self, token, timeout, flags);
1551 	}
1552 
lock_detect__anonbd25f9e510081553 	int lock_detect(u_int32_t flags, u_int32_t atype, u_int32_t *rejected) {
1554 		return self->lock_detect(self, flags, atype, rejected);
1555 	}
1556 
1557 	%csmethodmodifiers lock_get "private"
1558 	DB_LOCK lock_get(u_int32_t locker, u_int32_t flags, DBT *object, const db_lockmode_t mode, int *err) {
1559 		DB_LOCK lock;
1560 
1561 		*err = self->lock_get(self, locker, flags, object, mode, &lock);
1562 		return lock;
1563 	}
1564 
lock_id__anonbd25f9e510081565 	int lock_id(u_int32_t *id) {
1566 		return self->lock_id(self, id);
1567 	}
1568 
lock_id_free__anonbd25f9e510081569 	int lock_id_free(u_int32_t id) {
1570 		return self->lock_id_free(self, id);
1571 	}
1572 
lock_put__anonbd25f9e510081573 	int lock_put(DB_LOCK *lck) {
1574 		return self->lock_put(self, lck);
1575 	}
1576 
1577 	%typemap(cstype, out="IntPtr") void * "IntPtr"
1578 	%csmethodmodifiers lock_stat "private"
1579 	void *lock_stat(u_int32_t flags, int *err) {
1580 		DB_LOCK_STAT *ret;
1581 		*err = self->lock_stat(self, &ret, flags);
1582 		return (void *)ret;
1583 	}
1584 
lock_stat_print__anonbd25f9e510081585 	int lock_stat_print(u_int32_t flags) {
1586 		return self->lock_stat_print(self, flags);
1587 	}
1588 
1589 
1590 	%typemap(cstype) DB_LOCKREQ ** "IntPtr[]"
1591 	%typemap(imtype) DB_LOCKREQ ** "IntPtr[]"
1592 	%typemap(csin) DB_LOCKREQ ** "$csinput"
1593 	int lock_vec(u_int32_t locker, u_int32_t flags, DB_LOCKREQ **list, int nlist, DB_LOCKREQ *elistp){
1594 		int i, ret;
1595 		DB_LOCKREQ *vec;
1596 
1597 		ret = __os_malloc(self->env, sizeof(DB_LOCKREQ) * nlist, &vec);
1598 		if (ret != 0)
1599 			return ENOMEM;
1600 		for (i = 0; i < nlist; i++)
1601 			vec[i] = *list[i];
1602 
1603 		if (elistp == NULL)
1604 			ret = self->lock_vec(self, locker, flags, vec, nlist, NULL);
1605 		else
1606 			ret = self->lock_vec(self, locker, flags, vec, nlist, &elistp);
1607 
1608 		for (i = 0; i < nlist; i++)
1609 			*list[i] = vec[i];
1610 
1611 		__os_free(self->env , vec);
1612 
1613 		return ret;
1614 	}
1615 
1616 	%typemap(cstype) char ** "List<string>"
1617 	%typemap(imtype) char ** "IntPtr"
1618 	%typemap(csin) char ** "$csinput"
1619 	char **log_archive(u_int32_t flags, int *err, int *cntp) {
1620 		char **list = NULL;
1621 		int cnt = 0;
1622 		*err = self->log_archive(self, &list, flags);
1623 
1624 		if (list != NULL)
1625 			while (list[cnt] != NULL) {
1626 				cnt++;
1627 			}
1628 		*cntp = cnt;
1629 		return list;
1630 	}
1631 	%typemap(cstype) char ** "out IntPtr"
1632 	%typemap(imtype) char ** "out IntPtr"
1633 	%typemap(csin) char ** "out $csinput"
1634 
1635 	%typemap(cstype) char *namep "IntPtr"
1636 	%typemap(imtype) char *namep "IntPtr"
1637 	%csmethodmodifiers log_file "private"
1638 	int log_file(const DB_LSN *lsn, char *namep, size_t len) {
1639 		int ret = self->log_file(self, lsn, namep, len);
1640 		if (ret == EINVAL)
1641 			return DB_BUFFER_SMALL;
1642 		return ret;
1643 	}
1644 
log_flush__anonbd25f9e510081645 	int log_flush(const DB_LSN *lsn) {
1646 		return self->log_flush(self, lsn);
1647 	}
1648 
log_put__anonbd25f9e510081649 	int log_put(DB_LSN *lsn, DBT *data, u_int32_t flags) {
1650 		return self->log_put(self, lsn, data, flags);
1651 	}
1652 
log_get_config__anonbd25f9e510081653 	int log_get_config(u_int32_t which, int *onoff) {
1654 		return self->log_get_config(self, which, onoff);
1655 	}
log_set_config__anonbd25f9e510081656 	int log_set_config(u_int32_t which, int onoff) {
1657 		return self->log_set_config(self, which, onoff);
1658 	}
1659 
log_printf__anonbd25f9e510081660 	int log_printf(DB_TXN *txn, const char *str) {
1661 		return self->log_printf(self, txn, "%s", str);
1662 	}
1663 
1664 	%typemap(cstype, out="IntPtr") void * "IntPtr"
1665 	%csmethodmodifiers log_stat "private"
1666 	void *log_stat(u_int32_t flags, int *err) {
1667 		DB_LOG_STAT *ret;
1668 		*err = self->log_stat(self, &ret, flags);
1669 		return (void *)ret;
1670 	}
1671 
log_stat_print__anonbd25f9e510081672 	int log_stat_print(u_int32_t flags) {
1673 		return self->log_stat_print(self, flags);
1674 	}
1675 
1676 
lsn_reset__anonbd25f9e510081677 	int lsn_reset(const char *file, u_int32_t flags) {
1678 		return self->lsn_reset(self, file, flags);
1679 	}
1680 
1681 	%typemap(cstype, out="IntPtr") void * "IntPtr"
1682 	%typemap(cstype, out="ref IntPtr") void *** "ref IntPtr"
1683 	%typemap(csin) void *** "ref $csinput"
1684 	%typemap(imtype, out="ref IntPtr") void *** "ref IntPtr"
1685 	%csmethodmodifiers memp_stat "private"
1686 	void *memp_stat(void ***fstatp, u_int32_t flags, int *err, int *cntp) {
1687 		DB_MPOOL_STAT *ret;
1688 		DB_MPOOL_FSTAT **fptr;
1689 		int cnt;
1690 
1691 		*err = self->memp_stat(self, &ret, &fptr, flags);
1692 		cnt = 0;
1693 		if (fptr != NULL)
1694 			while (fptr[cnt] != NULL) {
1695 				cnt++;
1696 			}
1697 
1698 		*cntp = cnt;
1699 		*fstatp = (void **)fptr;
1700 		return (void *)ret;
1701 	}
1702 
memp_stat_print__anonbd25f9e510081703 	int memp_stat_print(u_int32_t flags) {
1704 		return self->memp_stat_print(self, flags);
1705 	}
1706 
memp_sync__anonbd25f9e510081707 	int memp_sync(DB_LSN *lsn) {
1708 		return self->memp_sync(self, lsn);
1709 	}
1710 
memp_trickle__anonbd25f9e510081711 	int memp_trickle(int percent, int *nwrotep) {
1712 		return self->memp_trickle(self, percent, nwrotep);
1713 	}
1714 
mutex_alloc__anonbd25f9e510081715 	int mutex_alloc(u_int32_t flags, db_mutex_t *mutexp) {
1716 		return self->mutex_alloc(self, flags, mutexp);
1717 	}
1718 
mutex_free__anonbd25f9e510081719 	int mutex_free(db_mutex_t mutex) {
1720 		return self->mutex_free(self, mutex);
1721 	}
1722 
mutex_lock__anonbd25f9e510081723 	int mutex_lock(db_mutex_t mutex) {
1724 		return self->mutex_lock(self, mutex);
1725 	}
1726 
1727 	%typemap(cstype, out="IntPtr") void * "IntPtr"
1728 	%csmethodmodifiers mutex_stat "private"
1729 	void *mutex_stat(u_int32_t flags, int *err) {
1730 		DB_MUTEX_STAT *ret;
1731 		*err = self->mutex_stat(self, &ret, flags);
1732 		return (void *)ret;
1733 	}
1734 
mutex_stat_print__anonbd25f9e510081735 	int mutex_stat_print(u_int32_t flags) {
1736 		return self->mutex_stat_print(self, flags);
1737 	}
1738 
mutex_unlock__anonbd25f9e510081739 	int mutex_unlock(db_mutex_t mutex) {
1740 		return self->mutex_unlock(self, mutex);
1741 	}
1742 
mutex_get_align__anonbd25f9e510081743 	int mutex_get_align(u_int32_t *align) {
1744 		return self->mutex_get_align(self, align);
1745 	}
mutex_set_align__anonbd25f9e510081746 	int mutex_set_align(u_int32_t align) {
1747 		return self->mutex_set_align(self, align);
1748 	}
1749 
mutex_get_increment__anonbd25f9e510081750 	int mutex_get_increment(u_int32_t *increment) {
1751 		return self->mutex_get_increment(self, increment);
1752 	}
mutex_set_increment__anonbd25f9e510081753 	int mutex_set_increment(u_int32_t increment) {
1754 		return self->mutex_set_increment(self, increment);
1755 	}
1756 
mutex_get_init__anonbd25f9e510081757 	int mutex_get_init(u_int32_t *init) {
1758 		return self->mutex_get_init(self, init);
1759 	}
mutex_set_init__anonbd25f9e510081760 	int mutex_set_init(u_int32_t init) {
1761 		return self->mutex_set_init(self, init);
1762 	}
1763 
mutex_get_max__anonbd25f9e510081764 	int mutex_get_max(u_int32_t *max) {
1765 		return self->mutex_get_max(self, max);
1766 	}
mutex_set_max__anonbd25f9e510081767 	int mutex_set_max(u_int32_t max) {
1768 		return self->mutex_set_max(self, max);
1769 	}
1770 
mutex_get_tas_spins__anonbd25f9e510081771 	int mutex_get_tas_spins(u_int32_t *tas_spins) {
1772 		return self->mutex_get_tas_spins(self, tas_spins);
1773 	}
mutex_set_tas_spins__anonbd25f9e510081774 	int mutex_set_tas_spins(u_int32_t tas_spins) {
1775 		return self->mutex_set_tas_spins(self, tas_spins);
1776 	}
1777 
open__anonbd25f9e510081778 	int open(const char *home, u_int32_t flags, int mode) {
1779 		return self->open(self, home, flags, mode);
1780 	}
1781 
get_open_flags__anonbd25f9e510081782 	int get_open_flags(u_int32_t *flags) {
1783 		return self->get_open_flags(self, flags);
1784 	}
1785 
remove__anonbd25f9e510081786 	int remove(char *db_home, u_int32_t flags) {
1787 		return self->remove(self, db_home, flags);
1788 	}
1789 
repmgr_set_ack_policy__anonbd25f9e510081790 	int repmgr_set_ack_policy(int ack_policy) {
1791 		return self->repmgr_set_ack_policy(self, ack_policy);
1792 	}
repmgr_get_ack_policy__anonbd25f9e510081793 	int repmgr_get_ack_policy(int *ack_policy) {
1794 		return self->repmgr_get_ack_policy(self, ack_policy);
1795 	}
1796 
repmgr_set_ssl_config__anonbd25f9e510081797 	int repmgr_set_ssl_config(int config_type, char *value) {
1798 		return self->repmgr_set_ssl_config(self, config_type, value);
1799 	}
1800 
repmgr_get_incoming_queue_max__anonbd25f9e510081801 	int repmgr_get_incoming_queue_max(u_int32_t *gbytes, u_int32_t *bytes) {
1802 		return self->repmgr_get_incoming_queue_max(self, gbytes, bytes);
1803 	}
repmgr_set_incoming_queue_max__anonbd25f9e510081804 	int repmgr_set_incoming_queue_max(u_int32_t gbytes, u_int32_t bytes) {
1805 		return self->repmgr_set_incoming_queue_max(self, gbytes, bytes);
1806 	}
1807 
repmgr_channel__anonbd25f9e510081808 	DB_CHANNEL *repmgr_channel(int eid, u_int32_t flags, int *err) {
1809 		DB_CHANNEL *channel = NULL;
1810 		*err = self->repmgr_channel(self, eid, &channel, flags);
1811 		return channel;
1812 	}
1813 
repmgr_local_site__anonbd25f9e510081814 	DB_SITE *repmgr_local_site(int *err) {
1815 		DB_SITE *sitep = NULL;
1816 		*err = self->repmgr_local_site(self, &sitep);
1817 		return sitep;
1818 	}
1819 
1820 	%typemap(cstype) void (*)(DB_ENV *, DB_CHANNEL *, DBT *, u_int32_t, u_int32_t) "BDB_MessageDispatchDelegate"
1821 	%typemap(imtype) void (*)(DB_ENV *, DB_CHANNEL *, DBT *, u_int32_t, u_int32_t) "BDB_MessageDispatchDelegate"
1822 	%typemap(csin) void (*dispatch)(DB_ENV *, DB_CHANNEL *, DBT *, u_int32_t, u_int32_t) "dispatch"
1823 	int repmgr_msg_dispatch(
1824 	    void (*dispatch)(DB_ENV *, DB_CHANNEL *, DBT *, u_int32_t, u_int32_t), u_int32_t flags) {
1825 		return self->repmgr_msg_dispatch(self, dispatch, flags);
1826 	}
1827 
repmgr_site__anonbd25f9e510081828 	DB_SITE *repmgr_site(char *host, u_int port, int *err) {
1829 		DB_SITE *sitep= NULL;
1830 		*err = self->repmgr_site(self, host, port, &sitep, 0);
1831 		return sitep;
1832 	}
1833 
repmgr_site_by_eid__anonbd25f9e510081834 	DB_SITE *repmgr_site_by_eid(int eid, int *err){
1835 		DB_SITE *sitep= NULL;
1836 		*err = self->repmgr_site_by_eid(self, eid, &sitep);
1837 		return sitep;
1838 	}
1839 
1840 	%typemap(cstype) DB_REPMGR_SITE * "RepMgrSite[]"
1841 	%typemap(imtype) DB_REPMGR_SITE * "IntPtr"
1842 	%csmethodmodifiers repmgr_site_list "private"
1843 	DB_REPMGR_SITE *repmgr_site_list(u_int *countp, u_int32_t *sizep, int *err) {
1844 		DB_REPMGR_SITE *listp = NULL;
1845 
1846 		*err = self->repmgr_site_list(self, countp, &listp);
1847 		*sizep = sizeof(DB_REPMGR_SITE);
1848 		return listp;
1849 	}
1850 
repmgr_start__anonbd25f9e510081851 	int repmgr_start(int nthreads, u_int32_t flags) {
1852 		return self->repmgr_start(self, nthreads, flags);
1853 	}
1854 
1855 	%csmethodmodifiers repmgr_stat "private"
1856 	%typemap(cstype, out="IntPtr") void * "IntPtr"
1857 	void *repmgr_stat(u_int32_t flags, int *err) {
1858 		DB_REPMGR_STAT *ret;
1859 		*err = self->repmgr_stat(self, &ret, flags);
1860 		return (void *)ret;
1861 	}
1862 
repmgr_stat_print__anonbd25f9e510081863 	int repmgr_stat_print(u_int32_t flags) {
1864 		return self->repmgr_stat_print(self, flags);
1865 	}
1866 
rep_elect__anonbd25f9e510081867 	int rep_elect(u_int32_t nsites, u_int32_t nvotes, u_int32_t flags) {
1868 		return self->rep_elect(self, nsites, nvotes, flags);
1869 	}
1870 
rep_process_message__anonbd25f9e510081871 	int rep_process_message(DBT *control, DBT *rec, int envid, DB_LSN *ret_lsnp) {
1872 		return self->rep_process_message(self, control, rec, envid, ret_lsnp);
1873 	}
1874 
rep_start__anonbd25f9e510081875 	int rep_start(DBT *cdata, u_int32_t flags) {
1876 		return self->rep_start(self, cdata, flags);
1877 	}
1878 
1879 	%csmethodmodifiers rep_stat "private"
1880 	%typemap(cstype, out="IntPtr") void * "IntPtr"
1881 	void *rep_stat(u_int32_t flags, int *err) {
1882 		DB_REP_STAT *ret;
1883 		*err = self->rep_stat(self, &ret, flags);
1884 		return (void *)ret;
1885 	}
1886 
rep_stat_print__anonbd25f9e510081887 	int rep_stat_print(u_int32_t flags) {
1888 		return self->rep_stat_print(self, flags);
1889 	}
1890 
rep_sync__anonbd25f9e510081891 	int rep_sync(u_int32_t flags) {
1892 		return self->rep_sync(self, flags);
1893 	}
1894 
rep_set_config__anonbd25f9e510081895 	int rep_set_config(u_int32_t which, int onoff) {
1896 		return self->rep_set_config(self, which, onoff);
1897 	}
rep_get_config__anonbd25f9e510081898 	int rep_get_config(u_int32_t which, int *onoffp) {
1899 		return self->rep_get_config(self, which, onoffp);
1900 	}
1901 
rep_set_clockskew__anonbd25f9e510081902 	int rep_set_clockskew(u_int32_t fast_clock, u_int32_t slow_clock) {
1903 		return self->rep_set_clockskew(self, fast_clock, slow_clock);
1904 	}
rep_get_clockskew__anonbd25f9e510081905 	int rep_get_clockskew(u_int32_t *fast_clockp, u_int32_t *slow_clockp) {
1906 		return self->rep_get_clockskew(self, fast_clockp, slow_clockp);
1907 	}
1908 
rep_set_limit__anonbd25f9e510081909 	int rep_set_limit(u_int32_t gbytes, u_int32_t bytes) {
1910 		return self->rep_set_limit(self, gbytes, bytes);
1911 	}
rep_get_limit__anonbd25f9e510081912 	int rep_get_limit(u_int32_t *gbytesp, u_int32_t *bytesp) {
1913 		return self->rep_get_limit(self, gbytesp, bytesp);
1914 	}
1915 
rep_set_nsites__anonbd25f9e510081916 	int rep_set_nsites(u_int32_t nsites) {
1917 		return self->rep_set_nsites(self, nsites);
1918 	}
rep_get_nsites__anonbd25f9e510081919 	int rep_get_nsites(u_int32_t *nsitesp) {
1920 		return self->rep_get_nsites(self, nsitesp);
1921 	}
1922 
rep_set_priority__anonbd25f9e510081923 	int rep_set_priority(u_int32_t priority) {
1924 		return self->rep_set_priority(self, priority);
1925 	}
rep_get_priority__anonbd25f9e510081926 	int rep_get_priority(u_int32_t *priorityp) {
1927 		return self->rep_get_priority(self, priorityp);
1928 	}
1929 
rep_set_request__anonbd25f9e510081930 	int rep_set_request(u_int32_t min, u_int32_t max) {
1931 		return self->rep_set_request(self, min, max);
1932 	}
rep_get_request__anonbd25f9e510081933 	int rep_get_request(u_int32_t *minp, u_int32_t *maxp) {
1934 		return self->rep_get_request(self, minp, maxp);
1935 	}
1936 
rep_set_timeout__anonbd25f9e510081937 	int rep_set_timeout(int which, u_int32_t timeout) {
1938 		return self->rep_set_timeout(self, which, timeout);
1939 	}
rep_get_timeout__anonbd25f9e510081940 	int rep_get_timeout(int which, u_int32_t *timeoutp) {
1941 		return self->rep_get_timeout(self, which, timeoutp);
1942 	}
1943 
1944 	%typemap(cstype) int (*)(DB_ENV*, const DBT*, const DBT*, const DB_LSN *, int envid, u_int32_t) "BDB_RepTransportDelegate"
1945 	%typemap(imtype) int (*)(DB_ENV*, const DBT*, const DBT*, const DB_LSN *, int envid, u_int32_t) "BDB_RepTransportDelegate"
1946 	%typemap(csin) int (*send)(DB_ENV *, const DBT*, const DBT*, const DB_LSN*, int, u_int32_t) "send"
1947 	int rep_set_transport(int envid, int (*send)(DB_ENV *dbenv, const DBT *control, const DBT *rec, const DB_LSN *lsnp, int envid, u_int32_t flags)) {
1948 		return self->rep_set_transport(self, envid, send);
1949 	}
1950 
1951 	%typemap(cstype) int (*)(DB_ENV *, const char *, int *, u_int32_t) "BDB_ReplicationViewDelegate"
1952 	%typemap(imtype) int (*)(DB_ENV *, const char *, int *, u_int32_t) "BDB_ReplicationViewDelegate"
1953 	%typemap(csin) int (*f_repview)(DB_ENV *, const char *, int *, u_int32_t) "f_repview"
1954 	int rep_set_view(int (*f_repview)(DB_ENV *, const char *, int *, u_int32_t)) {
1955 		return self->rep_set_view(self, f_repview);
1956 	}
1957 
1958 	%typemap(cstype) int (*)(DB_ENV*, const char *dbname, void *handle) "BDB_BackupCloseDelegate"
1959 	%typemap(imtype) int (*)(DB_ENV*, const char *dbname, void *handle) "BDB_BackupCloseDelegate"
1960 	%typemap(csin) int (*close_func)(DB_ENV *, const char *dbname, void *handle) "close_func"
1961 	%typemap(cstype) int (*)(DB_ENV *, const char *dbname, const char *target, void **handle) "BDB_BackupOpenDelegate"
1962 	%typemap(imtype) int (*)(DB_ENV *, const char *dbname, const char *target, void **handle) "BDB_BackupOpenDelegate"
1963 	%typemap(csin) int (*open_func)(DB_ENV *, const char *dbname, const char *target, void **handle) "open_func"
1964 	%typemap(cstype) int (*)(DB_ENV *, u_int32_t off_gbytes, u_int32_t off_bytes, u_int32_t size, u_int8_t *buf, void *handle) "BDB_BackupWriteDelegate"
1965 	%typemap(imtype) int (*)(DB_ENV *, u_int32_t off_btytes, u_int32_t off_bytes, u_int32_t size, u_int8_t *buf, void *handle) "BDB_BackupWriteDelegate"
1966 	%typemap(csin) int (*write_func)(DB_ENV *, u_int32_t off_gbytes, u_int32_t off_bytes, u_int32_t size, u_int8_t *buf, void *handle) "write_func"
1967 	int set_backup_callbacks(int (*open_func)(DB_ENV *, const char *dbname, const char *target, void **handle), int (*write_func)(DB_ENV *, u_int32_t off_gbytes, u_int32_t off_bytes, u_int32_t size, u_int8_t *buf, void *handle), int (*close_func)(DB_ENV *, const char *dbname, void *handle)) {
1968 		return self->set_backup_callbacks(self, open_func, write_func, close_func);
1969 	}
1970 
get_backup_config__anonbd25f9e510081971 	int get_backup_config(DB_BACKUP_CONFIG cfg, u_int32_t *value) {
1972 		return self->get_backup_config(self, cfg, value);
1973 	}
set_backup_config__anonbd25f9e510081974 	int set_backup_config(DB_BACKUP_CONFIG cfg, u_int32_t value) {
1975 		return self->set_backup_config(self, cfg, value);
1976 	}
1977 
get_cachesize__anonbd25f9e510081978 	int get_cachesize(u_int32_t *gbytes, u_int32_t *bytes, int *ncache) {
1979 		return self->get_cachesize(self, gbytes, bytes, ncache);
1980 	}
set_cachesize__anonbd25f9e510081981 	int set_cachesize(u_int32_t gbytes, u_int32_t bytes, int ncache) {
1982 		return self->set_cachesize(self, gbytes, bytes, ncache);
1983 	}
1984 
get_cache_max__anonbd25f9e510081985 	int get_cache_max(u_int32_t *gbytes, u_int32_t *bytes) {
1986 		return self->get_cache_max(self, gbytes, bytes);
1987 	}
set_cache_max__anonbd25f9e510081988 	int set_cache_max(u_int32_t gbytes, u_int32_t bytes) {
1989 		return self->set_cache_max(self, gbytes, bytes);
1990 	}
1991 
get_ext_file_dir__anonbd25f9e510081992 	int get_ext_file_dir(const char **dirp) {
1993 		return self->get_ext_file_dir(self, dirp);
1994 	}
1995 
1996 	%typemap(cstype) char ** "List<string>"
1997 	%typemap(imtype) char ** "IntPtr"
1998 	%typemap(csin) char ** "$csinput"
1999 	%csmethodmodifiers get_data_dirs "private"
2000 	char **get_data_dirs(int *err, int *cntp) {
2001 		char **list = NULL;
2002 		int cnt = 0;
2003 		*err = self->get_data_dirs(self, &list);
2004 
2005 		if (list != NULL)
2006 			while (list[cnt] != NULL) {
2007 				cnt++;
2008 			}
2009 		*cntp = cnt;
2010 		return list;
2011 	}
2012 
add_data_dir__anonbd25f9e510082013 	int add_data_dir(const char *dir) {
2014 		return self->add_data_dir(self, dir);
2015 	}
2016 
set_create_dir__anonbd25f9e510082017 	int set_create_dir(const char *dir) {
2018 		return self->set_create_dir(self, dir);
2019 	}
2020 
get_encrypt_flags__anonbd25f9e510082021 	int get_encrypt_flags(u_int32_t *flags) {
2022 		return self->get_encrypt_flags(self, flags);
2023 	}
set_encrypt__anonbd25f9e510082024 	int set_encrypt(const char *passwd, u_int32_t flags) {
2025 		return self->set_encrypt(self, passwd, flags);
2026 	}
2027 
2028 	%typemap(cstype) void (*)(const DB_ENV *, const char *, const char *) "BDB_ErrcallDelegate"
2029 	%typemap(imtype) void (*)(const DB_ENV *, const char *, const char *) "BDB_ErrcallDelegate"
2030 	%typemap(csin) void (*db_errcall_fcn)(const DB_ENV *dbenv, const char *errpfx, const char *errmsg) "db_errcall_fcn"
2031 	void set_errcall(void (*db_errcall_fcn)(const DB_ENV *dbenv, const char *errpfx, const char *errmsg)) {
2032 		self->set_errcall(self, db_errcall_fcn);
2033 	}
2034 
2035 	%typemap(cstype) void (*)(DB_ENV*, u_int32_t, void*) "BDB_EventNotifyDelegate"
2036 	%typemap(imtype) void (*)(DB_ENV*, u_int32_t, void*) "BDB_EventNotifyDelegate"
2037 	%typemap(csin) void (*callback)(DB_ENV *dbenv, u_int32_t, void*) "callback"
2038 	int set_event_notify(void (*callback)(DB_ENV *env, u_int32_t event, void *event_info)) {
2039 		return self->set_event_notify(self, callback);
2040 	}
2041 
set_ext_file_dir__anonbd25f9e510082042 	int set_ext_file_dir(const char *dir) {
2043 		return self->set_ext_file_dir(self, dir);
2044 	}
2045 
get_ext_file_threshold__anonbd25f9e510082046 	int get_ext_file_threshold(u_int32_t *bytes) {
2047 		return self->get_ext_file_threshold(self, bytes);
2048 	}
set_ext_file_threshold__anonbd25f9e510082049 	int set_ext_file_threshold(u_int32_t bytes, u_int32_t flags) {
2050 		return self->set_ext_file_threshold(self, bytes, flags);
2051 	}
2052 
2053 	%typemap(cstype) void (*)(DB_ENV*, int, int) "BDB_EnvFeedbackDelegate"
2054 	%typemap(imtype) void (*)(DB_ENV*, int, int) "BDB_EnvFeedbackDelegate"
2055 	%typemap(csin) void (*callback)(DB_ENV *dbenv, int opcode, int percent) "callback"
2056 	int set_feedback(void (*callback)(DB_ENV *dbenv, int opcode, int percent)) {
2057 		return self->set_feedback(self, callback);
2058 	}
2059 
get_flags__anonbd25f9e510082060 	int get_flags(u_int32_t *flags) {
2061 		return self->get_flags(self, flags);
2062 	}
set_flags__anonbd25f9e510082063 	int set_flags(u_int32_t flags, int onoff) {
2064 		return self->set_flags(self, flags, onoff);
2065 	}
2066 
2067 	%typemap(cstype) char ** "out IntPtr"
2068 	%typemap(imtype) char ** "out IntPtr"
2069 	%typemap(csin) char ** "out $csinput"
2070 	%csmethodmodifiers get_intermediate_dir_mode "private"
2071 	int get_intermediate_dir_mode(const char **mode) {
2072 		return self->get_intermediate_dir_mode(self, mode);
2073 	}
set_intermediate_dir_mode__anonbd25f9e510082074 	int set_intermediate_dir_mode(const char *mode) {
2075 		return self->set_intermediate_dir_mode(self, mode);
2076 	}
2077 
2078 	%typemap(cstype) int (*)(DB_ENV*, pid_t, db_threadid_t, u_int32_t) "BDB_IsAliveDelegate"
2079 	%typemap(imtype) int (*)(DB_ENV*, pid_t, db_threadid_t, u_int32_t) "BDB_IsAliveDelegate"
2080 	%typemap(csin) int (*callback)(DB_ENV *dbenv, pid_t, db_threadid_t, u_int32_t) "callback"
2081 	int set_isalive(int (*callback)(DB_ENV *dbenv, pid_t pid, db_threadid_t tid, u_int32_t flags)) {
2082 		return self->set_isalive(self, callback);
2083 	}
2084 
get_lg_bsize__anonbd25f9e510082085 	int get_lg_bsize(u_int32_t *bsize){
2086 		return self->get_lg_bsize(self, bsize);
2087 	}
set_lg_bsize__anonbd25f9e510082088 	int set_lg_bsize(u_int32_t bsize){
2089 		return self->set_lg_bsize(self, bsize);
2090 	}
get_lg_dir__anonbd25f9e510082091 	int get_lg_dir(const char **dir){
2092 		return self->get_lg_dir(self, dir);
2093 	}
set_lg_dir__anonbd25f9e510082094 	int set_lg_dir(const char *dir){
2095 		return self->set_lg_dir(self, dir);
2096 	}
get_lg_filemode__anonbd25f9e510082097 	int get_lg_filemode(int *mode){
2098 		return self->get_lg_filemode(self, mode);
2099 	}
set_lg_filemode__anonbd25f9e510082100 	int set_lg_filemode(int mode){
2101 		return self->set_lg_filemode(self, mode);
2102 	}
get_lg_max__anonbd25f9e510082103 	int get_lg_max(u_int32_t *max){
2104 		return self->get_lg_max(self, max);
2105 	}
set_lg_max__anonbd25f9e510082106 	int set_lg_max(u_int32_t max){
2107 		return self->set_lg_max(self, max);
2108 	}
get_lg_regionmax__anonbd25f9e510082109 	int get_lg_regionmax(u_int32_t *max){
2110 		return self->get_lg_regionmax(self, max);
2111 	}
set_lg_regionmax__anonbd25f9e510082112 	int set_lg_regionmax(u_int32_t max){
2113 		return self->set_lg_regionmax(self, max);
2114 	}
log_verify__anonbd25f9e510082115         int log_verify(const char *envhome, u_int32_t cachesz,
2116             const char *dbfile, const char *dbname,
2117             time_t stime, time_t etime,
2118             u_int32_t stfile, u_int32_t stoffset,
2119             u_int32_t efile, u_int32_t eoffset,
2120             int caf, int verbose) {
2121                 return self->env->log_verify_wrap(self->env, envhome, cachesz,
2122                     dbfile, dbname, stime, etime, stfile, stoffset, efile,
2123                     eoffset, caf, verbose);
2124         }
2125 
get_lk_conflicts_nmodes__anonbd25f9e510082126 	int get_lk_conflicts_nmodes(int *nmodes) {
2127 		return self->get_lk_conflicts(self, NULL, nmodes);
2128 	}
2129 
get_lk_conflicts__anonbd25f9e510082130 	int get_lk_conflicts(u_int8_t *conflicts) {
2131 		int i, nmodes, ret;
2132 		u_int8_t *mtrx = NULL;
2133 
2134 		ret = self->get_lk_conflicts(self, &mtrx, &nmodes);
2135 		for (i = 0; i < nmodes * nmodes; i++)
2136 			conflicts[i] = mtrx[i];
2137 
2138 		return ret;
2139 	}
set_lk_conflicts__anonbd25f9e510082140 	int set_lk_conflicts(u_int8_t *conflicts, int nmodes) {
2141 		return self->set_lk_conflicts(self, conflicts, nmodes);
2142 	}
2143 
get_lk_detect__anonbd25f9e510082144 	int get_lk_detect(u_int32_t *mode) {
2145 		return self->get_lk_detect(self, mode);
2146 	}
set_lk_detect__anonbd25f9e510082147 	int set_lk_detect(u_int32_t mode) {
2148 		return self->set_lk_detect(self, mode);
2149 	}
2150 
get_lk_max_locks__anonbd25f9e510082151 	int get_lk_max_locks(u_int32_t *max) {
2152 		return self->get_lk_max_locks(self, max);
2153 	}
set_lk_max_locks__anonbd25f9e510082154 	int set_lk_max_locks(u_int32_t max) {
2155 		return self->set_lk_max_locks(self, max);
2156 	}
2157 
get_lk_max_lockers__anonbd25f9e510082158 	int get_lk_max_lockers(u_int32_t *max) {
2159 		return self->get_lk_max_lockers(self, max);
2160 	}
set_lk_max_lockers__anonbd25f9e510082161 	int set_lk_max_lockers(u_int32_t max) {
2162 		return self->set_lk_max_lockers(self, max);
2163 	}
2164 
get_lk_max_objects__anonbd25f9e510082165 	int get_lk_max_objects(u_int32_t *max) {
2166 		return self->get_lk_max_objects(self, max);
2167 	}
set_lk_max_objects__anonbd25f9e510082168 	int set_lk_max_objects(u_int32_t max) {
2169 		return self->set_lk_max_objects(self, max);
2170 	}
2171 
get_lk_partitions__anonbd25f9e510082172 	int get_lk_partitions(u_int32_t *max) {
2173 		return self->get_lk_partitions(self, max);
2174 	}
set_lk_partitions__anonbd25f9e510082175 	int set_lk_partitions(u_int32_t max) {
2176 		return self->set_lk_partitions(self, max);
2177 	}
2178 
get_lk_tablesize__anonbd25f9e510082179 	int get_lk_tablesize(u_int32_t *tablesize) {
2180 		return self->get_lk_tablesize(self, tablesize);
2181 	}
set_lk_tablesize__anonbd25f9e510082182 	int set_lk_tablesize(u_int32_t tablesize) {
2183 		return self->set_lk_tablesize(self, tablesize);
2184 	}
2185 
get_memory_init__anonbd25f9e510082186 	int get_memory_init(DB_MEM_CONFIG type, u_int32_t *count) {
2187 		return self->get_memory_init(self, type, count);
2188 	}
set_memory_init__anonbd25f9e510082189 	int set_memory_init(DB_MEM_CONFIG type, u_int32_t count) {
2190 		return self->set_memory_init(self, type, count);
2191 	}
2192 
get_memory_max__anonbd25f9e510082193 	int get_memory_max(u_int32_t *gbytes, u_int32_t *bytes) {
2194 		return self->get_memory_max(self, gbytes, bytes);
2195 	}
set_memory_max__anonbd25f9e510082196 	int set_memory_max(u_int32_t gbytes, u_int32_t bytes) {
2197 		return self->set_memory_max(self, gbytes, bytes);
2198 	}
2199 
get_metadata_dir__anonbd25f9e510082200 	int get_metadata_dir(const char **dir) {
2201 		return self->get_metadata_dir(self, dir);
2202 	}
set_metadata_dir__anonbd25f9e510082203 	int set_metadata_dir(const char *dir) {
2204 		return self->set_metadata_dir(self, dir);
2205 	}
2206 
get_mp_max_openfd__anonbd25f9e510082207 	int get_mp_max_openfd(int *maxopenfd) {
2208 		return self->get_mp_max_openfd(self, maxopenfd);
2209 	}
set_mp_max_openfd__anonbd25f9e510082210 	int set_mp_max_openfd(int maxopenfd) {
2211 		return self->set_mp_max_openfd(self, maxopenfd);
2212 	}
2213 
get_mp_max_write__anonbd25f9e510082214 	int get_mp_max_write(int *maxwrite, db_timeout_t *maxwrite_sleep) {
2215 		return self->get_mp_max_write(self, maxwrite, maxwrite_sleep);
2216 	}
set_mp_max_write__anonbd25f9e510082217 	int set_mp_max_write(int maxwrite, db_timeout_t maxwrite_sleep) {
2218 		return self->set_mp_max_write(self, maxwrite, maxwrite_sleep);
2219 	}
2220 
get_mp_mmapsize__anonbd25f9e510082221 	int get_mp_mmapsize(size_t *mp_mmapsize) {
2222 		return self->get_mp_mmapsize(self, mp_mmapsize);
2223 	}
set_mp_mmapsize__anonbd25f9e510082224 	int set_mp_mmapsize(size_t mp_mmapsize) {
2225 		return self->set_mp_mmapsize(self, mp_mmapsize);
2226 	}
2227 
2228 	%typemap(cstype) void (*)(const DB_ENV *, const char *, const char *) "BDB_MsgcallDelegate"
2229 	%typemap(imtype) void (*)(const DB_ENV *, const char *, const char *) "BDB_MsgcallDelegate"
2230 	%typemap(csin) void (*db_msgcall_fcn)(const DB_ENV *dbenv, const char *, const char *msg) "db_msgcall_fcn"
2231 	void set_msgcall(void (*db_msgcall_fcn)(const DB_ENV *dbenv, const char *, const char *msg)) {
2232 		self->set_msgcall(self, db_msgcall_fcn);
2233 	}
2234 
set_msgfile__anonbd25f9e510082235 	int set_msgfile(char *msgfile) {
2236 		int ret;
2237 		FILE *fmsg;
2238 		ret = 0;
2239 		fmsg = NULL;
2240 		self->get_msgfile(self, &fmsg);
2241 		if (fmsg != NULL && fmsg != stdout && fmsg != stderr) {
2242 			fclose(fmsg);
2243 			fmsg = NULL;
2244 		}
2245 		if (strcmp(msgfile, "") == 0 || msgfile == NULL)
2246 			self->set_msgfile(self, NULL);
2247 		else if (strcmp(msgfile, "stdout") == 0)
2248 			self->set_msgfile(self, stdout);
2249 		else if (strcmp(msgfile, "stderr") == 0)
2250 			self->set_msgfile(self, stderr);
2251 		else {
2252 			fmsg = fopen(msgfile, "a");
2253 			if (fmsg != NULL) {
2254 				self->set_msgfile(self, fmsg);
2255 			}
2256 			else
2257 				ret = 1;
2258 		}
2259 		return ret;
2260 	}
2261 
get_region_dir__anonbd25f9e510082262 	int get_region_dir(const char **dir){
2263 		return self->get_region_dir(self, dir);
2264 	}
set_region_dir__anonbd25f9e510082265 	int set_region_dir(const char *dir){
2266 		return self->set_region_dir(self, dir);
2267 	}
2268 
get_thread_count__anonbd25f9e510082269 	int get_thread_count(u_int32_t *count) {
2270 		return self->get_thread_count(self, count);
2271 	}
set_thread_count__anonbd25f9e510082272 	int set_thread_count(u_int32_t count) {
2273 		return self->set_thread_count(self, count);
2274 	}
2275 
2276 	%typemap(cstype) void (*)(DB_ENV*, pid_t*, db_threadid_t*) "BDB_ThreadIDDelegate"
2277 	%typemap(imtype) void (*)(DB_ENV*, pid_t*, db_threadid_t*) "BDB_ThreadIDDelegate"
2278 	%typemap(csin) void (*callback)(DB_ENV *dbenv, pid_t*, db_threadid_t*) "callback"
2279 	int set_thread_id(void (*callback)(DB_ENV *dbenv, pid_t *pid, db_threadid_t *tid)) {
2280 		return self->set_thread_id(self, callback);
2281 	}
2282 
2283 	%typemap(cstype) char* (*)(DB_ENV*, pid_t, db_threadid_t, char *) "BDB_ThreadNameDelegate"
2284 	%typemap(imtype) char* (*)(DB_ENV*, pid_t, db_threadid_t, char *) "BDB_ThreadNameDelegate"
2285 	%typemap(csin) char *(*callback)(DB_ENV *dbenv, pid_t, db_threadid_t, char *) "callback"
2286 	int set_thread_id_string(char *(*callback)(DB_ENV *dbenv, pid_t pid, db_threadid_t tid, char *buf)) {
2287 		return self->set_thread_id_string(self, callback);
2288 	}
2289 
get_timeout__anonbd25f9e510082290 	int get_timeout(db_timeout_t *timeout, u_int32_t flags) {
2291 		return self->get_timeout(self, timeout, flags);
2292 	}
set_timeout__anonbd25f9e510082293 	int set_timeout(db_timeout_t timeout, u_int32_t flags) {
2294 		return self->set_timeout(self, timeout, flags);
2295 	}
2296 
get_tmp_dir__anonbd25f9e510082297 	int get_tmp_dir(const char **dir) {
2298 		return self->get_tmp_dir(self, dir);
2299 	}
set_tmp_dir__anonbd25f9e510082300 	int set_tmp_dir(const char *dir) {
2301 		return self->set_tmp_dir(self, dir);
2302 	}
2303 
get_tx_max__anonbd25f9e510082304 	int get_tx_max(u_int32_t *max) {
2305 		return self->get_tx_max(self, max);
2306 	}
set_tx_max__anonbd25f9e510082307 	int set_tx_max(u_int32_t max) {
2308 		return self->set_tx_max(self, max);
2309 	}
2310 
get_tx_timestamp__anonbd25f9e510082311 	int get_tx_timestamp(time_t *timestamp) {
2312 		return self->get_tx_timestamp(self, timestamp);
2313 	}
set_tx_timestamp__anonbd25f9e510082314 	int set_tx_timestamp(time_t *timestamp) {
2315 		return self->set_tx_timestamp(self, timestamp);
2316 	}
2317 
get_verbose__anonbd25f9e510082318 	int get_verbose(u_int32_t *msgs) {
2319 		int onoff, ret;
2320 
2321 		*msgs = 0;
2322 		if ((ret = self->get_verbose(self, DB_VERB_DEADLOCK, &onoff)) != 0)
2323 			return ret;
2324 		if (onoff)
2325 			*msgs |= DB_VERB_DEADLOCK;
2326 		if ((ret = self->get_verbose(self, DB_VERB_FILEOPS, &onoff)) != 0)
2327 			return ret;
2328 		if (onoff)
2329 			*msgs |= DB_VERB_FILEOPS;
2330 		if ((ret = self->get_verbose(self, DB_VERB_FILEOPS_ALL, &onoff)) != 0)
2331 			return ret;
2332 		if (onoff)
2333 			*msgs |= DB_VERB_FILEOPS_ALL;
2334 		if ((ret = self->get_verbose(self, DB_VERB_RECOVERY, &onoff)) != 0)
2335 			return ret;
2336 		if (onoff)
2337 			*msgs |= DB_VERB_RECOVERY;
2338 		if ((ret = self->get_verbose(self, DB_VERB_REGISTER, &onoff)) != 0)
2339 			return ret;
2340 		if (onoff)
2341 			*msgs |= DB_VERB_REGISTER;
2342 		if ((ret = self->get_verbose(self, DB_VERB_REPLICATION, &onoff)) != 0)
2343 			return ret;
2344 		if (onoff)
2345 			*msgs |= DB_VERB_REPLICATION;
2346 		if ((ret = self->get_verbose(self, DB_VERB_REP_ELECT, &onoff)) != 0)
2347 			return ret;
2348 		if (onoff)
2349 			*msgs |= DB_VERB_REP_ELECT;
2350 		if ((ret = self->get_verbose(self, DB_VERB_REP_LEASE, &onoff)) != 0)
2351 			return ret;
2352 		if (onoff)
2353 			*msgs |= DB_VERB_REP_LEASE;
2354 		if ((ret = self->get_verbose(self, DB_VERB_REP_MISC, &onoff)) != 0)
2355 			return ret;
2356 		if (onoff)
2357 			*msgs |= DB_VERB_REP_MISC;
2358 		if ((ret = self->get_verbose(self, DB_VERB_REP_MSGS, &onoff)) != 0)
2359 			return ret;
2360 		if (onoff)
2361 			*msgs |= DB_VERB_REP_MSGS;
2362 		if ((ret = self->get_verbose(self, DB_VERB_REP_SYNC, &onoff)) != 0)
2363 			return ret;
2364 		if (onoff)
2365 			*msgs |= DB_VERB_REP_SYNC;
2366 		if ((ret = self->get_verbose(self, DB_VERB_REP_SYSTEM, &onoff)) != 0)
2367 			return ret;
2368 		if (onoff)
2369 			*msgs |= DB_VERB_REP_SYSTEM;
2370 		if ((ret = self->get_verbose(self, DB_VERB_REPMGR_CONNFAIL, &onoff)) != 0)
2371 			return ret;
2372 		if (onoff)
2373 			*msgs |= DB_VERB_REPMGR_CONNFAIL;
2374 		if ((ret = self->get_verbose(self, DB_VERB_REPMGR_MISC, &onoff)) != 0)
2375 			return ret;
2376 		if (onoff)
2377 			*msgs |= DB_VERB_REPMGR_MISC;
2378 		if ((ret = self->get_verbose(self, DB_VERB_REPMGR_SSL_ALL, &onoff)) != 0)
2379 			return ret;
2380 		if (onoff)
2381 			*msgs |= DB_VERB_REPMGR_SSL_ALL;
2382 		if ((ret = self->get_verbose(self, DB_VERB_REPMGR_SSL_CONN, &onoff)) != 0)
2383 			return ret;
2384 		if (onoff)
2385 			*msgs |= DB_VERB_REPMGR_SSL_CONN;
2386 		if ((ret = self->get_verbose(self, DB_VERB_REPMGR_SSL_IO, &onoff)) != 0)
2387 			return ret;
2388 		if (onoff)
2389 			*msgs |= DB_VERB_REPMGR_SSL_IO;
2390 		if ((ret = self->get_verbose(self, DB_VERB_WAITSFOR, &onoff)) != 0)
2391 			return ret;
2392 		if (onoff)
2393 			*msgs |= DB_VERB_WAITSFOR;
2394 
2395 		return 0;
2396 	}
set_verbose__anonbd25f9e510082397 	int set_verbose(u_int32_t which, int onoff) {
2398 		int ret;
2399 
2400 		if ((which & DB_VERB_DEADLOCK) &&
2401 			(ret = self->set_verbose(self, DB_VERB_DEADLOCK, onoff)) != 0)
2402 			return ret;
2403 		if ((which & DB_VERB_FILEOPS) &&
2404 			(ret = self->set_verbose(self, DB_VERB_FILEOPS, onoff)) != 0)
2405 			return ret;
2406 		if ((which & DB_VERB_FILEOPS_ALL) &&
2407 			(ret = self->set_verbose(self, DB_VERB_FILEOPS_ALL, onoff)) != 0)
2408 			return ret;
2409 		if ((which & DB_VERB_RECOVERY) &&
2410 			(ret = self->set_verbose(self, DB_VERB_RECOVERY, onoff)) != 0)
2411 			return ret;
2412 		if ((which & DB_VERB_REGISTER) &&
2413 			(ret = self->set_verbose(self, DB_VERB_REGISTER, onoff)) != 0)
2414 			return ret;
2415 		if ((which & DB_VERB_REPLICATION) &&
2416 			(ret = self->set_verbose(self, DB_VERB_REPLICATION, onoff)) != 0)
2417 			return ret;
2418 		if ((which & DB_VERB_REP_ELECT) &&
2419 			(ret = self->set_verbose(self, DB_VERB_REP_ELECT, onoff)) != 0)
2420 			return ret;
2421 		if ((which & DB_VERB_REP_LEASE) &&
2422 			(ret = self->set_verbose(self, DB_VERB_REP_LEASE, onoff)) != 0)
2423 			return ret;
2424 		if ((which & DB_VERB_REP_MISC) &&
2425 			(ret = self->set_verbose(self, DB_VERB_REP_MISC, onoff)) != 0)
2426 			return ret;
2427 		if ((which & DB_VERB_REP_MSGS) &&
2428 			(ret = self->set_verbose(self, DB_VERB_REP_MSGS, onoff)) != 0)
2429 			return ret;
2430 		if ((which & DB_VERB_REP_SYNC) &&
2431 			(ret = self->set_verbose(self, DB_VERB_REP_SYNC, onoff)) != 0)
2432 			return ret;
2433 		if ((which & DB_VERB_REP_SYSTEM) &&
2434 			(ret = self->set_verbose(self, DB_VERB_REP_SYSTEM, onoff)) != 0)
2435 			return ret;
2436 		if ((which & DB_VERB_REPMGR_CONNFAIL) &&
2437 			(ret = self->set_verbose(self, DB_VERB_REPMGR_CONNFAIL, onoff)) != 0)
2438 			return ret;
2439 		if ((which & DB_VERB_REPMGR_MISC) &&
2440 			(ret = self->set_verbose(self, DB_VERB_REPMGR_MISC, onoff)) != 0)
2441 			return ret;
2442 		if ((which & DB_VERB_REPMGR_SSL_ALL) &&
2443 			(ret = self->set_verbose(self, DB_VERB_REPMGR_SSL_ALL, onoff)) != 0)
2444 			return ret;
2445 		if ((which & DB_VERB_REPMGR_SSL_CONN) &&
2446 			(ret = self->set_verbose(self, DB_VERB_REPMGR_SSL_CONN, onoff)) != 0)
2447 			return ret;
2448 		if ((which & DB_VERB_REPMGR_SSL_IO) &&
2449 			(ret = self->set_verbose(self, DB_VERB_REPMGR_SSL_IO, onoff)) != 0)
2450 			return ret;
2451 		if ((which & DB_VERB_WAITSFOR) &&
2452 			(ret = self->set_verbose(self, DB_VERB_WAITSFOR, onoff)) != 0)
2453 			return ret;
2454 		return 0;
2455 	}
2456 
stat_print__anonbd25f9e510082457 	int stat_print(u_int32_t flags) {
2458 		return self->stat_print(self, flags);
2459 	}
2460 
2461 	%csmethodmodifiers txn_begin "private"
2462 	DB_TXN *txn_begin(DB_TXN *parent, u_int32_t flags, int *err) {
2463 		DB_TXN *txnid = NULL;
2464 
2465 		*err = self->txn_begin(self, parent, &txnid, flags);
2466 		return txnid;
2467 	}
2468 
txn_checkpoint__anonbd25f9e510082469 	int txn_checkpoint(u_int32_t kbyte, u_int32_t min, u_int32_t flags) {
2470 		return self->txn_checkpoint(self, kbyte, min, flags);
2471 	}
2472 
2473 	%csmethodmodifiers txn_recover "private"
2474 	%typemap(cstype) DB_PREPLIST [] "IntPtr"
2475 	%typemap(imtype) DB_PREPLIST [] "IntPtr"
2476 	%typemap(csin) DB_PREPLIST [] "$csinput"
2477 	int txn_recover(DB_PREPLIST preplist[], long count, long *retp, u_int32_t flags) {
2478 		return self->txn_recover(self, preplist, count, retp, flags);
2479 	}
2480 
2481 	%csmethodmodifiers txn_stat "private"
2482 	%typemap(cstype, out="IntPtr") void * "IntPtr"
2483 	void *txn_stat(u_int32_t flags, u_int32_t *size, int *err) {
2484 		DB_TXN_STAT *ret;
2485 		*err = self->txn_stat(self, &ret, flags);
2486 		*size = sizeof(DB_TXN_ACTIVE);
2487 		return (void *)ret;
2488 	}
2489 
txn_stat_print__anonbd25f9e510082490 	int txn_stat_print(u_int32_t flags) {
2491 		return self->txn_stat_print(self, flags);
2492 	}
2493 
2494 }
2495 } DB_ENV;
2496 
2497 typedef struct {
2498 	%typemap(csvarin) double less %{%}
2499 	double less;
2500 	%typemap(csvarin) double equal %{%}
2501 	double equal;
2502 	%typemap(csvarin) double greater %{%}
2503 	double greater;
2504 } DB_KEY_RANGE;
2505 
2506 typedef struct {
2507 	roff_t		off;		/* Offset of the lock in the region */
2508 	u_int32_t	ndx;		/* Index of the object referenced by
2509 					 * this lock; used for locking. */
2510 	u_int32_t	gen;		/* Generation number of this lock. */
2511 	db_lockmode_t	mode;		/* mode of this lock. */
2512 } DB_LOCK;
2513 
2514 typedef struct {
2515 	db_lockop_t	 op;		/* Operation. */
2516 	db_lockmode_t	 mode;		/* Requested mode. */
2517 	db_timeout_t	 timeout;	/* Time to expire lock. */
2518 %typemap(csvarout) DBT *obj %{
2519     get {
2520       IntPtr cPtr = $imcall;
2521       DatabaseEntry ret = (cPtr == IntPtr.Zero) ? null : DatabaseEntry.fromDBT(new DBT(cPtr, false));
2522       return ret;
2523     } %}
2524         DBT	*obj;			/* Object being locked. */
2525 	%rename(lck) lock;
2526 	DB_LOCK		 lock;		/* Lock returned. */
2527 } DB_LOCKREQ;
2528 
2529 char *db_strerror(int errno);
2530 int log_compare(DB_LSN *lsn0, DB_LSN *lsn1);
2531 %typemap(cstype) void *ptr "IntPtr"
2532 %typemap(imtype) void *ptr "IntPtr"
2533 %typemap(csin) void *ptr "$csinput"
2534 %rename(__os_ufree) wrap_ufree;
2535 %inline %{
wrap_ufree(DB_ENV * dbenv,void * ptr)2536 void wrap_ufree(DB_ENV *dbenv, void *ptr) {
2537 	if (dbenv == NULL)
2538 		__os_ufree(NULL, ptr);
2539 	else
2540 		__os_ufree(dbenv->env, ptr);
2541 }
2542 %}
2543 %typemap(cstype, out="IntPtr") void * "IntPtr"
2544 %typemap(cstype, out="out IntPtr") void ** "out IntPtr"
2545 %typemap(csin) void ** "out $csinput"
2546 %typemap(imtype, out="out IntPtr") void ** "out IntPtr"
2547 %rename(__os_umalloc) wrap_umalloc;
2548 %inline %{
wrap_umalloc(DB_ENV * dbenv,size_t size)2549 void *wrap_umalloc(DB_ENV *dbenv, size_t size) {
2550 	void *ptr;
2551 	if (dbenv == NULL)
2552 		__os_umalloc(NULL, size, &ptr);
2553 	else
2554 		__os_umalloc(dbenv->env, size, &ptr);
2555 	return ptr;
2556 }
alloc_dbt_arr(DB_ENV * dbenv,int num_dbt,void ** ptr)2557 size_t alloc_dbt_arr(DB_ENV *dbenv, int num_dbt, void **ptr) {
2558 	size_t ret = sizeof(DBT);
2559 	if (dbenv == NULL)
2560 		__os_umalloc(NULL, num_dbt * ret, ptr);
2561 	else
2562 		__os_umalloc(dbenv->env, num_dbt * ret, ptr);
2563 	return ret;
2564 }
2565 %}
2566 
2567 
2568 
2569 typedef struct {
2570         %typemap(cstype) u_int8_t [DB_GID_SIZE] "byte[]"
2571         %typemap(imtype) u_int8_t [DB_GID_SIZE] "byte[]"
2572         %typemap(csout, excode=SWIGEXCODE) u_int8_t [DB_GID_SIZE] "{byte[] res = (byte [])($imcall); $excode; return res;}"
2573         %typemap(csvarin) u_int8_t gid[DB_GID_SIZE] %{%}
2574 	%typemap(csvarout) u_int8_t gid[DB_GID_SIZE] %{
2575         get {
2576           byte[] ret = new byte[DbConstants.DB_GID_SIZE];
2577 	  IntPtr cPtr = new IntPtr(swigCPtr.Handle.ToInt32() + IntPtr.Size);
2578 	  Marshal.Copy(cPtr, ret, 0, ret.Length);
2579 	  return ret;
2580         }
2581 	%}
2582 
2583         %typemap(csvarin) DB_TXN *txn %{%}
2584 	DB_TXN	*txn;
2585 	u_int8_t gid[DB_GID_SIZE];
2586 } DB_PREPLIST;
2587 
2588 %typemap(cscode) DB_SEQUENCE %{
stat(uint flags)2589 	internal SequenceStatStruct stat(uint flags) {
2590 		int err = 0;
2591 		IntPtr ptr = stat(flags, ref err);
2592 		DatabaseException.ThrowException(err);
2593 		SequenceStatStruct ret = (SequenceStatStruct)Marshal.PtrToStructure(ptr, typeof(SequenceStatStruct));
2594 		libdb_csharp.__os_ufree(null, ptr);
2595 		return ret;
2596 	}
2597 %}
2598 typedef struct {
2599 %extend {
DB_SEQUENCE__anonbd25f9e515082600 	DB_SEQUENCE(DB *dbp, u_int32_t flags) {
2601 		DB_SEQUENCE *seq = NULL;
2602 		int ret;
2603 
2604 		ret = db_sequence_create(&seq, dbp, flags);
2605 		if (ret == 0)
2606 			return seq;
2607 		else
2608 			return NULL;
2609 	}
2610 
~DB_SEQUENCE__anonbd25f9e515082611 	~DB_SEQUENCE() { }
2612 
close__anonbd25f9e515082613 	int close(u_int32_t flags) {
2614 		return self->close(self, flags);
2615 	}
2616 
get__anonbd25f9e515082617 	int get(DB_TXN *txn, u_int32_t delta, db_seq_t *retp, u_int32_t flags) {
2618 		return self->get(self, txn, delta, retp, flags);
2619 	}
2620 
get_db__anonbd25f9e515082621 	DB *get_db() {
2622 		DB *dbp = NULL;
2623 		int err = 0;
2624 		err = self->get_db(self, &dbp);
2625 		return dbp;
2626 	}
2627 
get_key__anonbd25f9e515082628 	int get_key(DBT *key) {
2629 		return self->get_key(self, key);
2630 	}
2631 
initial_value__anonbd25f9e515082632 	int initial_value(db_seq_t value) {
2633 		return self->initial_value(self, value);
2634 	}
2635 
open__anonbd25f9e515082636 	int open(DB_TXN *txn, DBT *key, u_int32_t flags) {
2637 		return self->open(self, txn, key, flags);
2638 	}
2639 
remove__anonbd25f9e515082640 	int remove(DB_TXN *txn, u_int32_t flags) {
2641 		return self->remove(self, txn, flags);
2642 	}
2643 
get_cachesize__anonbd25f9e515082644 	int get_cachesize(u_int32_t *size) {
2645 		return self->get_cachesize(self, size);
2646 	}
set_cachesize__anonbd25f9e515082647 	int set_cachesize(u_int32_t size) {
2648 		return self->set_cachesize(self, size);
2649 	}
2650 
get_flags__anonbd25f9e515082651 	int get_flags(u_int32_t *flags) {
2652 		return self->get_flags(self, flags);
2653 	}
set_flags__anonbd25f9e515082654 	int set_flags(u_int32_t flags) {
2655 		return self->set_flags(self, flags);
2656 	}
2657 
get_range__anonbd25f9e515082658 	int get_range(db_seq_t *min, db_seq_t *max) {
2659 		return self->get_range(self, min, max);
2660 	}
set_range__anonbd25f9e515082661 	int set_range(db_seq_t min, db_seq_t max) {
2662 		return self->set_range(self, min, max);
2663 	}
2664 
2665 	%csmethodmodifiers stat "private"
2666 	%typemap(cstype, out="IntPtr") void * "IntPtr"
2667 	void *stat(u_int32_t flags, int *err) {
2668 		DB_SEQUENCE_STAT *ret = NULL;
2669 
2670 		*err = self->stat(self, &ret, flags);
2671 		return (void *)ret;
2672 	}
2673 
stat_print__anonbd25f9e515082674 	int stat_print(u_int32_t flags) {
2675 		return self->stat_print(self, flags);
2676 	}
2677 }
2678 } DB_SEQUENCE;
2679 
2680 %pragma(csharp) imclasscode=%{
2681 #if DEBUG
2682 	private const string libname = "libdb_csharp" + DbConstants.DB_VERSION_MAJOR_STR + DbConstants.DB_VERSION_MINOR_STR + "d";
2683 #else
2684 	private const string libname = "libdb_csharp" + DbConstants.DB_VERSION_MAJOR_STR + DbConstants.DB_VERSION_MINOR_STR;
2685 #endif
2686 %}
2687