libmongocrypt
Data Fields
_mongocrypt_binary_t Struct Reference

#include <mongocrypt.h>

Data Fields

void * data
 
uint32_t len
 

Detailed Description

A non-owning view of a byte buffer.

When constructing a mongocrypt_binary_t it is the responsibility of the caller to maintain the lifetime of the viewed data. However, all public functions that take a mongocrypt_binary_t as an argument will make a copy of the viewed data. For example, the following is valid:

// The viewed data of bin has been copied. Ok to free the view and the data.
my_free_fn (mydata);
MONGOCRYPT_EXPORT void mongocrypt_binary_destroy(mongocrypt_binary_t *binary)
MONGOCRYPT_EXPORT bool mongocrypt_setopt_kms_provider_local(mongocrypt_t *crypt, mongocrypt_binary_t *key)
MONGOCRYPT_EXPORT mongocrypt_binary_t * mongocrypt_binary_new_from_data(uint8_t *data, uint32_t len)
Definition: mongocrypt.h:87

Functions with a mongocrypt_binary_t* out guarantee the lifetime of the viewed data to live as long as the parent object. For example, mongocrypt_ctx_mongo_op guarantees that the viewed data of mongocrypt_binary_t is valid until the parent ctx is destroyed with mongocrypt_ctx_destroy.

The mongocrypt_binary_t struct definition is public. Consumers may rely on the struct layout.


The documentation for this struct was generated from the following file: