1 module mongoaux.mongoc;
2 // This file was auto-generated. Don't change it.
3 // mongo-c-driver version: 1.8.0
4 // libbson version: 1.7.0
5 
6 import core.stdc.stdio;
7 import core.sys.posix.unistd;
8 import core.sys.posix.netdb;
9 
10 extern (C): 
11 
12 // libbson stuffs --->
13 
14 
15 bson_context_t* bson_context_get_default ();
16 
17 void bson_context_destroy (bson_context_t* context);
18 
19 
20 bson_t* bson_new_from_json (
21     const(ubyte)* data,
22     ssize_t len,
23     bson_error_t* error);
24 
25 
26 char* bson_as_json (const(bson_t)* bson, size_t* length);
27 
28 
29 void bson_destroy (bson_t* bson);
30 
31 
32 const(ubyte)* bson_get_data (const(bson_t)* bson);
33 
34 
35 bson_t* bson_new_from_data (const(ubyte)* data, size_t length);
36 
37 
38 bool bson_init_static (bson_t* b, const(ubyte)* data, size_t length);
39 
40 void bson_oid_init (bson_oid_t* oid, bson_context_t* context);
41 
42 void bson_strfreev (char** strv);
43 // libbson data struct --->
44 extern (C):
45 
46 alias bson_unichar_t = uint;
47 
48 enum bson_context_flags_t
49 {
50     BSON_CONTEXT_NONE = 0,
51     BSON_CONTEXT_THREAD_SAFE = 1,
52     BSON_CONTEXT_DISABLE_HOST_CACHE = 2,
53     BSON_CONTEXT_DISABLE_PID_CACHE = 4,
54 
55     BSON_CONTEXT_USE_TASK_ID = 8
56 }
57 
58 struct _bson_context_t;
59 alias bson_context_t = _bson_context_t;
60 
61 struct _bson_t
62 {
63     uint flags;
64     uint len;
65     ubyte[120] padding;
66 }
67 
68 alias bson_t = _bson_t;
69 
70 alias static_assert_test_149 = char[1];
71 
72 struct bson_oid_t
73 {
74     ubyte[12] bytes;
75 }
76 
77 alias static_assert_test_163 = char[1];
78 
79 struct bson_decimal128_t
80 {
81     ulong low;
82     ulong high;
83 }
84 
85 enum bson_validate_flags_t
86 {
87     BSON_VALIDATE_NONE = 0,
88     BSON_VALIDATE_UTF8 = 1,
89     BSON_VALIDATE_DOLLAR_KEYS = 2,
90     BSON_VALIDATE_DOT_KEYS = 4,
91     BSON_VALIDATE_UTF8_ALLOW_NULL = 8,
92     BSON_VALIDATE_EMPTY_KEYS = 16
93 }
94 
95 enum bson_type_t
96 {
97     BSON_TYPE_EOD = 0,
98     BSON_TYPE_DOUBLE = 1,
99     BSON_TYPE_UTF8 = 2,
100     BSON_TYPE_DOCUMENT = 3,
101     BSON_TYPE_ARRAY = 4,
102     BSON_TYPE_BINARY = 5,
103     BSON_TYPE_UNDEFINED = 6,
104     BSON_TYPE_OID = 7,
105     BSON_TYPE_BOOL = 8,
106     BSON_TYPE_DATE_TIME = 9,
107     BSON_TYPE_NULL = 10,
108     BSON_TYPE_REGEX = 11,
109     BSON_TYPE_DBPOINTER = 12,
110     BSON_TYPE_CODE = 13,
111     BSON_TYPE_SYMBOL = 14,
112     BSON_TYPE_CODEWSCOPE = 15,
113     BSON_TYPE_INT32 = 16,
114     BSON_TYPE_TIMESTAMP = 17,
115     BSON_TYPE_INT64 = 18,
116     BSON_TYPE_DECIMAL128 = 19,
117     BSON_TYPE_MAXKEY = 127,
118     BSON_TYPE_MINKEY = 255
119 }
120 
121 enum bson_subtype_t
122 {
123     BSON_SUBTYPE_BINARY = 0,
124     BSON_SUBTYPE_FUNCTION = 1,
125     BSON_SUBTYPE_BINARY_DEPRECATED = 2,
126     BSON_SUBTYPE_UUID_DEPRECATED = 3,
127     BSON_SUBTYPE_UUID = 4,
128     BSON_SUBTYPE_MD5 = 5,
129     BSON_SUBTYPE_USER = 128
130 }
131 
132 struct _bson_value_t;
133 // IGN struct _bson_value_t
134 // IGN {
135 // IGN     bson_type_t value_type;
136 // IGN     int padding;
137 // IGN 
138 // IGN     union _Anonymous_0
139 // IGN     {
140 // IGN         bson_oid_t v_oid;
141 // IGN         long v_int64;
142 // IGN         int v_int32;
143 // IGN         byte v_int8;
144 // IGN         double v_double;
145 // IGN         bool v_bool;
146 // IGN         long v_datetime;
147 // IGN 
148 // IGN         struct _Anonymous_1
149 // IGN         {
150 // IGN             uint timestamp;
151 // IGN             uint increment;
152 // IGN         }
153 // IGN 
154 // IGN         _Anonymous_1 v_timestamp;
155 // IGN 
156 // IGN         struct _Anonymous_2
157 // IGN         {
158 // IGN             char* str;
159 // IGN             uint len;
160 // IGN         }
161 // IGN 
162 // IGN         _Anonymous_2 v_utf8;
163 // IGN 
164 // IGN         struct _Anonymous_3
165 // IGN         {
166 // IGN             ubyte* data;
167 // IGN             uint data_len;
168 // IGN         }
169 // IGN 
170 // IGN         _Anonymous_3 v_doc;
171 // IGN 
172 // IGN         struct _Anonymous_4
173 // IGN         {
174 // IGN             ubyte* data;
175 // IGN             uint data_len;
176 // IGN             bson_subtype_t subtype;
177 // IGN         }
178 // IGN 
179 // IGN         _Anonymous_4 v_binary;
180 // IGN 
181 // IGN         struct _Anonymous_5
182 // IGN         {
183 // IGN             char* regex;
184 // IGN             char* options;
185 // IGN         }
186 // IGN 
187 // IGN         _Anonymous_5 v_regex;
188 // IGN 
189 // IGN         struct _Anonymous_6
190 // IGN         {
191 // IGN             char* collection;
192 // IGN             uint collection_len;
193 // IGN             bson_oid_t oid;
194 // IGN         }
195 // IGN 
196 // IGN         _Anonymous_6 v_dbpointer;
197 // IGN 
198 // IGN         struct _Anonymous_7
199 // IGN         {
200 // IGN             char* code;
201 // IGN             uint code_len;
202 // IGN         }
203 // IGN 
204 // IGN         _Anonymous_7 v_code;
205 // IGN 
206 // IGN         struct _Anonymous_8
207 // IGN         {
208 // IGN             char* code;
209 // IGN             ubyte* scope_data;
210 // IGN             uint code_len;
211 // IGN             uint scope_len;
212 // IGN         }
213 // IGN 
214 // IGN         _Anonymous_8 v_codewscope;
215 // IGN 
216 // IGN         struct _Anonymous_9
217 // IGN         {
218 // IGN             char* symbol;
219 // IGN             uint len;
220 // IGN         }
221 // IGN 
222 // IGN         _Anonymous_9 v_symbol;
223 // IGN         bson_decimal128_t v_decimal128;
224 // IGN     }
225 // IGN 
226 // IGN     _Anonymous_0 value;
227 // IGN }
228 
229 alias bson_value_t = _bson_value_t;
230 
231 struct bson_iter_t;
232 // IGN struct bson_iter_t
233 // IGN {
234 // IGN     const(ubyte)* raw;
235 // IGN     uint len;
236 // IGN     uint off;
237 // IGN     uint type;
238 // IGN     uint key;
239 // IGN     uint d1;
240 // IGN     uint d2;
241 // IGN     uint d3;
242 // IGN     uint d4;
243 // IGN     uint next_off;
244 // IGN     uint err_off;
245 // IGN     bson_value_t value;
246 // IGN }
247 
248 struct bson_reader_t
249 {
250     uint type;
251 }
252 
253 struct bson_visitor_t
254 {
255     bool function (const(bson_iter_t)* iter, const(char)* key, void* data) visit_before;
256     bool function (const(bson_iter_t)* iter, const(char)* key, void* data) visit_after;
257 
258     void function (const(bson_iter_t)* iter, void* data) visit_corrupt;
259 
260     bool function (const(bson_iter_t)* iter, const(char)* key, double v_double, void* data) visit_double;
261     bool function (const(bson_iter_t)* iter, const(char)* key, size_t v_utf8_len, const(char)* v_utf8, void* data) visit_utf8;
262     bool function (const(bson_iter_t)* iter, const(char)* key, const(bson_t)* v_document, void* data) visit_document;
263     bool function (const(bson_iter_t)* iter, const(char)* key, const(bson_t)* v_array, void* data) visit_array;
264     bool function (const(bson_iter_t)* iter, const(char)* key, bson_subtype_t v_subtype, size_t v_binary_len, const(ubyte)* v_binary, void* data) visit_binary;
265 
266     bool function (const(bson_iter_t)* iter, const(char)* key, void* data) visit_undefined;
267     bool function (const(bson_iter_t)* iter, const(char)* key, const(bson_oid_t)* v_oid, void* data) visit_oid;
268     bool function (const(bson_iter_t)* iter, const(char)* key, bool v_bool, void* data) visit_bool;
269     bool function (const(bson_iter_t)* iter, const(char)* key, long msec_since_epoch, void* data) visit_date_time;
270     bool function (const(bson_iter_t)* iter, const(char)* key, void* data) visit_null;
271     bool function (const(bson_iter_t)* iter, const(char)* key, const(char)* v_regex, const(char)* v_options, void* data) visit_regex;
272     bool function (const(bson_iter_t)* iter, const(char)* key, size_t v_collection_len, const(char)* v_collection, const(bson_oid_t)* v_oid, void* data) visit_dbpointer;
273     bool function (const(bson_iter_t)* iter, const(char)* key, size_t v_code_len, const(char)* v_code, void* data) visit_code;
274     bool function (const(bson_iter_t)* iter, const(char)* key, size_t v_symbol_len, const(char)* v_symbol, void* data) visit_symbol;
275     bool function (const(bson_iter_t)* iter, const(char)* key, size_t v_code_len, const(char)* v_code, const(bson_t)* v_scope, void* data) visit_codewscope;
276     bool function (const(bson_iter_t)* iter, const(char)* key, int v_int32, void* data) visit_int32;
277     bool function (const(bson_iter_t)* iter, const(char)* key, uint v_timestamp, uint v_increment, void* data) visit_timestamp;
278     bool function (const(bson_iter_t)* iter, const(char)* key, long v_int64, void* data) visit_int64;
279     bool function (const(bson_iter_t)* iter, const(char)* key, void* data) visit_maxkey;
280     bool function (const(bson_iter_t)* iter, const(char)* key, void* data) visit_minkey;
281 
282     void function (const(bson_iter_t)* iter, const(char)* key, uint type_code, void* data) visit_unsupported_type;
283     bool function (const(bson_iter_t)* iter, const(char)* key, const(bson_decimal128_t)* v_decimal128, void* data) visit_decimal128;
284 
285     void*[7] padding;
286 }
287 
288 enum BSON_ERROR_BUFFER_SIZE = 504;
289 
290 struct _bson_error_t
291 {
292     uint domain;
293     uint code;
294     char[BSON_ERROR_BUFFER_SIZE] message;
295 }
296 
297 alias bson_error_t = _bson_error_t;
298 
299 alias static_assert_test_504 = char[1];
300 
301 size_t bson_next_power_of_two (size_t v);
302 
303 bool bson_is_power_of_two (uint v);
304 
305 
306 // mongo-c-clients stuffs --->
307 
308 // from file mongoc-stream-tls-libressl.h:
309 /*
310  * Copyright 2016 MongoDB, Inc.
311  *
312  * Licensed under the Apache License, Version 2.0 (the "License");
313  * you may not use this file except in compliance with the License.
314  * You may obtain a copy of the License at
315  *
316  *   http://www.apache.org/licenses/LICENSE-2.0
317  *
318  * Unless required by applicable law or agreed to in writing, software
319  * distributed under the License is distributed on an "AS IS" BASIS,
320  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
321  * See the License for the specific language governing permissions and
322  * limitations under the License.
323  */
324 
325 
326 /* MONGOC_ENABLE_SSL_LIBRESSL */
327 /* MONGOC_STREAM_TLS_LIBRESSL_H */
328 
329 // from file mongoc-write-concern.h:
330 /*
331  * Copyright 2013 MongoDB, Inc.
332  *
333  * Licensed under the Apache License, Version 2.0 (the "License");
334  * you may not use this file except in compliance with the License.
335  * You may obtain a copy of the License at
336  *
337  *   http://www.apache.org/licenses/LICENSE-2.0
338  *
339  * Unless required by applicable law or agreed to in writing, software
340  * distributed under the License is distributed on an "AS IS" BASIS,
341  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
342  * See the License for the specific language governing permissions and
343  * limitations under the License.
344  */
345 
346 
347 enum WRITE_CONCERN_W_UNACKNOWLEDGED = 0;
348 enum WRITE_CONCERN_W_ERRORS_IGNORED = -1; /* deprecated */
349 enum WRITE_CONCERN_W_DEFAULT = -2;
350 enum WRITE_CONCERN_W_MAJORITY = -3;
351 enum WRITE_CONCERN_W_TAG = -4;
352 
353 struct _mongoc_write_concern_t;
354 alias mongoc_write_concern_t = _mongoc_write_concern_t;
355 
356 mongoc_write_concern_t* mongoc_write_concern_new ();
357 mongoc_write_concern_t* mongoc_write_concern_copy (
358     const(mongoc_write_concern_t)* write_concern);
359 void mongoc_write_concern_destroy (mongoc_write_concern_t* write_concern);
360 bool mongoc_write_concern_get_fsync (
361     const(mongoc_write_concern_t)* write_concern);
362 void mongoc_write_concern_set_fsync (
363     mongoc_write_concern_t* write_concern,
364     bool fsync_);
365 bool mongoc_write_concern_get_journal (
366     const(mongoc_write_concern_t)* write_concern);
367 bool mongoc_write_concern_journal_is_set (
368     const(mongoc_write_concern_t)* write_concern);
369 void mongoc_write_concern_set_journal (
370     mongoc_write_concern_t* write_concern,
371     bool journal);
372 int mongoc_write_concern_get_w (const(mongoc_write_concern_t)* write_concern);
373 void mongoc_write_concern_set_w (mongoc_write_concern_t* write_concern, int w);
374 const(char)* mongoc_write_concern_get_wtag (
375     const(mongoc_write_concern_t)* write_concern);
376 void mongoc_write_concern_set_wtag (
377     mongoc_write_concern_t* write_concern,
378     const(char)* tag);
379 int mongoc_write_concern_get_wtimeout (
380     const(mongoc_write_concern_t)* write_concern);
381 void mongoc_write_concern_set_wtimeout (
382     mongoc_write_concern_t* write_concern,
383     int wtimeout_msec);
384 bool mongoc_write_concern_get_wmajority (
385     const(mongoc_write_concern_t)* write_concern);
386 void mongoc_write_concern_set_wmajority (
387     mongoc_write_concern_t* write_concern,
388     int wtimeout_msec);
389 bool mongoc_write_concern_is_acknowledged (
390     const(mongoc_write_concern_t)* write_concern);
391 bool mongoc_write_concern_is_valid (
392     const(mongoc_write_concern_t)* write_concern);
393 bool mongoc_write_concern_append (
394     mongoc_write_concern_t* write_concern,
395     bson_t* doc);
396 bool mongoc_write_concern_is_default (
397     const(mongoc_write_concern_t)* write_concern);
398 
399 /* MONGOC_WRITE_CONCERN_H */
400 
401 // from file mongoc-server-description.h:
402 /*
403  * Copyright 2014 MongoDB, Inc.
404  *
405  * Licensed under the Apache License, Version 2.0 (the "License");
406  * you may not use this file except in compliance with the License.
407  * You may obtain a copy of the License at
408  *
409  *   http://www.apache.org/licenses/LICENSE-2.0
410  *
411  * Unless required by applicable law or agreed to in writing, software
412  * distributed under the License is distributed on an "AS IS" BASIS,
413  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
414  * See the License for the specific language governing permissions and
415  * limitations under the License.
416  */
417 
418 
419 struct _mongoc_server_description_t;
420 alias mongoc_server_description_t = _mongoc_server_description_t;
421 
422 void mongoc_server_description_destroy (
423     mongoc_server_description_t* description);
424 
425 mongoc_server_description_t* mongoc_server_description_new_copy (
426     const(mongoc_server_description_t)* description);
427 
428 uint mongoc_server_description_id (
429     const(mongoc_server_description_t)* description);
430 
431 mongoc_host_list_t* mongoc_server_description_host (
432     const(mongoc_server_description_t)* description);
433 
434 long mongoc_server_description_round_trip_time (
435     const(mongoc_server_description_t)* description);
436 
437 const(char)* mongoc_server_description_type (
438     const(mongoc_server_description_t)* description);
439 
440 const(bson_t)* mongoc_server_description_ismaster (
441     const(mongoc_server_description_t)* description);
442 
443 int mongoc_server_description_compressor_id (
444     const(mongoc_server_description_t)* description);
445 
446 
447 // from file mongoc-iovec.h:
448 /*
449  * Copyright 2014 MongoDB, Inc.
450  *
451  * Licensed under the Apache License, Version 2.0 (the "License");
452  * you may not use this file except in compliance with the License.
453  * You may obtain a copy of the License at
454  *
455  *   http://www.apache.org/licenses/LICENSE-2.0
456  *
457  * Unless required by applicable law or agreed to in writing, software
458  * distributed under the License is distributed on an "AS IS" BASIS,
459  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
460  * See the License for the specific language governing permissions and
461  * limitations under the License.
462  */
463 
464 
465 alias mongoc_iovec_t = iovec;
466 
467 /* MONGOC_IOVEC_H */
468 
469 // from file mongoc-host-list.h:
470 /*
471  * Copyright 2013 MongoDB, Inc.
472  *
473  * Licensed under the Apache License, Version 2.0 (the "License");
474  * you may not use this file except in compliance with the License.
475  * You may obtain a copy of the License at
476  *
477  *   http://www.apache.org/licenses/LICENSE-2.0
478  *
479  * Unless required by applicable law or agreed to in writing, software
480  * distributed under the License is distributed on an "AS IS" BASIS,
481  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
482  * See the License for the specific language governing permissions and
483  * limitations under the License.
484  */
485 
486 
487 enum BSON_HOST_NAME_MAX = 255;
488 
489 alias mongoc_host_list_t = _mongoc_host_list_t;
490 
491 struct _mongoc_host_list_t
492 {
493     mongoc_host_list_t* next;
494     char[256] host;
495     char[262] host_and_port;
496     ushort port;
497     int family;
498     void*[4] padding;
499 }
500 
501 /* MONGOC_HOST_LIST_H */
502 
503 // from file mongoc-topology-description-patched.c:
504 /*
505  * Copyright 2016 MongoDB, Inc.
506  *
507  * Licensed under the Apache License, Version 2.0 (the "License");
508  * you may not use this file except in compliance with the License.
509  * You may obtain a copy of the License at
510  *
511  *   http://www.apache.org/licenses/LICENSE-2.0
512  *
513  * Unless required by applicable law or agreed to in writing, software
514  * distributed under the License is distributed on an "AS IS" BASIS,
515  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
516  * See the License for the specific language governing permissions and
517  * limitations under the License.
518  */
519 
520 
521 struct _mongoc_topology_description_t;
522 alias mongoc_topology_description_t = _mongoc_topology_description_t;
523 
524 bool mongoc_topology_description_has_readable_server (
525     mongoc_topology_description_t* td,
526     const(mongoc_read_prefs_t)* prefs);
527 bool mongoc_topology_description_has_writable_server (
528     mongoc_topology_description_t* td);
529 const(char)* mongoc_topology_description_type (
530     const(mongoc_topology_description_t)* td);
531 mongoc_server_description_t** mongoc_topology_description_get_servers (
532     const(mongoc_topology_description_t)* td,
533     size_t* n);
534 
535 /* MONGOC_TOPOLOGY_DESCRIPTION_H */
536 
537 // from file mongoc-stream-gridfs.h:
538 /*
539  * Copyright 2013 MongoDB Inc.
540  *
541  * Licensed under the Apache License, Version 2.0 (the "License");
542  * you may not use this file except in compliance with the License.
543  * You may obtain a copy of the License at
544  *
545  *   http://www.apache.org/licenses/LICENSE-2.0
546  *
547  * Unless required by applicable law or agreed to in writing, software
548  * distributed under the License is distributed on an "AS IS" BASIS,
549  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
550  * See the License for the specific language governing permissions and
551  * limitations under the License.
552  */
553 
554 
555 mongoc_stream_t* mongoc_stream_gridfs_new (mongoc_gridfs_file_t* file);
556 
557 /* MONGOC_STREAM_GRIDFS_H */
558 
559 // from file mongoc-stream.h:
560 /*
561  * Copyright 2013-2014 MongoDB, Inc.
562  *
563  * Licensed under the Apache License, Version 2.0 (the "License");
564  * you may not use this file except in compliance with the License.
565  * You may obtain a copy of the License at
566  *
567  *   http://www.apache.org/licenses/LICENSE-2.0
568  *
569  * Unless required by applicable law or agreed to in writing, software
570  * distributed under the License is distributed on an "AS IS" BASIS,
571  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
572  * See the License for the specific language governing permissions and
573  * limitations under the License.
574  */
575 
576 
577 
578 
579 alias mongoc_stream_t = _mongoc_stream_t;
580 
581 struct _mongoc_stream_poll_t
582 {
583     mongoc_stream_t* stream;
584     int events;
585     int revents;
586 }
587 
588 alias mongoc_stream_poll_t = _mongoc_stream_poll_t;
589 
590 struct _mongoc_stream_t
591 {
592     int type;
593     void function (mongoc_stream_t* stream) destroy;
594     int function (mongoc_stream_t* stream) close;
595     int function (mongoc_stream_t* stream) flush;
596     ssize_t function (mongoc_stream_t* stream, mongoc_iovec_t* iov, size_t iovcnt, int timeout_msec) writev;
597     ssize_t function (mongoc_stream_t* stream, mongoc_iovec_t* iov, size_t iovcnt, size_t min_bytes, int timeout_msec) readv;
598     int function (mongoc_stream_t* stream, int level, int optname, void* optval, mongoc_socklen_t optlen) setsockopt;
599     mongoc_stream_t* function (mongoc_stream_t* stream) get_base_stream;
600     bool function (mongoc_stream_t* stream) check_closed;
601     ssize_t function (mongoc_stream_poll_t* streams, size_t nstreams, int timeout) poll;
602     void function (mongoc_stream_t* stream) failed;
603     bool function (mongoc_stream_t* stream) timed_out;
604     void*[4] padding;
605 }
606 
607 mongoc_stream_t* mongoc_stream_get_base_stream (mongoc_stream_t* stream);
608 mongoc_stream_t* mongoc_stream_get_tls_stream (mongoc_stream_t* stream);
609 int mongoc_stream_close (mongoc_stream_t* stream);
610 void mongoc_stream_destroy (mongoc_stream_t* stream);
611 void mongoc_stream_failed (mongoc_stream_t* stream);
612 int mongoc_stream_flush (mongoc_stream_t* stream);
613 ssize_t mongoc_stream_writev (
614     mongoc_stream_t* stream,
615     mongoc_iovec_t* iov,
616     size_t iovcnt,
617     int timeout_msec);
618 ssize_t mongoc_stream_write (
619     mongoc_stream_t* stream,
620     void* buf,
621     size_t count,
622     int timeout_msec);
623 ssize_t mongoc_stream_readv (
624     mongoc_stream_t* stream,
625     mongoc_iovec_t* iov,
626     size_t iovcnt,
627     size_t min_bytes,
628     int timeout_msec);
629 ssize_t mongoc_stream_read (
630     mongoc_stream_t* stream,
631     void* buf,
632     size_t count,
633     size_t min_bytes,
634     int timeout_msec);
635 int mongoc_stream_setsockopt (
636     mongoc_stream_t* stream,
637     int level,
638     int optname,
639     void* optval,
640     mongoc_socklen_t optlen);
641 bool mongoc_stream_check_closed (mongoc_stream_t* stream);
642 bool mongoc_stream_timed_out (mongoc_stream_t* stream);
643 ssize_t mongoc_stream_poll (
644     mongoc_stream_poll_t* streams,
645     size_t nstreams,
646     int timeout);
647 
648 /* MONGOC_STREAM_H */
649 
650 // from file mongoc-apm.h:
651 /*
652  * Copyright 2015 MongoDB, Inc.
653  *
654  * Licensed under the Apache License, Version 2.0 (the "License");
655  * you may not use this file except in compliance with the License.
656  * You may obtain a copy of the License at
657  *
658  *   http://www.apache.org/licenses/LICENSE-2.0
659  *
660  * Unless required by applicable law or agreed to in writing, software
661  * distributed under the License is distributed on an "AS IS" BASIS,
662  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
663  * See the License for the specific language governing permissions and
664  * limitations under the License.
665  */
666 
667 
668 /*
669  * Application Performance Management (APM) interface, complies with two specs.
670  * MongoDB's Command Monitoring Spec:
671  *
672  * https://github.com/mongodb/specifications/tree/master/source/command-monitoring
673  *
674  * MongoDB's Spec for Monitoring Server Discovery and Monitoring (SDAM) events:
675  *
676  * https://github.com/mongodb/specifications/tree/master/source/server-discovery-and-monitoring
677  *
678  */
679 
680 /*
681  * callbacks to receive APM events
682  */
683 
684 struct _mongoc_apm_callbacks_t;
685 alias mongoc_apm_callbacks_t = _mongoc_apm_callbacks_t;
686 
687 /*
688  * command monitoring events
689  */
690 
691 struct _mongoc_apm_command_started_t;
692 alias mongoc_apm_command_started_t = _mongoc_apm_command_started_t;
693 struct _mongoc_apm_command_succeeded_t;
694 alias mongoc_apm_command_succeeded_t = _mongoc_apm_command_succeeded_t;
695 struct _mongoc_apm_command_failed_t;
696 alias mongoc_apm_command_failed_t = _mongoc_apm_command_failed_t;
697 
698 /*
699  * SDAM monitoring events
700  */
701 
702 struct _mongoc_apm_server_changed_t;
703 alias mongoc_apm_server_changed_t = _mongoc_apm_server_changed_t;
704 struct _mongoc_apm_server_opening_t;
705 alias mongoc_apm_server_opening_t = _mongoc_apm_server_opening_t;
706 struct _mongoc_apm_server_closed_t;
707 alias mongoc_apm_server_closed_t = _mongoc_apm_server_closed_t;
708 struct _mongoc_apm_topology_changed_t;
709 alias mongoc_apm_topology_changed_t = _mongoc_apm_topology_changed_t;
710 struct _mongoc_apm_topology_opening_t;
711 alias mongoc_apm_topology_opening_t = _mongoc_apm_topology_opening_t;
712 struct _mongoc_apm_topology_closed_t;
713 alias mongoc_apm_topology_closed_t = _mongoc_apm_topology_closed_t;
714 struct _mongoc_apm_server_heartbeat_started_t;
715 alias mongoc_apm_server_heartbeat_started_t = _mongoc_apm_server_heartbeat_started_t;
716 struct _mongoc_apm_server_heartbeat_succeeded_t;
717 alias mongoc_apm_server_heartbeat_succeeded_t = _mongoc_apm_server_heartbeat_succeeded_t;
718 struct _mongoc_apm_server_heartbeat_failed_t;
719 alias mongoc_apm_server_heartbeat_failed_t = _mongoc_apm_server_heartbeat_failed_t;
720 
721 /*
722  * event field accessors
723  */
724 
725 /* command-started event fields */
726 
727 const(bson_t)* mongoc_apm_command_started_get_command (
728     const(mongoc_apm_command_started_t)* event);
729 const(char)* mongoc_apm_command_started_get_database_name (
730     const(mongoc_apm_command_started_t)* event);
731 const(char)* mongoc_apm_command_started_get_command_name (
732     const(mongoc_apm_command_started_t)* event);
733 long mongoc_apm_command_started_get_request_id (
734     const(mongoc_apm_command_started_t)* event);
735 long mongoc_apm_command_started_get_operation_id (
736     const(mongoc_apm_command_started_t)* event);
737 const(mongoc_host_list_t)* mongoc_apm_command_started_get_host (
738     const(mongoc_apm_command_started_t)* event);
739 uint mongoc_apm_command_started_get_server_id (
740     const(mongoc_apm_command_started_t)* event);
741 void* mongoc_apm_command_started_get_context (
742     const(mongoc_apm_command_started_t)* event);
743 
744 /* command-succeeded event fields */
745 
746 long mongoc_apm_command_succeeded_get_duration (
747     const(mongoc_apm_command_succeeded_t)* event);
748 const(bson_t)* mongoc_apm_command_succeeded_get_reply (
749     const(mongoc_apm_command_succeeded_t)* event);
750 const(char)* mongoc_apm_command_succeeded_get_command_name (
751     const(mongoc_apm_command_succeeded_t)* event);
752 long mongoc_apm_command_succeeded_get_request_id (
753     const(mongoc_apm_command_succeeded_t)* event);
754 long mongoc_apm_command_succeeded_get_operation_id (
755     const(mongoc_apm_command_succeeded_t)* event);
756 const(mongoc_host_list_t)* mongoc_apm_command_succeeded_get_host (
757     const(mongoc_apm_command_succeeded_t)* event);
758 uint mongoc_apm_command_succeeded_get_server_id (
759     const(mongoc_apm_command_succeeded_t)* event);
760 void* mongoc_apm_command_succeeded_get_context (
761     const(mongoc_apm_command_succeeded_t)* event);
762 
763 /* command-failed event fields */
764 
765 long mongoc_apm_command_failed_get_duration (
766     const(mongoc_apm_command_failed_t)* event);
767 const(char)* mongoc_apm_command_failed_get_command_name (
768     const(mongoc_apm_command_failed_t)* event);
769 
770 /* retrieve the error by filling out the passed-in "error" struct */
771 void mongoc_apm_command_failed_get_error (
772     const(mongoc_apm_command_failed_t)* event,
773     bson_error_t* error);
774 long mongoc_apm_command_failed_get_request_id (
775     const(mongoc_apm_command_failed_t)* event);
776 long mongoc_apm_command_failed_get_operation_id (
777     const(mongoc_apm_command_failed_t)* event);
778 const(mongoc_host_list_t)* mongoc_apm_command_failed_get_host (
779     const(mongoc_apm_command_failed_t)* event);
780 uint mongoc_apm_command_failed_get_server_id (
781     const(mongoc_apm_command_failed_t)* event);
782 void* mongoc_apm_command_failed_get_context (
783     const(mongoc_apm_command_failed_t)* event);
784 
785 /* server-changed event fields */
786 
787 const(mongoc_host_list_t)* mongoc_apm_server_changed_get_host (
788     const(mongoc_apm_server_changed_t)* event);
789 void mongoc_apm_server_changed_get_topology_id (
790     const(mongoc_apm_server_changed_t)* event,
791     bson_oid_t* topology_id);
792 const(mongoc_server_description_t)* mongoc_apm_server_changed_get_previous_description (
793     const(mongoc_apm_server_changed_t)* event);
794 const(mongoc_server_description_t)* mongoc_apm_server_changed_get_new_description (
795     const(mongoc_apm_server_changed_t)* event);
796 void* mongoc_apm_server_changed_get_context (
797     const(mongoc_apm_server_changed_t)* event);
798 
799 /* server-opening event fields */
800 
801 const(mongoc_host_list_t)* mongoc_apm_server_opening_get_host (
802     const(mongoc_apm_server_opening_t)* event);
803 void mongoc_apm_server_opening_get_topology_id (
804     const(mongoc_apm_server_opening_t)* event,
805     bson_oid_t* topology_id);
806 void* mongoc_apm_server_opening_get_context (
807     const(mongoc_apm_server_opening_t)* event);
808 
809 /* server-closed event fields */
810 
811 const(mongoc_host_list_t)* mongoc_apm_server_closed_get_host (
812     const(mongoc_apm_server_closed_t)* event);
813 void mongoc_apm_server_closed_get_topology_id (
814     const(mongoc_apm_server_closed_t)* event,
815     bson_oid_t* topology_id);
816 void* mongoc_apm_server_closed_get_context (
817     const(mongoc_apm_server_closed_t)* event);
818 
819 /* topology-changed event fields */
820 
821 void mongoc_apm_topology_changed_get_topology_id (
822     const(mongoc_apm_topology_changed_t)* event,
823     bson_oid_t* topology_id);
824 const(mongoc_topology_description_t)* mongoc_apm_topology_changed_get_previous_description (
825     const(mongoc_apm_topology_changed_t)* event);
826 const(mongoc_topology_description_t)* mongoc_apm_topology_changed_get_new_description (
827     const(mongoc_apm_topology_changed_t)* event);
828 void* mongoc_apm_topology_changed_get_context (
829     const(mongoc_apm_topology_changed_t)* event);
830 
831 /* topology-opening event field */
832 
833 void mongoc_apm_topology_opening_get_topology_id (
834     const(mongoc_apm_topology_opening_t)* event,
835     bson_oid_t* topology_id);
836 void* mongoc_apm_topology_opening_get_context (
837     const(mongoc_apm_topology_opening_t)* event);
838 
839 /* topology-closed event field */
840 
841 void mongoc_apm_topology_closed_get_topology_id (
842     const(mongoc_apm_topology_closed_t)* event,
843     bson_oid_t* topology_id);
844 void* mongoc_apm_topology_closed_get_context (
845     const(mongoc_apm_topology_closed_t)* event);
846 
847 /* heartbeat-started event field */
848 
849 const(mongoc_host_list_t)* mongoc_apm_server_heartbeat_started_get_host (
850     const(mongoc_apm_server_heartbeat_started_t)* event);
851 void* mongoc_apm_server_heartbeat_started_get_context (
852     const(mongoc_apm_server_heartbeat_started_t)* event);
853 
854 /* heartbeat-succeeded event fields */
855 
856 long mongoc_apm_server_heartbeat_succeeded_get_duration (
857     const(mongoc_apm_server_heartbeat_succeeded_t)* event);
858 const(bson_t)* mongoc_apm_server_heartbeat_succeeded_get_reply (
859     const(mongoc_apm_server_heartbeat_succeeded_t)* event);
860 const(mongoc_host_list_t)* mongoc_apm_server_heartbeat_succeeded_get_host (
861     const(mongoc_apm_server_heartbeat_succeeded_t)* event);
862 void* mongoc_apm_server_heartbeat_succeeded_get_context (
863     const(mongoc_apm_server_heartbeat_succeeded_t)* event);
864 
865 /* heartbeat-failed event fields */
866 
867 long mongoc_apm_server_heartbeat_failed_get_duration (
868     const(mongoc_apm_server_heartbeat_failed_t)* event);
869 void mongoc_apm_server_heartbeat_failed_get_error (
870     const(mongoc_apm_server_heartbeat_failed_t)* event,
871     bson_error_t* error);
872 const(mongoc_host_list_t)* mongoc_apm_server_heartbeat_failed_get_host (
873     const(mongoc_apm_server_heartbeat_failed_t)* event);
874 void* mongoc_apm_server_heartbeat_failed_get_context (
875     const(mongoc_apm_server_heartbeat_failed_t)* event);
876 
877 /*
878  * callbacks
879  */
880 
881 alias mongoc_apm_command_started_cb_t = void function (const(mongoc_apm_command_started_t)* event);
882 alias mongoc_apm_command_succeeded_cb_t = void function (const(mongoc_apm_command_succeeded_t)* event);
883 alias mongoc_apm_command_failed_cb_t = void function (const(mongoc_apm_command_failed_t)* event);
884 alias mongoc_apm_server_changed_cb_t = void function (const(mongoc_apm_server_changed_t)* event);
885 alias mongoc_apm_server_opening_cb_t = void function (const(mongoc_apm_server_opening_t)* event);
886 alias mongoc_apm_server_closed_cb_t = void function (const(mongoc_apm_server_closed_t)* event);
887 alias mongoc_apm_topology_changed_cb_t = void function (const(mongoc_apm_topology_changed_t)* event);
888 alias mongoc_apm_topology_opening_cb_t = void function (const(mongoc_apm_topology_opening_t)* event);
889 alias mongoc_apm_topology_closed_cb_t = void function (const(mongoc_apm_topology_closed_t)* event);
890 alias mongoc_apm_server_heartbeat_started_cb_t = void function (const(mongoc_apm_server_heartbeat_started_t)* event);
891 alias mongoc_apm_server_heartbeat_succeeded_cb_t = void function (const(mongoc_apm_server_heartbeat_succeeded_t)* event);
892 alias mongoc_apm_server_heartbeat_failed_cb_t = void function (const(mongoc_apm_server_heartbeat_failed_t)* event);
893 
894 /*
895  * registering callbacks
896  */
897 
898 mongoc_apm_callbacks_t* mongoc_apm_callbacks_new ();
899 void mongoc_apm_callbacks_destroy (mongoc_apm_callbacks_t* callbacks);
900 void mongoc_apm_set_command_started_cb (
901     mongoc_apm_callbacks_t* callbacks,
902     mongoc_apm_command_started_cb_t cb);
903 void mongoc_apm_set_command_succeeded_cb (
904     mongoc_apm_callbacks_t* callbacks,
905     mongoc_apm_command_succeeded_cb_t cb);
906 void mongoc_apm_set_command_failed_cb (
907     mongoc_apm_callbacks_t* callbacks,
908     mongoc_apm_command_failed_cb_t cb);
909 void mongoc_apm_set_server_changed_cb (
910     mongoc_apm_callbacks_t* callbacks,
911     mongoc_apm_server_changed_cb_t cb);
912 void mongoc_apm_set_server_opening_cb (
913     mongoc_apm_callbacks_t* callbacks,
914     mongoc_apm_server_opening_cb_t cb);
915 void mongoc_apm_set_server_closed_cb (
916     mongoc_apm_callbacks_t* callbacks,
917     mongoc_apm_server_closed_cb_t cb);
918 void mongoc_apm_set_topology_changed_cb (
919     mongoc_apm_callbacks_t* callbacks,
920     mongoc_apm_topology_changed_cb_t cb);
921 void mongoc_apm_set_topology_opening_cb (
922     mongoc_apm_callbacks_t* callbacks,
923     mongoc_apm_topology_opening_cb_t cb);
924 void mongoc_apm_set_topology_closed_cb (
925     mongoc_apm_callbacks_t* callbacks,
926     mongoc_apm_topology_closed_cb_t cb);
927 void mongoc_apm_set_server_heartbeat_started_cb (
928     mongoc_apm_callbacks_t* callbacks,
929     mongoc_apm_server_heartbeat_started_cb_t cb);
930 void mongoc_apm_set_server_heartbeat_succeeded_cb (
931     mongoc_apm_callbacks_t* callbacks,
932     mongoc_apm_server_heartbeat_succeeded_cb_t cb);
933 void mongoc_apm_set_server_heartbeat_failed_cb (
934     mongoc_apm_callbacks_t* callbacks,
935     mongoc_apm_server_heartbeat_failed_cb_t cb);
936 
937 /* MONGOC_APM_H */
938 
939 // from file mongoc-index.h:
940 /*
941  * Copyright 2013 MongoDB Inc.
942  *
943  * Licensed under the Apache License, Version 2.0 (the "License");
944  * you may not use this file except in compliance with the License.
945  * You may obtain a copy of the License at
946  *
947  *   http://www.apache.org/licenses/LICENSE-2.0
948  *
949  * Unless required by applicable law or agreed to in writing, software
950  * distributed under the License is distributed on an "AS IS" BASIS,
951  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
952  * See the License for the specific language governing permissions and
953  * limitations under the License.
954  */
955 
956 
957 struct mongoc_index_opt_geo_t
958 {
959     ubyte twod_sphere_version;
960     ubyte twod_bits_precision;
961     double twod_location_min;
962     double twod_location_max;
963     double haystack_bucket_size;
964     ubyte*[32] padding;
965 }
966 
967 struct mongoc_index_opt_storage_t
968 {
969     int type;
970 }
971 
972 enum mongoc_index_storage_opt_type_t
973 {
974     STORAGE_OPT_MMAPV1 = 0,
975     STORAGE_OPT_WIREDTIGER = 1
976 }
977 
978 struct mongoc_index_opt_wt_t
979 {
980     mongoc_index_opt_storage_t base;
981     const(char)* config_str;
982     void*[8] padding;
983 }
984 
985 struct mongoc_index_opt_t
986 {
987     bool is_initialized;
988     bool background;
989     bool unique;
990     const(char)* name;
991     bool drop_dups;
992     bool sparse;
993     int expire_after_seconds;
994     int v;
995     const(bson_t)* weights;
996     const(char)* default_language;
997     const(char)* language_override;
998     mongoc_index_opt_geo_t* geo_options;
999     mongoc_index_opt_storage_t* storage_options;
1000     const(bson_t)* partial_filter_expression;
1001     const(bson_t)* collation;
1002     void*[4] padding;
1003 }
1004 
1005 const(mongoc_index_opt_t)* mongoc_index_opt_get_default ();
1006 const(mongoc_index_opt_geo_t)* mongoc_index_opt_geo_get_default ();
1007 const(mongoc_index_opt_wt_t)* mongoc_index_opt_wt_get_default ();
1008 void mongoc_index_opt_init (mongoc_index_opt_t* opt);
1009 void mongoc_index_opt_geo_init (mongoc_index_opt_geo_t* opt);
1010 void mongoc_index_opt_wt_init (mongoc_index_opt_wt_t* opt);
1011 
1012 /* MONGOC_INDEX_H */
1013 
1014 // from file mongoc-stream-buffered.h:
1015 /*
1016  * Copyright 2013 MongoDB, Inc.
1017  *
1018  * Licensed under the Apache License, Version 2.0 (the "License");
1019  * you may not use this file except in compliance with the License.
1020  * You may obtain a copy of the License at
1021  *
1022  *   http://www.apache.org/licenses/LICENSE-2.0
1023  *
1024  * Unless required by applicable law or agreed to in writing, software
1025  * distributed under the License is distributed on an "AS IS" BASIS,
1026  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1027  * See the License for the specific language governing permissions and
1028  * limitations under the License.
1029  */
1030 
1031 
1032 mongoc_stream_t* mongoc_stream_buffered_new (
1033     mongoc_stream_t* base_stream,
1034     size_t buffer_size);
1035 
1036 /* MONGOC_STREAM_BUFFERED_H */
1037 
1038 // from file mongoc-database-patched.c:
1039 /*
1040  * Copyright 2013 MongoDB, Inc.
1041  *
1042  * Licensed under the Apache License, Version 2.0 (the "License");
1043  * you may not use this file except in compliance with the License.
1044  * You may obtain a copy of the License at
1045  *
1046  *   http://www.apache.org/licenses/LICENSE-2.0
1047  *
1048  * Unless required by applicable law or agreed to in writing, software
1049  * distributed under the License is distributed on an "AS IS" BASIS,
1050  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1051  * See the License for the specific language governing permissions and
1052  * limitations under the License.
1053  */
1054 
1055 
1056 struct _mongoc_collection_t;
1057 alias mongoc_collection_t = _mongoc_collection_t;
1058 struct _mongoc_database_t;
1059 alias mongoc_database_t = _mongoc_database_t;
1060 
1061 const(char)* mongoc_database_get_name (mongoc_database_t* database);
1062 bool mongoc_database_remove_user (
1063     mongoc_database_t* database,
1064     const(char)* username,
1065     bson_error_t* error);
1066 bool mongoc_database_remove_all_users (
1067     mongoc_database_t* database,
1068     bson_error_t* error);
1069 bool mongoc_database_add_user (
1070     mongoc_database_t* database,
1071     const(char)* username,
1072     const(char)* password,
1073     const(bson_t)* roles,
1074     const(bson_t)* custom_data,
1075     bson_error_t* error);
1076 void mongoc_database_destroy (mongoc_database_t* database);
1077 mongoc_database_t* mongoc_database_copy (mongoc_database_t* database);
1078 mongoc_cursor_t* mongoc_database_command (
1079     mongoc_database_t* database,
1080     mongoc_query_flags_t flags,
1081     uint skip,
1082     uint limit,
1083     uint batch_size,
1084     const(bson_t)* command,
1085     const(bson_t)* fields,
1086     const(mongoc_read_prefs_t)* read_prefs);
1087 bool mongoc_database_read_command_with_opts (
1088     mongoc_database_t* database,
1089     const(bson_t)* command,
1090     const(mongoc_read_prefs_t)* read_prefs,
1091     const(bson_t)* opts,
1092     bson_t* reply,
1093     bson_error_t* error);
1094 bool mongoc_database_write_command_with_opts (
1095     mongoc_database_t* database,
1096     const(bson_t)* command,
1097     const(bson_t)* opts,
1098     bson_t* reply,
1099     bson_error_t* error);
1100 
1101 /* IGNORED */
1102 bool mongoc_database_read_write_command_with_opts (
1103     mongoc_database_t* database,
1104     const(bson_t)* command,
1105     const(mongoc_read_prefs_t)* read_prefs,
1106     const(bson_t)* opts,
1107     bson_t* reply,
1108     bson_error_t* error);
1109 bool mongoc_database_command_simple (
1110     mongoc_database_t* database,
1111     const(bson_t)* command,
1112     const(mongoc_read_prefs_t)* read_prefs,
1113     bson_t* reply,
1114     bson_error_t* error);
1115 bool mongoc_database_drop (mongoc_database_t* database, bson_error_t* error);
1116 bool mongoc_database_drop_with_opts (
1117     mongoc_database_t* database,
1118     const(bson_t)* opts,
1119     bson_error_t* error);
1120 bool mongoc_database_has_collection (
1121     mongoc_database_t* database,
1122     const(char)* name,
1123     bson_error_t* error);
1124 mongoc_collection_t* mongoc_database_create_collection (
1125     mongoc_database_t* database,
1126     const(char)* name,
1127     const(bson_t)* options,
1128     bson_error_t* error);
1129 const(mongoc_read_prefs_t)* mongoc_database_get_read_prefs (
1130     const(mongoc_database_t)* database);
1131 void mongoc_database_set_read_prefs (
1132     mongoc_database_t* database,
1133     const(mongoc_read_prefs_t)* read_prefs);
1134 const(mongoc_write_concern_t)* mongoc_database_get_write_concern (
1135     const(mongoc_database_t)* database);
1136 void mongoc_database_set_write_concern (
1137     mongoc_database_t* database,
1138     const(mongoc_write_concern_t)* write_concern);
1139 const(mongoc_read_concern_t)* mongoc_database_get_read_concern (
1140     const(mongoc_database_t)* database);
1141 void mongoc_database_set_read_concern (
1142     mongoc_database_t* database,
1143     const(mongoc_read_concern_t)* read_concern);
1144 mongoc_cursor_t* mongoc_database_find_collections (
1145     mongoc_database_t* database,
1146     const(bson_t)* filter,
1147     bson_error_t* error);
1148 char** mongoc_database_get_collection_names (
1149     mongoc_database_t* database,
1150     bson_error_t* error);
1151 mongoc_collection_t* mongoc_database_get_collection (
1152     mongoc_database_t* database,
1153     const(char)* name);
1154 
1155 /* MONGOC_DATABASE_H */
1156 
1157 // from file mongoc-bulk-operation.h:
1158 /*
1159  * Copyright 2014 MongoDB, Inc.
1160  *
1161  * Licensed under the Apache License, Version 2.0 (the "License");
1162  * you may not use this file except in compliance with the License.
1163  * You may obtain a copy of the License at
1164  *
1165  *   http://www.apache.org/licenses/LICENSE-2.0
1166  *
1167  * Unless required by applicable law or agreed to in writing, software
1168  * distributed under the License is distributed on an "AS IS" BASIS,
1169  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1170  * See the License for the specific language governing permissions and
1171  * limitations under the License.
1172  */
1173 
1174 
1175 struct _mongoc_bulk_operation_t;
1176 alias mongoc_bulk_operation_t = _mongoc_bulk_operation_t;
1177 struct _mongoc_bulk_write_flags_t;
1178 alias mongoc_bulk_write_flags_t = _mongoc_bulk_write_flags_t;
1179 
1180 void mongoc_bulk_operation_destroy (mongoc_bulk_operation_t* bulk);
1181 uint mongoc_bulk_operation_execute (
1182     mongoc_bulk_operation_t* bulk,
1183     bson_t* reply,
1184     bson_error_t* error);
1185 void mongoc_bulk_operation_delete (
1186     mongoc_bulk_operation_t* bulk,
1187     const(bson_t)* selector);
1188 void mongoc_bulk_operation_delete_one (
1189     mongoc_bulk_operation_t* bulk,
1190     const(bson_t)* selector);
1191 void mongoc_bulk_operation_insert (
1192     mongoc_bulk_operation_t* bulk,
1193     const(bson_t)* document);
1194 bool mongoc_bulk_operation_insert_with_opts (
1195     mongoc_bulk_operation_t* bulk,
1196     const(bson_t)* document,
1197     const(bson_t)* opts,
1198     bson_error_t* error); /* OUT */
1199 void mongoc_bulk_operation_remove (
1200     mongoc_bulk_operation_t* bulk,
1201     const(bson_t)* selector);
1202 bool mongoc_bulk_operation_remove_many_with_opts (
1203     mongoc_bulk_operation_t* bulk,
1204     const(bson_t)* selector,
1205     const(bson_t)* opts,
1206     bson_error_t* error); /* OUT */
1207 void mongoc_bulk_operation_remove_one (
1208     mongoc_bulk_operation_t* bulk,
1209     const(bson_t)* selector);
1210 bool mongoc_bulk_operation_remove_one_with_opts (
1211     mongoc_bulk_operation_t* bulk,
1212     const(bson_t)* selector,
1213     const(bson_t)* opts,
1214     bson_error_t* error); /* OUT */
1215 void mongoc_bulk_operation_replace_one (
1216     mongoc_bulk_operation_t* bulk,
1217     const(bson_t)* selector,
1218     const(bson_t)* document,
1219     bool upsert);
1220 bool mongoc_bulk_operation_replace_one_with_opts (
1221     mongoc_bulk_operation_t* bulk,
1222     const(bson_t)* selector,
1223     const(bson_t)* document,
1224     const(bson_t)* opts,
1225     bson_error_t* error); /* OUT */
1226 void mongoc_bulk_operation_update (
1227     mongoc_bulk_operation_t* bulk,
1228     const(bson_t)* selector,
1229     const(bson_t)* document,
1230     bool upsert);
1231 bool mongoc_bulk_operation_update_many_with_opts (
1232     mongoc_bulk_operation_t* bulk,
1233     const(bson_t)* selector,
1234     const(bson_t)* document,
1235     const(bson_t)* opts,
1236     bson_error_t* error); /* OUT */
1237 void mongoc_bulk_operation_update_one (
1238     mongoc_bulk_operation_t* bulk,
1239     const(bson_t)* selector,
1240     const(bson_t)* document,
1241     bool upsert);
1242 bool mongoc_bulk_operation_update_one_with_opts (
1243     mongoc_bulk_operation_t* bulk,
1244     const(bson_t)* selector,
1245     const(bson_t)* document,
1246     const(bson_t)* opts,
1247     bson_error_t* error); /* OUT */
1248 void mongoc_bulk_operation_set_bypass_document_validation (
1249     mongoc_bulk_operation_t* bulk,
1250     bool bypass);
1251 
1252 /*
1253  * The following functions are really only useful by language bindings and
1254  * those wanting to replay a bulk operation to a number of clients or
1255  * collections.
1256  */
1257 mongoc_bulk_operation_t* mongoc_bulk_operation_new (bool ordered);
1258 void mongoc_bulk_operation_set_write_concern (
1259     mongoc_bulk_operation_t* bulk,
1260     const(mongoc_write_concern_t)* write_concern);
1261 void mongoc_bulk_operation_set_database (
1262     mongoc_bulk_operation_t* bulk,
1263     const(char)* database);
1264 void mongoc_bulk_operation_set_collection (
1265     mongoc_bulk_operation_t* bulk,
1266     const(char)* collection);
1267 void mongoc_bulk_operation_set_client (
1268     mongoc_bulk_operation_t* bulk,
1269     void* client);
1270 
1271 /* These names include the term "hint" for backward compatibility, should be
1272  * mongoc_bulk_operation_get_server_id, mongoc_bulk_operation_set_server_id. */
1273 void mongoc_bulk_operation_set_hint (
1274     mongoc_bulk_operation_t* bulk,
1275     uint server_id);
1276 uint mongoc_bulk_operation_get_hint (const(mongoc_bulk_operation_t)* bulk);
1277 const(mongoc_write_concern_t)* mongoc_bulk_operation_get_write_concern (
1278     const(mongoc_bulk_operation_t)* bulk);
1279 
1280 /* MONGOC_BULK_OPERATION_H */
1281 
1282 // from file mongoc-uri.h:
1283 /*
1284  * Copyright 2013 MongoDB, Inc.
1285  *
1286  * Licensed under the Apache License, Version 2.0 (the "License");
1287  * you may not use this file except in compliance with the License.
1288  * You may obtain a copy of the License at
1289  *
1290  *   http://www.apache.org/licenses/LICENSE-2.0
1291  *
1292  * Unless required by applicable law or agreed to in writing, software
1293  * distributed under the License is distributed on an "AS IS" BASIS,
1294  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1295  * See the License for the specific language governing permissions and
1296  * limitations under the License.
1297  */
1298 
1299 
1300 enum DEFAULT_PORT = 27017;
1301 
1302 enum URI_APPNAME = "appname";
1303 enum URI_AUTHMECHANISM = "authmechanism";
1304 enum URI_AUTHMECHANISMPROPERTIES = "authmechanismproperties";
1305 enum URI_AUTHSOURCE = "authsource";
1306 enum URI_CANONICALIZEHOSTNAME = "canonicalizehostname";
1307 enum URI_CONNECTTIMEOUTMS = "connecttimeoutms";
1308 enum URI_COMPRESSORS = "compressors";
1309 enum URI_GSSAPISERVICENAME = "gssapiservicename";
1310 enum URI_HEARTBEATFREQUENCYMS = "heartbeatfrequencyms";
1311 enum URI_JOURNAL = "journal";
1312 enum URI_LOCALTHRESHOLDMS = "localthresholdms";
1313 enum URI_MAXIDLETIMEMS = "maxidletimems";
1314 enum URI_MAXPOOLSIZE = "maxpoolsize";
1315 enum URI_MAXSTALENESSSECONDS = "maxstalenessseconds";
1316 enum URI_MINPOOLSIZE = "minpoolsize";
1317 enum URI_READCONCERNLEVEL = "readconcernlevel";
1318 enum URI_READPREFERENCE = "readpreference";
1319 enum URI_READPREFERENCETAGS = "readpreferencetags";
1320 enum URI_REPLICASET = "replicaset";
1321 enum URI_SAFE = "safe";
1322 enum URI_SERVERSELECTIONTIMEOUTMS = "serverselectiontimeoutms";
1323 enum URI_SERVERSELECTIONTRYONCE = "serverselectiontryonce";
1324 enum URI_SLAVEOK = "slaveok";
1325 enum URI_SOCKETCHECKINTERVALMS = "socketcheckintervalms";
1326 enum URI_SOCKETTIMEOUTMS = "sockettimeoutms";
1327 enum URI_SSL = "ssl";
1328 enum URI_SSLCLIENTCERTIFICATEKEYFILE = "sslclientcertificatekeyfile";
1329 enum URI_SSLCLIENTCERTIFICATEKEYPASSWORD = "sslclientcertificatekeypassword";
1330 enum URI_SSLCERTIFICATEAUTHORITYFILE = "sslcertificateauthorityfile";
1331 enum URI_SSLALLOWINVALIDCERTIFICATES = "sslallowinvalidcertificates";
1332 enum URI_SSLALLOWINVALIDHOSTNAMES = "sslallowinvalidhostnames";
1333 enum URI_W = "w";
1334 enum URI_WAITQUEUEMULTIPLE = "waitqueuemultiple";
1335 enum URI_WAITQUEUETIMEOUTMS = "waitqueuetimeoutms";
1336 enum URI_WTIMEOUTMS = "wtimeoutms";
1337 enum URI_ZLIBCOMPRESSIONLEVEL = "zlibcompressionlevel";
1338 
1339 struct _mongoc_uri_t;
1340 alias mongoc_uri_t = _mongoc_uri_t;
1341 
1342 mongoc_uri_t* mongoc_uri_copy (const(mongoc_uri_t)* uri);
1343 void mongoc_uri_destroy (mongoc_uri_t* uri);
1344 mongoc_uri_t* mongoc_uri_new (const(char)* uri_string);
1345 mongoc_uri_t* mongoc_uri_new_with_error (
1346     const(char)* uri_string,
1347     bson_error_t* error);
1348 mongoc_uri_t* mongoc_uri_new_for_host_port (const(char)* hostname, ushort port);
1349 const(mongoc_host_list_t)* mongoc_uri_get_hosts (const(mongoc_uri_t)* uri);
1350 const(char)* mongoc_uri_get_database (const(mongoc_uri_t)* uri);
1351 bool mongoc_uri_set_database (mongoc_uri_t* uri, const(char)* database);
1352 const(bson_t)* mongoc_uri_get_compressors (const(mongoc_uri_t)* uri);
1353 const(bson_t)* mongoc_uri_get_options (const(mongoc_uri_t)* uri);
1354 const(char)* mongoc_uri_get_password (const(mongoc_uri_t)* uri);
1355 bool mongoc_uri_set_password (mongoc_uri_t* uri, const(char)* password);
1356 bool mongoc_uri_option_is_int32 (const(char)* key);
1357 bool mongoc_uri_option_is_bool (const(char)* key);
1358 bool mongoc_uri_option_is_utf8 (const(char)* key);
1359 int mongoc_uri_get_option_as_int32 (
1360     const(mongoc_uri_t)* uri,
1361     const(char)* option,
1362     int fallback);
1363 bool mongoc_uri_get_option_as_bool (
1364     const(mongoc_uri_t)* uri,
1365     const(char)* option,
1366     bool fallback);
1367 const(char)* mongoc_uri_get_option_as_utf8 (
1368     const(mongoc_uri_t)* uri,
1369     const(char)* option,
1370     const(char)* fallback);
1371 bool mongoc_uri_set_option_as_int32 (
1372     mongoc_uri_t* uri,
1373     const(char)* option,
1374     int value);
1375 bool mongoc_uri_set_option_as_bool (
1376     mongoc_uri_t* uri,
1377     const(char)* option,
1378     bool value);
1379 bool mongoc_uri_set_option_as_utf8 (
1380     mongoc_uri_t* uri,
1381     const(char)* option,
1382     const(char)* value);
1383 const(bson_t)* mongoc_uri_get_read_prefs (const(mongoc_uri_t)* uri);
1384 const(char)* mongoc_uri_get_replica_set (const(mongoc_uri_t)* uri);
1385 const(char)* mongoc_uri_get_string (const(mongoc_uri_t)* uri);
1386 const(char)* mongoc_uri_get_username (const(mongoc_uri_t)* uri);
1387 bool mongoc_uri_set_username (mongoc_uri_t* uri, const(char)* username);
1388 const(bson_t)* mongoc_uri_get_credentials (const(mongoc_uri_t)* uri);
1389 const(char)* mongoc_uri_get_auth_source (const(mongoc_uri_t)* uri);
1390 bool mongoc_uri_set_auth_source (mongoc_uri_t* uri, const(char)* value);
1391 const(char)* mongoc_uri_get_appname (const(mongoc_uri_t)* uri);
1392 bool mongoc_uri_set_appname (mongoc_uri_t* uri, const(char)* value);
1393 bool mongoc_uri_set_compressors (mongoc_uri_t* uri, const(char)* value);
1394 const(char)* mongoc_uri_get_auth_mechanism (const(mongoc_uri_t)* uri);
1395 bool mongoc_uri_set_auth_mechanism (mongoc_uri_t* uri, const(char)* value);
1396 bool mongoc_uri_get_mechanism_properties (
1397     const(mongoc_uri_t)* uri,
1398     bson_t* properties);
1399 bool mongoc_uri_set_mechanism_properties (
1400     mongoc_uri_t* uri,
1401     const(bson_t)* properties);
1402 bool mongoc_uri_get_ssl (const(mongoc_uri_t)* uri);
1403 char* mongoc_uri_unescape (const(char)* escaped_string);
1404 const(mongoc_read_prefs_t)* mongoc_uri_get_read_prefs_t (
1405     const(mongoc_uri_t)* uri);
1406 void mongoc_uri_set_read_prefs_t (
1407     mongoc_uri_t* uri,
1408     const(mongoc_read_prefs_t)* prefs);
1409 const(mongoc_write_concern_t)* mongoc_uri_get_write_concern (
1410     const(mongoc_uri_t)* uri);
1411 void mongoc_uri_set_write_concern (
1412     mongoc_uri_t* uri,
1413     const(mongoc_write_concern_t)* wc);
1414 const(mongoc_read_concern_t)* mongoc_uri_get_read_concern (
1415     const(mongoc_uri_t)* uri);
1416 void mongoc_uri_set_read_concern (
1417     mongoc_uri_t* uri,
1418     const(mongoc_read_concern_t)* rc);
1419 
1420 /* MONGOC_URI_H */
1421 
1422 // from file mongoc-find-and-modify.h:
1423 /*
1424  * Copyright 2015 MongoDB, Inc.
1425  *
1426  * Licensed under the Apache License, Version 2.0 (the "License");
1427  * you may not use this file except in compliance with the License.
1428  * You may obtain a copy of the License at
1429  *
1430  *   http://www.apache.org/licenses/LICENSE-2.0
1431  *
1432  * Unless required by applicable law or agreed to in writing, software
1433  * distributed under the License is distributed on an "AS IS" BASIS,
1434  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1435  * See the License for the specific language governing permissions and
1436  * limitations under the License.
1437  */
1438 
1439 
1440 enum mongoc_find_and_modify_flags_t
1441 {
1442     AND_MODIFY_NONE = 0,
1443     AND_MODIFY_REMOVE = 1,
1444     AND_MODIFY_UPSERT = 2,
1445     AND_MODIFY_RETURN_NEW = 4
1446 }
1447 
1448 struct _mongoc_find_and_modify_opts_t;
1449 alias mongoc_find_and_modify_opts_t = _mongoc_find_and_modify_opts_t;
1450 
1451 mongoc_find_and_modify_opts_t* mongoc_find_and_modify_opts_new ();
1452 
1453 bool mongoc_find_and_modify_opts_set_sort (
1454     mongoc_find_and_modify_opts_t* opts,
1455     const(bson_t)* sort);
1456 
1457 void mongoc_find_and_modify_opts_get_sort (
1458     const(mongoc_find_and_modify_opts_t)* opts,
1459     bson_t* sort);
1460 
1461 bool mongoc_find_and_modify_opts_set_update (
1462     mongoc_find_and_modify_opts_t* opts,
1463     const(bson_t)* update);
1464 
1465 void mongoc_find_and_modify_opts_get_update (
1466     const(mongoc_find_and_modify_opts_t)* opts,
1467     bson_t* update);
1468 
1469 bool mongoc_find_and_modify_opts_set_fields (
1470     mongoc_find_and_modify_opts_t* opts,
1471     const(bson_t)* fields);
1472 
1473 void mongoc_find_and_modify_opts_get_fields (
1474     const(mongoc_find_and_modify_opts_t)* opts,
1475     bson_t* fields);
1476 
1477 bool mongoc_find_and_modify_opts_set_flags (
1478     mongoc_find_and_modify_opts_t* opts,
1479     const mongoc_find_and_modify_flags_t flags);
1480 
1481 mongoc_find_and_modify_flags_t mongoc_find_and_modify_opts_get_flags (
1482     const(mongoc_find_and_modify_opts_t)* opts);
1483 
1484 bool mongoc_find_and_modify_opts_set_bypass_document_validation (
1485     mongoc_find_and_modify_opts_t* opts,
1486     bool bypass);
1487 
1488 bool mongoc_find_and_modify_opts_get_bypass_document_validation (
1489     const(mongoc_find_and_modify_opts_t)* opts);
1490 
1491 bool mongoc_find_and_modify_opts_set_max_time_ms (
1492     mongoc_find_and_modify_opts_t* opts,
1493     uint max_time_ms);
1494 
1495 uint mongoc_find_and_modify_opts_get_max_time_ms (
1496     const(mongoc_find_and_modify_opts_t)* opts);
1497 
1498 bool mongoc_find_and_modify_opts_append (
1499     mongoc_find_and_modify_opts_t* opts,
1500     const(bson_t)* extra);
1501 
1502 void mongoc_find_and_modify_opts_get_extra (
1503     const(mongoc_find_and_modify_opts_t)* opts,
1504     bson_t* extra);
1505 
1506 void mongoc_find_and_modify_opts_destroy (mongoc_find_and_modify_opts_t* opts);
1507 
1508 /* MONGOC_FIND_AND_MODIFY_H */
1509 
1510 // from file mongoc-stream-file.h:
1511 /*
1512  * Copyright 2014 MongoDB, Inc.
1513  *
1514  * Licensed under the Apache License, Version 2.0 (the "License");
1515  * you may not use this file except in compliance with the License.
1516  * You may obtain a copy of the License at
1517  *
1518  *   http://www.apache.org/licenses/LICENSE-2.0
1519  *
1520  * Unless required by applicable law or agreed to in writing, software
1521  * distributed under the License is distributed on an "AS IS" BASIS,
1522  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1523  * See the License for the specific language governing permissions and
1524  * limitations under the License.
1525  */
1526 
1527 
1528 struct _mongoc_stream_file_t;
1529 alias mongoc_stream_file_t = _mongoc_stream_file_t;
1530 
1531 mongoc_stream_t* mongoc_stream_file_new (int fd);
1532 mongoc_stream_t* mongoc_stream_file_new_for_path (
1533     const(char)* path,
1534     int flags,
1535     int mode);
1536 int mongoc_stream_file_get_fd (mongoc_stream_file_t* stream);
1537 
1538 /* MONGOC_STREAM_FILE_H */
1539 
1540 // from file mongoc-read-concern.h:
1541 /*
1542  * Copyright 2015 MongoDB, Inc.
1543  *
1544  * Licensed under the Apache License, Version 2.0 (the "License");
1545  * you may not use this file except in compliance with the License.
1546  * You may obtain a copy of the License at
1547  *
1548  *   http://www.apache.org/licenses/LICENSE-2.0
1549  *
1550  * Unless required by applicable law or agreed to in writing, software
1551  * distributed under the License is distributed on an "AS IS" BASIS,
1552  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1553  * See the License for the specific language governing permissions and
1554  * limitations under the License.
1555  */
1556 
1557 
1558 enum READ_CONCERN_LEVEL_LOCAL = "local";
1559 enum READ_CONCERN_LEVEL_MAJORITY = "majority";
1560 enum READ_CONCERN_LEVEL_LINEARIZABLE = "linearizable";
1561 
1562 struct _mongoc_read_concern_t;
1563 alias mongoc_read_concern_t = _mongoc_read_concern_t;
1564 
1565 mongoc_read_concern_t* mongoc_read_concern_new ();
1566 mongoc_read_concern_t* mongoc_read_concern_copy (
1567     const(mongoc_read_concern_t)* read_concern);
1568 void mongoc_read_concern_destroy (mongoc_read_concern_t* read_concern);
1569 const(char)* mongoc_read_concern_get_level (
1570     const(mongoc_read_concern_t)* read_concern);
1571 bool mongoc_read_concern_set_level (
1572     mongoc_read_concern_t* read_concern,
1573     const(char)* level);
1574 bool mongoc_read_concern_append (
1575     mongoc_read_concern_t* read_concern,
1576     bson_t* doc);
1577 bool mongoc_read_concern_is_default (
1578     const(mongoc_read_concern_t)* read_concern);
1579 
1580 /* MONGOC_READ_CONCERN_H */
1581 
1582 // from file mongoc-stream-tls-openssl.h:
1583 /*
1584  * Copyright 2016 MongoDB, Inc.
1585  *
1586  * Licensed under the Apache License, Version 2.0 (the "License");
1587  * you may not use this file except in compliance with the License.
1588  * You may obtain a copy of the License at
1589  *
1590  *   http://www.apache.org/licenses/LICENSE-2.0
1591  *
1592  * Unless required by applicable law or agreed to in writing, software
1593  * distributed under the License is distributed on an "AS IS" BASIS,
1594  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1595  * See the License for the specific language governing permissions and
1596  * limitations under the License.
1597  */
1598 
1599 
1600 /* MONGOC_ENABLE_SSL_OPENSSL */
1601 /* MONGOC_STREAM_TLS_OPENSSL_H */
1602 
1603 // from file mongoc-version-functions.h:
1604 /*
1605  * Copyright 2015 MongoDB, Inc.
1606  *
1607  * Licensed under the Apache License, Version 2.0 (the "License");
1608  * you may not use this file except in compliance with the License.
1609  * You may obtain a copy of the License at
1610  *
1611  *   http://www.apache.org/licenses/LICENSE-2.0
1612  *
1613  * Unless required by applicable law or agreed to in writing, software
1614  * distributed under the License is distributed on an "AS IS" BASIS,
1615  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1616  * See the License for the specific language governing permissions and
1617  * limitations under the License.
1618  */
1619 
1620 
1621 /* for "bool" */
1622 
1623 int mongoc_get_major_version ();
1624 int mongoc_get_minor_version ();
1625 int mongoc_get_micro_version ();
1626 const(char)* mongoc_get_version ();
1627 bool mongoc_check_version (
1628     int required_major,
1629     int required_minor,
1630     int required_micro);
1631 
1632 /* MONGOC_VERSION_FUNCTIONS_H */
1633 
1634 // from file mongoc-gridfs-file.h:
1635 /*
1636  * Copyright 2013 MongoDB Inc.
1637  *
1638  * Licensed under the Apache License, Version 2.0 (the "License");
1639  * you may not use this file except in compliance with the License.
1640  * You may obtain a copy of the License at
1641  *
1642  *   http://www.apache.org/licenses/LICENSE-2.0
1643  *
1644  * Unless required by applicable law or agreed to in writing, software
1645  * distributed under the License is distributed on an "AS IS" BASIS,
1646  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1647  * See the License for the specific language governing permissions and
1648  * limitations under the License.
1649  */
1650 
1651 
1652 
1653 struct _mongoc_gridfs_file_t;
1654 alias mongoc_gridfs_file_t = _mongoc_gridfs_file_t;
1655 alias mongoc_gridfs_file_opt_t = _mongoc_gridfs_file_opt_t;
1656 
1657 struct _mongoc_gridfs_file_opt_t
1658 {
1659     const(char)* md5;
1660     const(char)* filename;
1661     const(char)* content_type;
1662     const(bson_t)* aliases;
1663     const(bson_t)* metadata;
1664     uint chunk_size;
1665 }
1666 
1667 const(char)* mongoc_gridfs_file_get_md5 (mongoc_gridfs_file_t* file);
1668 void mongoc_gridfs_file_set_md5 (mongoc_gridfs_file_t* file, const(char)* str);
1669 const(char)* mongoc_gridfs_file_get_filename (mongoc_gridfs_file_t* file);
1670 void mongoc_gridfs_file_set_filename (mongoc_gridfs_file_t* file, const(char)* str);
1671 const(char)* mongoc_gridfs_file_get_content_type (mongoc_gridfs_file_t* file);
1672 void mongoc_gridfs_file_set_content_type (mongoc_gridfs_file_t* file, const(char)* str);
1673 const(bson_t)* mongoc_gridfs_file_get_aliases (mongoc_gridfs_file_t* file);
1674 void mongoc_gridfs_file_set_aliases (mongoc_gridfs_file_t* file, const(bson_t)* bson);
1675 const(bson_t)* mongoc_gridfs_file_get_metadata (mongoc_gridfs_file_t* file);
1676 void mongoc_gridfs_file_set_metadata (mongoc_gridfs_file_t* file, const(bson_t)* bson);
1677 
1678 const(bson_value_t)* mongoc_gridfs_file_get_id (mongoc_gridfs_file_t* file);
1679 
1680 long mongoc_gridfs_file_get_length (mongoc_gridfs_file_t* file);
1681 
1682 int mongoc_gridfs_file_get_chunk_size (mongoc_gridfs_file_t* file);
1683 
1684 long mongoc_gridfs_file_get_upload_date (mongoc_gridfs_file_t* file);
1685 
1686 ssize_t mongoc_gridfs_file_writev (
1687     mongoc_gridfs_file_t* file,
1688     const(mongoc_iovec_t)* iov,
1689     size_t iovcnt,
1690     uint timeout_msec);
1691 ssize_t mongoc_gridfs_file_readv (
1692     mongoc_gridfs_file_t* file,
1693     mongoc_iovec_t* iov,
1694     size_t iovcnt,
1695     size_t min_bytes,
1696     uint timeout_msec);
1697 int mongoc_gridfs_file_seek (
1698     mongoc_gridfs_file_t* file,
1699     long delta,
1700     int whence);
1701 
1702 ulong mongoc_gridfs_file_tell (mongoc_gridfs_file_t* file);
1703 
1704 bool mongoc_gridfs_file_set_id (
1705     mongoc_gridfs_file_t* file,
1706     const(bson_value_t)* id,
1707     bson_error_t* error);
1708 
1709 bool mongoc_gridfs_file_save (mongoc_gridfs_file_t* file);
1710 
1711 void mongoc_gridfs_file_destroy (mongoc_gridfs_file_t* file);
1712 
1713 bool mongoc_gridfs_file_error (mongoc_gridfs_file_t* file, bson_error_t* error);
1714 
1715 bool mongoc_gridfs_file_remove (
1716     mongoc_gridfs_file_t* file,
1717     bson_error_t* error);
1718 
1719 /* MONGOC_GRIDFS_FILE_H */
1720 
1721 // from file mongoc-gridfs-file-page.h:
1722 /*
1723  * Copyright 2013 MongoDB Inc.
1724  *
1725  * Licensed under the Apache License, Version 2.0 (the "License");
1726  * you may not use this file except in compliance with the License.
1727  * You may obtain a copy of the License at
1728  *
1729  *   http://www.apache.org/licenses/LICENSE-2.0
1730  *
1731  * Unless required by applicable law or agreed to in writing, software
1732  * distributed under the License is distributed on an "AS IS" BASIS,
1733  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1734  * See the License for the specific language governing permissions and
1735  * limitations under the License.
1736  */
1737 
1738 
1739 struct _mongoc_gridfs_file_page_t;
1740 alias mongoc_gridfs_file_page_t = _mongoc_gridfs_file_page_t;
1741 
1742 /* MONGOC_GRIDFS_FILE_PAGE_H */
1743 
1744 // from file mongoc-macros.h:
1745 /*
1746  * Copyright 2017 MongoDB, Inc.
1747  *
1748  * Licensed under the Apache License, Version 2.0 (the "License");
1749  * you may not use this file except in compliance with the License.
1750  * You may obtain a copy of the License at
1751  *
1752  *   http://www.apache.org/licenses/LICENSE-2.0
1753  *
1754  * Unless required by applicable law or agreed to in writing, software
1755  * distributed under the License is distributed on an "AS IS" BASIS,
1756  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1757  * See the License for the specific language governing permissions and
1758  * limitations under the License.
1759  */
1760 
1761 
1762 /* Decorate public functions:
1763  * - if MONGOC_STATIC, we're compiling a program that uses libmongoc as
1764  *   a static library, don't decorate functions
1765  * - else if MONGOC_COMPILATION, we're compiling a static or shared libmongoc,
1766  *   mark public functions for export from the shared lib (which has no effect
1767  *   on the static lib)
1768  * - else, we're compiling a program that uses libmongoc as a shared library,
1769  *   mark public functions as DLL imports for Microsoft Visual C.
1770  */
1771 
1772 /*
1773  * Microsoft Visual C
1774  */
1775 
1776 /*
1777  * GCC
1778  */
1779 
1780 /*
1781  * Other compilers
1782  */
1783 
1784 /* MONGOC_MACROS_H */
1785 
1786 // from file mongoc-crypto-cng.h:
1787 /*
1788  * Copyright 2016 MongoDB, Inc.
1789  *
1790  * Licensed under the Apache License, Version 2.0 (the "License");
1791  * you may not use this file except in compliance with the License.
1792  * You may obtain a copy of the License at
1793  *
1794  *   http://www.apache.org/licenses/LICENSE-2.0
1795  *
1796  * Unless required by applicable law or agreed to in writing, software
1797  * distributed under the License is distributed on an "AS IS" BASIS,
1798  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1799  * See the License for the specific language governing permissions and
1800  * limitations under the License.
1801  */
1802 
1803 
1804 /* OUT */
1805 
1806 /* OUT */
1807 
1808 /* MONGOC_CRYPTO_CNG_H */
1809 /* MONGOC_ENABLE_CRYPTO_CNG */
1810 
1811 // from file mongoc-read-prefs.h:
1812 /*
1813  * Copyright 2013 MongoDB, Inc.
1814  *
1815  * Licensed under the Apache License, Version 2.0 (the "License");
1816  * you may not use this file except in compliance with the License.
1817  * You may obtain a copy of the License at
1818  *
1819  *   http://www.apache.org/licenses/LICENSE-2.0
1820  *
1821  * Unless required by applicable law or agreed to in writing, software
1822  * distributed under the License is distributed on an "AS IS" BASIS,
1823  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1824  * See the License for the specific language governing permissions and
1825  * limitations under the License.
1826  */
1827 
1828 
1829 enum NO_MAX_STALENESS = -1;
1830 enum SMALLEST_MAX_STALENESS_SECONDS = 90;
1831 
1832 struct _mongoc_read_prefs_t;
1833 alias mongoc_read_prefs_t = _mongoc_read_prefs_t;
1834 
1835 enum mongoc_read_mode_t
1836 {
1837     PRIMARY = 1,
1838     SECONDARY = 2,
1839     PRIMARY_PREFERRED = 5,
1840     SECONDARY_PREFERRED = 6,
1841     NEAREST = 10
1842 }
1843 
1844 mongoc_read_prefs_t* mongoc_read_prefs_new (mongoc_read_mode_t read_mode);
1845 mongoc_read_prefs_t* mongoc_read_prefs_copy (
1846     const(mongoc_read_prefs_t)* read_prefs);
1847 void mongoc_read_prefs_destroy (mongoc_read_prefs_t* read_prefs);
1848 mongoc_read_mode_t mongoc_read_prefs_get_mode (
1849     const(mongoc_read_prefs_t)* read_prefs);
1850 void mongoc_read_prefs_set_mode (
1851     mongoc_read_prefs_t* read_prefs,
1852     mongoc_read_mode_t mode);
1853 const(bson_t)* mongoc_read_prefs_get_tags (
1854     const(mongoc_read_prefs_t)* read_prefs);
1855 void mongoc_read_prefs_set_tags (
1856     mongoc_read_prefs_t* read_prefs,
1857     const(bson_t)* tags);
1858 void mongoc_read_prefs_add_tag (
1859     mongoc_read_prefs_t* read_prefs,
1860     const(bson_t)* tag);
1861 long mongoc_read_prefs_get_max_staleness_seconds (
1862     const(mongoc_read_prefs_t)* read_prefs);
1863 void mongoc_read_prefs_set_max_staleness_seconds (
1864     mongoc_read_prefs_t* read_prefs,
1865     long max_staleness_seconds);
1866 bool mongoc_read_prefs_is_valid (const(mongoc_read_prefs_t)* read_prefs);
1867 
1868 /* MONGOC_READ_PREFS_H */
1869 
1870 // from file mongoc.h:
1871 /*
1872  * Copyright 2013 MongoDB, Inc.
1873  *
1874  * Licensed under the Apache License, Version 2.0 (the "License");
1875  * you may not use this file except in compliance with the License.
1876  * You may obtain a copy of the License at
1877  *
1878  *   http://www.apache.org/licenses/LICENSE-2.0
1879  *
1880  * Unless required by applicable law or agreed to in writing, software
1881  * distributed under the License is distributed on an "AS IS" BASIS,
1882  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1883  * See the License for the specific language governing permissions and
1884  * limitations under the License.
1885  */
1886 
1887 
1888 /* MONGOC_H */
1889 
1890 // from file mongoc-gridfs-file-list.h:
1891 /*
1892  * Copyright 2013 MongoDB Inc.
1893  *
1894  * Licensed under the Apache License, Version 2.0 (the "License");
1895  * you may not use this file except in compliance with the License.
1896  * You may obtain a copy of the License at
1897  *
1898  *   http://www.apache.org/licenses/LICENSE-2.0
1899  *
1900  * Unless required by applicable law or agreed to in writing, software
1901  * distributed under the License is distributed on an "AS IS" BASIS,
1902  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1903  * See the License for the specific language governing permissions and
1904  * limitations under the License.
1905  */
1906 
1907 
1908 struct _mongoc_gridfs_file_list_t;
1909 alias mongoc_gridfs_file_list_t = _mongoc_gridfs_file_list_t;
1910 
1911 mongoc_gridfs_file_t* mongoc_gridfs_file_list_next (
1912     mongoc_gridfs_file_list_t* list);
1913 void mongoc_gridfs_file_list_destroy (mongoc_gridfs_file_list_t* list);
1914 bool mongoc_gridfs_file_list_error (
1915     mongoc_gridfs_file_list_t* list,
1916     bson_error_t* error);
1917 
1918 /* MONGOC_GRIDFS_FILE_LIST_H */
1919 
1920 // from file mongoc-stream-tls.h:
1921 /*
1922  * Copyright 2013 MongoDB, Inc.
1923  *
1924  * Licensed under the Apache License, Version 2.0 (the "License");
1925  * you may not use this file except in compliance with the License.
1926  * You may obtain a copy of the License at
1927  *
1928  *   http://www.apache.org/licenses/LICENSE-2.0
1929  *
1930  * Unless required by applicable law or agreed to in writing, software
1931  * distributed under the License is distributed on an "AS IS" BASIS,
1932  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1933  * See the License for the specific language governing permissions and
1934  * limitations under the License.
1935  */
1936 
1937 
1938 struct _mongoc_stream_tls_t;
1939 alias mongoc_stream_tls_t = _mongoc_stream_tls_t;
1940 
1941 bool mongoc_stream_tls_handshake (
1942     mongoc_stream_t* stream,
1943     const(char)* host,
1944     int timeout_msec,
1945     int* events,
1946     bson_error_t* error);
1947 bool mongoc_stream_tls_handshake_block (
1948     mongoc_stream_t* stream,
1949     const(char)* host,
1950     int timeout_msec,
1951     bson_error_t* error);
1952 bool mongoc_stream_tls_do_handshake (mongoc_stream_t* stream, int timeout_msec);
1953 bool mongoc_stream_tls_check_cert (mongoc_stream_t* stream, const(char)* host);
1954 mongoc_stream_t* mongoc_stream_tls_new_with_hostname (
1955     mongoc_stream_t* base_stream,
1956     const(char)* host,
1957     mongoc_ssl_opt_t* opt,
1958     int client);
1959 mongoc_stream_t* mongoc_stream_tls_new (
1960     mongoc_stream_t* base_stream,
1961     mongoc_ssl_opt_t* opt,
1962     int client);
1963 
1964 /* MONGOC_STREAM_TLS_H */
1965 
1966 // from file mongoc-client.h:
1967 /*
1968  * Copyright 2013 MongoDB, Inc.
1969  *
1970  * Licensed under the Apache License, Version 2.0 (the "License");
1971  * you may not use this file except in compliance with the License.
1972  * You may obtain a copy of the License at
1973  *
1974  *   http://www.apache.org/licenses/LICENSE-2.0
1975  *
1976  * Unless required by applicable law or agreed to in writing, software
1977  * distributed under the License is distributed on an "AS IS" BASIS,
1978  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1979  * See the License for the specific language governing permissions and
1980  * limitations under the License.
1981  */
1982 
1983 
1984 enum NAMESPACE_MAX = 128;
1985 
1986 enum DEFAULT_CONNECTTIMEOUTMS = 10 * 1000L;
1987 
1988 /*
1989  * NOTE: The default socket timeout for connections is 5 minutes. This
1990  *       means that if your MongoDB server dies or becomes unavailable
1991  *       it will take 5 minutes to detect this.
1992  *
1993  *       You can change this by providing sockettimeoutms= in your
1994  *       connection URI.
1995  */
1996 enum DEFAULT_SOCKETTIMEOUTMS = 1000L * 60L * 5L;
1997 
1998 /**
1999  * mongoc_client_t:
2000  *
2001  * The mongoc_client_t structure maintains information about a connection to
2002  * a MongoDB server.
2003  */
2004 struct _mongoc_client_t;
2005 alias mongoc_client_t = _mongoc_client_t;
2006 
2007 /**
2008  * mongoc_stream_initiator_t:
2009  * @uri: The uri and options for the stream.
2010  * @host: The host and port (or UNIX domain socket path) to connect to.
2011  * @user_data: The pointer passed to mongoc_client_set_stream_initiator.
2012  * @error: A location for an error.
2013  *
2014  * Creates a new mongoc_stream_t for the host and port. Begin a
2015  * non-blocking connect and return immediately.
2016  *
2017  * This can be used by language bindings to create network transports other
2018  * than those built into libmongoc. An example of such would be the streams
2019  * API provided by PHP.
2020  *
2021  * Returns: A newly allocated mongoc_stream_t or NULL on failure.
2022  */
2023 alias mongoc_stream_initiator_t = _mongoc_stream_t* function (const(mongoc_uri_t)* uri, const(mongoc_host_list_t)* host, void* user_data, bson_error_t* error);
2024 
2025 mongoc_client_t* mongoc_client_new (const(char)* uri_string);
2026 mongoc_client_t* mongoc_client_new_from_uri (const(mongoc_uri_t)* uri);
2027 const(mongoc_uri_t)* mongoc_client_get_uri (const(mongoc_client_t)* client);
2028 void mongoc_client_set_stream_initiator (
2029     mongoc_client_t* client,
2030     mongoc_stream_initiator_t initiator,
2031     void* user_data);
2032 mongoc_cursor_t* mongoc_client_command (
2033     mongoc_client_t* client,
2034     const(char)* db_name,
2035     mongoc_query_flags_t flags,
2036     uint skip,
2037     uint limit,
2038     uint batch_size,
2039     const(bson_t)* query,
2040     const(bson_t)* fields,
2041     const(mongoc_read_prefs_t)* read_prefs);
2042 void mongoc_client_kill_cursor (mongoc_client_t* client, long cursor_id);
2043 bool mongoc_client_command_simple (
2044     mongoc_client_t* client,
2045     const(char)* db_name,
2046     const(bson_t)* command,
2047     const(mongoc_read_prefs_t)* read_prefs,
2048     bson_t* reply,
2049     bson_error_t* error);
2050 bool mongoc_client_read_command_with_opts (
2051     mongoc_client_t* client,
2052     const(char)* db_name,
2053     const(bson_t)* command,
2054     const(mongoc_read_prefs_t)* read_prefs,
2055     const(bson_t)* opts,
2056     bson_t* reply,
2057     bson_error_t* error);
2058 bool mongoc_client_write_command_with_opts (
2059     mongoc_client_t* client,
2060     const(char)* db_name,
2061     const(bson_t)* command,
2062     const(bson_t)* opts,
2063     bson_t* reply,
2064     bson_error_t* error);
2065 
2066 /* IGNORED */
2067 bool mongoc_client_read_write_command_with_opts (
2068     mongoc_client_t* client,
2069     const(char)* db_name,
2070     const(bson_t)* command,
2071     const(mongoc_read_prefs_t)* read_prefs,
2072     const(bson_t)* opts,
2073     bson_t* reply,
2074     bson_error_t* error);
2075 bool mongoc_client_command_simple_with_server_id (
2076     mongoc_client_t* client,
2077     const(char)* db_name,
2078     const(bson_t)* command,
2079     const(mongoc_read_prefs_t)* read_prefs,
2080     uint server_id,
2081     bson_t* reply,
2082     bson_error_t* error);
2083 void mongoc_client_destroy (mongoc_client_t* client);
2084 mongoc_database_t* mongoc_client_get_database (
2085     mongoc_client_t* client,
2086     const(char)* name);
2087 mongoc_database_t* mongoc_client_get_default_database (mongoc_client_t* client);
2088 mongoc_gridfs_t* mongoc_client_get_gridfs (
2089     mongoc_client_t* client,
2090     const(char)* db,
2091     const(char)* prefix,
2092     bson_error_t* error);
2093 mongoc_collection_t* mongoc_client_get_collection (
2094     mongoc_client_t* client,
2095     const(char)* db,
2096     const(char)* collection);
2097 char** mongoc_client_get_database_names (
2098     mongoc_client_t* client,
2099     bson_error_t* error);
2100 mongoc_cursor_t* mongoc_client_find_databases (
2101     mongoc_client_t* client,
2102     bson_error_t* error);
2103 bool mongoc_client_get_server_status (
2104     mongoc_client_t* client,
2105     mongoc_read_prefs_t* read_prefs,
2106     bson_t* reply,
2107     bson_error_t* error);
2108 int mongoc_client_get_max_message_size (mongoc_client_t* client);
2109 int mongoc_client_get_max_bson_size (mongoc_client_t* client);
2110 const(mongoc_write_concern_t)* mongoc_client_get_write_concern (
2111     const(mongoc_client_t)* client);
2112 void mongoc_client_set_write_concern (
2113     mongoc_client_t* client,
2114     const(mongoc_write_concern_t)* write_concern);
2115 const(mongoc_read_concern_t)* mongoc_client_get_read_concern (
2116     const(mongoc_client_t)* client);
2117 void mongoc_client_set_read_concern (
2118     mongoc_client_t* client,
2119     const(mongoc_read_concern_t)* read_concern);
2120 const(mongoc_read_prefs_t)* mongoc_client_get_read_prefs (
2121     const(mongoc_client_t)* client);
2122 void mongoc_client_set_read_prefs (
2123     mongoc_client_t* client,
2124     const(mongoc_read_prefs_t)* read_prefs);
2125 void mongoc_client_set_ssl_opts (
2126     mongoc_client_t* client,
2127     const(mongoc_ssl_opt_t)* opts);
2128 
2129 bool mongoc_client_set_apm_callbacks (
2130     mongoc_client_t* client,
2131     mongoc_apm_callbacks_t* callbacks,
2132     void* context);
2133 mongoc_server_description_t* mongoc_client_get_server_description (
2134     mongoc_client_t* client,
2135     uint server_id);
2136 mongoc_server_description_t** mongoc_client_get_server_descriptions (
2137     const(mongoc_client_t)* client,
2138     size_t* n);
2139 void mongoc_server_descriptions_destroy_all (
2140     mongoc_server_description_t** sds,
2141     size_t n);
2142 mongoc_server_description_t* mongoc_client_select_server (
2143     mongoc_client_t* client,
2144     bool for_writes,
2145     const(mongoc_read_prefs_t)* prefs,
2146     bson_error_t* error);
2147 bool mongoc_client_set_error_api (mongoc_client_t* client, int version_);
2148 bool mongoc_client_set_appname (mongoc_client_t* client, const(char)* appname);
2149 
2150 /* MONGOC_CLIENT_H */
2151 
2152 // from file mongoc-client-pool.h:
2153 /*
2154  * Copyright 2013 MongoDB, Inc.
2155  *
2156  * Licensed under the Apache License, Version 2.0 (the "License");
2157  * you may not use this file except in compliance with the License.
2158  * You may obtain a copy of the License at
2159  *
2160  *   http://www.apache.org/licenses/LICENSE-2.0
2161  *
2162  * Unless required by applicable law or agreed to in writing, software
2163  * distributed under the License is distributed on an "AS IS" BASIS,
2164  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2165  * See the License for the specific language governing permissions and
2166  * limitations under the License.
2167  */
2168 
2169 
2170 struct _mongoc_client_pool_t;
2171 alias mongoc_client_pool_t = _mongoc_client_pool_t;
2172 
2173 mongoc_client_pool_t* mongoc_client_pool_new (const(mongoc_uri_t)* uri);
2174 void mongoc_client_pool_destroy (mongoc_client_pool_t* pool);
2175 mongoc_client_t* mongoc_client_pool_pop (mongoc_client_pool_t* pool);
2176 void mongoc_client_pool_push (
2177     mongoc_client_pool_t* pool,
2178     mongoc_client_t* client);
2179 mongoc_client_t* mongoc_client_pool_try_pop (mongoc_client_pool_t* pool);
2180 void mongoc_client_pool_max_size (
2181     mongoc_client_pool_t* pool,
2182     uint max_pool_size);
2183 void mongoc_client_pool_min_size (
2184     mongoc_client_pool_t* pool,
2185     uint min_pool_size);
2186 void mongoc_client_pool_set_ssl_opts (
2187     mongoc_client_pool_t* pool,
2188     const(mongoc_ssl_opt_t)* opts);
2189 
2190 bool mongoc_client_pool_set_apm_callbacks (
2191     mongoc_client_pool_t* pool,
2192     mongoc_apm_callbacks_t* callbacks,
2193     void* context);
2194 bool mongoc_client_pool_set_error_api (
2195     mongoc_client_pool_t* pool,
2196     int version_);
2197 bool mongoc_client_pool_set_appname (
2198     mongoc_client_pool_t* pool,
2199     const(char)* appname);
2200 
2201 /* MONGOC_CLIENT_POOL_H */
2202 
2203 // from file mongoc-opcode.h:
2204 /*
2205  * Copyright 2013 MongoDB, Inc.
2206  *
2207  * Licensed under the Apache License, Version 2.0 (the "License");
2208  * you may not use this file except in compliance with the License.
2209  * You may obtain a copy of the License at
2210  *
2211  *   http://www.apache.org/licenses/LICENSE-2.0
2212  *
2213  * Unless required by applicable law or agreed to in writing, software
2214  * distributed under the License is distributed on an "AS IS" BASIS,
2215  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2216  * See the License for the specific language governing permissions and
2217  * limitations under the License.
2218  */
2219 
2220 
2221 enum mongoc_opcode_t
2222 {
2223     REPLY = 1,
2224     MSG = 1000,
2225     UPDATE = 2001,
2226     INSERT = 2002,
2227     QUERY = 2004,
2228     GET_MORE = 2005,
2229     DELETE = 2006,
2230     KILL_CURSORS = 2007,
2231     COMPRESSED = 2012
2232 }
2233 
2234 /* MONGOC_OPCODE_H */
2235 
2236 // from file mongoc-handshake.h:
2237 /*
2238  * Copyright 2016 MongoDB, Inc.
2239  *
2240  * Licensed under the Apache License, Version 2.0 (the "License");
2241  * you may not use this file except in compliance with the License.
2242  * You may obtain a copy of the License at
2243  *
2244  *   http://www.apache.org/licenses/LICENSE-2.0
2245  *
2246  * Unless required by applicable law or agreed to in writing, software
2247  * distributed under the License is distributed on an "AS IS" BASIS,
2248  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2249  * See the License for the specific language governing permissions and
2250  * limitations under the License.
2251  */
2252 
2253 
2254 enum HANDSHAKE_APPNAME_MAX = 128;
2255 
2256 /**
2257  * mongoc_handshake_data_append:
2258  *
2259  * This function is intended for use by drivers which wrap the C Driver.
2260  * Calling this function will store the given strings as handshake data about
2261  * the system and driver by appending them to the handshake data for the
2262  * underlying C Driver. These values, along with other handshake data collected
2263  * during mongoc_init will be sent to the server as part of the initial
2264  * connection handshake in the "client" document. This function cannot be
2265  * called more than once, or after a handshake has been initiated.
2266  *
2267  * The passed in strings are copied, and don't have to remain valid after the
2268  * call to mongoc_handshake_data_append(). The driver may store truncated
2269  * versions of the passed in strings.
2270  *
2271  * Note:
2272  *   This function allocates memory, and therefore caution should be used when
2273  *   using this in conjunction with bson_mem_set_vtable. If this function is
2274  *   called before bson_mem_set_vtable, then bson_mem_restore_vtable must be
2275  *   called before calling mongoc_cleanup. Failure to do so will result in
2276  *   memory being freed by the wrong allocator.
2277  *
2278  *
2279  * @driver_name: An optional string storing the name of the wrapping driver
2280  * @driver_version: An optional string storing the version of the wrapping
2281  * driver.
2282  * @platform: An optional string storing any information about the current
2283  *            platform, for example configure options or compile flags.
2284  *
2285  *
2286  * Returns true if the given fields are set successfully. Otherwise, it returns
2287  * false and logs an error.
2288  *
2289  * The default handshake data the driver sends with "isMaster" looks something
2290  * like:
2291  *  client: {
2292  *    driver: {
2293  *      name: "mongoc",
2294  *      version: "1.5.0"
2295  *    },
2296  *    os: {...},
2297  *    platform: "CC=gcc CFLAGS=-Wall -pedantic"
2298  *  }
2299  *
2300  * If we call
2301  *   mongoc_handshake_data_append ("phongo", "1.1.8", "CC=clang")
2302  * and it returns true, the driver sends handshake data like:
2303  *  client: {
2304  *    driver: {
2305  *      name: "mongoc / phongo",
2306  *      version: "1.5.0 / 1.1.8"
2307  *    },
2308  *    os: {...},
2309  *    platform: "CC=gcc CFLAGS=-Wall -pedantic / CC=clang"
2310  *  }
2311  *
2312  */
2313 bool mongoc_handshake_data_append (
2314     const(char)* driver_name,
2315     const(char)* driver_version,
2316     const(char)* platform);
2317 
2318 
2319 // from file mongoc-cursor.h:
2320 /*
2321  * Copyright 2013 MongoDB, Inc.
2322  *
2323  * Licensed under the Apache License, Version 2.0 (the "License");
2324  * you may not use this file except in compliance with the License.
2325  * You may obtain a copy of the License at
2326  *
2327  *   http://www.apache.org/licenses/LICENSE-2.0
2328  *
2329  * Unless required by applicable law or agreed to in writing, software
2330  * distributed under the License is distributed on an "AS IS" BASIS,
2331  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2332  * See the License for the specific language governing permissions and
2333  * limitations under the License.
2334  */
2335 
2336 
2337 struct _mongoc_cursor_t;
2338 alias mongoc_cursor_t = _mongoc_cursor_t;
2339 
2340 /* forward decl */
2341 
2342 mongoc_cursor_t* mongoc_cursor_clone (const(mongoc_cursor_t)* cursor);
2343 void mongoc_cursor_destroy (mongoc_cursor_t* cursor);
2344 bool mongoc_cursor_more (mongoc_cursor_t* cursor);
2345 bool mongoc_cursor_next (mongoc_cursor_t* cursor, const(bson_t*)* bson);
2346 bool mongoc_cursor_error (mongoc_cursor_t* cursor, bson_error_t* error);
2347 bool mongoc_cursor_error_document (
2348     mongoc_cursor_t* cursor,
2349     bson_error_t* error,
2350     const(bson_t*)* doc);
2351 void mongoc_cursor_get_host (mongoc_cursor_t* cursor, mongoc_host_list_t* host);
2352 bool mongoc_cursor_is_alive (const(mongoc_cursor_t)* cursor);
2353 const(bson_t)* mongoc_cursor_current (const(mongoc_cursor_t)* cursor);
2354 void mongoc_cursor_set_batch_size (mongoc_cursor_t* cursor, uint batch_size);
2355 uint mongoc_cursor_get_batch_size (const(mongoc_cursor_t)* cursor);
2356 bool mongoc_cursor_set_limit (mongoc_cursor_t* cursor, long limit);
2357 long mongoc_cursor_get_limit (const(mongoc_cursor_t)* cursor);
2358 
2359 /* These names include the term "hint" for backward compatibility, should be
2360  * mongoc_cursor_get_server_id, mongoc_cursor_set_server_id. */
2361 bool mongoc_cursor_set_hint (mongoc_cursor_t* cursor, uint server_id);
2362 uint mongoc_cursor_get_hint (const(mongoc_cursor_t)* cursor);
2363 long mongoc_cursor_get_id (const(mongoc_cursor_t)* cursor);
2364 void mongoc_cursor_set_max_await_time_ms (
2365     mongoc_cursor_t* cursor,
2366     uint max_await_time_ms);
2367 uint mongoc_cursor_get_max_await_time_ms (const(mongoc_cursor_t)* cursor);
2368 mongoc_cursor_t* mongoc_cursor_new_from_command_reply (
2369     _mongoc_client_t* client,
2370     bson_t* reply,
2371     uint server_id);
2372 
2373 /* MONGOC_CURSOR_H */
2374 
2375 // from file mongoc-collection.h:
2376 /*
2377  * Copyright 2013-2014 MongoDB, Inc.
2378  *
2379  * Licensed under the Apache License, Version 2.0 (the "License");
2380  * you may not use this file except in compliance with the License.
2381  * You may obtain a copy of the License at
2382  *
2383  *   http://www.apache.org/licenses/LICENSE-2.0
2384  *
2385  * Unless required by applicable law or agreed to in writing, software
2386  * distributed under the License is distributed on an "AS IS" BASIS,
2387  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2388  * See the License for the specific language governing permissions and
2389  * limitations under the License.
2390  */
2391 
2392 
2393 
2394 mongoc_cursor_t* mongoc_collection_aggregate (
2395     mongoc_collection_t* collection,
2396     mongoc_query_flags_t flags,
2397     const(bson_t)* pipeline,
2398     const(bson_t)* opts,
2399     const(mongoc_read_prefs_t)* read_prefs);
2400 void mongoc_collection_destroy (mongoc_collection_t* collection);
2401 mongoc_collection_t* mongoc_collection_copy (mongoc_collection_t* collection);
2402 mongoc_cursor_t* mongoc_collection_command (
2403     mongoc_collection_t* collection,
2404     mongoc_query_flags_t flags,
2405     uint skip,
2406     uint limit,
2407     uint batch_size,
2408     const(bson_t)* command,
2409     const(bson_t)* fields,
2410     const(mongoc_read_prefs_t)* read_prefs);
2411 bool mongoc_collection_read_command_with_opts (
2412     mongoc_collection_t* collection,
2413     const(bson_t)* command,
2414     const(mongoc_read_prefs_t)* read_prefs,
2415     const(bson_t)* opts,
2416     bson_t* reply,
2417     bson_error_t* error);
2418 bool mongoc_collection_write_command_with_opts (
2419     mongoc_collection_t* collection,
2420     const(bson_t)* command,
2421     const(bson_t)* opts,
2422     bson_t* reply,
2423     bson_error_t* error);
2424 
2425 /* IGNORED */
2426 bool mongoc_collection_read_write_command_with_opts (
2427     mongoc_collection_t* collection,
2428     const(bson_t)* command,
2429     const(mongoc_read_prefs_t)* read_prefs,
2430     const(bson_t)* opts,
2431     bson_t* reply,
2432     bson_error_t* error);
2433 bool mongoc_collection_command_simple (
2434     mongoc_collection_t* collection,
2435     const(bson_t)* command,
2436     const(mongoc_read_prefs_t)* read_prefs,
2437     bson_t* reply,
2438     bson_error_t* error);
2439 long mongoc_collection_count (
2440     mongoc_collection_t* collection,
2441     mongoc_query_flags_t flags,
2442     const(bson_t)* query,
2443     long skip,
2444     long limit,
2445     const(mongoc_read_prefs_t)* read_prefs,
2446     bson_error_t* error);
2447 long mongoc_collection_count_with_opts (
2448     mongoc_collection_t* collection,
2449     mongoc_query_flags_t flags,
2450     const(bson_t)* query,
2451     long skip,
2452     long limit,
2453     const(bson_t)* opts,
2454     const(mongoc_read_prefs_t)* read_prefs,
2455     bson_error_t* error);
2456 bool mongoc_collection_drop (
2457     mongoc_collection_t* collection,
2458     bson_error_t* error);
2459 bool mongoc_collection_drop_with_opts (
2460     mongoc_collection_t* collection,
2461     const(bson_t)* opts,
2462     bson_error_t* error);
2463 bool mongoc_collection_drop_index (
2464     mongoc_collection_t* collection,
2465     const(char)* index_name,
2466     bson_error_t* error);
2467 bool mongoc_collection_drop_index_with_opts (
2468     mongoc_collection_t* collection,
2469     const(char)* index_name,
2470     const(bson_t)* opts,
2471     bson_error_t* error);
2472 bool mongoc_collection_create_index (
2473     mongoc_collection_t* collection,
2474     const(bson_t)* keys,
2475     const(mongoc_index_opt_t)* opt,
2476     bson_error_t* error);
2477 bool mongoc_collection_create_index_with_opts (
2478     mongoc_collection_t* collection,
2479     const(bson_t)* keys,
2480     const(mongoc_index_opt_t)* opt,
2481     const(bson_t)* opts,
2482     bson_t* reply,
2483     bson_error_t* error);
2484 bool mongoc_collection_ensure_index (
2485     mongoc_collection_t* collection,
2486     const(bson_t)* keys,
2487     const(mongoc_index_opt_t)* opt,
2488     bson_error_t* error);
2489 mongoc_cursor_t* mongoc_collection_find_indexes (
2490     mongoc_collection_t* collection,
2491     bson_error_t* error);
2492 mongoc_cursor_t* mongoc_collection_find (
2493     mongoc_collection_t* collection,
2494     mongoc_query_flags_t flags,
2495     uint skip,
2496     uint limit,
2497     uint batch_size,
2498     const(bson_t)* query,
2499     const(bson_t)* fields,
2500     const(mongoc_read_prefs_t)* read_prefs);
2501 mongoc_cursor_t* mongoc_collection_find_with_opts (
2502     mongoc_collection_t* collection,
2503     const(bson_t)* filter,
2504     const(bson_t)* opts,
2505     const(mongoc_read_prefs_t)* read_prefs);
2506 bool mongoc_collection_insert (
2507     mongoc_collection_t* collection,
2508     mongoc_insert_flags_t flags,
2509     const(bson_t)* document,
2510     const(mongoc_write_concern_t)* write_concern,
2511     bson_error_t* error);
2512 bool mongoc_collection_insert_bulk (
2513     mongoc_collection_t* collection,
2514     mongoc_insert_flags_t flags,
2515     const(bson_t*)* documents,
2516     uint n_documents,
2517     const(mongoc_write_concern_t)* write_concern,
2518     bson_error_t* error);
2519 bool mongoc_collection_update (
2520     mongoc_collection_t* collection,
2521     mongoc_update_flags_t flags,
2522     const(bson_t)* selector,
2523     const(bson_t)* update,
2524     const(mongoc_write_concern_t)* write_concern,
2525     bson_error_t* error);
2526 bool mongoc_collection_delete (
2527     mongoc_collection_t* collection,
2528     mongoc_delete_flags_t flags,
2529     const(bson_t)* selector,
2530     const(mongoc_write_concern_t)* write_concern,
2531     bson_error_t* error);
2532 bool mongoc_collection_save (
2533     mongoc_collection_t* collection,
2534     const(bson_t)* document,
2535     const(mongoc_write_concern_t)* write_concern,
2536     bson_error_t* error);
2537 bool mongoc_collection_remove (
2538     mongoc_collection_t* collection,
2539     mongoc_remove_flags_t flags,
2540     const(bson_t)* selector,
2541     const(mongoc_write_concern_t)* write_concern,
2542     bson_error_t* error);
2543 bool mongoc_collection_rename (
2544     mongoc_collection_t* collection,
2545     const(char)* new_db,
2546     const(char)* new_name,
2547     bool drop_target_before_rename,
2548     bson_error_t* error);
2549 bool mongoc_collection_rename_with_opts (
2550     mongoc_collection_t* collection,
2551     const(char)* new_db,
2552     const(char)* new_name,
2553     bool drop_target_before_rename,
2554     const(bson_t)* opts,
2555     bson_error_t* error);
2556 bool mongoc_collection_find_and_modify_with_opts (
2557     mongoc_collection_t* collection,
2558     const(bson_t)* query,
2559     const(mongoc_find_and_modify_opts_t)* opts,
2560     bson_t* reply,
2561     bson_error_t* error);
2562 bool mongoc_collection_find_and_modify (
2563     mongoc_collection_t* collection,
2564     const(bson_t)* query,
2565     const(bson_t)* sort,
2566     const(bson_t)* update,
2567     const(bson_t)* fields,
2568     bool _remove,
2569     bool upsert,
2570     bool _new,
2571     bson_t* reply,
2572     bson_error_t* error);
2573 bool mongoc_collection_stats (
2574     mongoc_collection_t* collection,
2575     const(bson_t)* options,
2576     bson_t* reply,
2577     bson_error_t* error);
2578 mongoc_bulk_operation_t* mongoc_collection_create_bulk_operation (
2579     mongoc_collection_t* collection,
2580     bool ordered,
2581     const(mongoc_write_concern_t)* write_concern);
2582 const(mongoc_read_prefs_t)* mongoc_collection_get_read_prefs (
2583     const(mongoc_collection_t)* collection);
2584 void mongoc_collection_set_read_prefs (
2585     mongoc_collection_t* collection,
2586     const(mongoc_read_prefs_t)* read_prefs);
2587 const(mongoc_read_concern_t)* mongoc_collection_get_read_concern (
2588     const(mongoc_collection_t)* collection);
2589 void mongoc_collection_set_read_concern (
2590     mongoc_collection_t* collection,
2591     const(mongoc_read_concern_t)* read_concern);
2592 const(mongoc_write_concern_t)* mongoc_collection_get_write_concern (
2593     const(mongoc_collection_t)* collection);
2594 void mongoc_collection_set_write_concern (
2595     mongoc_collection_t* collection,
2596     const(mongoc_write_concern_t)* write_concern);
2597 const(char)* mongoc_collection_get_name (mongoc_collection_t* collection);
2598 const(bson_t)* mongoc_collection_get_last_error (
2599     const(mongoc_collection_t)* collection);
2600 char* mongoc_collection_keys_to_index_string (const(bson_t)* keys);
2601 bool mongoc_collection_validate (
2602     mongoc_collection_t* collection,
2603     const(bson_t)* options,
2604     bson_t* reply,
2605     bson_error_t* error);
2606 
2607 /* MONGOC_COLLECTION_H */
2608 
2609 // from file mongoc-socket.h:
2610 /*
2611  * Copyright 2014 MongoDB, Inc.
2612  *
2613  * Licensed under the Apache License, Version 2.0 (the "License");
2614  * you may not use this file except in compliance with the License.
2615  * You may obtain a copy of the License at
2616  *
2617  *   http://www.apache.org/licenses/LICENSE-2.0
2618  *
2619  * Unless required by applicable law or agreed to in writing, software
2620  * distributed under the License is distributed on an "AS IS" BASIS,
2621  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2622  * See the License for the specific language governing permissions and
2623  * limitations under the License.
2624  */
2625 
2626 
2627 
2628 alias mongoc_socklen_t = uint;
2629 
2630 struct _mongoc_socket_t;
2631 alias mongoc_socket_t = _mongoc_socket_t;
2632 
2633 struct mongoc_socket_poll_t
2634 {
2635     mongoc_socket_t* socket;
2636     int events;
2637     int revents;
2638 }
2639 
2640 mongoc_socket_t* mongoc_socket_accept (mongoc_socket_t* sock, long expire_at);
2641 int mongoc_socket_bind (
2642     mongoc_socket_t* sock,
2643     const(sockaddr)* addr,
2644     mongoc_socklen_t addrlen);
2645 int mongoc_socket_close (mongoc_socket_t* socket);
2646 int mongoc_socket_connect (
2647     mongoc_socket_t* sock,
2648     const(sockaddr)* addr,
2649     mongoc_socklen_t addrlen,
2650     long expire_at);
2651 char* mongoc_socket_getnameinfo (mongoc_socket_t* sock);
2652 void mongoc_socket_destroy (mongoc_socket_t* sock);
2653 int mongoc_socket_errno (mongoc_socket_t* sock);
2654 int mongoc_socket_getsockname (
2655     mongoc_socket_t* sock,
2656     sockaddr* addr,
2657     mongoc_socklen_t* addrlen);
2658 int mongoc_socket_listen (mongoc_socket_t* sock, uint backlog);
2659 mongoc_socket_t* mongoc_socket_new (int domain, int type, int protocol);
2660 ssize_t mongoc_socket_recv (
2661     mongoc_socket_t* sock,
2662     void* buf,
2663     size_t buflen,
2664     int flags,
2665     long expire_at);
2666 int mongoc_socket_setsockopt (
2667     mongoc_socket_t* sock,
2668     int level,
2669     int optname,
2670     const(void)* optval,
2671     mongoc_socklen_t optlen);
2672 ssize_t mongoc_socket_send (
2673     mongoc_socket_t* sock,
2674     const(void)* buf,
2675     size_t buflen,
2676     long expire_at);
2677 ssize_t mongoc_socket_sendv (
2678     mongoc_socket_t* sock,
2679     mongoc_iovec_t* iov,
2680     size_t iovcnt,
2681     long expire_at);
2682 bool mongoc_socket_check_closed (mongoc_socket_t* sock);
2683 void mongoc_socket_inet_ntop (addrinfo* rp, char* buf, size_t buflen);
2684 ssize_t mongoc_socket_poll (
2685     mongoc_socket_poll_t* sds,
2686     size_t nsds,
2687     int timeout);
2688 
2689 /* MONGOC_SOCKET_H */
2690 
2691 // from file mongoc-matcher.h:
2692 /*
2693  * Copyright 2014 MongoDB, Inc.
2694  *
2695  * Licensed under the Apache License, Version 2.0 (the "License");
2696  * you may not use this file except in compliance with the License.
2697  * You may obtain a copy of the License at
2698  *
2699  *   http://www.apache.org/licenses/LICENSE-2.0
2700  *
2701  * Unless required by applicable law or agreed to in writing, software
2702  * distributed under the License is distributed on an "AS IS" BASIS,
2703  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2704  * See the License for the specific language governing permissions and
2705  * limitations under the License.
2706  */
2707 
2708 
2709 struct _mongoc_matcher_t;
2710 alias mongoc_matcher_t = _mongoc_matcher_t;
2711 
2712 mongoc_matcher_t* mongoc_matcher_new (
2713     const(bson_t)* query,
2714     bson_error_t* error);
2715 bool mongoc_matcher_match (
2716     const(mongoc_matcher_t)* matcher,
2717     const(bson_t)* document);
2718 void mongoc_matcher_destroy (mongoc_matcher_t* matcher);
2719 
2720 /* MONGOC_MATCHER_H */
2721 
2722 // from file mongoc-stream-tls-secure-channel.h:
2723 /*
2724  * Copyright 2016 MongoDB, Inc.
2725  *
2726  * Licensed under the Apache License, Version 2.0 (the "License");
2727  * you may not use this file except in compliance with the License.
2728  * You may obtain a copy of the License at
2729  *
2730  *   http://www.apache.org/licenses/LICENSE-2.0
2731  *
2732  * Unless required by applicable law or agreed to in writing, software
2733  * distributed under the License is distributed on an "AS IS" BASIS,
2734  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2735  * See the License for the specific language governing permissions and
2736  * limitations under the License.
2737  */
2738 
2739 
2740 /* MONGOC_ENABLE_SSL_SECURE_CHANNEL */
2741 /* MONGOC_STREAM_TLS_SECURE_CHANNEL_H */
2742 
2743 // from file mongoc-log.h:
2744 /*
2745  * Copyright 2013 MongoDB, Inc.
2746  *
2747  * Licensed under the Apache License, Version 2.0 (the "License");
2748  * you may not use this file except in compliance with the License.
2749  * You may obtain a copy of the License at
2750  *
2751  *   http://www.apache.org/licenses/LICENSE-2.0
2752  *
2753  * Unless required by applicable law or agreed to in writing, software
2754  * distributed under the License is distributed on an "AS IS" BASIS,
2755  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2756  * See the License for the specific language governing permissions and
2757  * limitations under the License.
2758  */
2759 
2760 
2761 enum LOG_DOMAIN = "mongoc";
2762 
2763 enum mongoc_log_level_t
2764 {
2765     LEVEL_ERROR = 0,
2766     LEVEL_CRITICAL = 1,
2767     LEVEL_WARNING = 2,
2768     LEVEL_MESSAGE = 3,
2769     LEVEL_INFO = 4,
2770     LEVEL_DEBUG = 5,
2771     LEVEL_TRACE = 6
2772 }
2773 
2774 /**
2775  * mongoc_log_func_t:
2776  * @log_level: The level of the log message.
2777  * @log_domain: The domain of the log message, such as "client".
2778  * @message: The message generated.
2779  * @user_data: User data provided to mongoc_log_set_handler().
2780  *
2781  * This function prototype can be used to set a custom log handler for the
2782  * libmongoc library. This is useful if you would like to show them in a
2783  * user interface or alternate storage.
2784  */
2785 alias mongoc_log_func_t = void function (mongoc_log_level_t log_level, const(char)* log_domain, const(char)* message, void* user_data);
2786 
2787 /**
2788  * mongoc_log_set_handler:
2789  * @log_func: A function to handle log messages.
2790  * @user_data: User data for @log_func.
2791  *
2792  * Sets the function to be called to handle logging.
2793  */
2794 void mongoc_log_set_handler (mongoc_log_func_t log_func, void* user_data);
2795 
2796 /**
2797  * mongoc_log:
2798  * @log_level: The log level.
2799  * @log_domain: The log domain (such as "client").
2800  * @format: The format string for the log message.
2801  *
2802  * Logs a message using the currently configured logger.
2803  *
2804  * This method will hold a logging lock to prevent concurrent calls to the
2805  * logging infrastructure. It is important that your configured log function
2806  * does not re-enter the logging system or deadlock will occur.
2807  *
2808  */
2809 void mongoc_log (
2810     mongoc_log_level_t log_level,
2811     const(char)* log_domain,
2812     const(char)* format,
2813     ...);
2814 
2815 void mongoc_log_default_handler (
2816     mongoc_log_level_t log_level,
2817     const(char)* log_domain,
2818     const(char)* message,
2819     void* user_data);
2820 
2821 /**
2822  * mongoc_log_level_str:
2823  * @log_level: The log level.
2824  *
2825  * Returns: The string representation of log_level
2826  */
2827 const(char)* mongoc_log_level_str (mongoc_log_level_t log_level);
2828 
2829 /**
2830  * mongoc_log_trace_enable:
2831  *
2832  * Enables tracing at runtime (if it has been enabled at compile time).
2833  */
2834 void mongoc_log_trace_enable ();
2835 
2836 /**
2837  * mongoc_log_trace_disable:
2838  *
2839  * Disables tracing at runtime (if it has been enabled at compile time).
2840  */
2841 void mongoc_log_trace_disable ();
2842 
2843 /* MONGOC_LOG_H */
2844 
2845 // from file mongoc-gridfs.h:
2846 /*
2847  * Copyright 2013 MongoDB Inc.
2848  *
2849  * Licensed under the Apache License, Version 2.0 (the "License");
2850  * you may not use this file except in compliance with the License.
2851  * You may obtain a copy of the License at
2852  *
2853  *   http://www.apache.org/licenses/LICENSE-2.0
2854  *
2855  * Unless required by applicable law or agreed to in writing, software
2856  * distributed under the License is distributed on an "AS IS" BASIS,
2857  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2858  * See the License for the specific language governing permissions and
2859  * limitations under the License.
2860  */
2861 
2862 
2863 struct _mongoc_gridfs_t;
2864 alias mongoc_gridfs_t = _mongoc_gridfs_t;
2865 
2866 mongoc_gridfs_file_t* mongoc_gridfs_create_file_from_stream (
2867     mongoc_gridfs_t* gridfs,
2868     mongoc_stream_t* stream,
2869     mongoc_gridfs_file_opt_t* opt);
2870 mongoc_gridfs_file_t* mongoc_gridfs_create_file (
2871     mongoc_gridfs_t* gridfs,
2872     mongoc_gridfs_file_opt_t* opt);
2873 mongoc_gridfs_file_list_t* mongoc_gridfs_find (
2874     mongoc_gridfs_t* gridfs,
2875     const(bson_t)* query);
2876 mongoc_gridfs_file_t* mongoc_gridfs_find_one (
2877     mongoc_gridfs_t* gridfs,
2878     const(bson_t)* query,
2879     bson_error_t* error);
2880 mongoc_gridfs_file_list_t* mongoc_gridfs_find_with_opts (
2881     mongoc_gridfs_t* gridfs,
2882     const(bson_t)* filter,
2883     const(bson_t)* opts);
2884 mongoc_gridfs_file_t* mongoc_gridfs_find_one_with_opts (
2885     mongoc_gridfs_t* gridfs,
2886     const(bson_t)* filter,
2887     const(bson_t)* opts,
2888     bson_error_t* error);
2889 mongoc_gridfs_file_t* mongoc_gridfs_find_one_by_filename (
2890     mongoc_gridfs_t* gridfs,
2891     const(char)* filename,
2892     bson_error_t* error);
2893 bool mongoc_gridfs_drop (mongoc_gridfs_t* gridfs, bson_error_t* error);
2894 void mongoc_gridfs_destroy (mongoc_gridfs_t* gridfs);
2895 mongoc_collection_t* mongoc_gridfs_get_files (mongoc_gridfs_t* gridfs);
2896 mongoc_collection_t* mongoc_gridfs_get_chunks (mongoc_gridfs_t* gridfs);
2897 bool mongoc_gridfs_remove_by_filename (
2898     mongoc_gridfs_t* gridfs,
2899     const(char)* filename,
2900     bson_error_t* error);
2901 
2902 /* MONGOC_GRIDFS_H */
2903 
2904 // from file mongoc-error.h:
2905 /*
2906  * Copyright 2013 MongoDB, Inc.
2907  *
2908  * Licensed under the Apache License, Version 2.0 (the "License");
2909  * you may not use this file except in compliance with the License.
2910  * You may obtain a copy of the License at
2911  *
2912  *   http://www.apache.org/licenses/LICENSE-2.0
2913  *
2914  * Unless required by applicable law or agreed to in writing, software
2915  * distributed under the License is distributed on an "AS IS" BASIS,
2916  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2917  * See the License for the specific language governing permissions and
2918  * limitations under the License.
2919  */
2920 
2921 
2922 enum ERROR_API_VERSION_LEGACY = 1;
2923 enum ERROR_API_VERSION_2 = 2;
2924 
2925 enum mongoc_error_domain_t
2926 {
2927     CLIENT = 1,
2928     STREAM = 2,
2929     PROTOCOL = 3,
2930     CURSOR = 4,
2931     QUERY = 5,
2932     INSERT = 6,
2933     SASL = 7,
2934     BSON = 8,
2935     MATCHER = 9,
2936     NAMESPACE = 10,
2937     COMMAND = 11,
2938     COLLECTION = 12,
2939     GRIDFS = 13,
2940     SCRAM = 14,
2941     SERVER_SELECTION = 15,
2942     WRITE_CONCERN = 16,
2943     SERVER = 17 /* Error API Version 2 only */
2944 }
2945 
2946 enum mongoc_error_code_t
2947 {
2948     STREAM_INVALID_TYPE = 1,
2949     STREAM_INVALID_STATE = 2,
2950     STREAM_NAME_RESOLUTION = 3,
2951     STREAM_SOCKET = 4,
2952     STREAM_CONNECT = 5,
2953     STREAM_NOT_ESTABLISHED = 6,
2954 
2955     CLIENT_NOT_READY = 7,
2956     CLIENT_TOO_BIG = 8,
2957     CLIENT_TOO_SMALL = 9,
2958     CLIENT_GETNONCE = 10,
2959     CLIENT_AUTHENTICATE = 11,
2960     CLIENT_NO_ACCEPTABLE_PEER = 12,
2961     CLIENT_IN_EXHAUST = 13,
2962 
2963     PROTOCOL_INVALID_REPLY = 14,
2964     PROTOCOL_BAD_WIRE_VERSION = 15,
2965 
2966     CURSOR_INVALID_CURSOR = 16,
2967 
2968     QUERY_FAILURE = 17,
2969 
2970     BSON_INVALID = 18,
2971 
2972     MATCHER_INVALID = 19,
2973 
2974     NAMESPACE_INVALID = 20,
2975     NAMESPACE_INVALID_FILTER_TYPE = 21,
2976 
2977     COMMAND_INVALID_ARG = 22,
2978 
2979     COLLECTION_INSERT_FAILED = 23,
2980     COLLECTION_UPDATE_FAILED = 24,
2981     COLLECTION_DELETE_FAILED = 25,
2982     COLLECTION_DOES_NOT_EXIST = 26,
2983 
2984     GRIDFS_INVALID_FILENAME = 27,
2985 
2986     SCRAM_NOT_DONE = 28,
2987     SCRAM_PROTOCOL_ERROR = 29,
2988 
2989     QUERY_COMMAND_NOT_FOUND = 59,
2990     QUERY_NOT_TAILABLE = 13051,
2991 
2992     SERVER_SELECTION_BAD_WIRE_VERSION = 13052,
2993     SERVER_SELECTION_FAILURE = 13053,
2994     SERVER_SELECTION_INVALID_ID = 13054,
2995 
2996     GRIDFS_CHUNK_MISSING = 13055,
2997     GRIDFS_PROTOCOL_ERROR = 13056,
2998 
2999     /* Dup with query failure. */
3000     PROTOCOL_ERROR = 17,
3001 
3002     WRITE_CONCERN_ERROR = 64,
3003 
3004     DUPLICATE_KEY = 11000
3005 }
3006 
3007 /* MONGOC_ERRORS_H */
3008 
3009 // from file mongoc-stream-tls-secure-transport.h:
3010 /*
3011  * Copyright 2016 MongoDB, Inc.
3012  *
3013  * Licensed under the Apache License, Version 2.0 (the "License");
3014  * you may not use this file except in compliance with the License.
3015  * You may obtain a copy of the License at
3016  *
3017  *   http://www.apache.org/licenses/LICENSE-2.0
3018  *
3019  * Unless required by applicable law or agreed to in writing, software
3020  * distributed under the License is distributed on an "AS IS" BASIS,
3021  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3022  * See the License for the specific language governing permissions and
3023  * limitations under the License.
3024  */
3025 
3026 
3027 /* MONGOC_ENABLE_SSL_SECURE_TRANSPORT */
3028 /* MONGOC_STREAM_TLS_SECURE_TRANSPORT_H */
3029 
3030 // from file mongoc-init.h:
3031 /*
3032  * Copyright 2013 MongoDB, Inc.
3033  *
3034  * Licensed under the Apache License, Version 2.0 (the "License");
3035  * you may not use this file except in compliance with the License.
3036  * You may obtain a copy of the License at
3037  *
3038  *   http://www.apache.org/licenses/LICENSE-2.0
3039  *
3040  * Unless required by applicable law or agreed to in writing, software
3041  * distributed under the License is distributed on an "AS IS" BASIS,
3042  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3043  * See the License for the specific language governing permissions and
3044  * limitations under the License.
3045  */
3046 
3047 
3048 void mongoc_init ();
3049 void mongoc_cleanup ();
3050 
3051 /* MONGOC_INIT_H */
3052 
3053 // from file mongoc-ssl.h:
3054 /*
3055  * Copyright 2013 MongoDB, Inc.
3056  *
3057  * Licensed under the Apache License, Version 2.0 (the "License");
3058  * you may not use this file except in compliance with the License.
3059  * You may obtain a copy of the License at
3060  *
3061  *   http://www.apache.org/licenses/LICENSE-2.0
3062  *
3063  * Unless required by applicable law or agreed to in writing, software
3064  * distributed under the License is distributed on an "AS IS" BASIS,
3065  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3066  * See the License for the specific language governing permissions and
3067  * limitations under the License.
3068  */
3069 
3070 
3071 alias mongoc_ssl_opt_t = _mongoc_ssl_opt_t;
3072 
3073 struct _mongoc_ssl_opt_t
3074 {
3075     const(char)* pem_file;
3076     const(char)* pem_pwd;
3077     const(char)* ca_file;
3078     const(char)* ca_dir;
3079     const(char)* crl_file;
3080     bool weak_cert_validation;
3081     bool allow_invalid_hostname;
3082     void*[7] padding;
3083 }
3084 
3085 const(mongoc_ssl_opt_t)* mongoc_ssl_opt_get_default ();
3086 
3087 /* MONGOC_SSL_H */
3088 
3089 // from file mongoc-stream-socket.h:
3090 /*
3091  * Copyright 2014 MongoDB, Inc.
3092  *
3093  * Licensed under the Apache License, Version 2.0 (the "License");
3094  * you may not use this file except in compliance with the License.
3095  * You may obtain a copy of the License at
3096  *
3097  *   http://www.apache.org/licenses/LICENSE-2.0
3098  *
3099  * Unless required by applicable law or agreed to in writing, software
3100  * distributed under the License is distributed on an "AS IS" BASIS,
3101  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3102  * See the License for the specific language governing permissions and
3103  * limitations under the License.
3104  */
3105 
3106 
3107 struct _mongoc_stream_socket_t;
3108 alias mongoc_stream_socket_t = _mongoc_stream_socket_t;
3109 
3110 mongoc_stream_t* mongoc_stream_socket_new (mongoc_socket_t* socket);
3111 mongoc_socket_t* mongoc_stream_socket_get_socket (
3112     mongoc_stream_socket_t* stream);
3113 
3114 /* MONGOC_STREAM_SOCKET_H */
3115 
3116 // from file mongoc-flags.h:
3117 /*
3118  * Copyright 2013 MongoDB, Inc.
3119  *
3120  * Licensed under the Apache License, Version 2.0 (the "License");
3121  * you may not use this file except in compliance with the License.
3122  * You may obtain a copy of the License at
3123  *
3124  *   http://www.apache.org/licenses/LICENSE-2.0
3125  *
3126  * Unless required by applicable law or agreed to in writing, software
3127  * distributed under the License is distributed on an "AS IS" BASIS,
3128  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3129  * See the License for the specific language governing permissions and
3130  * limitations under the License.
3131  */
3132 
3133 
3134 /**
3135  * mongoc_delete_flags_t:
3136  * @MONGOC_DELETE_NONE: Specify no delete flags.
3137  * @MONGOC_DELETE_SINGLE_REMOVE: Only remove the first document matching the
3138  *    document selector.
3139  *
3140  * This type is only for use with deprecated functions and should not be
3141  * used in new code. Use mongoc_remove_flags_t instead.
3142  *
3143  * #mongoc_delete_flags_t are used when performing a delete operation.
3144  */
3145 enum mongoc_delete_flags_t
3146 {
3147     NONE = 0,
3148     SINGLE_REMOVE = 1
3149 }
3150 
3151 /**
3152  * mongoc_remove_flags_t:
3153  * @MONGOC_REMOVE_NONE: Specify no delete flags.
3154  * @MONGOC_REMOVE_SINGLE_REMOVE: Only remove the first document matching the
3155  *    document selector.
3156  *
3157  * #mongoc_remove_flags_t are used when performing a remove operation.
3158  */
3159 enum mongoc_remove_flags_t
3160 {
3161     NONE = 0,
3162     SINGLE_REMOVE = 1
3163 }
3164 
3165 /**
3166  * mongoc_insert_flags_t:
3167  * @MONGOC_INSERT_NONE: Specify no insert flags.
3168  * @MONGOC_INSERT_CONTINUE_ON_ERROR: Continue inserting documents from
3169  *    the insertion set even if one fails.
3170  *
3171  * #mongoc_insert_flags_t are used when performing an insert operation.
3172  */
3173 enum mongoc_insert_flags_t
3174 {
3175     NONE = 0,
3176     CONTINUE_ON_ERROR = 1
3177 }
3178 
3179 enum INSERT_NO_VALIDATE = 1U << 31;
3180 
3181 /**
3182  * mongoc_query_flags_t:
3183  * @MONGOC_QUERY_NONE: No query flags supplied.
3184  * @MONGOC_QUERY_TAILABLE_CURSOR: Cursor will not be closed when the last
3185  *    data is retrieved. You can resume this cursor later.
3186  * @MONGOC_QUERY_SLAVE_OK: Allow query of replica slave.
3187  * @MONGOC_QUERY_OPLOG_REPLAY: Used internally by Mongo.
3188  * @MONGOC_QUERY_NO_CURSOR_TIMEOUT: The server normally times out idle
3189  *    cursors after an inactivity period (10 minutes). This prevents that.
3190  * @MONGOC_QUERY_AWAIT_DATA: Use with %MONGOC_QUERY_TAILABLE_CURSOR. Block
3191  *    rather than returning no data. After a period, time out.
3192  * @MONGOC_QUERY_EXHAUST: Stream the data down full blast in multiple
3193  *    "more" packages. Faster when you are pulling a lot of data and
3194  *    know you want to pull it all down.
3195  * @MONGOC_QUERY_PARTIAL: Get partial results from mongos if some shards
3196  *    are down (instead of throwing an error).
3197  *
3198  * #mongoc_query_flags_t is used for querying a Mongo instance.
3199  */
3200 enum mongoc_query_flags_t
3201 {
3202     NONE = 0,
3203     TAILABLE_CURSOR = 2,
3204     SLAVE_OK = 4,
3205     OPLOG_REPLAY = 8,
3206     NO_CURSOR_TIMEOUT = 16,
3207     AWAIT_DATA = 32,
3208     EXHAUST = 64,
3209     PARTIAL = 128
3210 }
3211 
3212 /**
3213  * mongoc_reply_flags_t:
3214  * @MONGOC_REPLY_NONE: No flags set.
3215  * @MONGOC_REPLY_CURSOR_NOT_FOUND: Cursor was not found.
3216  * @MONGOC_REPLY_QUERY_FAILURE: Query failed, error document provided.
3217  * @MONGOC_REPLY_SHARD_CONFIG_STALE: Shard configuration is stale.
3218  * @MONGOC_REPLY_AWAIT_CAPABLE: Wait for data to be returned until timeout
3219  *    has passed. Used with %MONGOC_QUERY_TAILABLE_CURSOR.
3220  *
3221  * #mongoc_reply_flags_t contains flags supplied by the Mongo server in reply
3222  * to a request.
3223  */
3224 enum mongoc_reply_flags_t
3225 {
3226     NONE = 0,
3227     CURSOR_NOT_FOUND = 1,
3228     QUERY_FAILURE = 2,
3229     SHARD_CONFIG_STALE = 4,
3230     AWAIT_CAPABLE = 8
3231 }
3232 
3233 /**
3234  * mongoc_update_flags_t:
3235  * @MONGOC_UPDATE_NONE: No update flags specified.
3236  * @MONGOC_UPDATE_UPSERT: Perform an upsert.
3237  * @MONGOC_UPDATE_MULTI_UPDATE: Continue updating after first match.
3238  *
3239  * #mongoc_update_flags_t is used when updating documents found in Mongo.
3240  */
3241 enum mongoc_update_flags_t
3242 {
3243     NONE = 0,
3244     UPSERT = 1,
3245     MULTI_UPDATE = 2
3246 }
3247 
3248 enum UPDATE_NO_VALIDATE = 1U << 31;
3249 
3250 /* MONGOC_FLAGS_H */