1MONGOC_HANDSHAKE_DATA_APPEND(3)    libmongoc   MONGOC_HANDSHAKE_DATA_APPEND(3)
2
3
4

NAME

6       mongoc_handshake_data_append - mongoc_handshake_data_append()
7

SYNOPSIS

9          bool
10          mongoc_handshake_data_append (const char *driver_name,
11                                        const char *driver_version,
12                                        const char *platform);
13
14       Appends  the  given  strings to the handshake data for the underlying C
15       Driver.
16

DESCRIPTION

18       This function is intended for use by drivers which wrap the  C  Driver.
19       Calling  this  function  will store the given strings as handshake data
20       about the system and driver by appending them to the handshake data for
21       the  underlying C Driver. These values, along with other handshake data
22       collected during mongoc_init will be sent to the server as part of  the
23       initial  connection  handshake  in the "client" document. This function
24       must not be called more than once, or after server  monitoring  begins.
25       For  a single-threaded mongoc_client_t, server monitoring begins on the
26       first operation requiring a server. For a mongoc_client_pool_t,  server
27       monitoring begins on the first call to :symbol:`mongoc_client_pool_pop.
28
29       The  passed in strings are copied, and don't have to remain valid after
30       the call to mongoc_handshake_data_append(). The driver may store  trun‐
31       cated versions of the passed in strings.
32
33       NOTE:
34          This function allocates memory, and therefore caution should be used
35          when using this in conjunction with bson_mem_set_vtable().  If  this
36          function    is    called    before    bson_mem_set_vtable(),    then
37          bson_mem_restore_vtable()   must   be    called    before    calling
38          mongoc_cleanup(). Failure to do so will result in memory being freed
39          by the wrong allocator.
40

PARAMETERS

42driver_name: An optional string storing  the  name  of  the  wrapping
43         driver
44
45driver_version:  An  optional string storing the version of the wrap‐
46         ping driver.
47
48platform: An optional string storing any information about  the  cur‐
49         rent platform, for example configure options or compile flags.
50

RETURNS

52       true  if  the  given fields are set successfully. Otherwise, it returns
53       false and logs an error.
54
55       The default handshake data the driver sends with  "hello"  looks  some‐
56       thing like:
57
58          client: {
59            driver: {
60              name: "mongoc",
61              version: "1.5.0"
62            },
63            os: {...},
64            platform: "CC=gcc CFLAGS=-Wall -pedantic"
65          }
66
67       If we call mongoc_handshake_data_append() ("phongo", "1.1.8", "CC=clang
68       / ") and it returns true, the driver sends handshake data like:
69
70          client: {
71            driver: {
72              name: "mongoc / phongo",
73              version: "1.5.0 / 1.1.8"
74            },
75            os: {...},
76            platform: "CC=clang / gcc CFLAGS=-Wall -pedantic"
77          }
78

AUTHOR

80       MongoDB, Inc
81
83       2017-present, MongoDB, Inc
84
85
86
87
881.24.3                           Aug 17, 2023  MONGOC_HANDSHAKE_DATA_APPEND(3)
Impressum