ProvisioningLibrary
Atmel Security Provisioning Library
atcaprov_bson.h
Go to the documentation of this file.
1 
42 #ifndef ATCAPROV_BSON_H
43 #define ATCAPROV_BSON_H
44 
45 #include <stdint.h>
46 #include <string.h>
47 
48 #define BSON_TYPE_DOUBLE (0x01)
49 #define BSON_TYPE_STRING (0x02)
50 #define BSON_TYPE_DOCUMENT (0x03)
51 #define BSON_TYPE_ARRAY (0x04)
52 #define BSON_TYPE_BINARY (0x05)
53 #define BSON_TYPE_OBJID (0x07)
54 #define BSON_TYPE_BOOL (0x08)
55 #define BSON_TYPE_DATETIME (0x09)
56 #define BSON_TYPE_NULL (0x0A)
57 #define BSON_TYPE_REGEX (0x0B)
58 #define BSON_TYPE_DBPTR (0x0C)
59 #define BSON_TYPE_JAVASCRIPT (0x0D)
60 #define BSON_TYPE_JAVASCRIPTWS (0x0F)
61 #define BSON_TYPE_INT32 (0x10)
62 #define BSON_TYPE_TIMESTAMP (0x11)
63 #define BSON_TYPE_INT64 (0x12)
64 #define BSON_TYPE_MINKEY (0xFF)
65 #define BSON_TYPE_MAXKEY (0x7F)
66 
67 #ifdef __cplusplus
68 extern "C" {
69 #endif
70 
74 const uint8_t* bson_memfind(const uint8_t* area, size_t area_size, const uint8_t* data, size_t data_size);
75 
79 int32_t bson_dec_int32(const uint8_t* data);
80 
84 void bson_enc_int32(uint8_t* data, int32_t value);
85 
89 void bson_enc_bool(uint8_t* data, int value);
90 
107 const uint8_t* bson_find_field(const uint8_t* area, size_t area_size, uint8_t type, const char* name, uint32_t* size, int index);
108 
109 #ifdef __cplusplus
110 }
111 #endif
112 
113 #endif
int32_t bson_dec_int32(const uint8_t *data)
Decode a BSON int32 value.
Definition: atcaprov_bson.c:56
void bson_enc_int32(uint8_t *data, int32_t value)
Encode a BSON int32 value.
Definition: atcaprov_bson.c:61
const uint8_t * bson_find_field(const uint8_t *area, size_t area_size, uint8_t type, const char *name, uint32_t *size, int index)
Simple routine to find fields in BSON data.
Definition: atcaprov_bson.c:74
const uint8_t * bson_memfind(const uint8_t *area, size_t area_size, const uint8_t *data, size_t data_size)
Find binary data within a search area.
Definition: atcaprov_bson.c:44
void bson_enc_bool(uint8_t *data, int value)
Encode a BSON boolean value.
Definition: atcaprov_bson.c:69