Skip to content

Commit 2d085cf

Browse files
committed
CDRIVER-1689 Document mongoc_handshake_data_append in the .h, not public doc
1 parent cbdd47d commit 2d085cf

File tree

2 files changed

+55
-70
lines changed

2 files changed

+55
-70
lines changed

doc/mongoc_handshake_data_append.page

Lines changed: 0 additions & 70 deletions
This file was deleted.

src/mongoc/mongoc-handshake.h

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,61 @@ BSON_BEGIN_DECLS
2828

2929
#define MONGOC_HANDSHAKE_APPNAME_MAX 128
3030

31+
/**
32+
* mongoc_handshake_data_append:
33+
*
34+
* This function is intended for use by drivers which wrap the C Driver.
35+
* Calling this function will store the given strings as handshake data about
36+
* the system and driver by appending them to the handshake data for the
37+
* underlying C Driver. These values, along with other handshake data collected
38+
* during mongoc_init will be sent to the server as part of the initial
39+
* connection handshake in the "client" document. This function cannot be
40+
* called more than once, or after a handshake has been initiated.
41+
*
42+
* The passed in strings are copied, and don't have to remain valid after the
43+
* call to mongoc_handshake_data_append(). The driver may store truncated
44+
* versions of the passed in strings.
45+
*
46+
* Note:
47+
* This function allocates memory, and therefore caution should be used when
48+
* using this in conjunction with bson_mem_set_vtable. If this function is
49+
* called before bson_mem_set_vtable, then bson_mem_restore_vtable must be
50+
* called before calling mongoc_cleanup. Failure to do so will result in
51+
* memory being freed by the wrong allocator.
52+
*
53+
*
54+
* @driver_name: An optional string storing the name of the wrapping driver
55+
* @driver_version: An optional string storing the version of the wrapping driver.
56+
* @platform: An optional string storing any information about the current
57+
* platform, for example configure options or compile flags.
58+
*
59+
*
60+
* Returns true if the given fields are set successfully. Otherwise, it returns
61+
* false and logs an error.
62+
*
63+
* The default handshake data the driver sends with "isMaster" looks something like:
64+
* client: {
65+
* driver: {
66+
* name: "mongoc",
67+
* version: "1.5.0"
68+
* },
69+
* os: {...},
70+
* platform: "CC=gcc CFLAGS=-Wall -pedantic"
71+
* }
72+
*
73+
* If we call
74+
* mongoc_handshake_data_append ("phongo", "1.1.8", "CC=clang")
75+
* and it returns true, the driver sends handshake data like:
76+
* client: {
77+
* driver: {
78+
* name: "mongoc / phongo",
79+
* version: "1.5.0 / 1.1.8"
80+
* },
81+
* os: {...},
82+
* platform: "CC=gcc CFLAGS=-Wall -pedantic / CC=clang"
83+
* }
84+
*
85+
*/
3186
BSON_API
3287
bool
3388
mongoc_handshake_data_append (const char *driver_name,

0 commit comments

Comments
 (0)