@dittolive/ditto 4.7.4 → 4.7.5-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (160) hide show
  1. package/README.md +2 -2
  2. package/node/ditto.cjs.js +1 -1
  3. package/node/ditto.darwin-arm64.node +0 -0
  4. package/node/ditto.darwin-x64.node +0 -0
  5. package/node/ditto.linux-arm.node +0 -0
  6. package/node/ditto.linux-arm64.node +0 -0
  7. package/node/ditto.linux-x64.node +0 -0
  8. package/node/ditto.win32-x64.node +0 -0
  9. package/node/transports.darwin-arm64.node +0 -0
  10. package/node/transports.darwin-x64.node +0 -0
  11. package/package.json +2 -5
  12. package/web/ditto.es6.js +1 -1
  13. package/web/ditto.umd.js +1 -1
  14. package/web/ditto.wasm +0 -0
  15. package/DittoReactNative.podspec +0 -27
  16. package/react-native/android/.gradle/8.9/checksums/checksums.lock +0 -0
  17. package/react-native/android/.gradle/8.9/dependencies-accessors/gc.properties +0 -0
  18. package/react-native/android/.gradle/8.9/fileChanges/last-build.bin +0 -0
  19. package/react-native/android/.gradle/8.9/fileHashes/fileHashes.lock +0 -0
  20. package/react-native/android/.gradle/8.9/gc.properties +0 -0
  21. package/react-native/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  22. package/react-native/android/.gradle/buildOutputCleanup/cache.properties +0 -2
  23. package/react-native/android/.gradle/vcs-1/gc.properties +0 -0
  24. package/react-native/android/CMakeLists.txt +0 -36
  25. package/react-native/android/build.gradle +0 -190
  26. package/react-native/android/cpp-adapter.cpp +0 -259
  27. package/react-native/android/gradle.properties +0 -5
  28. package/react-native/android/src/main/AndroidManifest.xml +0 -4
  29. package/react-native/android/src/main/java/com/dittolive/rnsdk/DittoRNSDKModule.java +0 -120
  30. package/react-native/android/src/main/java/com/dittolive/rnsdk/DittoRNSDKPackage.java +0 -28
  31. package/react-native/cpp/include/Arc.hpp +0 -159
  32. package/react-native/cpp/include/Attachment.h +0 -20
  33. package/react-native/cpp/include/Authentication.h +0 -23
  34. package/react-native/cpp/include/Collection.h +0 -13
  35. package/react-native/cpp/include/ConnectionRequest.h +0 -18
  36. package/react-native/cpp/include/DQL.h +0 -21
  37. package/react-native/cpp/include/Document.h +0 -17
  38. package/react-native/cpp/include/FFIUtils.h +0 -16
  39. package/react-native/cpp/include/IO.h +0 -13
  40. package/react-native/cpp/include/Identity.h +0 -17
  41. package/react-native/cpp/include/Lifecycle.h +0 -16
  42. package/react-native/cpp/include/LiveQuery.h +0 -17
  43. package/react-native/cpp/include/Logger.h +0 -22
  44. package/react-native/cpp/include/Misc.h +0 -30
  45. package/react-native/cpp/include/Presence.h +0 -18
  46. package/react-native/cpp/include/SmallPeerInfo.h +0 -19
  47. package/react-native/cpp/include/Transports.h +0 -25
  48. package/react-native/cpp/include/TypedArray.hpp +0 -167
  49. package/react-native/cpp/include/Utils.h +0 -70
  50. package/react-native/cpp/include/main.h +0 -10
  51. package/react-native/cpp/src/Attachment.cpp +0 -272
  52. package/react-native/cpp/src/Authentication.cpp +0 -227
  53. package/react-native/cpp/src/Collection.cpp +0 -56
  54. package/react-native/cpp/src/ConnectionRequest.cpp +0 -123
  55. package/react-native/cpp/src/DQL.cpp +0 -256
  56. package/react-native/cpp/src/Document.cpp +0 -146
  57. package/react-native/cpp/src/FFIUtils.cpp +0 -122
  58. package/react-native/cpp/src/IO.cpp +0 -35
  59. package/react-native/cpp/src/Identity.cpp +0 -122
  60. package/react-native/cpp/src/Lifecycle.cpp +0 -93
  61. package/react-native/cpp/src/LiveQuery.cpp +0 -63
  62. package/react-native/cpp/src/Logger.cpp +0 -199
  63. package/react-native/cpp/src/Misc.cpp +0 -322
  64. package/react-native/cpp/src/Presence.cpp +0 -166
  65. package/react-native/cpp/src/SmallPeerInfo.cpp +0 -142
  66. package/react-native/cpp/src/Transports.cpp +0 -275
  67. package/react-native/cpp/src/TypedArray.cpp +0 -303
  68. package/react-native/cpp/src/Utils.cpp +0 -139
  69. package/react-native/cpp/src/main.cpp +0 -178
  70. package/react-native/dittoffi/dittoffi.h +0 -4873
  71. package/react-native/dittoffi/ifaddrs.cpp +0 -385
  72. package/react-native/dittoffi/ifaddrs.h +0 -206
  73. package/react-native/ios/DittoRNSDK.h +0 -7
  74. package/react-native/ios/DittoRNSDK.mm +0 -159
  75. package/react-native/ios/YeetJSIUtils.h +0 -60
  76. package/react-native/ios/YeetJSIUtils.mm +0 -196
  77. package/react-native/lib/commonjs/ditto.rn.js +0 -93
  78. package/react-native/lib/commonjs/ditto.rn.js.map +0 -1
  79. package/react-native/lib/commonjs/index.js +0 -61
  80. package/react-native/lib/commonjs/index.js.map +0 -1
  81. package/react-native/lib/module/ditto.rn.js +0 -89
  82. package/react-native/lib/module/ditto.rn.js.map +0 -1
  83. package/react-native/lib/module/index.js +0 -27
  84. package/react-native/lib/module/index.js.map +0 -1
  85. package/react-native/lib/typescript/ditto.rn.d.ts +0 -15
  86. package/react-native/lib/typescript/ditto.rn.d.ts.map +0 -1
  87. package/react-native/lib/typescript/index.d.ts +0 -1
  88. package/react-native/lib/typescript/index.d.ts.map +0 -1
  89. package/react-native/src/ditto.rn.ts +0 -123
  90. package/react-native/src/environment/environment.fallback.ts +0 -4
  91. package/react-native/src/index.ts +0 -29
  92. package/react-native/src/sources/@cbor-redux.ts +0 -2
  93. package/react-native/src/sources/@ditto.core.ts +0 -1
  94. package/react-native/src/sources/@environment.ts +0 -1
  95. package/react-native/src/sources/attachment-fetch-event.ts +0 -54
  96. package/react-native/src/sources/attachment-fetcher-manager.ts +0 -145
  97. package/react-native/src/sources/attachment-fetcher.ts +0 -265
  98. package/react-native/src/sources/attachment-token.ts +0 -129
  99. package/react-native/src/sources/attachment.ts +0 -121
  100. package/react-native/src/sources/augment.ts +0 -108
  101. package/react-native/src/sources/authenticator.ts +0 -314
  102. package/react-native/src/sources/base-pending-cursor-operation.ts +0 -255
  103. package/react-native/src/sources/base-pending-id-specific-operation.ts +0 -112
  104. package/react-native/src/sources/bridge.ts +0 -557
  105. package/react-native/src/sources/build-time-constants.ts +0 -8
  106. package/react-native/src/sources/cbor.ts +0 -20
  107. package/react-native/src/sources/collection-interface.ts +0 -73
  108. package/react-native/src/sources/collection.ts +0 -219
  109. package/react-native/src/sources/collections-event.ts +0 -99
  110. package/react-native/src/sources/connection-request.ts +0 -142
  111. package/react-native/src/sources/counter.ts +0 -82
  112. package/react-native/src/sources/ditto.ts +0 -991
  113. package/react-native/src/sources/document-id.ts +0 -163
  114. package/react-native/src/sources/document-path.ts +0 -308
  115. package/react-native/src/sources/document.ts +0 -237
  116. package/react-native/src/sources/epilogue.ts +0 -32
  117. package/react-native/src/sources/error-codes.ts +0 -114
  118. package/react-native/src/sources/error.ts +0 -256
  119. package/react-native/src/sources/essentials.ts +0 -81
  120. package/react-native/src/sources/ffi-error.ts +0 -134
  121. package/react-native/src/sources/ffi.ts +0 -2190
  122. package/react-native/src/sources/identity.ts +0 -163
  123. package/react-native/src/sources/init.ts +0 -71
  124. package/react-native/src/sources/internal.ts +0 -143
  125. package/react-native/src/sources/keep-alive.ts +0 -73
  126. package/react-native/src/sources/key-path.ts +0 -198
  127. package/react-native/src/sources/live-query-event.ts +0 -208
  128. package/react-native/src/sources/live-query-manager.ts +0 -110
  129. package/react-native/src/sources/live-query.ts +0 -167
  130. package/react-native/src/sources/logger.ts +0 -196
  131. package/react-native/src/sources/main.ts +0 -61
  132. package/react-native/src/sources/observer-manager.ts +0 -185
  133. package/react-native/src/sources/observer.ts +0 -79
  134. package/react-native/src/sources/pending-collections-operation.ts +0 -241
  135. package/react-native/src/sources/pending-cursor-operation.ts +0 -218
  136. package/react-native/src/sources/pending-id-specific-operation.ts +0 -218
  137. package/react-native/src/sources/presence-manager.ts +0 -170
  138. package/react-native/src/sources/presence.ts +0 -427
  139. package/react-native/src/sources/query-result-item.ts +0 -131
  140. package/react-native/src/sources/query-result.ts +0 -55
  141. package/react-native/src/sources/register.ts +0 -95
  142. package/react-native/src/sources/small-peer-info.ts +0 -166
  143. package/react-native/src/sources/static-tcp-client.ts +0 -8
  144. package/react-native/src/sources/store-observer.ts +0 -170
  145. package/react-native/src/sources/store.ts +0 -630
  146. package/react-native/src/sources/subscription-manager.ts +0 -99
  147. package/react-native/src/sources/subscription.ts +0 -89
  148. package/react-native/src/sources/sync-subscription.ts +0 -90
  149. package/react-native/src/sources/sync.ts +0 -561
  150. package/react-native/src/sources/test-helpers.ts +0 -24
  151. package/react-native/src/sources/transport-conditions-manager.ts +0 -104
  152. package/react-native/src/sources/transport-config.ts +0 -430
  153. package/react-native/src/sources/update-result.ts +0 -66
  154. package/react-native/src/sources/update-results-map.ts +0 -65
  155. package/react-native/src/sources/websocket-client.ts +0 -7
  156. package/react-native/src/sources/write-transaction-collection.ts +0 -122
  157. package/react-native/src/sources/write-transaction-pending-cursor-operation.ts +0 -101
  158. package/react-native/src/sources/write-transaction-pending-id-specific-operation.ts +0 -74
  159. package/react-native/src/sources/write-transaction.ts +0 -121
  160. package/react-native.config.js +0 -9
@@ -1,4873 +0,0 @@
1
- /*! \file */
2
- /*******************************************
3
- * *
4
- * File auto-generated by `::safer_ffi`. *
5
- * *
6
- * Do not manually edit this file. *
7
- * *
8
- *******************************************/
9
-
10
- #ifndef __RUST_DITTOFFI__
11
- #define __RUST_DITTOFFI__
12
- #ifdef __cplusplus
13
- extern "C" {
14
- #endif
15
-
16
- /** <No documentation available> */
17
- #define DITTOFFI_PRESENCE_PEER_METADATA_MAX_SIZE_IN_BYTES ((uint32_t) 4096)
18
-
19
-
20
- #include <stddef.h>
21
- #include <stdint.h>
22
-
23
- /** \brief
24
- * This enum contains all the Ditto types exposed publicly. The IDs **MUST**
25
- * not be modified otherwise this would break the type conversions.
26
- *
27
- * CHECKME: When merging with Russell's work on explicit types, this enum may
28
- * be duplicated.
29
- */
30
- typedef enum DittoCrdtType {
31
- /** <No documentation available> */
32
- DITTO_CRDT_TYPE_COUNTER = 0,
33
- /** <No documentation available> */
34
- DITTO_CRDT_TYPE_REGISTER = 1,
35
- /** <No documentation available> */
36
- DITTO_CRDT_TYPE_ATTACHMENT = 2,
37
- /** <No documentation available> */
38
- DITTO_CRDT_TYPE_RGA = 3,
39
- /** <No documentation available> */
40
- DITTO_CRDT_TYPE_R_W_MAP = 4,
41
- /** <No documentation available> */
42
- DITTO_CRDT_TYPE_ST_COUNTER = 5,
43
- /** <No documentation available> */
44
- DITTO_CRDT_TYPE_A_W_SET = 6,
45
- } DittoCrdtType_t;
46
-
47
- /** \brief
48
- * A short-lived FFI object to let an SDK handle an authentication request
49
- * in an async manner.
50
- */
51
- typedef struct CAuthServerAuthRequest CAuthServerAuthRequest_t;
52
-
53
- /** <No documentation available> */
54
- void
55
- /* fn */ auth_server_auth_submit_with_error (
56
- CAuthServerAuthRequest_t * req,
57
- uint32_t _error_code);
58
-
59
- /** \brief
60
- * `&'lt [T]` but with a guaranteed `#[repr(C)]` layout.
61
- *
62
- * # C layout (for some given type T)
63
- *
64
- * ```c
65
- * typedef struct {
66
- * // Cannot be NULL
67
- * T * ptr;
68
- * size_t len;
69
- * } slice_T;
70
- * ```
71
- *
72
- * # Nullable pointer?
73
- *
74
- * If you want to support the above typedef, but where the `ptr` field is
75
- * allowed to be `NULL` (with the contents of `len` then being undefined)
76
- * use the `Option< slice_ptr<_> >` type.
77
- */
78
- typedef struct slice_ref_uint8 {
79
- /** \brief
80
- * Pointer to the first element (if any).
81
- */
82
- uint8_t const * ptr;
83
-
84
- /** \brief
85
- * Element count
86
- */
87
- size_t len;
88
- } slice_ref_uint8_t;
89
-
90
- /** <No documentation available> */
91
- void
92
- /* fn */ auth_server_auth_submit_with_success (
93
- CAuthServerAuthRequest_t * req,
94
- slice_ref_uint8_t success_cbor);
95
-
96
- /** <No documentation available> */
97
- typedef struct CAuthServerRefreshRequest CAuthServerRefreshRequest_t;
98
-
99
- /** <No documentation available> */
100
- void
101
- /* fn */ auth_server_refresh_submit_with_error (
102
- CAuthServerRefreshRequest_t * req,
103
- uint32_t _error_code);
104
-
105
- /** <No documentation available> */
106
- void
107
- /* fn */ auth_server_refresh_submit_with_success (
108
- CAuthServerRefreshRequest_t * req,
109
- slice_ref_uint8_t success_cbor);
110
-
111
- /** \brief
112
- * An opaque handle for each installed transport, heap-allocated and owned by
113
- * the SDK.
114
- *
115
- * A pointer to this handle is used to send platform events over FFI. In the
116
- * future this handle will be the SDK's only point of control over the
117
- * transport once created. In particular, a transport will be removed by
118
- * freeing the handle. The concept of online and offline will be eliminated.
119
- * (i.e., if you don't want a transport, remove it.)
120
- *
121
- * For now, the `Peer` object holds the transports and provides an API based on
122
- * a numeric id assigned to each transport instance. Until that is removed, the
123
- * id still exists and the SDK can request it from the opaque handle over FFI.
124
- *
125
- * For each transport type, define an `extern "C"` function to free that
126
- * specific monomorphisation of the `TransportHandle` using `Box::from_raw`,
127
- * plus a function to retrieve the transport id, which will be removed later.
128
- *
129
- * Safety: The SDK owns the `TransportHandle`. It is responsible for ensuring
130
- * that it does not use the pointer to the `TransportHandle` after freeing it
131
- * with its respective function. In Rust we will assume it is okay to unsafely
132
- * dereference a handle.
133
- *
134
- * The C interface of `TransportHandle` is thread-safe (`Send + Sync`).
135
- */
136
- typedef struct TransportHandle_AwdlClientPlatformEvent TransportHandle_AwdlClientPlatformEvent_t;
137
-
138
- /** \brief
139
- * Generic enum used by crate and platforms to indicate a connection status
140
- */
141
- typedef enum ConnectState {
142
- /** <No documentation available> */
143
- CONNECT_STATE_DISCONNECTED,
144
- /** <No documentation available> */
145
- CONNECT_STATE_CONNECTED,
146
- /** <No documentation available> */
147
- CONNECT_STATE_CONNECTING,
148
- /** <No documentation available> */
149
- CONNECT_STATE_DISCONNECTING,
150
- } ConnectState_t;
151
-
152
- /** \brief
153
- * The platform advises Rust that a peer has changed its current connection
154
- * status
155
- */
156
- void
157
- /* fn */ awdl_client_connect_state_changed (
158
- TransportHandle_AwdlClientPlatformEvent_t const * handle,
159
- char const * announce,
160
- ConnectState_t state);
161
-
162
- /** \brief
163
- * The platform advises Rust that a complete message has been received from a
164
- * remote peer
165
- */
166
- void
167
- /* fn */ awdl_client_data_available (
168
- TransportHandle_AwdlClientPlatformEvent_t const * handle,
169
- char const * announce);
170
-
171
- /** \brief
172
- * The SDK requests to drop its handle to the AWDL Client Transport
173
- *
174
- * At some point dropping this events channel will effectively shut down and
175
- * remove the Transport. At time of writing, the Transport is still owned
176
- * within Peer.
177
- */
178
- void
179
- /* fn */ awdl_client_free_handle (
180
- TransportHandle_AwdlClientPlatformEvent_t * handle);
181
-
182
- /** \brief
183
- * The platform advises Rust that a peer has been identified. We know only its
184
- * announce string.
185
- */
186
- void
187
- /* fn */ awdl_client_platform_peer_appeared (
188
- TransportHandle_AwdlClientPlatformEvent_t const * handle,
189
- char const * announce);
190
-
191
- /** \brief
192
- * The platform advises Rust that a peer has disappeared.
193
- */
194
- void
195
- /* fn */ awdl_client_platform_peer_disappeared (
196
- TransportHandle_AwdlClientPlatformEvent_t const * handle,
197
- char const * announce);
198
-
199
- /** \brief
200
- * The platform advises Rust that a given peer is now clear to queue up a new
201
- * message whenever one is ready to go
202
- */
203
- void
204
- /* fn */ awdl_client_ready_to_send (
205
- TransportHandle_AwdlClientPlatformEvent_t const * handle,
206
- char const * announce);
207
-
208
- /** \brief
209
- * Generic enum used by crate and platforms to indicate online-ness.
210
- *
211
- * In other words, is something active or not? Not everything will use the
212
- * transitional states.
213
- */
214
- typedef enum OnlineState {
215
- /** <No documentation available> */
216
- ONLINE_STATE_OFFLINE,
217
- /** <No documentation available> */
218
- ONLINE_STATE_ONLINE,
219
- /** <No documentation available> */
220
- ONLINE_STATE_GOING_ONLINE,
221
- /** <No documentation available> */
222
- ONLINE_STATE_GOING_OFFLINE,
223
- } OnlineState_t;
224
-
225
- /** \brief
226
- * A code reported by platforms/transports to indicate specific health
227
- * conditions
228
- */
229
- typedef enum TransportCondition {
230
- /** \brief
231
- * A default state. Only use this for transient conditions, e.g., we are
232
- * waiting for a platform to finish starting up. If everything is just
233
- * quiet, use `Ok`.
234
- */
235
- TRANSPORT_CONDITION_UNKNOWN,
236
- /** \brief
237
- * No known problems.
238
- */
239
- TRANSPORT_CONDITION_OK,
240
- /** \brief
241
- * Catch-all failure, particularly for unexpected/internal faults. If
242
- * possible, add a new case that the customer will be able to
243
- * interpret.
244
- */
245
- TRANSPORT_CONDITION_GENERIC_FAILURE,
246
- /** \brief
247
- * App is in background.
248
- */
249
- TRANSPORT_CONDITION_APP_IN_BACKGROUND,
250
- /** \brief
251
- * We are not able to publish or discover with the mDNS daemon.
252
- */
253
- TRANSPORT_CONDITION_MDNS_FAILURE,
254
- /** \brief
255
- * We cannot bind to a port.
256
- */
257
- TRANSPORT_CONDITION_TCP_LISTEN_FAILURE,
258
- /** \brief
259
- * No app permission to act as a BLE Central.
260
- */
261
- TRANSPORT_CONDITION_NO_BLE_CENTRAL_PERMISSION,
262
- /** \brief
263
- * No app permission to act as a BLE Peripheral.
264
- */
265
- TRANSPORT_CONDITION_NO_BLE_PERIPHERAL_PERMISSION,
266
- /** \brief
267
- * This Transport targets a particular peer and we can't reach them right
268
- * now.
269
- */
270
- TRANSPORT_CONDITION_CANNOT_ESTABLISH_CONNECTION,
271
- /** \brief
272
- * The device has Bluetooth disabled at the OS level.
273
- */
274
- TRANSPORT_CONDITION_BLE_DISABLED,
275
- /** \brief
276
- * The device has no Bluetooth hardware.
277
- */
278
- TRANSPORT_CONDITION_NO_BLE_HARDWARE,
279
- /** \brief
280
- * The device has Wifi disabled at the OS level.
281
- */
282
- TRANSPORT_CONDITION_WIFI_DISABLED,
283
- /** \brief
284
- * The platform has suspended briefly for internal reasons. Peers are
285
- * reset.
286
- */
287
- TRANSPORT_CONDITION_TEMPORARILY_UNAVAILABLE,
288
- } TransportCondition_t;
289
-
290
- /** \brief
291
- * The platform advises Rust that searching status changed
292
- */
293
- void
294
- /* fn */ awdl_client_scanning_state_changed (
295
- TransportHandle_AwdlClientPlatformEvent_t const * handle,
296
- OnlineState_t state,
297
- TransportCondition_t condition);
298
-
299
- /** \brief
300
- * An opaque handle for each installed transport, heap-allocated and owned by
301
- * the SDK.
302
- *
303
- * A pointer to this handle is used to send platform events over FFI. In the
304
- * future this handle will be the SDK's only point of control over the
305
- * transport once created. In particular, a transport will be removed by
306
- * freeing the handle. The concept of online and offline will be eliminated.
307
- * (i.e., if you don't want a transport, remove it.)
308
- *
309
- * For now, the `Peer` object holds the transports and provides an API based on
310
- * a numeric id assigned to each transport instance. Until that is removed, the
311
- * id still exists and the SDK can request it from the opaque handle over FFI.
312
- *
313
- * For each transport type, define an `extern "C"` function to free that
314
- * specific monomorphisation of the `TransportHandle` using `Box::from_raw`,
315
- * plus a function to retrieve the transport id, which will be removed later.
316
- *
317
- * Safety: The SDK owns the `TransportHandle`. It is responsible for ensuring
318
- * that it does not use the pointer to the `TransportHandle` after freeing it
319
- * with its respective function. In Rust we will assume it is okay to unsafely
320
- * dereference a handle.
321
- *
322
- * The C interface of `TransportHandle` is thread-safe (`Send + Sync`).
323
- */
324
- typedef struct TransportHandle_AwdlServerPlatformEvent TransportHandle_AwdlServerPlatformEvent_t;
325
-
326
- /** \brief
327
- * The platform advises Rust that advertising status changed
328
- */
329
- void
330
- /* fn */ awdl_server_advertising_state_changed (
331
- TransportHandle_AwdlServerPlatformEvent_t const * handle,
332
- OnlineState_t state,
333
- TransportCondition_t condition);
334
-
335
- /** \brief
336
- * The platform advises Rust that a peer has changed its current connection
337
- * status
338
- */
339
- void
340
- /* fn */ awdl_server_connect_state_changed (
341
- TransportHandle_AwdlServerPlatformEvent_t const * handle,
342
- int64_t platform_id,
343
- ConnectState_t state);
344
-
345
- /** \brief
346
- * The platform advises Rust that a complete message has been received from a
347
- * remote peer
348
- */
349
- void
350
- /* fn */ awdl_server_data_available (
351
- TransportHandle_AwdlServerPlatformEvent_t const * handle,
352
- int64_t platform_id);
353
-
354
- /** \brief
355
- * The SDK requests to drop its handle to the AWDL Server Transport
356
- *
357
- * At some point dropping this events channel will effectively shut down and
358
- * remove the Transport. At time of writing, the Transport is still owned
359
- * within Peer.
360
- */
361
- void
362
- /* fn */ awdl_server_free_handle (
363
- TransportHandle_AwdlServerPlatformEvent_t * handle);
364
-
365
- /** \brief
366
- * The platform advises Rust that a peer has been identified. We know only its
367
- * announce string.
368
- */
369
- void
370
- /* fn */ awdl_server_platform_peer_appeared (
371
- TransportHandle_AwdlServerPlatformEvent_t const * handle,
372
- int64_t platform_id);
373
-
374
- /** \brief
375
- * The platform advises Rust that a peer has disappeared.
376
- */
377
- void
378
- /* fn */ awdl_server_platform_peer_disappeared (
379
- TransportHandle_AwdlServerPlatformEvent_t const * handle,
380
- int64_t platform_id);
381
-
382
- /** \brief
383
- * The platform advises Rust that a given peer is now clear to queue up a new
384
- * message whenever one is ready to go
385
- */
386
- void
387
- /* fn */ awdl_server_ready_to_send (
388
- TransportHandle_AwdlServerPlatformEvent_t const * handle,
389
- int64_t platform_id);
390
-
391
- /** \brief
392
- * An opaque handle for each installed transport, heap-allocated and owned by
393
- * the SDK.
394
- *
395
- * A pointer to this handle is used to send platform events over FFI. In the
396
- * future this handle will be the SDK's only point of control over the
397
- * transport once created. In particular, a transport will be removed by
398
- * freeing the handle. The concept of online and offline will be eliminated.
399
- * (i.e., if you don't want a transport, remove it.)
400
- *
401
- * For now, the `Peer` object holds the transports and provides an API based on
402
- * a numeric id assigned to each transport instance. Until that is removed, the
403
- * id still exists and the SDK can request it from the opaque handle over FFI.
404
- *
405
- * For each transport type, define an `extern "C"` function to free that
406
- * specific monomorphisation of the `TransportHandle` using `Box::from_raw`,
407
- * plus a function to retrieve the transport id, which will be removed later.
408
- *
409
- * Safety: The SDK owns the `TransportHandle`. It is responsible for ensuring
410
- * that it does not use the pointer to the `TransportHandle` after freeing it
411
- * with its respective function. In Rust we will assume it is okay to unsafely
412
- * dereference a handle.
413
- *
414
- * The C interface of `TransportHandle` is thread-safe (`Send + Sync`).
415
- */
416
- typedef struct TransportHandle_BleClientPlatformEvent TransportHandle_BleClientPlatformEvent_t;
417
-
418
- typedef struct {
419
- uint8_t idx[16];
420
- } uint8_16_array_t;
421
-
422
- /** <No documentation available> */
423
- void
424
- /* fn */ ble_advertisement_heard (
425
- TransportHandle_BleClientPlatformEvent_t const * handle,
426
- uint8_16_array_t const * peripheral_uuid,
427
- slice_ref_uint8_t local_name,
428
- float rssi);
429
-
430
- /** \brief
431
- * An opaque handle for each installed transport, heap-allocated and owned by
432
- * the SDK.
433
- *
434
- * A pointer to this handle is used to send platform events over FFI. In the
435
- * future this handle will be the SDK's only point of control over the
436
- * transport once created. In particular, a transport will be removed by
437
- * freeing the handle. The concept of online and offline will be eliminated.
438
- * (i.e., if you don't want a transport, remove it.)
439
- *
440
- * For now, the `Peer` object holds the transports and provides an API based on
441
- * a numeric id assigned to each transport instance. Until that is removed, the
442
- * id still exists and the SDK can request it from the opaque handle over FFI.
443
- *
444
- * For each transport type, define an `extern "C"` function to free that
445
- * specific monomorphisation of the `TransportHandle` using `Box::from_raw`,
446
- * plus a function to retrieve the transport id, which will be removed later.
447
- *
448
- * Safety: The SDK owns the `TransportHandle`. It is responsible for ensuring
449
- * that it does not use the pointer to the `TransportHandle` after freeing it
450
- * with its respective function. In Rust we will assume it is okay to unsafely
451
- * dereference a handle.
452
- *
453
- * The C interface of `TransportHandle` is thread-safe (`Send + Sync`).
454
- */
455
- typedef struct TransportHandle_BleServerPlatformEvent TransportHandle_BleServerPlatformEvent_t;
456
-
457
- /** <No documentation available> */
458
- void
459
- /* fn */ ble_advertising_state_changed (
460
- TransportHandle_BleServerPlatformEvent_t const * handle,
461
- OnlineState_t state,
462
- TransportCondition_t result);
463
-
464
- /** <No documentation available> */
465
- void
466
- /* fn */ ble_central_finished_connecting (
467
- TransportHandle_BleServerPlatformEvent_t const * handle,
468
- uint8_16_array_t const * uuid,
469
- slice_ref_uint8_t announce,
470
- int32_t l2cap_available,
471
- uint32_t mtu);
472
-
473
- /** <No documentation available> */
474
- void
475
- /* fn */ ble_central_l2cap_data_available (
476
- TransportHandle_BleServerPlatformEvent_t const * handle,
477
- uint8_16_array_t const * uuid);
478
-
479
- /** <No documentation available> */
480
- void
481
- /* fn */ ble_central_l2cap_ready_to_send (
482
- TransportHandle_BleServerPlatformEvent_t const * handle,
483
- uint8_16_array_t const * uuid);
484
-
485
- /** <No documentation available> */
486
- void
487
- /* fn */ ble_central_mtu_updated (
488
- TransportHandle_BleServerPlatformEvent_t const * handle,
489
- uint8_16_array_t const * uuid,
490
- uint32_t mtu);
491
-
492
- /** <No documentation available> */
493
- void
494
- /* fn */ ble_central_ready_to_send (
495
- TransportHandle_BleServerPlatformEvent_t const * handle,
496
- uint8_16_array_t const * uuid);
497
-
498
- /** <No documentation available> */
499
- void
500
- /* fn */ ble_central_unsubscribed (
501
- TransportHandle_BleServerPlatformEvent_t const * handle,
502
- uint8_16_array_t const * central_uuid);
503
-
504
- /** \brief
505
- * The SDK requests to drop its handle to the BLE Client Transport
506
- *
507
- * At some point dropping this events channel will effectively shut down and
508
- * remove the Transport. At time of writing, the Transport is still owned
509
- * within Peer.
510
- */
511
- void
512
- /* fn */ ble_client_free_handle (
513
- TransportHandle_BleClientPlatformEvent_t * handle);
514
-
515
- /** <No documentation available> */
516
- void
517
- /* fn */ ble_connection_state_changed (
518
- TransportHandle_BleClientPlatformEvent_t const * handle,
519
- uint8_16_array_t const * peripheral_uuid,
520
- ConnectState_t state,
521
- int32_t l2cap_available,
522
- uint32_t mtu);
523
-
524
- /** <No documentation available> */
525
- void
526
- /* fn */ ble_peripheral_l2cap_data_available (
527
- TransportHandle_BleClientPlatformEvent_t const * handle,
528
- uint8_16_array_t const * uuid);
529
-
530
- /** <No documentation available> */
531
- void
532
- /* fn */ ble_peripheral_l2cap_ready_to_send (
533
- TransportHandle_BleClientPlatformEvent_t const * handle,
534
- uint8_16_array_t const * uuid);
535
-
536
- /** <No documentation available> */
537
- void
538
- /* fn */ ble_peripheral_mtu_updated (
539
- TransportHandle_BleClientPlatformEvent_t const * handle,
540
- uint8_16_array_t const * uuid,
541
- uint32_t mtu);
542
-
543
- /** <No documentation available> */
544
- void
545
- /* fn */ ble_peripheral_ready_to_send (
546
- TransportHandle_BleClientPlatformEvent_t const * handle,
547
- uint8_16_array_t const * uuid);
548
-
549
- /** \brief
550
- * When receiving data from a Bluetooth LE peer, such as a characteristic
551
- * write, indicates what sort of data it is.
552
- */
553
- typedef enum BleDataType {
554
- /** \brief
555
- * The data _should_ contain the remote peer's announce string.
556
- * Used during handshake.
557
- */
558
- BLE_DATA_TYPE_ANNOUNCE = 0,
559
- /** \brief
560
- * Data message
561
- */
562
- BLE_DATA_TYPE_MESH_DATA = 1,
563
- /** \brief
564
- * Control message
565
- */
566
- BLE_DATA_TYPE_CONTROL = 2,
567
- } BleDataType_t;
568
-
569
- /** <No documentation available> */
570
- void
571
- /* fn */ ble_received_from_central (
572
- TransportHandle_BleServerPlatformEvent_t const * handle,
573
- uint8_16_array_t const * central_uuid,
574
- BleDataType_t data_type,
575
- slice_ref_uint8_t data);
576
-
577
- /** <No documentation available> */
578
- void
579
- /* fn */ ble_received_from_peripheral (
580
- TransportHandle_BleClientPlatformEvent_t const * handle,
581
- uint8_16_array_t const * peripheral_uuid,
582
- BleDataType_t data_type,
583
- slice_ref_uint8_t data);
584
-
585
- /** <No documentation available> */
586
- void
587
- /* fn */ ble_scanning_state_changed (
588
- TransportHandle_BleClientPlatformEvent_t const * handle,
589
- OnlineState_t state,
590
- TransportCondition_t result);
591
-
592
- /** \brief
593
- * The SDK requests to drop its handle to the BLE Server Transport
594
- *
595
- * At some point dropping this events channel will effectively shut down and
596
- * remove the Transport. At time of writing, the Transport is still owned
597
- * within Peer.
598
- */
599
- void
600
- /* fn */ ble_server_free_handle (
601
- TransportHandle_BleServerPlatformEvent_t * handle);
602
-
603
- /** <No documentation available> */
604
- typedef struct CDitto CDitto_t;
605
-
606
- /** \brief
607
- * `&'lt mut [T]` but with a guaranteed `#[repr(C)]` layout.
608
- *
609
- * # C layout (for some given type T)
610
- *
611
- * ```c
612
- * typedef struct {
613
- * // Cannot be NULL
614
- * T * ptr;
615
- * size_t len;
616
- * } slice_T;
617
- * ```
618
- *
619
- * # Nullable pointer?
620
- *
621
- * If you want to support the above typedef, but where the `ptr` field is
622
- * allowed to be `NULL` (with the contents of `len` then being undefined)
623
- * use the `Option< slice_ptr<_> >` type.
624
- */
625
- typedef struct slice_mut_uint8 {
626
- /** \brief
627
- * Pointer to the first element (if any).
628
- */
629
- uint8_t * ptr;
630
-
631
- /** \brief
632
- * Element count
633
- */
634
- size_t len;
635
- } slice_mut_uint8_t;
636
-
637
- /** <No documentation available> */
638
- typedef struct AwdlClientCallbacks {
639
- /** <No documentation available> */
640
- void (*start_searching)(void *, char const *, char const *);
641
-
642
- /** <No documentation available> */
643
- void (*stop_searching)(void *);
644
-
645
- /** <No documentation available> */
646
- void (*request_connect)(void *, char const *);
647
-
648
- /** <No documentation available> */
649
- void (*request_disconnect)(void *, char const *);
650
-
651
- /** <No documentation available> */
652
- int32_t (*send_data)(void *, char const *, slice_ref_uint8_t);
653
-
654
- /** <No documentation available> */
655
- int32_t (*read_data)(void *, char const *, slice_mut_uint8_t);
656
- } AwdlClientCallbacks_t;
657
-
658
- /** <No documentation available> */
659
- TransportHandle_AwdlClientPlatformEvent_t *
660
- /* fn */ ditto_add_awdl_client_transport (
661
- CDitto_t const * ditto,
662
- AwdlClientCallbacks_t callbacks,
663
- void * ctx,
664
- void (*retain)(void *),
665
- void (*release)(void *));
666
-
667
- /** <No documentation available> */
668
- typedef struct AwdlServerCallbacks {
669
- /** <No documentation available> */
670
- void (*start_advertising)(void *, char const *, char const *);
671
-
672
- /** <No documentation available> */
673
- void (*stop_advertising)(void *);
674
-
675
- /** <No documentation available> */
676
- void (*request_disconnect)(void *, int64_t);
677
-
678
- /** <No documentation available> */
679
- int32_t (*send_data)(void *, int64_t, slice_ref_uint8_t);
680
-
681
- /** <No documentation available> */
682
- int32_t (*read_data)(void *, int64_t, slice_mut_uint8_t);
683
- } AwdlServerCallbacks_t;
684
-
685
- /** <No documentation available> */
686
- TransportHandle_AwdlServerPlatformEvent_t *
687
- /* fn */ ditto_add_awdl_server_transport (
688
- CDitto_t const * ditto,
689
- AwdlServerCallbacks_t callbacks,
690
- void * ctx,
691
- void (*retain)(void *),
692
- void (*release)(void *));
693
-
694
-
695
- #include <stdbool.h>
696
-
697
- /** \brief
698
- * Rust-level representation of the result of a send operation, converted from
699
- * a bitfield
700
- */
701
- typedef struct SendResult {
702
- /** <No documentation available> */
703
- bool accepted;
704
-
705
- /** <No documentation available> */
706
- bool wait_for_ready;
707
- } SendResult_t;
708
-
709
- /** <No documentation available> */
710
- typedef struct BleClientCallbacks {
711
- /** <No documentation available> */
712
- void (*start_scanning)(void *, uint8_16_array_t const *, slice_ref_uint8_t);
713
-
714
- /** <No documentation available> */
715
- void (*stop_scanning)(void *);
716
-
717
- /** <No documentation available> */
718
- OnlineState_t (*scanning_state)(void *);
719
-
720
- /** <No documentation available> */
721
- void (*connect_peripheral)(void *, uint8_16_array_t const *);
722
-
723
- /** <No documentation available> */
724
- void (*disconnect_peripheral)(void *, uint8_16_array_t const *);
725
-
726
- /** <No documentation available> */
727
- SendResult_t (*write_to_peripheral)(void *, BleDataType_t, uint8_16_array_t const *, slice_ref_uint8_t);
728
-
729
- /** <No documentation available> */
730
- bool (*app_is_in_foreground)(void *);
731
-
732
- /** <No documentation available> */
733
- int32_t (*read_l2cap_from_peripheral)(void *, uint8_16_array_t const *, slice_mut_uint8_t);
734
-
735
- /** <No documentation available> */
736
- int32_t (*send_l2cap_to_peripheral)(void *, uint8_16_array_t const *, slice_ref_uint8_t);
737
- } BleClientCallbacks_t;
738
-
739
- /** <No documentation available> */
740
- TransportHandle_BleClientPlatformEvent_t *
741
- /* fn */ ditto_add_ble_client_transport (
742
- CDitto_t const * ditto,
743
- BleClientCallbacks_t callbacks,
744
- void * ctx,
745
- void (*retain)(void *),
746
- void (*release)(void *));
747
-
748
- /** <No documentation available> */
749
- typedef struct BleServerCallbacks {
750
- /** <No documentation available> */
751
- void (*start_advertising)(void *, uint8_16_array_t const *, slice_ref_uint8_t);
752
-
753
- /** <No documentation available> */
754
- void (*stop_advertising)(void *);
755
-
756
- /** <No documentation available> */
757
- OnlineState_t (*advertising_state)(void *);
758
-
759
- /** <No documentation available> */
760
- SendResult_t (*notify_to_central)(void *, BleDataType_t, uint8_16_array_t const *, slice_ref_uint8_t);
761
-
762
- /** <No documentation available> */
763
- bool (*app_is_in_foreground)(void *);
764
-
765
- /** <No documentation available> */
766
- int32_t (*read_l2cap_from_central)(void *, uint8_16_array_t const *, slice_mut_uint8_t);
767
-
768
- /** <No documentation available> */
769
- int32_t (*send_l2cap_to_central)(void *, uint8_16_array_t const *, slice_ref_uint8_t);
770
- } BleServerCallbacks_t;
771
-
772
- /** <No documentation available> */
773
- TransportHandle_BleServerPlatformEvent_t *
774
- /* fn */ ditto_add_ble_server_transport (
775
- CDitto_t const * ditto,
776
- BleServerCallbacks_t callbacks,
777
- void * ctx,
778
- void (*retain)(void *),
779
- void (*release)(void *));
780
-
781
- /** \brief
782
- * Requested reliability level for a message to be transmitted to another peer.
783
- *
784
- * Related to Link's
785
- * [`StreamReliability`](`::ditto_link::protocol::StreamReliability`).
786
- */
787
- typedef enum ReliabilityMode {
788
- /** \brief
789
- * No guarantees of successful delivery, ordering, or once-only delivery
790
- */
791
- RELIABILITY_MODE_UNRELIABLE,
792
- /** \brief
793
- * Messages will be delivered at most once, in the same order that they are sent,
794
- * but there may be gaps.
795
- */
796
- RELIABILITY_MODE_UNRELIABLE_SEQUENCED,
797
- /** \brief
798
- * Every message will be delivered in order or else the connection fails
799
- */
800
- RELIABILITY_MODE_RELIABLE,
801
- } ReliabilityMode_t;
802
-
803
- /** \brief
804
- * FFI version of CompletionReason
805
- */
806
- typedef enum BusCompletionReason {
807
- /** <No documentation available> */
808
- BUS_COMPLETION_REASON_CLOSED_BY_REMOTE,
809
- /** <No documentation available> */
810
- BUS_COMPLETION_REASON_CLOSED_BY_LOCAL,
811
- } BusCompletionReason_t;
812
-
813
- /** \brief
814
- * FFI mapping of SingleSendError results
815
- */
816
- typedef enum BusSingleSendResult {
817
- /** <No documentation available> */
818
- BUS_SINGLE_SEND_RESULT_OK,
819
- /** <No documentation available> */
820
- BUS_SINGLE_SEND_RESULT_PAYLOAD_TOO_LARGE,
821
- /** <No documentation available> */
822
- BUS_SINGLE_SEND_RESULT_QUEUE_FULL,
823
- /** <No documentation available> */
824
- BUS_SINGLE_SEND_RESULT_STREAM_FAILED,
825
- } BusSingleSendResult_t;
826
-
827
- /** <No documentation available> */
828
- typedef struct BusCallbacks {
829
- /** <No documentation available> */
830
- void (*new_incoming_stream)(void *, uint64_t, slice_ref_uint8_t, ReliabilityMode_t, uint64_t);
831
-
832
- /** <No documentation available> */
833
- void (*stream_open_succeeded)(void *, uint64_t, ReliabilityMode_t, uint64_t);
834
-
835
- /** <No documentation available> */
836
- void (*stream_open_failed)(void *, uint64_t);
837
-
838
- /** <No documentation available> */
839
- void (*stream_send_completed)(void *, uint64_t, uint32_t, uint64_t);
840
-
841
- /** <No documentation available> */
842
- void (*stream_closed)(void *, uint64_t, BusCompletionReason_t);
843
-
844
- /** <No documentation available> */
845
- void (*stream_incoming_message)(void *, uint64_t, slice_ref_uint8_t);
846
-
847
- /** <No documentation available> */
848
- void (*stream_remote_ack)(void *, uint64_t, uint64_t);
849
-
850
- /** <No documentation available> */
851
- void (*single_message_received)(void *, uint64_t, slice_ref_uint8_t, slice_ref_uint8_t);
852
-
853
- /** <No documentation available> */
854
- void (*finished_sending_single_message)(void *, uint64_t, ReliabilityMode_t, BusSingleSendResult_t);
855
- } BusCallbacks_t;
856
-
857
- /** <No documentation available> */
858
- void
859
- /* fn */ ditto_add_bus (
860
- CDitto_t const * ditto,
861
- BusCallbacks_t callbacks,
862
- void * ctx,
863
- void (*retain)(void *),
864
- void (*release)(void *));
865
-
866
- /** <No documentation available> */
867
- TransportHandle_BleClientPlatformEvent_t *
868
- /* fn */ ditto_add_internal_ble_client_transport (
869
- CDitto_t const * ditto);
870
-
871
- /** <No documentation available> */
872
- TransportHandle_BleServerPlatformEvent_t *
873
- /* fn */ ditto_add_internal_ble_server_transport (
874
- CDitto_t const * ditto);
875
-
876
- /** \brief
877
- * An opaque handle for each installed transport, heap-allocated and owned by
878
- * the SDK.
879
- *
880
- * A pointer to this handle is used to send platform events over FFI. In the
881
- * future this handle will be the SDK's only point of control over the
882
- * transport once created. In particular, a transport will be removed by
883
- * freeing the handle. The concept of online and offline will be eliminated.
884
- * (i.e., if you don't want a transport, remove it.)
885
- *
886
- * For now, the `Peer` object holds the transports and provides an API based on
887
- * a numeric id assigned to each transport instance. Until that is removed, the
888
- * id still exists and the SDK can request it from the opaque handle over FFI.
889
- *
890
- * For each transport type, define an `extern "C"` function to free that
891
- * specific monomorphisation of the `TransportHandle` using `Box::from_raw`,
892
- * plus a function to retrieve the transport id, which will be removed later.
893
- *
894
- * Safety: The SDK owns the `TransportHandle`. It is responsible for ensuring
895
- * that it does not use the pointer to the `TransportHandle` after freeing it
896
- * with its respective function. In Rust we will assume it is okay to unsafely
897
- * dereference a handle.
898
- *
899
- * The C interface of `TransportHandle` is thread-safe (`Send + Sync`).
900
- */
901
- typedef struct TransportHandle_MdnsClientPlatformEvent TransportHandle_MdnsClientPlatformEvent_t;
902
-
903
- /** <No documentation available> */
904
- TransportHandle_MdnsClientPlatformEvent_t *
905
- /* fn */ ditto_add_internal_mdns_client_transport (
906
- CDitto_t const * ditto);
907
-
908
- /** \brief
909
- * An opaque handle for each installed transport, heap-allocated and owned by
910
- * the SDK.
911
- *
912
- * A pointer to this handle is used to send platform events over FFI. In the
913
- * future this handle will be the SDK's only point of control over the
914
- * transport once created. In particular, a transport will be removed by
915
- * freeing the handle. The concept of online and offline will be eliminated.
916
- * (i.e., if you don't want a transport, remove it.)
917
- *
918
- * For now, the `Peer` object holds the transports and provides an API based on
919
- * a numeric id assigned to each transport instance. Until that is removed, the
920
- * id still exists and the SDK can request it from the opaque handle over FFI.
921
- *
922
- * For each transport type, define an `extern "C"` function to free that
923
- * specific monomorphisation of the `TransportHandle` using `Box::from_raw`,
924
- * plus a function to retrieve the transport id, which will be removed later.
925
- *
926
- * Safety: The SDK owns the `TransportHandle`. It is responsible for ensuring
927
- * that it does not use the pointer to the `TransportHandle` after freeing it
928
- * with its respective function. In Rust we will assume it is okay to unsafely
929
- * dereference a handle.
930
- *
931
- * The C interface of `TransportHandle` is thread-safe (`Send + Sync`).
932
- */
933
- typedef struct TransportHandle_MdnsServerPlatformEvent TransportHandle_MdnsServerPlatformEvent_t;
934
-
935
- /** <No documentation available> */
936
- TransportHandle_MdnsServerPlatformEvent_t *
937
- /* fn */ ditto_add_internal_mdns_server_transport (
938
- CDitto_t const * ditto);
939
-
940
- /** <No documentation available> */
941
- typedef struct MdnsClientCallbacks {
942
- /** <No documentation available> */
943
- void (*start_searching)(void *, char const *);
944
-
945
- /** <No documentation available> */
946
- void (*stop_searching)(void *);
947
-
948
- /** <No documentation available> */
949
- void (*resolve_service)(void *, slice_ref_uint8_t);
950
- } MdnsClientCallbacks_t;
951
-
952
- /** <No documentation available> */
953
- TransportHandle_MdnsClientPlatformEvent_t *
954
- /* fn */ ditto_add_mdns_client_transport (
955
- CDitto_t const * ditto,
956
- MdnsClientCallbacks_t callbacks,
957
- void * ctx,
958
- void (*retain)(void *),
959
- void (*release)(void *));
960
-
961
- /** <No documentation available> */
962
- typedef struct MdnsServerCallbacks {
963
- /** <No documentation available> */
964
- void (*start_advertising)(void *, char const *, char const *, uint16_t);
965
-
966
- /** <No documentation available> */
967
- void (*stop_advertising)(void *);
968
- } MdnsServerCallbacks_t;
969
-
970
- /** <No documentation available> */
971
- TransportHandle_MdnsServerPlatformEvent_t *
972
- /* fn */ ditto_add_mdns_server_transport (
973
- CDitto_t const * ditto,
974
- MdnsServerCallbacks_t callbacks,
975
- void * ctx,
976
- void (*retain)(void *),
977
- void (*release)(void *));
978
-
979
- /** <No documentation available> */
980
- void
981
- /* fn */ ditto_add_multicast_transport (
982
- CDitto_t const * ditto);
983
-
984
- /** \brief
985
- * An opaque handle for each installed transport, heap-allocated and owned by
986
- * the SDK.
987
- *
988
- * A pointer to this handle is used to send platform events over FFI. In the
989
- * future this handle will be the SDK's only point of control over the
990
- * transport once created. In particular, a transport will be removed by
991
- * freeing the handle. The concept of online and offline will be eliminated.
992
- * (i.e., if you don't want a transport, remove it.)
993
- *
994
- * For now, the `Peer` object holds the transports and provides an API based on
995
- * a numeric id assigned to each transport instance. Until that is removed, the
996
- * id still exists and the SDK can request it from the opaque handle over FFI.
997
- *
998
- * For each transport type, define an `extern "C"` function to free that
999
- * specific monomorphisation of the `TransportHandle` using `Box::from_raw`,
1000
- * plus a function to retrieve the transport id, which will be removed later.
1001
- *
1002
- * Safety: The SDK owns the `TransportHandle`. It is responsible for ensuring
1003
- * that it does not use the pointer to the `TransportHandle` after freeing it
1004
- * with its respective function. In Rust we will assume it is okay to unsafely
1005
- * dereference a handle.
1006
- *
1007
- * The C interface of `TransportHandle` is thread-safe (`Send + Sync`).
1008
- */
1009
- typedef struct TransportHandle_StaticTcpClientPlatformEvent TransportHandle_StaticTcpClientPlatformEvent_t;
1010
-
1011
- /** <No documentation available> */
1012
- TransportHandle_StaticTcpClientPlatformEvent_t *
1013
- /* fn */ ditto_add_static_tcp_client (
1014
- CDitto_t const * ditto,
1015
- char const * address);
1016
-
1017
- /** <No documentation available> */
1018
- typedef enum QuerySortDirection {
1019
- /** <No documentation available> */
1020
- QUERY_SORT_DIRECTION_ASCENDING = 1,
1021
- /** <No documentation available> */
1022
- QUERY_SORT_DIRECTION_DESCENDING,
1023
- } QuerySortDirection_t;
1024
-
1025
- /** \brief
1026
- * OrderBy Parameter
1027
- */
1028
- typedef struct COrderByParam {
1029
- /** <No documentation available> */
1030
- char const * query_c_str;
1031
-
1032
- /** <No documentation available> */
1033
- QuerySortDirection_t direction;
1034
- } COrderByParam_t;
1035
-
1036
- /** \brief
1037
- * `&'lt [T]` but with a guaranteed `#[repr(C)]` layout.
1038
- *
1039
- * # C layout (for some given type T)
1040
- *
1041
- * ```c
1042
- * typedef struct {
1043
- * // Cannot be NULL
1044
- * T * ptr;
1045
- * size_t len;
1046
- * } slice_T;
1047
- * ```
1048
- *
1049
- * # Nullable pointer?
1050
- *
1051
- * If you want to support the above typedef, but where the `ptr` field is
1052
- * allowed to be `NULL` (with the contents of `len` then being undefined)
1053
- * use the `Option< slice_ptr<_> >` type.
1054
- */
1055
- typedef struct slice_ref_COrderByParam {
1056
- /** \brief
1057
- * Pointer to the first element (if any).
1058
- */
1059
- COrderByParam_t const * ptr;
1060
-
1061
- /** \brief
1062
- * Element count
1063
- */
1064
- size_t len;
1065
- } slice_ref_COrderByParam_t;
1066
-
1067
- /** <No documentation available> */
1068
- int32_t
1069
- /* fn */ ditto_add_subscription (
1070
- CDitto_t const * ditto,
1071
- char const * collection,
1072
- char const * query,
1073
- slice_ref_uint8_t query_args_cbor,
1074
- slice_ref_COrderByParam_t order_by,
1075
- int32_t limit,
1076
- uint32_t offset);
1077
-
1078
- /** \brief
1079
- * An opaque handle for each installed transport, heap-allocated and owned by
1080
- * the SDK.
1081
- *
1082
- * A pointer to this handle is used to send platform events over FFI. In the
1083
- * future this handle will be the SDK's only point of control over the
1084
- * transport once created. In particular, a transport will be removed by
1085
- * freeing the handle. The concept of online and offline will be eliminated.
1086
- * (i.e., if you don't want a transport, remove it.)
1087
- *
1088
- * For now, the `Peer` object holds the transports and provides an API based on
1089
- * a numeric id assigned to each transport instance. Until that is removed, the
1090
- * id still exists and the SDK can request it from the opaque handle over FFI.
1091
- *
1092
- * For each transport type, define an `extern "C"` function to free that
1093
- * specific monomorphisation of the `TransportHandle` using `Box::from_raw`,
1094
- * plus a function to retrieve the transport id, which will be removed later.
1095
- *
1096
- * Safety: The SDK owns the `TransportHandle`. It is responsible for ensuring
1097
- * that it does not use the pointer to the `TransportHandle` after freeing it
1098
- * with its respective function. In Rust we will assume it is okay to unsafely
1099
- * dereference a handle.
1100
- *
1101
- * The C interface of `TransportHandle` is thread-safe (`Send + Sync`).
1102
- */
1103
- typedef struct TransportHandle_WebsocketClientPlatformEvent TransportHandle_WebsocketClientPlatformEvent_t;
1104
-
1105
- /** <No documentation available> */
1106
- TransportHandle_WebsocketClientPlatformEvent_t *
1107
- /* fn */ ditto_add_websocket_client (
1108
- CDitto_t const * ditto,
1109
- char const * address,
1110
- uint32_t routing_hint);
1111
-
1112
- /** <No documentation available> */
1113
- typedef struct WifiAwareClientCallbacks {
1114
- /** <No documentation available> */
1115
- void (*start_searching)(void *, char const *, char const *);
1116
-
1117
- /** <No documentation available> */
1118
- void (*stop_searching)(void *);
1119
-
1120
- /** <No documentation available> */
1121
- void (*create_network)(void *, char const *);
1122
-
1123
- /** <No documentation available> */
1124
- void (*update_peer)(void *, char const *, ConnectState_t);
1125
- } WifiAwareClientCallbacks_t;
1126
-
1127
- /** \brief
1128
- * An opaque handle for each installed transport, heap-allocated and owned by
1129
- * the SDK.
1130
- *
1131
- * A pointer to this handle is used to send platform events over FFI. In the
1132
- * future this handle will be the SDK's only point of control over the
1133
- * transport once created. In particular, a transport will be removed by
1134
- * freeing the handle. The concept of online and offline will be eliminated.
1135
- * (i.e., if you don't want a transport, remove it.)
1136
- *
1137
- * For now, the `Peer` object holds the transports and provides an API based on
1138
- * a numeric id assigned to each transport instance. Until that is removed, the
1139
- * id still exists and the SDK can request it from the opaque handle over FFI.
1140
- *
1141
- * For each transport type, define an `extern "C"` function to free that
1142
- * specific monomorphisation of the `TransportHandle` using `Box::from_raw`,
1143
- * plus a function to retrieve the transport id, which will be removed later.
1144
- *
1145
- * Safety: The SDK owns the `TransportHandle`. It is responsible for ensuring
1146
- * that it does not use the pointer to the `TransportHandle` after freeing it
1147
- * with its respective function. In Rust we will assume it is okay to unsafely
1148
- * dereference a handle.
1149
- *
1150
- * The C interface of `TransportHandle` is thread-safe (`Send + Sync`).
1151
- */
1152
- typedef struct TransportHandle_WifiAwareClientPlatformEvent TransportHandle_WifiAwareClientPlatformEvent_t;
1153
-
1154
- /** <No documentation available> */
1155
- TransportHandle_WifiAwareClientPlatformEvent_t *
1156
- /* fn */ ditto_add_wifi_aware_client_transport (
1157
- CDitto_t const * ditto,
1158
- WifiAwareClientCallbacks_t callbacks,
1159
- void * ctx,
1160
- void (*retain)(void *),
1161
- void (*release)(void *));
1162
-
1163
- /** <No documentation available> */
1164
- typedef struct WifiAwareServerCallbacks {
1165
- /** <No documentation available> */
1166
- void (*start_advertising)(void *, char const *, char const *, uint16_t);
1167
-
1168
- /** <No documentation available> */
1169
- void (*stop_advertising)(void *);
1170
-
1171
- /** <No documentation available> */
1172
- void (*update_peer)(void *, char const *, ConnectState_t);
1173
- } WifiAwareServerCallbacks_t;
1174
-
1175
- /** \brief
1176
- * An opaque handle for each installed transport, heap-allocated and owned by
1177
- * the SDK.
1178
- *
1179
- * A pointer to this handle is used to send platform events over FFI. In the
1180
- * future this handle will be the SDK's only point of control over the
1181
- * transport once created. In particular, a transport will be removed by
1182
- * freeing the handle. The concept of online and offline will be eliminated.
1183
- * (i.e., if you don't want a transport, remove it.)
1184
- *
1185
- * For now, the `Peer` object holds the transports and provides an API based on
1186
- * a numeric id assigned to each transport instance. Until that is removed, the
1187
- * id still exists and the SDK can request it from the opaque handle over FFI.
1188
- *
1189
- * For each transport type, define an `extern "C"` function to free that
1190
- * specific monomorphisation of the `TransportHandle` using `Box::from_raw`,
1191
- * plus a function to retrieve the transport id, which will be removed later.
1192
- *
1193
- * Safety: The SDK owns the `TransportHandle`. It is responsible for ensuring
1194
- * that it does not use the pointer to the `TransportHandle` after freeing it
1195
- * with its respective function. In Rust we will assume it is okay to unsafely
1196
- * dereference a handle.
1197
- *
1198
- * The C interface of `TransportHandle` is thread-safe (`Send + Sync`).
1199
- */
1200
- typedef struct TransportHandle_WifiAwareServerPlatformEvent TransportHandle_WifiAwareServerPlatformEvent_t;
1201
-
1202
- /** <No documentation available> */
1203
- TransportHandle_WifiAwareServerPlatformEvent_t *
1204
- /* fn */ ditto_add_wifi_aware_server_advertiser (
1205
- CDitto_t const * ditto,
1206
- WifiAwareServerCallbacks_t callbacks,
1207
- void * ctx,
1208
- void (*retain)(void *),
1209
- void (*release)(void *));
1210
-
1211
- /** <No documentation available> */
1212
- char *
1213
- /* fn */ ditto_auth_client_get_app_id (
1214
- CDitto_t const * ditto);
1215
-
1216
- /** <No documentation available> */
1217
- uint64_t
1218
- /* fn */ ditto_auth_client_get_site_id (
1219
- CDitto_t const * ditto);
1220
-
1221
- /** <No documentation available> */
1222
- int32_t
1223
- /* fn */ ditto_auth_client_is_web_valid (
1224
- CDitto_t const * ditto);
1225
-
1226
- /** <No documentation available> */
1227
- int32_t
1228
- /* fn */ ditto_auth_client_is_x509_valid (
1229
- CDitto_t const * ditto);
1230
-
1231
- /** <No documentation available> */
1232
- int32_t
1233
- /* fn */ ditto_auth_client_login_with_credentials (
1234
- CDitto_t * ditto,
1235
- char const * username,
1236
- char const * password,
1237
- char const * provider);
1238
-
1239
- /** <No documentation available> */
1240
- int32_t
1241
- /* fn */ ditto_auth_client_login_with_token (
1242
- CDitto_t * ditto,
1243
- char const * token,
1244
- char const * provider);
1245
-
1246
- /** <No documentation available> */
1247
- typedef struct BoxedCharPtrResult {
1248
- /** <No documentation available> */
1249
- int32_t status_code;
1250
-
1251
- /** <No documentation available> */
1252
- char * c_string;
1253
- } BoxedCharPtrResult_t;
1254
-
1255
- /** <No documentation available> */
1256
- BoxedCharPtrResult_t
1257
- /* fn */ ditto_auth_client_login_with_token_and_feedback (
1258
- CDitto_t const * ditto,
1259
- char const * token,
1260
- char const * provider);
1261
-
1262
- /** \brief
1263
- * Trigger an explicit logout and purge of any cached credentials
1264
- */
1265
- int32_t
1266
- /* fn */ ditto_auth_client_logout (
1267
- CDitto_t const * ditto);
1268
-
1269
- /** \brief
1270
- * An `SdkLoginProvider` that sends the notifications over FFI
1271
- */
1272
- typedef struct CLoginProvider CLoginProvider_t;
1273
-
1274
- /** \brief
1275
- * Create a LoginProvider. Ownership passes to the SDK.
1276
- *
1277
- * This cannot be freed directly - it should be passed in when creating an
1278
- * AuthClient.
1279
- */
1280
- CLoginProvider_t *
1281
- /* fn */ ditto_auth_client_make_login_provider (
1282
- void * ctx,
1283
- void (*retain)(void *),
1284
- void (*release)(void *),
1285
- void (*expiring_cb)(void *, uint32_t));
1286
-
1287
- /** \brief
1288
- * Set a validity listener.
1289
- */
1290
- void
1291
- /* fn */ ditto_auth_client_set_validity_listener (
1292
- CDitto_t const * ditto,
1293
- void * ctx,
1294
- void (*retain)(void *),
1295
- void (*release)(void *),
1296
- void (*validity_update_cb)(void *, int32_t, int32_t));
1297
-
1298
- /** <No documentation available> */
1299
- char *
1300
- /* fn */ ditto_auth_client_user_id (
1301
- CDitto_t const * ditto);
1302
-
1303
- /** <No documentation available> */
1304
- void
1305
- /* fn */ ditto_auth_login_provider_free (
1306
- CLoginProvider_t * login_provider);
1307
-
1308
- /** <No documentation available> */
1309
- void
1310
- /* fn */ ditto_auth_set_login_provider (
1311
- CDitto_t const * ditto,
1312
- CLoginProvider_t * login_provider);
1313
-
1314
- /** <No documentation available> */
1315
- void
1316
- /* fn */ ditto_bus_close_stream (
1317
- CDitto_t const * ditto,
1318
- uint64_t stream_id);
1319
-
1320
- /** <No documentation available> */
1321
- void
1322
- /* fn */ ditto_bus_enqueue_stream_message (
1323
- CDitto_t const * ditto,
1324
- uint64_t stream_id,
1325
- slice_ref_uint8_t message);
1326
-
1327
- /** <No documentation available> */
1328
- typedef enum BusStreamEnqueueReadiness {
1329
- /** <No documentation available> */
1330
- BUS_STREAM_ENQUEUE_READINESS_READY,
1331
- /** <No documentation available> */
1332
- BUS_STREAM_ENQUEUE_READINESS_NOT_READY,
1333
- /** <No documentation available> */
1334
- BUS_STREAM_ENQUEUE_READINESS_ERROR,
1335
- } BusStreamEnqueueReadiness_t;
1336
-
1337
- /** <No documentation available> */
1338
- BusStreamEnqueueReadiness_t
1339
- /* fn */ ditto_bus_is_stream_ready_to_enqueue (
1340
- CDitto_t const * ditto,
1341
- uint64_t stream_id);
1342
-
1343
- /** <No documentation available> */
1344
- void
1345
- /* fn */ ditto_bus_open_stream (
1346
- CDitto_t const * ditto,
1347
- slice_ref_uint8_t destination,
1348
- ReliabilityMode_t reliability_mode,
1349
- uint64_t open_ctx);
1350
-
1351
- /** <No documentation available> */
1352
- void
1353
- /* fn */ ditto_bus_send_single_message (
1354
- CDitto_t const * ditto,
1355
- slice_ref_uint8_t destination,
1356
- uint64_t send_ctx,
1357
- ReliabilityMode_t reliability_mode,
1358
- slice_ref_uint8_t message);
1359
-
1360
- /** \brief
1361
- * [`Box`][`rust::Box`]`<[T]>` (fat pointer to a slice),
1362
- * but with a guaranteed `#[repr(C)]` layout.
1363
- *
1364
- * # C layout (for some given type T)
1365
- *
1366
- * ```c
1367
- * typedef struct {
1368
- * // Cannot be NULL
1369
- * T * ptr;
1370
- * size_t len;
1371
- * } slice_T;
1372
- * ```
1373
- *
1374
- * # Nullable pointer?
1375
- *
1376
- * If you want to support the above typedef, but where the `ptr` field is
1377
- * allowed to be `NULL` (with the contents of `len` then being undefined)
1378
- * use the `Option< slice_ptr<_> >` type.
1379
- */
1380
- typedef struct slice_boxed_uint8 {
1381
- /** \brief
1382
- * Pointer to the first element (if any).
1383
- */
1384
- uint8_t * ptr;
1385
-
1386
- /** \brief
1387
- * Element count
1388
- */
1389
- size_t len;
1390
- } slice_boxed_uint8_t;
1391
-
1392
- /** \brief
1393
- * Releases a byte array value returned by DittoStore.
1394
- *
1395
- * DittoStore manages its own memory allocations and it is not safe to release
1396
- * such values with C's `free()`. That's why the structures it returns provide
1397
- * their own associated `free` function.
1398
- *
1399
- * It should be used for values returned by functions like
1400
- * `ditto_document_cbor`.
1401
- */
1402
- void
1403
- /* fn */ ditto_c_bytes_free (
1404
- slice_boxed_uint8_t bytes);
1405
-
1406
- /** \brief
1407
- * Releases `char *` value returned by DittoStore.
1408
- *
1409
- * DittoStore manages its own memory allocations and it is not safe to release
1410
- * such values with C's `free()`. That's why the structures it returns provide
1411
- * their own associated `free` function and this is one we need for `char *`.
1412
- *
1413
- * It should be used for values returned by functions like
1414
- * `ditto_document_id_query_compatible`.
1415
- */
1416
- void
1417
- /* fn */ ditto_c_string_free (
1418
- char * s);
1419
-
1420
- /** \brief
1421
- * Empty error callback
1422
- * (useful for passing to `err_cb` functions to ignore errors; use with
1423
- * caution)
1424
- */
1425
- void
1426
- /* fn */ ditto_callback_err_nop (
1427
- int32_t _code,
1428
- char const * _err,
1429
- void * _data);
1430
-
1431
- /** \brief
1432
- * Empty callback (useful for passing to `free` functions)
1433
- */
1434
- void
1435
- /* fn */ ditto_callback_nop (
1436
- void const * _data);
1437
-
1438
- /** <No documentation available> */
1439
- typedef struct DittoCancellable DittoCancellable_t;
1440
-
1441
- /** <No documentation available> */
1442
- void
1443
- /* fn */ ditto_cancel (
1444
- DittoCancellable_t * _cancelable);
1445
-
1446
- /** \brief
1447
- * Cancels a resolve callback registered by ditto_resolve_attachment.
1448
- *
1449
- * Returns following error codes:
1450
- *
1451
- * * `0` -- no error
1452
- * * `1` -- an error
1453
- * * `2` -- invalid id
1454
- * * `3` -- token never issued
1455
- *
1456
- * In case of a non-zero return value, error message can be retrieved using
1457
- * `ditto_error_message` function.
1458
- */
1459
- uint32_t
1460
- /* fn */ ditto_cancel_resolve_attachment (
1461
- CDitto_t const * ditto,
1462
- slice_ref_uint8_t id,
1463
- uint64_t cancel_token);
1464
-
1465
- /** \brief
1466
- * The `PathAccessorType` enum allows you to specify (usually from the SDK side
1467
- * of the FFI) what sort of type you’re trying to access. So for some of the
1468
- * cases in the enum, e.g. `String`, `Bool`, etc, it’s quite straightforward
1469
- * what you’re asking for. For something like `Int` it’s a little more complex
1470
- * in that if the value at the path you’ve provided is an integer _or_ a float
1471
- * (with no fractional part to it) then it’ll return an integer to you. For
1472
- * `Array` or `Object` it’ll give you back an array or an object (respectively)
1473
- * if either the value at the path provided is a `Register` containing an
1474
- * array/object or if the value at the path provided is an `RGA`/`RWMap`,
1475
- * respectively.
1476
- *
1477
- * There are then the explicit type accessor type cases in that enum, e.g.
1478
- * `Counter`, `Register`, etc which will only return a value if the “active”
1479
- * value (most recently updated) at the provided path is a CRDT of the
1480
- * specified type, otherwise `None` will be returned.
1481
- */
1482
- typedef enum PathAccessorType {
1483
- /** <No documentation available> */
1484
- PATH_ACCESSOR_TYPE_STRING,
1485
- /** <No documentation available> */
1486
- PATH_ACCESSOR_TYPE_NUMBER,
1487
- /** <No documentation available> */
1488
- PATH_ACCESSOR_TYPE_INT,
1489
- /** <No documentation available> */
1490
- PATH_ACCESSOR_TYPE_U_INT,
1491
- /** <No documentation available> */
1492
- PATH_ACCESSOR_TYPE_FLOAT,
1493
- /** <No documentation available> */
1494
- PATH_ACCESSOR_TYPE_DOUBLE,
1495
- /** <No documentation available> */
1496
- PATH_ACCESSOR_TYPE_BOOL,
1497
- /** <No documentation available> */
1498
- PATH_ACCESSOR_TYPE_NULL,
1499
- /** <No documentation available> */
1500
- PATH_ACCESSOR_TYPE_OBJECT,
1501
- /** <No documentation available> */
1502
- PATH_ACCESSOR_TYPE_ARRAY,
1503
- /** <No documentation available> */
1504
- PATH_ACCESSOR_TYPE_ANY,
1505
- /** <No documentation available> */
1506
- PATH_ACCESSOR_TYPE_COUNTER,
1507
- /** <No documentation available> */
1508
- PATH_ACCESSOR_TYPE_REGISTER,
1509
- /** <No documentation available> */
1510
- PATH_ACCESSOR_TYPE_ATTACHMENT,
1511
- /** <No documentation available> */
1512
- PATH_ACCESSOR_TYPE_R_W_MAP,
1513
- } PathAccessorType_t;
1514
-
1515
- /** <No documentation available> */
1516
- typedef struct CBORPathResult {
1517
- /** <No documentation available> */
1518
- int32_t status_code;
1519
-
1520
- /** <No documentation available> */
1521
- slice_boxed_uint8_t cbor;
1522
- } CBORPathResult_t;
1523
-
1524
- /** \brief
1525
- * Gets the CBOR value at the path in the provided CBOR and returns it if the
1526
- * value found matches the type requested, otherwise `None` will be returned in
1527
- * the result.
1528
- *
1529
- * If CBOR is returned in the result then the bytes have to be released with
1530
- * `::ditto_c_bytes_free`.
1531
- */
1532
- CBORPathResult_t
1533
- /* fn */ ditto_cbor_get_cbor_with_path_type (
1534
- slice_ref_uint8_t cbor,
1535
- char const * path,
1536
- PathAccessorType_t path_type);
1537
-
1538
- /** \brief
1539
- * Represents the error code as returned by various FFI functions. It's a
1540
- * simple integer for now, the codes are specified by each FFI function
1541
- * individually (for now, we plan to introduce a proper error type in the near
1542
- * future).
1543
- * Beware that all errors are not captured here. It is encouraged to use this enum
1544
- * instead of explicit `status_code` -mostly 0 and 1-.
1545
- */
1546
- typedef enum DittoErrorCode {
1547
- /** <No documentation available> */
1548
- DITTO_ERROR_CODE_OK = 0,
1549
- /** <No documentation available> */
1550
- DITTO_ERROR_CODE_UNKNOWN = 1,
1551
- /** <No documentation available> */
1552
- DITTO_ERROR_CODE_NOT_IMPLEMENTED = 2,
1553
- /** \brief
1554
- * Fatal case that ought to never happen.
1555
- */
1556
- DITTO_ERROR_CODE_UNREACHABLE = 2989,
1557
- /** <No documentation available> */
1558
- DITTO_ERROR_CODE_FAILED_TO_ACQUIRE_LOCK_FILE = 16777217,
1559
- /** <No documentation available> */
1560
- DITTO_ERROR_CODE_INVALID_PASSPHRASE = 33554433,
1561
- /** <No documentation available> */
1562
- DITTO_ERROR_CODE_EXTRANEOUS_PASSPHRASE_GIVEN = 33554434,
1563
- /** <No documentation available> */
1564
- DITTO_ERROR_CODE_PASSPHRASE_NOT_GIVEN = 33554435,
1565
- /** <No documentation available> */
1566
- DITTO_ERROR_CODE_ALREADY_ENCRYPTED = 33554436,
1567
- /** <No documentation available> */
1568
- DITTO_ERROR_CODE_ENCRYPTION_FAILED = 33554437,
1569
- /** <No documentation available> */
1570
- DITTO_ERROR_CODE_CANNOT_BE_ENCRYPTED = 33554438,
1571
- /** <No documentation available> */
1572
- DITTO_ERROR_CODE_NOT_INITIALIZED = 33554439,
1573
- /** <No documentation available> */
1574
- DITTO_ERROR_CODE_SORT_FAILED = 50331649,
1575
- /** <No documentation available> */
1576
- DITTO_ERROR_CODE_DQL_FAILED_TO_COMPILE_QUERY = 50331650,
1577
- /** <No documentation available> */
1578
- DITTO_ERROR_CODE_DQL_UNSUPPORTED = 50331651,
1579
- /** <No documentation available> */
1580
- DITTO_ERROR_CODE_DQL_EXECUTION_FAILED = 50331652,
1581
- /** <No documentation available> */
1582
- DITTO_ERROR_CODE_PARAMETER_QUERY_FAILED = 50331653,
1583
- } DittoErrorCode_t;
1584
-
1585
- /** \brief
1586
- * Changes the passphrase and re-encrypts all data. This can take a while,
1587
- * progress is reported via the progress callback. Returns a progress token
1588
- * or 0 if a _synchronous_ error occured, in which case the `error_code` out
1589
- * parameter is set (see error code table below).
1590
- *
1591
- * Note that errors can also occur while the operation is in progress. Those
1592
- * are typically IO errors and are reported via the progress callback.
1593
- * The combination of `passphrase` and `newPassphrase` have the following
1594
- * effects:
1595
- *
1596
- * - `passphrase = NULL` & `newPassphrase = NULL` -> No-op if not encrypted, otherwise error code
1597
- * 3.
1598
- *
1599
- * - `passphrase = "123"` & `newPassphrase = "123"` -> No-op if encrypted and password is correct,
1600
- * error code 2 if not encrypted, and error code 1 if encrypted but `passphrase` invalid.
1601
- *
1602
- * - `passphrase = NULL` & `newPassphrase = "123"` -> Add encryption. No-op if already encrypted
1603
- * and passphrase matches, error code 4 if already encrypted but passphrase does not match.
1604
- *
1605
- * - `passphrase = "123"` & `newPassphrase = NULL` -> Remove encryption. No op
1606
- * - if not encrypted.
1607
- *
1608
- * - `passphrase = "123"` & `newPassphrase = "456"` -> Re-encrypt. Error code 1 if passphrase
1609
- * invalid.
1610
- */
1611
- DittoCancellable_t *
1612
- /* fn */ ditto_change_passphrase (
1613
- char const * _working_dir,
1614
- char const * _old_passphrase,
1615
- char const * _new_passphrase,
1616
- void * _ctx,
1617
- void (*_c_cb)(void *),
1618
- DittoErrorCode_t * _error_code);
1619
-
1620
- /** \brief
1621
- * Deregister any presence callback, releasing the receiver on the SDK side.
1622
- */
1623
- void
1624
- /* fn */ ditto_clear_presence_callback (
1625
- CDitto_t const * ditto);
1626
-
1627
- /** \brief
1628
- * Deregister v1 presence callback, releasing the receiver on the SDK side.
1629
- */
1630
- void
1631
- /* fn */ ditto_clear_presence_v1_callback (
1632
- CDitto_t const * ditto);
1633
-
1634
- /** \brief
1635
- * Deregister v2 presence callback, releasing the receiver on the SDK side.
1636
- */
1637
- void
1638
- /* fn */ ditto_clear_presence_v2_callback (
1639
- CDitto_t const * ditto);
1640
-
1641
- /** \brief
1642
- * Deregister v3 presence callback, releasing the receiver on the SDK side.
1643
- */
1644
- void
1645
- /* fn */ ditto_clear_presence_v3_callback (
1646
- CDitto_t const * ditto);
1647
-
1648
- /** <No documentation available> */
1649
- int32_t
1650
- /* fn */ ditto_collection (
1651
- CDitto_t const * ditto,
1652
- char const * name);
1653
-
1654
- /** \brief
1655
- * Write transaction synchronous API.
1656
- */
1657
- typedef struct CWriteTransaction CWriteTransaction_t;
1658
-
1659
- /** <No documentation available> */
1660
- typedef struct BoolResult {
1661
- /** <No documentation available> */
1662
- int32_t status_code;
1663
-
1664
- /** <No documentation available> */
1665
- bool bool_value;
1666
- } BoolResult_t;
1667
-
1668
- /** \brief
1669
- * Evict a document from the collection, using the provided write transaction.
1670
- *
1671
- * `was_evicted` is set to indicate whether the document was removed
1672
- * successfully.
1673
- *
1674
- * * [js only] Returns -1 in case of outstanding non-`await`ed transaction operation.
1675
- */
1676
- BoolResult_t
1677
- /* fn */ ditto_collection_evict (
1678
- CDitto_t const * ditto,
1679
- char const * coll_name,
1680
- CWriteTransaction_t * transaction,
1681
- slice_ref_uint8_t id);
1682
-
1683
- /** \brief
1684
- * `&'lt [T]` but with a guaranteed `#[repr(C)]` layout.
1685
- *
1686
- * # C layout (for some given type T)
1687
- *
1688
- * ```c
1689
- * typedef struct {
1690
- * // Cannot be NULL
1691
- * T * ptr;
1692
- * size_t len;
1693
- * } slice_T;
1694
- * ```
1695
- *
1696
- * # Nullable pointer?
1697
- *
1698
- * If you want to support the above typedef, but where the `ptr` field is
1699
- * allowed to be `NULL` (with the contents of `len` then being undefined)
1700
- * use the `Option< slice_ptr<_> >` type.
1701
- */
1702
- typedef struct slice_ref_slice_boxed_uint8 {
1703
- /** \brief
1704
- * Pointer to the first element (if any).
1705
- */
1706
- slice_boxed_uint8_t const * ptr;
1707
-
1708
- /** \brief
1709
- * Element count
1710
- */
1711
- size_t len;
1712
- } slice_ref_slice_boxed_uint8_t;
1713
-
1714
- /** \brief
1715
- * Same as [`Vec<T>`][`rust::Vec`], but with guaranteed `#[repr(C)]` layout
1716
- */
1717
- typedef struct Vec_slice_boxed_uint8 {
1718
- /** <No documentation available> */
1719
- slice_boxed_uint8_t * ptr;
1720
-
1721
- /** <No documentation available> */
1722
- size_t len;
1723
-
1724
- /** <No documentation available> */
1725
- size_t cap;
1726
- } Vec_slice_boxed_uint8_t;
1727
-
1728
- /** <No documentation available> */
1729
- typedef struct DocIdsResult {
1730
- /** <No documentation available> */
1731
- int32_t status_code;
1732
-
1733
- /** <No documentation available> */
1734
- Vec_slice_boxed_uint8_t ids;
1735
- } DocIdsResult_t;
1736
-
1737
- /** \brief
1738
- * Evict several documents from the collection, using the provided write transaction.
1739
- *
1740
- * Returns the list of successfully evicted document ids.
1741
- *
1742
- * * [js only] Returns -1 in case of outstanding non-`await`ed transaction operation.
1743
- */
1744
- DocIdsResult_t
1745
- /* fn */ ditto_collection_evict_by_ids (
1746
- CDitto_t const * ditto,
1747
- char const * coll_name,
1748
- CWriteTransaction_t * transaction,
1749
- slice_ref_slice_boxed_uint8_t ids);
1750
-
1751
- /** \brief
1752
- * Evict all documents returned by the specified query from a collection.
1753
- *
1754
- * `out_ids` is set to the list of IDs of all documents successfully evicted.
1755
- *
1756
- * [js only] Returns -2 in case of outstanding non-awaited transaction operation.
1757
- */
1758
- DocIdsResult_t
1759
- /* fn */ ditto_collection_evict_query_str (
1760
- CDitto_t const * ditto,
1761
- char const * coll_name,
1762
- CWriteTransaction_t * transaction,
1763
- char const * query,
1764
- slice_ref_uint8_t query_args_cbor,
1765
- slice_ref_COrderByParam_t order_by_params,
1766
- int32_t limit,
1767
- uint32_t offset);
1768
-
1769
- /** \brief
1770
- * Database document consisting of an associate `DocumentId` and
1771
- * `ditto_crdt::Document` pair. Within the `store` crate the association of
1772
- * these two elements are maintained together within this single structure,
1773
- * while these elements may be stored separately in upstream or downstream
1774
- * crates. This type corresponds to the `Record` type in the `replication`
1775
- * crate, rather than a literal document.
1776
- */
1777
- typedef struct CDocument CDocument_t;
1778
-
1779
- /** \brief
1780
- * Same as [`Vec<T>`][`rust::Vec`], but with guaranteed `#[repr(C)]` layout
1781
- */
1782
- typedef struct Vec_CDocument_ptr {
1783
- /** <No documentation available> */
1784
- CDocument_t * * ptr;
1785
-
1786
- /** <No documentation available> */
1787
- size_t len;
1788
-
1789
- /** <No documentation available> */
1790
- size_t cap;
1791
- } Vec_CDocument_ptr_t;
1792
-
1793
- /** <No documentation available> */
1794
- typedef struct DocumentsResult {
1795
- /** <No documentation available> */
1796
- int32_t status_code;
1797
-
1798
- /** <No documentation available> */
1799
- Vec_CDocument_ptr_t documents;
1800
- } DocumentsResult_t;
1801
-
1802
- /** \brief
1803
- * Execute the specified query.
1804
- *
1805
- * `out_documents` is set to the list of all documents successfully retrieved
1806
- * from the collection.
1807
- *
1808
- * [js only] Returns -2 in case of outstanding non-awaited transaction operation.
1809
- */
1810
- DocumentsResult_t
1811
- /* fn */ ditto_collection_exec_query_str (
1812
- CDitto_t const * ditto,
1813
- char const * coll_name,
1814
- CWriteTransaction_t * txn,
1815
- char const * query,
1816
- slice_ref_uint8_t query_args_cbor,
1817
- slice_ref_COrderByParam_t order_by_params,
1818
- int32_t limit,
1819
- uint32_t offset);
1820
-
1821
- /** \brief
1822
- * Read transaction synchronous API.
1823
- */
1824
- typedef struct CReadTransaction CReadTransaction_t;
1825
-
1826
- /** <No documentation available> */
1827
- typedef struct DocumentsIdsResult {
1828
- /** <No documentation available> */
1829
- int32_t status_code;
1830
-
1831
- /** <No documentation available> */
1832
- Vec_CDocument_ptr_t documents;
1833
-
1834
- /** <No documentation available> */
1835
- Vec_slice_boxed_uint8_t ids;
1836
- } DocumentsIdsResult_t;
1837
-
1838
- /** \brief
1839
- * [js only] Returns `-1` in case of outstanding non-`awaited` transaction operation.
1840
- */
1841
- DocumentsIdsResult_t
1842
- /* fn */ ditto_collection_find_by_ids (
1843
- CDitto_t const * ditto,
1844
- char const * coll_name,
1845
- slice_ref_slice_boxed_uint8_t ids,
1846
- CReadTransaction_t * transaction);
1847
-
1848
- /** <No documentation available> */
1849
- typedef struct DocumentResult {
1850
- /** <No documentation available> */
1851
- int32_t status_code;
1852
-
1853
- /** <No documentation available> */
1854
- CDocument_t * document;
1855
- } DocumentResult_t;
1856
-
1857
- /** \brief
1858
- * [js only] Returns `-1` in case of outstanding non-`awaited` transaction operation.
1859
- */
1860
- DocumentResult_t
1861
- /* fn */ ditto_collection_get (
1862
- CDitto_t const * ditto,
1863
- char const * coll_name,
1864
- slice_ref_uint8_t id,
1865
- CReadTransaction_t * transaction);
1866
-
1867
- /** <No documentation available> */
1868
- typedef enum WriteStrategyRs {
1869
- /** \brief
1870
- * Create or merge with existing data
1871
- */
1872
- WRITE_STRATEGY_RS_MERGE,
1873
- /** \brief
1874
- * Only insert if no document already exists with the same document ID
1875
- */
1876
- WRITE_STRATEGY_RS_INSERT_IF_ABSENT,
1877
- /** \brief
1878
- * Insert as default data, only if no document already exists with the same
1879
- * document ID
1880
- */
1881
- WRITE_STRATEGY_RS_INSERT_DEFAULT_IF_ABSENT,
1882
- /** \brief
1883
- * This works as follows:
1884
- * - If the document does not exist, it is created with the given value
1885
- * - If the document exists, the value is compared to the document's current value, any
1886
- * differing leaf's values in the Document are updated to match the given value. Nothing is
1887
- * removed.
1888
- */
1889
- WRITE_STRATEGY_RS_UPDATE_DIFFERENT_VALUES,
1890
- } WriteStrategyRs_t;
1891
-
1892
- /** <No documentation available> */
1893
- typedef struct DocIdResult {
1894
- /** <No documentation available> */
1895
- int32_t status_code;
1896
-
1897
- /** <No documentation available> */
1898
- slice_boxed_uint8_t id;
1899
- } DocIdResult_t;
1900
-
1901
- /** \brief
1902
- * Inserts a document into the store.
1903
- *
1904
- * If an ID is provided explicitly via the `doc_id` parameter then that will be
1905
- * used as the document's ID. If an ID is provided implicitly via the
1906
- * document's value (`doc_cbor`) then that will be used as the document's ID,
1907
- * assuming no explicit ID was provided. If neither an explicit nor an implicit
1908
- * document ID was provided then a new document ID will be generated and used
1909
- * as the new document's ID.
1910
- *
1911
- * Return codes:
1912
- *
1913
- * * `0` -- success
1914
- * * `1` -- improper CBOR provided for the document value
1915
- * * `2` -- invalid CBOR for the document value (i.e. the CBOR could be parsed but it represented a
1916
- * non-`Object` value)
1917
- * * `3` -- unable to create document ID from value at `_id` key in document's value (`doc_cbor`
1918
- * argument)
1919
- * * `4` -- (js only) concurrent database operation (missing `await`?)
1920
- */
1921
- DocIdResult_t
1922
- /* fn */ ditto_collection_insert_value (
1923
- CDitto_t const * ditto,
1924
- char const * coll_name,
1925
- slice_ref_uint8_t doc_cbor,
1926
- WriteStrategyRs_t write_strategy,
1927
- char const * log_hint,
1928
- CWriteTransaction_t * txn);
1929
-
1930
- /** \brief
1931
- * Remove a document from the collection, using the provided write transaction.
1932
- *
1933
- * `was_removed` is set to indicate whether the document was removed
1934
- * successfully.
1935
- *
1936
- * * [js only] Returns -1 in case of outstanding non-`await`ed transaction operation.
1937
- */
1938
- BoolResult_t
1939
- /* fn */ ditto_collection_remove (
1940
- CDitto_t const * ditto,
1941
- char const * coll_name,
1942
- CWriteTransaction_t * transaction,
1943
- slice_ref_uint8_t id);
1944
-
1945
- /** \brief
1946
- * Remove documents from the collection, using the provided write transaction.
1947
- *
1948
- * Return the list of successfully removed DocumentId
1949
- *
1950
- * Will return an error if the number of keys is greater than 1024.
1951
- * * [js only] Returns -1 in case of outstanding non-`await`ed transaction operation.
1952
- */
1953
- DocIdsResult_t
1954
- /* fn */ ditto_collection_remove_by_ids (
1955
- CDitto_t const * ditto,
1956
- char const * coll_name,
1957
- CWriteTransaction_t * transaction,
1958
- slice_ref_slice_boxed_uint8_t ids);
1959
-
1960
- /** \brief
1961
- * Remove all documents returned by the specified query from a collection.
1962
- *
1963
- * `out_ids` is set to the list of IDs of all documents successfully removed.
1964
- *
1965
- * [js only] Returns -2 in case of outstanding non-awaited transaction operation.
1966
- */
1967
- DocIdsResult_t
1968
- /* fn */ ditto_collection_remove_query_str (
1969
- CDitto_t const * ditto,
1970
- char const * coll_name,
1971
- CWriteTransaction_t * transaction,
1972
- char const * query,
1973
- slice_ref_uint8_t query_args_cbor,
1974
- slice_ref_COrderByParam_t order_by_params,
1975
- int32_t limit,
1976
- uint32_t offset);
1977
-
1978
- /** \brief
1979
- * [js only] Returns -1 in case of outstanding non-awaited transaction operation.
1980
- */
1981
- int32_t
1982
- /* fn */ ditto_collection_update (
1983
- CDitto_t const * ditto,
1984
- char const * coll_name,
1985
- CWriteTransaction_t * transaction,
1986
- CDocument_t * document);
1987
-
1988
- /** \brief
1989
- * Update multiple documents in a collection, using the provided write
1990
- * transaction.
1991
- *
1992
- * # Return Values
1993
- *
1994
- * - Returns `0` if all links were successfully updated in all documents.
1995
- * - Returns `-1` if one or more documents' links fail to all update
1996
- * successfully, but all documents themselves are successfully updated. Note
1997
- * that in the event of an attachment failing to update, updates are still
1998
- * attempted on the rest of the attachments and the rest of the documents.
1999
- * - If a document fails to update, the appropriate error code is returned for
2000
- * the cause of the failure. Note that if a document fails to update, no more
2001
- * document updates are attempted.
2002
- */
2003
- int32_t
2004
- /* fn */ ditto_collection_update_multiple (
2005
- CDitto_t const * ditto,
2006
- char const * coll_name,
2007
- CWriteTransaction_t * transaction,
2008
- Vec_CDocument_ptr_t documents);
2009
-
2010
- /** <No documentation available> */
2011
- int32_t
2012
- /* fn */ ditto_disable_sync_with_v3 (
2013
- CDitto_t const * ditto);
2014
-
2015
- /** \brief
2016
- * List of components using the file storage system
2017
- */
2018
- /** \remark Has the same ABI as `uint8_t` **/
2019
- #ifdef DOXYGEN
2020
- typedef
2021
- #endif
2022
- enum FsComponent {
2023
- /** <No documentation available> */
2024
- FS_COMPONENT_ROOT = 0,
2025
- /** <No documentation available> */
2026
- FS_COMPONENT_STORE,
2027
- /** <No documentation available> */
2028
- FS_COMPONENT_AUTH,
2029
- /** <No documentation available> */
2030
- FS_COMPONENT_REPLICATION,
2031
- /** <No documentation available> */
2032
- FS_COMPONENT_ATTACHMENT,
2033
- }
2034
- #ifndef DOXYGEN
2035
- ; typedef uint8_t
2036
- #endif
2037
- FsComponent_t;
2038
-
2039
- /** \brief
2040
- * Get a cbor repr of the disk usage
2041
- */
2042
- slice_boxed_uint8_t
2043
- /* fn */ ditto_disk_usage (
2044
- CDitto_t const * ditto,
2045
- FsComponent_t path);
2046
-
2047
- /** \brief
2048
- * Document's CBOR
2049
- */
2050
- slice_boxed_uint8_t
2051
- /* fn */ ditto_document_cbor (
2052
- CDocument_t const * document);
2053
-
2054
- /** \brief
2055
- * Releases the document
2056
- */
2057
- void
2058
- /* fn */ ditto_document_free (
2059
- CDocument_t * document);
2060
-
2061
- /** \brief
2062
- * Gets the CBOR value at the path in the provided document and returns it if
2063
- * the value found matches the type requested, otherwise `None` will be
2064
- * returned in the result.
2065
- *
2066
- * To understand how this is intended to be used it might be instructive to see
2067
- * how things work in the DittoDocumentPath of the Swift SDK, for example:
2068
- * <https://github.com/getditto/ditto/blob/v2/cocoa/DittoSwift/Store/DittoDocumentPath.swift#L63-L277>
2069
- *
2070
- * where the valueAtPathInDocumentWithType implementation looks like this:
2071
- * <https://github.com/getditto/ditto/blob/259cfa64dd2c6b36ffee2e97514695ccbfff6755/cocoa/DittoSwift/Store/Internal/ValueAtPath.swift#L42-L49>
2072
- *
2073
- * Note: all the of the values returned by
2074
- * `ditto_document_get_cbor_with_path_type` are untyped (i.e. there’s never an
2075
- * object with `_value` and `_ditto_internal_type_jkb12973t4b` keys being
2076
- * returned). For example, if you request a value at a path with a
2077
- * `PathAccessorType` of `Counter` and there is indeed a counter at that path
2078
- * then the value (as CBOR) that will be returned will be the `f64`/`double`
2079
- * representation of the counter’s value, on its own.
2080
- *
2081
- * If CBOR is returned in the result then the bytes have to be released with
2082
- * `::ditto_c_bytes_free`.
2083
- */
2084
- CBORPathResult_t
2085
- /* fn */ ditto_document_get_cbor_with_path_type (
2086
- CDocument_t const * document,
2087
- char const * pointer,
2088
- PathAccessorType_t path_type);
2089
-
2090
- /** \brief
2091
- * Document's ID
2092
- *
2093
- * The resulting bytes have to be freed with `::ditto_c_bytes_free`
2094
- */
2095
- slice_boxed_uint8_t
2096
- /* fn */ ditto_document_id (
2097
- CDocument_t const * document);
2098
-
2099
- /** \brief
2100
- * Defines how string primitives should be encoded. This is relevant if a
2101
- * document ID was created from a string. There are occasions when we want the
2102
- * stringified representation of the document ID do include quotes around the
2103
- * string, for example when creating a query like `_id == "abc"`. However,
2104
- * there are also times when we want to return the string as just a string, for
2105
- * example when we're injecting a document ID into a document's value before
2106
- * then serializing the document and sending those bytes across the FFI
2107
- * boundary.
2108
- */
2109
- typedef enum StringPrimitiveFormat {
2110
- /** <No documentation available> */
2111
- STRING_PRIMITIVE_FORMAT_WITH_QUOTES,
2112
- /** <No documentation available> */
2113
- STRING_PRIMITIVE_FORMAT_WITHOUT_QUOTES,
2114
- } StringPrimitiveFormat_t;
2115
-
2116
- /** \brief
2117
- * Convert a document ID from CBOR bytes into a Ditto query language compatible
2118
- * string.
2119
- *
2120
- * The resulting string has to be freed with `::ditto_c_string_free`
2121
- */
2122
- char *
2123
- /* fn */ ditto_document_id_query_compatible (
2124
- slice_ref_uint8_t id,
2125
- StringPrimitiveFormat_t string_primitive_format);
2126
-
2127
- /** <No documentation available> */
2128
- int32_t
2129
- /* fn */ ditto_document_increment_counter (
2130
- CDocument_t * document,
2131
- char const * pointer,
2132
- double amount);
2133
-
2134
- /** \brief
2135
- * Removes a value from a document. Only object properties can be removed. If the
2136
- * `pointer` points to an array index, the removal will fail. To update an array
2137
- * within a register, see `ditto_document_update`.
2138
- *
2139
- * # Arguments
2140
- *
2141
- * * `document` - A pointer to the document which was previously returned from a query.
2142
- * * `pointer` - A JMESPath _pointer_ to a property within `document` which is to be removed.
2143
- *
2144
- * # Returns
2145
- *
2146
- * `0` if the remove was successful or non-zero to indicate failure. To
2147
- * retrieve an error message in the case of failure, call
2148
- * `ditto_error_message()`.
2149
- */
2150
- int32_t
2151
- /* fn */ ditto_document_remove (
2152
- CDocument_t * document,
2153
- char const * pointer);
2154
-
2155
- /** <No documentation available> */
2156
- int32_t
2157
- /* fn */ ditto_document_set_cbor (
2158
- CDocument_t * document,
2159
- char const * pointer,
2160
- slice_ref_uint8_t cbor);
2161
-
2162
- /** <No documentation available> */
2163
- int32_t
2164
- /* fn */ ditto_document_set_cbor_with_timestamp (
2165
- CDocument_t * document,
2166
- char const * pointer,
2167
- slice_ref_uint8_t cbor,
2168
- uint32_t _timestamp);
2169
-
2170
- /** \brief
2171
- * Updates the document with values taken from provided CBOR data.
2172
- *
2173
- * Returns following error codes:
2174
- *
2175
- * * `0` -- no error
2176
- * * `1` -- invalid CBOR data
2177
- * * `2` -- CBOR data was not a map
2178
- * * `3` -- update error
2179
- * * `4` -- `_id` key provided
2180
- * * `5` -- invalid value
2181
- *
2182
- * In case of a non-zero return value, error message can be retrieved using
2183
- * `::ditto_error_message` function.
2184
- */
2185
- int32_t
2186
- /* fn */ ditto_document_update (
2187
- CDocument_t * document,
2188
- slice_ref_uint8_t cbor);
2189
-
2190
- /** \brief
2191
- * `&'lt [T]` but with a guaranteed `#[repr(C)]` layout.
2192
- *
2193
- * # C layout (for some given type T)
2194
- *
2195
- * ```c
2196
- * typedef struct {
2197
- * // Cannot be NULL
2198
- * T * ptr;
2199
- * size_t len;
2200
- * } slice_T;
2201
- * ```
2202
- *
2203
- * # Nullable pointer?
2204
- *
2205
- * If you want to support the above typedef, but where the `ptr` field is
2206
- * allowed to be `NULL` (with the contents of `len` then being undefined)
2207
- * use the `Option< slice_ptr<_> >` type.
2208
- */
2209
- typedef struct slice_ref_CDocument_ptr {
2210
- /** \brief
2211
- * Pointer to the first element (if any).
2212
- */
2213
- CDocument_t * const * ptr;
2214
-
2215
- /** \brief
2216
- * Element count
2217
- */
2218
- size_t len;
2219
- } slice_ref_CDocument_ptr_t;
2220
-
2221
- /** <No documentation available> */
2222
- typedef struct U64Result {
2223
- /** <No documentation available> */
2224
- int32_t status_code;
2225
-
2226
- /** <No documentation available> */
2227
- uint64_t u64;
2228
- } U64Result_t;
2229
-
2230
- /** <No documentation available> */
2231
- U64Result_t
2232
- /* fn */ ditto_documents_hash (
2233
- slice_ref_CDocument_ptr_t documents);
2234
-
2235
- /** <No documentation available> */
2236
- BoxedCharPtrResult_t
2237
- /* fn */ ditto_documents_hash_mnemonic (
2238
- slice_ref_CDocument_ptr_t documents);
2239
-
2240
- /** \brief
2241
- * Retrieves last thread-local error message (used by some synchronous APIs)
2242
- * and removes it. Subsequent call to this function (if nothing else has
2243
- * happened) will always return `NULL`.
2244
- *
2245
- * Returns `NULL` if there was no error. A non-null result MUST be freed using
2246
- * `ditto_c_string_free`.
2247
- */
2248
- char *
2249
- /* fn */ ditto_error_message (void);
2250
-
2251
- /** \brief
2252
- * Retrieves last thread-local error message (used by some synchronous APIs)
2253
- * and retains ownership of it.
2254
- *
2255
- * Returns `NULL` if there was no error. A non-null result MUST be freed using
2256
- * `ditto_c_string_free`.
2257
- */
2258
- char *
2259
- /* fn */ ditto_error_message_peek (void);
2260
-
2261
- /** <No documentation available> */
2262
- typedef struct CIdentityConfig CIdentityConfig_t;
2263
-
2264
- /** \brief
2265
- * Whether or not history tracking is enabled.
2266
- */
2267
- typedef enum HistoryTracking {
2268
- /** <No documentation available> */
2269
- HISTORY_TRACKING_ENABLED,
2270
- /** <No documentation available> */
2271
- HISTORY_TRACKING_DISABLED,
2272
- } HistoryTracking_t;
2273
-
2274
- /** \brief
2275
- * Same as `ditto_make()`, only takes an additional `passphrase` and an out
2276
- * `error_code` parameter.
2277
- *
2278
- * Returns the Ditto pointer on success. On failure, returns `NULL` and sets the
2279
- * out `error_code` parameter (1 or 2 possible here, plus IO errors).
2280
- */
2281
- CDitto_t *
2282
- /* fn */ ditto_experimental_make_with_passphrase (
2283
- char const * working_dir,
2284
- CIdentityConfig_t * identity_config,
2285
- HistoryTracking_t history_tracking,
2286
- char const * passphrase,
2287
- DittoErrorCode_t * error_code);
2288
-
2289
- /** \brief
2290
- * Frees the `Ditto` object.
2291
- *
2292
- * It is expected that `ditto_shutdown` will have been called before this is called.
2293
- */
2294
- void
2295
- /* fn */ ditto_free (
2296
- CDitto_t * ditto);
2297
-
2298
- /** \brief
2299
- * A shared read-only reference to an existing Attachment.
2300
- */
2301
- typedef struct AttachmentHandle AttachmentHandle_t;
2302
-
2303
- /** <No documentation available> */
2304
- void
2305
- /* fn */ ditto_free_attachment_handle (
2306
- AttachmentHandle_t * handle);
2307
-
2308
- /** \brief
2309
- * Frees a `Vec_CDocument_ptr_t`, used in `c_cb_params`.
2310
- *
2311
- * \remark This functions frees both the backing buffer allocation and each
2312
- * individual `Document` pointer. If ownership has been taken of the latter,
2313
- * then you must ensure the `len` field of the struct is zeroed before calling
2314
- * this function.
2315
- */
2316
- void
2317
- /* fn */ ditto_free_documents (
2318
- Vec_CDocument_ptr_t documents);
2319
-
2320
- /** \brief
2321
- * [`Box`][`rust::Box`]`<[T]>` (fat pointer to a slice),
2322
- * but with a guaranteed `#[repr(C)]` layout.
2323
- *
2324
- * # C layout (for some given type T)
2325
- *
2326
- * ```c
2327
- * typedef struct {
2328
- * // Cannot be NULL
2329
- * T * ptr;
2330
- * size_t len;
2331
- * } slice_T;
2332
- * ```
2333
- *
2334
- * # Nullable pointer?
2335
- *
2336
- * If you want to support the above typedef, but where the `ptr` field is
2337
- * allowed to be `NULL` (with the contents of `len` then being undefined)
2338
- * use the `Option< slice_ptr<_> >` type.
2339
- */
2340
- typedef struct slice_boxed_size {
2341
- /** \brief
2342
- * Pointer to the first element (if any).
2343
- */
2344
- size_t * ptr;
2345
-
2346
- /** \brief
2347
- * Element count
2348
- */
2349
- size_t len;
2350
- } slice_boxed_size_t;
2351
-
2352
- /** \brief
2353
- * Frees a `slice_box_size_t`, used in `c_cb_params`.
2354
- */
2355
- void
2356
- /* fn */ ditto_free_indices (
2357
- slice_boxed_size_t indices);
2358
-
2359
- /** <No documentation available> */
2360
- typedef struct AttachmentHandleResult {
2361
- /** <No documentation available> */
2362
- int32_t status_code;
2363
-
2364
- /** <No documentation available> */
2365
- AttachmentHandle_t * handle;
2366
- } AttachmentHandleResult_t;
2367
-
2368
- /** <No documentation available> */
2369
- AttachmentHandleResult_t
2370
- /* fn */ ditto_get_attachment_status (
2371
- CDitto_t * ditto,
2372
- slice_ref_uint8_t id);
2373
-
2374
- /** \brief
2375
- * Same as [`Vec<T>`][`rust::Vec`], but with guaranteed `#[repr(C)]` layout
2376
- */
2377
- typedef struct Vec_char_ptr {
2378
- /** <No documentation available> */
2379
- char * * ptr;
2380
-
2381
- /** <No documentation available> */
2382
- size_t len;
2383
-
2384
- /** <No documentation available> */
2385
- size_t cap;
2386
- } Vec_char_ptr_t;
2387
-
2388
- /** <No documentation available> */
2389
- typedef struct CollectionNamesResult {
2390
- /** <No documentation available> */
2391
- int32_t status_code;
2392
-
2393
- /** <No documentation available> */
2394
- Vec_char_ptr_t names;
2395
- } CollectionNamesResult_t;
2396
-
2397
- /** <No documentation available> */
2398
- CollectionNamesResult_t
2399
- /* fn */ ditto_get_collection_names (
2400
- CDitto_t const * ditto);
2401
-
2402
- /** <No documentation available> */
2403
- typedef struct AttachmentDataResult {
2404
- /** <No documentation available> */
2405
- int8_t status;
2406
-
2407
- /** <No documentation available> */
2408
- slice_boxed_uint8_t data;
2409
- } AttachmentDataResult_t;
2410
-
2411
- /** <No documentation available> */
2412
- AttachmentDataResult_t
2413
- /* fn */ ditto_get_complete_attachment_data (
2414
- CDitto_t const * ditto,
2415
- AttachmentHandle_t const * handle);
2416
-
2417
- /** <No documentation available> */
2418
- char *
2419
- /* fn */ ditto_get_complete_attachment_path (
2420
- CDitto_t const * ditto,
2421
- AttachmentHandle_t const * handle);
2422
-
2423
- /** \brief
2424
- * Returns a human-readable SDK version string, including platform information.
2425
- * While useful when logging, its exact format or contents ought not to be
2426
- * relied on.
2427
- *
2428
- * The returned string must be freed.
2429
- */
2430
- char *
2431
- /* fn */ ditto_get_sdk_version (void);
2432
-
2433
- /** <No documentation available> */
2434
- typedef struct IdentityConfigResult {
2435
- /** <No documentation available> */
2436
- int32_t status_code;
2437
-
2438
- /** <No documentation available> */
2439
- CIdentityConfig_t * identity_config;
2440
- } IdentityConfigResult_t;
2441
-
2442
- /** <No documentation available> */
2443
- IdentityConfigResult_t
2444
- /* fn */ ditto_identity_config_make_manual (
2445
- char const * manual_identity_str);
2446
-
2447
- /** <No documentation available> */
2448
- IdentityConfigResult_t
2449
- /* fn */ ditto_identity_config_make_manual_v0 (
2450
- char const * config_cbor_b64);
2451
-
2452
- /** <No documentation available> */
2453
- IdentityConfigResult_t
2454
- /* fn */ ditto_identity_config_make_offline_playground (
2455
- char const * app_id,
2456
- uint64_t site_id);
2457
-
2458
- /** <No documentation available> */
2459
- IdentityConfigResult_t
2460
- /* fn */ ditto_identity_config_make_online_playground (
2461
- char const * app_id,
2462
- char const * shared_token,
2463
- char const * base_url);
2464
-
2465
- /** <No documentation available> */
2466
- IdentityConfigResult_t
2467
- /* fn */ ditto_identity_config_make_online_with_authentication (
2468
- char const * app_id,
2469
- char const * base_url);
2470
-
2471
- /** <No documentation available> */
2472
- IdentityConfigResult_t
2473
- /* fn */ ditto_identity_config_make_shared_key (
2474
- char const * app_id,
2475
- char const * key_der_b64,
2476
- uint64_t site_id);
2477
-
2478
- /** <No documentation available> */
2479
- typedef enum Platform {
2480
- /** <No documentation available> */
2481
- PLATFORM_WINDOWS,
2482
- /** <No documentation available> */
2483
- PLATFORM_MAC,
2484
- /** <No documentation available> */
2485
- PLATFORM_IOS,
2486
- /** <No documentation available> */
2487
- PLATFORM_ANDROID,
2488
- /** <No documentation available> */
2489
- PLATFORM_LINUX,
2490
- /** <No documentation available> */
2491
- PLATFORM_WEB,
2492
- /** <No documentation available> */
2493
- PLATFORM_UNKNOWN,
2494
- } Platform_t;
2495
-
2496
- /** <No documentation available> */
2497
- typedef enum Language {
2498
- /** <No documentation available> */
2499
- LANGUAGE_SWIFT,
2500
- /** <No documentation available> */
2501
- LANGUAGE_OBJECTIVE_C,
2502
- /** <No documentation available> */
2503
- LANGUAGE_C_PLUS_PLUS,
2504
- /** <No documentation available> */
2505
- LANGUAGE_C_SHARP,
2506
- /** <No documentation available> */
2507
- LANGUAGE_JAVA_SCRIPT,
2508
- /** <No documentation available> */
2509
- LANGUAGE_UNKNOWN,
2510
- /** <No documentation available> */
2511
- LANGUAGE_RUST,
2512
- /** <No documentation available> */
2513
- LANGUAGE_J_V_M_BASED,
2514
- } Language_t;
2515
-
2516
- /** <No documentation available> */
2517
- void
2518
- /* fn */ ditto_init_sdk_version (
2519
- Platform_t platform,
2520
- Language_t language,
2521
- char const * sdk_semver);
2522
-
2523
- typedef struct {
2524
- uint8_t idx[8];
2525
- } uint8_8_array_t;
2526
-
2527
- /** \brief
2528
- * Construct a new Timeseries Event from the following parts:
2529
- * * `timestamp` - u64 Unix epoch seconds as 8 big endian bytes
2530
- * * `nanos` - Number of nanoseconds offset into the current second
2531
- * * `ts_name` - The name of the timeseries
2532
- * * `cbor` - The cbor content for the event
2533
- * * `txn` - An optional write transaction. If one is provided then it will not be committed. If
2534
- * one is not provided then one will be obtained and it will be committed.
2535
- *
2536
- * Return codes:
2537
- * * `0` -- success
2538
- * * `1` -- invalid CBOR
2539
- * * `2` -- `cbor` is not an object
2540
- * * `3` -- (js only) concurrent database operation (missing `await`?)
2541
- */
2542
- int32_t
2543
- /* fn */ ditto_insert_timeseries_event (
2544
- CDitto_t const * ditto,
2545
- uint8_8_array_t timestamp,
2546
- uint32_t nanos,
2547
- char const * ts_name,
2548
- slice_ref_uint8_t cbor,
2549
- CWriteTransaction_t * txn);
2550
-
2551
- /** <No documentation available> */
2552
- void
2553
- /* fn */ ditto_invalidate_tcp_listeners (
2554
- CDitto_t const * ditto);
2555
-
2556
- /** \brief
2557
- * Returns `true` if Ditto data at that path is encrypted, otherwise
2558
- * returns `false`
2559
- */
2560
- bool
2561
- /* fn */ ditto_is_encrypted (
2562
- CDitto_t const * ditto);
2563
-
2564
- /** \brief
2565
- * Describes how a live query callback's availability should be treated.
2566
- *
2567
- * If `Always` is specified then as soon as a transaction is committed that
2568
- * impacts the live query the consumer-provided callback will be called with
2569
- * the relevant update information. This can be temporarily delayed if there's
2570
- * a lot of activity leading to the event receivers lagging or if groups of
2571
- * transactions are coalesced into a single live query update.
2572
- *
2573
- * If `WhenSignalled` is specified then the consumer-provided live query
2574
- * callback will only be called when there is a transaction committed that
2575
- * impacts the live query *and* the consumer has signalled that they are ready
2576
- * to receive a new live query event (via the callback).
2577
- */
2578
- typedef enum LiveQueryAvailability {
2579
- /** <No documentation available> */
2580
- LIVE_QUERY_AVAILABILITY_ALWAYS,
2581
- /** <No documentation available> */
2582
- LIVE_QUERY_AVAILABILITY_WHEN_SIGNALLED,
2583
- } LiveQueryAvailability_t;
2584
-
2585
- /** <No documentation available> */
2586
- typedef struct c_cb_params {
2587
- /** \brief
2588
- * Must be freed with `ditto_free_documents`.
2589
- */
2590
- Vec_CDocument_ptr_t documents;
2591
-
2592
- /** <No documentation available> */
2593
- bool is_initial;
2594
-
2595
- /** \brief
2596
- * Must be freed with `ditto_free_documents`.
2597
- */
2598
- Vec_CDocument_ptr_t old_documents;
2599
-
2600
- /** \brief
2601
- * Must be freed using `ditto_free_indices`.
2602
- */
2603
- slice_boxed_size_t insertions;
2604
-
2605
- /** \brief
2606
- * Must be freed using `ditto_free_indices`.
2607
- */
2608
- slice_boxed_size_t deletions;
2609
-
2610
- /** \brief
2611
- * Must be freed using `ditto_free_indices`.
2612
- */
2613
- slice_boxed_size_t updates;
2614
-
2615
- /** \brief
2616
- * Must be freed using `ditto_free_indices`.
2617
- */
2618
- slice_boxed_size_t moves;
2619
- } c_cb_params_t;
2620
-
2621
- /** <No documentation available> */
2622
- typedef struct I64Result {
2623
- /** <No documentation available> */
2624
- int32_t status_code;
2625
-
2626
- /** <No documentation available> */
2627
- int64_t i64;
2628
- } I64Result_t;
2629
-
2630
- /** \brief
2631
- * Convenience function for `ditto_live_query_register`, so as not to require
2632
- * pre-compiling the query.
2633
- */
2634
- I64Result_t
2635
- /* fn */ ditto_live_query_register_str (
2636
- CDitto_t const * ditto,
2637
- char const * coll_name,
2638
- char const * query,
2639
- slice_ref_uint8_t query_args_cbor,
2640
- slice_ref_COrderByParam_t order_by,
2641
- int32_t limit,
2642
- uint32_t offset,
2643
- LiveQueryAvailability_t lq_availability,
2644
- void * ctx,
2645
- void (*retain)(void *),
2646
- void (*release)(void *),
2647
- void (*c_cb)(void *, c_cb_params_t));
2648
-
2649
- /** <No documentation available> */
2650
- void
2651
- /* fn */ ditto_live_query_signal_available_next (
2652
- CDitto_t const * ditto,
2653
- int64_t id);
2654
-
2655
- /** <No documentation available> */
2656
- int32_t
2657
- /* fn */ ditto_live_query_start (
2658
- CDitto_t const * ditto,
2659
- int64_t id);
2660
-
2661
- /** <No documentation available> */
2662
- void
2663
- /* fn */ ditto_live_query_stop (
2664
- CDitto_t const * ditto,
2665
- int64_t id);
2666
-
2667
- /** <No documentation available> */
2668
- int32_t
2669
- /* fn */ ditto_live_query_webhook_generate_new_api_secret (
2670
- CDitto_t const * ditto);
2671
-
2672
- /** <No documentation available> */
2673
- DocIdResult_t
2674
- /* fn */ ditto_live_query_webhook_register_str (
2675
- CDitto_t const * ditto,
2676
- char const * coll_name,
2677
- char const * query,
2678
- slice_ref_COrderByParam_t order_by,
2679
- int32_t limit,
2680
- uint32_t offset,
2681
- char const * url);
2682
-
2683
- /** <No documentation available> */
2684
- int32_t
2685
- /* fn */ ditto_live_query_webhook_start_all (
2686
- CDitto_t const * ditto);
2687
-
2688
- /** <No documentation available> */
2689
- int32_t
2690
- /* fn */ ditto_live_query_webhook_start_by_id (
2691
- CDitto_t const * ditto,
2692
- slice_ref_uint8_t doc_id);
2693
-
2694
- /** <No documentation available> */
2695
- typedef enum CLogLevel {
2696
- /** <No documentation available> */
2697
- C_LOG_LEVEL_ERROR = 1,
2698
- /** <No documentation available> */
2699
- C_LOG_LEVEL_WARNING,
2700
- /** <No documentation available> */
2701
- C_LOG_LEVEL_INFO,
2702
- /** <No documentation available> */
2703
- C_LOG_LEVEL_DEBUG,
2704
- /** <No documentation available> */
2705
- C_LOG_LEVEL_VERBOSE,
2706
- } CLogLevel_t;
2707
-
2708
- /** \brief
2709
- * Log function called over FFI such that logging can be grouped into a single
2710
- * logging mechanism.
2711
- */
2712
- void
2713
- /* fn */ ditto_log (
2714
- CLogLevel_t level,
2715
- char const * msg);
2716
-
2717
- /** \brief
2718
- * Get the path to an on-disk log, collected through a rotating file writer.
2719
- *
2720
- * Returns `NULL` if there is no on-disk rotating file writer set up, or if the path could not be
2721
- * converted to a string.
2722
- */
2723
- char *
2724
- /* fn */ ditto_logger_collect_on_disk_logs (void);
2725
-
2726
- /** <No documentation available> */
2727
- void
2728
- /* fn */ ditto_logger_emoji_headings_enabled (
2729
- bool enabled);
2730
-
2731
- /** <No documentation available> */
2732
- bool
2733
- /* fn */ ditto_logger_emoji_headings_enabled_get (void);
2734
-
2735
- /** <No documentation available> */
2736
- void
2737
- /* fn */ ditto_logger_enabled (
2738
- bool enabled);
2739
-
2740
- /** <No documentation available> */
2741
- bool
2742
- /* fn */ ditto_logger_enabled_get (void);
2743
-
2744
- /** \brief
2745
- * Initializes and registers the global Ditto logger.
2746
- */
2747
- void
2748
- /* fn */ ditto_logger_init (void);
2749
-
2750
- /** <No documentation available> */
2751
- void
2752
- /* fn */ ditto_logger_minimum_log_level (
2753
- CLogLevel_t log_level);
2754
-
2755
- /** <No documentation available> */
2756
- CLogLevel_t
2757
- /* fn */ ditto_logger_minimum_log_level_get (void);
2758
-
2759
- /** \brief
2760
- * Registers a custom logging callback to be called whenever Ditto wants to
2761
- * issue a log (on _top_ of emitting the log to the console).
2762
- *
2763
- * Care should be taken not to perform any Ditto operations within this
2764
- * callback, since those could emit new ditto logs, leading to a recursive
2765
- * situation. More specifically, this should not be fed `ditto_log`.
2766
- *
2767
- * A `NULL` may be fed to provide no callback (thus unregistering any
2768
- * previously registered one).
2769
- */
2770
- void
2771
- /* fn */ ditto_logger_set_custom_log_cb (
2772
- void (*custom_log_cb)(CLogLevel_t, char const *));
2773
-
2774
- /** \brief
2775
- * Registers a file path where logs will be written to, whenever Ditto wants
2776
- * to issue a log (on _top_ of emitting the log to the console).
2777
- *
2778
- * The path, if any, must be within an already existing directory.
2779
- *
2780
- * A `NULL` may be fed to provide no file (thus unregistering any previously
2781
- * registered one).
2782
- *
2783
- * Returns `0` on success, and `-1` otherwise (and the thread local error
2784
- * message is set accordingly).
2785
- */
2786
- int8_t
2787
- /* fn */ ditto_logger_set_log_file (
2788
- char const * log_file);
2789
-
2790
- /** \brief
2791
- * Make a Ditto object as an opaque pointer. The Ditto object creates the Tokio
2792
- * runtime and starts internal threads. The return value is a raw pointer whose
2793
- * only use is to supply as an argument to other ditto_* functions. The Ditto
2794
- * object must be stopped and freed with ditto_free().
2795
- */
2796
- CDitto_t *
2797
- /* fn */ ditto_make (
2798
- char const * working_dir,
2799
- CIdentityConfig_t * identity_config,
2800
- HistoryTracking_t history_tracking);
2801
-
2802
- /** <No documentation available> */
2803
- typedef struct CAttachment {
2804
- /** <No documentation available> */
2805
- slice_boxed_uint8_t id;
2806
-
2807
- /** <No documentation available> */
2808
- uint64_t len;
2809
-
2810
- /** <No documentation available> */
2811
- AttachmentHandle_t * handle;
2812
- } CAttachment_t;
2813
-
2814
- /** \brief
2815
- * Creates new Attachment from a blob of bytes link it to the given Document.
2816
- *
2817
- * Returns following error codes:
2818
- *
2819
- * * `0` -- no error
2820
- * * `1` -- an error
2821
- *
2822
- * In case of a non-zero return value, error message can be retrieved using
2823
- * `ditto_error_message` function.
2824
- */
2825
- uint32_t
2826
- /* fn */ ditto_new_attachment_from_bytes (
2827
- CDitto_t const * ditto,
2828
- slice_ref_uint8_t bytes,
2829
- CAttachment_t * out_attachment);
2830
-
2831
- /** \brief
2832
- * Describes how an attachment file should be handled by our Rust code.
2833
- *
2834
- * In most cases copying the file will be desirable but with the Android SDK,
2835
- * for example, we sometimes want to create a tempfile from an InputStream
2836
- * associated with the attachment file and then move that tempfile rather than
2837
- * copy it, so as to not make unnecessary copies.
2838
- */
2839
- typedef enum AttachmentFileOperation {
2840
- /** <No documentation available> */
2841
- ATTACHMENT_FILE_OPERATION_COPY = 1,
2842
- /** <No documentation available> */
2843
- ATTACHMENT_FILE_OPERATION_MOVE,
2844
- } AttachmentFileOperation_t;
2845
-
2846
- /** \brief
2847
- * Creates new Attachment from a file and link it to the given Document.
2848
- *
2849
- * Returns following error codes:
2850
- *
2851
- * * `0` -- no error
2852
- * * `1` -- an error
2853
- * * `2` -- file not found
2854
- * * `3` -- permission denied
2855
- *
2856
- * In case of a non-zero return value, error message can be retrieved using
2857
- * `ditto_error_message` function.
2858
- */
2859
- uint32_t
2860
- /* fn */ ditto_new_attachment_from_file (
2861
- CDitto_t const * ditto,
2862
- char const * source_path,
2863
- AttachmentFileOperation_t file_operation,
2864
- CAttachment_t * out_attachment);
2865
-
2866
- /** \brief
2867
- * Allow to free the Vector without dropping the Documents
2868
- */
2869
- void
2870
- /* fn */ ditto_only_vec_documents_free (
2871
- Vec_CDocument_ptr_t docs);
2872
-
2873
- /** \brief
2874
- * Request data showing who we are connected to in a user-friendly way.
2875
- */
2876
- char *
2877
- /* fn */ ditto_presence_v1 (
2878
- CDitto_t const * ditto);
2879
-
2880
- /** \brief
2881
- * Request data showing who we are connected to in a user-friendly way.
2882
- */
2883
- char *
2884
- /* fn */ ditto_presence_v2 (
2885
- CDitto_t const * ditto);
2886
-
2887
- /** \brief
2888
- * Request data showing who we are connected to in a user-friendly way.
2889
- */
2890
- char *
2891
- /* fn */ ditto_presence_v3 (
2892
- CDitto_t const * ditto);
2893
-
2894
- /** \brief
2895
- * `&'lt [T]` but with a guaranteed `#[repr(C)]` layout.
2896
- *
2897
- * # C layout (for some given type T)
2898
- *
2899
- * ```c
2900
- * typedef struct {
2901
- * // Cannot be NULL
2902
- * T * ptr;
2903
- * size_t len;
2904
- * } slice_T;
2905
- * ```
2906
- *
2907
- * # Nullable pointer?
2908
- *
2909
- * If you want to support the above typedef, but where the `ptr` field is
2910
- * allowed to be `NULL` (with the contents of `len` then being undefined)
2911
- * use the `Option< slice_ptr<_> >` type.
2912
- */
2913
- typedef struct slice_ref_char_const_ptr {
2914
- /** \brief
2915
- * Pointer to the first element (if any).
2916
- */
2917
- char const * const * ptr;
2918
-
2919
- /** \brief
2920
- * Element count
2921
- */
2922
- size_t len;
2923
- } slice_ref_char_const_ptr_t;
2924
-
2925
- /** <No documentation available> */
2926
- U64Result_t
2927
- /* fn */ ditto_queries_hash (
2928
- CDitto_t const * ditto,
2929
- slice_ref_char_const_ptr_t coll_names,
2930
- slice_ref_char_const_ptr_t queries);
2931
-
2932
- /** <No documentation available> */
2933
- BoxedCharPtrResult_t
2934
- /* fn */ ditto_queries_hash_mnemonic (
2935
- CDitto_t const * ditto,
2936
- slice_ref_char_const_ptr_t coll_names,
2937
- slice_ref_char_const_ptr_t queries);
2938
-
2939
- /** <No documentation available> */
2940
- typedef struct CReadTransactionResult {
2941
- /** <No documentation available> */
2942
- int32_t status_code;
2943
-
2944
- /** <No documentation available> */
2945
- CReadTransaction_t * txn;
2946
- } CReadTransactionResult_t;
2947
-
2948
- /** <No documentation available> */
2949
- CReadTransactionResult_t
2950
- /* fn */ ditto_read_transaction (
2951
- CDitto_t const * ditto);
2952
-
2953
- /** <No documentation available> */
2954
- void
2955
- /* fn */ ditto_read_transaction_free (
2956
- CReadTransaction_t * transaction);
2957
-
2958
- /** \brief
2959
- * Holder of the disk usage callback
2960
- * Drop this to stop the callback
2961
- */
2962
- typedef struct DiskUsageObserver DiskUsageObserver_t;
2963
-
2964
- /** \brief
2965
- * Register a function that will be called every time
2966
- * the given path directory or file is updated.
2967
- * Return a handle that should be given to ditto_release_disk_usage_callback
2968
- * to drop the callback
2969
- */
2970
- DiskUsageObserver_t *
2971
- /* fn */ ditto_register_disk_usage_callback (
2972
- CDitto_t const * ditto,
2973
- FsComponent_t component,
2974
- void * ctx,
2975
- void (*retain)(void *),
2976
- void (*release)(void *),
2977
- void (*c_cb)(void *, slice_ref_uint8_t));
2978
-
2979
- /** \brief
2980
- * Register a server that can authenticate client requests for an identity.
2981
- *
2982
- * Its route will be included in the HTTP server transport, if configured.
2983
- */
2984
- int32_t
2985
- /* fn */ ditto_register_local_auth_server (
2986
- CDitto_t * ditto,
2987
- char const * signing_key_pem,
2988
- slice_ref_char_const_ptr_t verifying_keys_pem,
2989
- char const * ca_key_pem,
2990
- void * ctx,
2991
- void (*retain)(void *),
2992
- void (*release)(void *),
2993
- void (*auth_cb)(void *, CAuthServerAuthRequest_t *, slice_ref_uint8_t),
2994
- void (*refresh_cb)(void *, CAuthServerRefreshRequest_t *, slice_ref_uint8_t));
2995
-
2996
- /** \brief
2997
- * Register a function that will be called every time the connection state
2998
- * of remote peers changes.
2999
- */
3000
- void
3001
- /* fn */ ditto_register_presence_callback_v3 (
3002
- CDitto_t const * ditto,
3003
- void * ctx,
3004
- void (*retain)(void *),
3005
- void (*release)(void *),
3006
- void (*c_cb)(void *, char const *));
3007
-
3008
- /** \brief
3009
- * Register a function that will be called every time the connection state
3010
- * of remote peers changes.
3011
- * REMOVE THIS IN V4
3012
- */
3013
- void
3014
- /* fn */ ditto_register_presence_v1_callback (
3015
- CDitto_t const * ditto,
3016
- void * ctx,
3017
- void (*retain)(void *),
3018
- void (*release)(void *),
3019
- void (*c_cb)(void *, char const *));
3020
-
3021
- /** \brief
3022
- * Register a function that will be called every time the connection state
3023
- * of remote peers changes.
3024
- * REMOVE THIS IN V4
3025
- */
3026
- void
3027
- /* fn */ ditto_register_presence_v2_callback (
3028
- CDitto_t const * ditto,
3029
- void * ctx,
3030
- void (*retain)(void *),
3031
- void (*release)(void *),
3032
- void (*c_cb)(void *, char const *));
3033
-
3034
- /** \brief
3035
- * User-friendly categories describing where condition events arose
3036
- */
3037
- typedef enum ConditionSource {
3038
- /** <No documentation available> */
3039
- CONDITION_SOURCE_BLUETOOTH,
3040
- /** <No documentation available> */
3041
- CONDITION_SOURCE_TCP,
3042
- /** <No documentation available> */
3043
- CONDITION_SOURCE_AWDL,
3044
- /** <No documentation available> */
3045
- CONDITION_SOURCE_MDNS,
3046
- /** <No documentation available> */
3047
- CONDITION_SOURCE_WIFI_AWARE,
3048
- } ConditionSource_t;
3049
-
3050
- /** \brief
3051
- * Register a function that will be called every time a transport changes
3052
- * condition.
3053
- *
3054
- * This should drive UI indicators to indicate overall connectivity via methods
3055
- * such as BLE, WiFi, or an internet-based server on a dedicated
3056
- * WsConnectTransport.
3057
- */
3058
- void
3059
- /* fn */ ditto_register_transport_condition_changed_callback (
3060
- CDitto_t const * ditto,
3061
- void * ctx,
3062
- void (*retain)(void *),
3063
- void (*release)(void *),
3064
- void (*c_cb)(void *, ConditionSource_t, TransportCondition_t));
3065
-
3066
- /** \brief
3067
- * Release the disk usage observer obtained from `ditto_register_disk_usage_callback`
3068
- */
3069
- void
3070
- /* fn */ ditto_release_disk_usage_callback (
3071
- DiskUsageObserver_t * _handle);
3072
-
3073
- /** <No documentation available> */
3074
- void
3075
- /* fn */ ditto_remove_multicast_transport (
3076
- CDitto_t const * ditto);
3077
-
3078
- /** <No documentation available> */
3079
- int32_t
3080
- /* fn */ ditto_remove_subscription (
3081
- CDitto_t const * ditto,
3082
- char const * collection,
3083
- char const * query,
3084
- slice_ref_uint8_t query_args_cbor,
3085
- slice_ref_COrderByParam_t order_by,
3086
- int32_t limit,
3087
- uint32_t offset);
3088
-
3089
- /** <No documentation available> */
3090
- typedef struct CancelTokenResult {
3091
- /** <No documentation available> */
3092
- int32_t status_code;
3093
-
3094
- /** <No documentation available> */
3095
- int64_t cancel_token;
3096
- } CancelTokenResult_t;
3097
-
3098
- /** \brief
3099
- * Register a new callback to resolve the attachment.
3100
- *
3101
- * The callback status could be:
3102
- * * `0` -- complete, with a handle that can be used in ditto_get_complete_attachment_path
3103
- * * `1` -- progress, with additional info about bytes downloaded and total bytes to download
3104
- * * `2` -- deleted, as the attachment ceased to exist in the doc database
3105
- *
3106
- * A cancel token with value `0` represents nil/invalid. This means either an error
3107
- * occured, or the token has already been fetched or deleted. Note that in this case
3108
- * the `on_complete_cb` and `on_deleted_cb` callbacks _may_ be called synchronously
3109
- * even before this function completes.
3110
- *
3111
- * Returns following error codes:
3112
- *
3113
- * * `0` -- no error
3114
- * * `1` -- an error
3115
- * * `2` -- invalid id
3116
- * * `3` -- attachment not found
3117
- *
3118
- * In case of a non-zero status code, error message can be retrieved using
3119
- * `ditto_error_message` function.
3120
- */
3121
- CancelTokenResult_t
3122
- /* fn */ ditto_resolve_attachment (
3123
- CDitto_t const * ditto,
3124
- slice_ref_uint8_t id,
3125
- void * ctx,
3126
- void (*retain)(void *),
3127
- void (*release)(void *),
3128
- void (*on_complete_cb)(void *, AttachmentHandle_t *),
3129
- void (*on_progress_cb)(void *, uint64_t, uint64_t),
3130
- void (*on_deleted_cb)(void *));
3131
-
3132
- /** <No documentation available> */
3133
- uint32_t
3134
- /* fn */ ditto_run_garbage_collection (
3135
- CDitto_t const * ditto);
3136
-
3137
- /** <No documentation available> */
3138
- bool
3139
- /* fn */ ditto_sdk_transports_android_is_inited (void);
3140
-
3141
- /** <No documentation available> */
3142
- char *
3143
- /* fn */ ditto_sdk_transports_android_missing_permissions (void);
3144
-
3145
- /** <No documentation available> */
3146
- void *
3147
- /* fn */ ditto_sdk_transports_android_missing_permissions_jni_array (void);
3148
-
3149
- /** <No documentation available> */
3150
- void
3151
- /* fn */ ditto_sdk_transports_android_shutdown (void);
3152
-
3153
- /** <No documentation available> */
3154
- typedef enum DittoSdkTransportsError {
3155
- /** <No documentation available> */
3156
- DITTO_SDK_TRANSPORTS_ERROR_NONE = 0,
3157
- /** <No documentation available> */
3158
- DITTO_SDK_TRANSPORTS_ERROR_GENERIC = 1,
3159
- /** <No documentation available> */
3160
- DITTO_SDK_TRANSPORTS_ERROR_UNAVAILABLE = 2,
3161
- /** <No documentation available> */
3162
- DITTO_SDK_TRANSPORTS_ERROR_MISSING_BLUETOOTH_INFO_PLIST_ENTRY = 3,
3163
- } DittoSdkTransportsError_t;
3164
-
3165
- /** <No documentation available> */
3166
- void *
3167
- /* fn */ ditto_sdk_transports_awdl_create (
3168
- CDitto_t const * ditto,
3169
- DittoSdkTransportsError_t * out_error);
3170
-
3171
- /** <No documentation available> */
3172
- bool
3173
- /* fn */ ditto_sdk_transports_awdl_destroy (
3174
- void * awdl,
3175
- DittoSdkTransportsError_t * out_error);
3176
-
3177
- /** <No documentation available> */
3178
- bool
3179
- /* fn */ ditto_sdk_transports_awdl_is_available (
3180
- CDitto_t const * _ditto);
3181
-
3182
- /** <No documentation available> */
3183
- void *
3184
- /* fn */ ditto_sdk_transports_ble_create (
3185
- CDitto_t const * ditto,
3186
- DittoSdkTransportsError_t * out_error);
3187
-
3188
- /** <No documentation available> */
3189
- bool
3190
- /* fn */ ditto_sdk_transports_ble_destroy (
3191
- void * ble,
3192
- DittoSdkTransportsError_t * out_error);
3193
-
3194
- /** <No documentation available> */
3195
- bool
3196
- /* fn */ ditto_sdk_transports_ble_is_available (
3197
- CDitto_t const * _ditto);
3198
-
3199
- /** <No documentation available> */
3200
- char *
3201
- /* fn */ ditto_sdk_transports_error_description (
3202
- DittoSdkTransportsError_t error);
3203
-
3204
- /** \brief
3205
- * Frees the output of `ditto_sdk_transports_error_new`.
3206
- */
3207
- void
3208
- /* fn */ ditto_sdk_transports_error_free (
3209
- DittoSdkTransportsError_t * it);
3210
-
3211
- /** \brief
3212
- * Obtain a fresh heap-allocated pointer to a (dummy) `DittoSdkTransportsError`.
3213
- *
3214
- * This is useful for languages with no access to inline/stack allocations and/or unable
3215
- * to produce pointers themselves.
3216
- */
3217
- DittoSdkTransportsError_t *
3218
- /* fn */ ditto_sdk_transports_error_new (void);
3219
-
3220
- /** \brief
3221
- * Obtain the value of a pointer to `DittoSdkTransportsError`
3222
- */
3223
- DittoSdkTransportsError_t
3224
- /* fn */ ditto_sdk_transports_error_value (
3225
- DittoSdkTransportsError_t const * it);
3226
-
3227
- /** <No documentation available> */
3228
- bool
3229
- /* fn */ ditto_sdk_transports_init (
3230
- DittoSdkTransportsError_t * out_error);
3231
-
3232
- /** <No documentation available> */
3233
- void *
3234
- /* fn */ ditto_sdk_transports_lan_create (
3235
- CDitto_t const * ditto,
3236
- DittoSdkTransportsError_t * out_error);
3237
-
3238
- /** <No documentation available> */
3239
- bool
3240
- /* fn */ ditto_sdk_transports_lan_destroy (
3241
- void * lan,
3242
- DittoSdkTransportsError_t * out_error);
3243
-
3244
- /** <No documentation available> */
3245
- bool
3246
- /* fn */ ditto_sdk_transports_lan_is_available (
3247
- CDitto_t const * _ditto);
3248
-
3249
- /** <No documentation available> */
3250
- bool
3251
- /* fn */ ditto_sdk_transports_set_android_context (
3252
- void * env,
3253
- void * context);
3254
-
3255
- /** <No documentation available> */
3256
- void *
3257
- /* fn */ ditto_sdk_transports_wifi_aware_create (
3258
- CDitto_t const * ditto,
3259
- DittoSdkTransportsError_t * out_error);
3260
-
3261
- /** <No documentation available> */
3262
- bool
3263
- /* fn */ ditto_sdk_transports_wifi_aware_destroy (
3264
- void * wifi_aware,
3265
- DittoSdkTransportsError_t * out_error);
3266
-
3267
- /** <No documentation available> */
3268
- bool
3269
- /* fn */ ditto_sdk_transports_wifi_aware_is_available (
3270
- CDitto_t const * _ditto);
3271
-
3272
- /** <No documentation available> */
3273
- void
3274
- /* fn */ ditto_set_connect_retry_interval (
3275
- CDitto_t const * ditto,
3276
- uint32_t retry_interval_millis);
3277
-
3278
- /** <No documentation available> */
3279
- char *
3280
- /* fn */ ditto_set_device_name (
3281
- CDitto_t const * ditto,
3282
- char const * device_name);
3283
-
3284
- /** <No documentation available> */
3285
- void
3286
- /* fn */ ditto_set_max_outgoing_ble_peers (
3287
- CDitto_t const * ditto,
3288
- uint32_t count);
3289
-
3290
- /** <No documentation available> */
3291
- uint32_t
3292
- /* fn */ ditto_set_priority_for_query_overlap_group (
3293
- CDitto_t const * ditto,
3294
- uint8_t prio,
3295
- uint8_t query_overlap_group);
3296
-
3297
- /** <No documentation available> */
3298
- uint32_t
3299
- /* fn */ ditto_set_query_overlap_group (
3300
- CDitto_t const * ditto,
3301
- uint8_t query_overlap_group);
3302
-
3303
- /** <No documentation available> */
3304
- void
3305
- /* fn */ ditto_set_static_tcp_clients (
3306
- CDitto_t const * ditto,
3307
- slice_ref_char_const_ptr_t list_of_servers);
3308
-
3309
- /** \brief
3310
- * configure tcp clients, updates and maintains list of active Websocket peer clients only
3311
- */
3312
- void
3313
- /* fn */ ditto_set_static_websocket_clients (
3314
- CDitto_t const * ditto,
3315
- slice_ref_char_const_ptr_t list_of_servers,
3316
- uint32_t routing_hint);
3317
-
3318
- /** <No documentation available> */
3319
- void
3320
- /* fn */ ditto_set_sync_group (
3321
- CDitto_t const * ditto,
3322
- uint32_t sync_group);
3323
-
3324
- /** \brief
3325
- * Shut down Ditto.
3326
- *
3327
- * All of the `Peer`'s subsystems are told to shut down, which includes, but is not limited to, the
3328
- * following happening:
3329
- * - all advertisers shut down
3330
- * - all servers stopped
3331
- * - all TCP listeners stopped
3332
- * - outbound replication stopped
3333
- *
3334
- * All of the live queries associated with the Ditto instance are also stopped. Any file lock
3335
- * handles are dropped once any long-running tasks have had a chance to complete.
3336
- */
3337
- void
3338
- /* fn */ ditto_shutdown (
3339
- CDitto_t const * ditto);
3340
-
3341
- /** \brief
3342
- * Indicates whether small peer info feature is currently enabled.
3343
- *
3344
- * `true` if enabled, and `false` if currently disabled. Small peer info
3345
- * consists of information scraped into a system collection at repeated
3346
- * interval.
3347
- *
3348
- * Note: whether the background ingestion process is enabled or not is a
3349
- * separate decision to whether this information is allowed to sync to other
3350
- * peers (including the big peer). This is controlled by [`SyncScope`]s. For
3351
- * the FFI function to get the current sync scope, see
3352
- * [`ditto_small_peer_info_get_sync_scope`]. By default, the small peer info
3353
- * document will not sync to any other peers. To sync this document with the
3354
- * big peer for dashboard and debugging purposes, set a sync scope of
3355
- * `BigPeerOnly`.
3356
- *
3357
- * [`SyncScope`]: DittoSmallPeerInfoSyncScope
3358
- */
3359
- bool
3360
- /* fn */ ditto_small_peer_info_get_is_enabled (
3361
- CDitto_t const * ditto);
3362
-
3363
- /** \brief
3364
- * Gets the JSON metadata being used in the small peer info document.
3365
- *
3366
- * The metadata is free-form, user-provided JSON data that is inserted into
3367
- * the small peer info system doc at each collection interval. The data has no
3368
- * schema so it is returned as a c_string. We validated the incoming data with
3369
- * our constraints, and we do not modify this data, so the same constraints
3370
- * hold. The validation constraints are:
3371
- * 1. The size of the metadata does not exceed [`SMALL_PEER_INFO_METADATA_SIZE_BYTES_MAX`]
3372
- * 2. The metadata can be parsed as a JSON string and its max depth does not exceed
3373
- * [`SMALL_PEER_INFO_METADATA_DEPTH_MAX`]
3374
- * 3. The metadata represents a JSON object that can be deserialized into a Map<String, Value>
3375
- *
3376
- * An empty JSON object string is returned if the data has not been set.
3377
- *
3378
- * This does not return the metadata from persistent storage. It only returns
3379
- * the data that has been set to be used by the collector
3380
- * (via [`ditto_small_peer_info_set_metadata`]) at each collector
3381
- */
3382
- char *
3383
- /* fn */ ditto_small_peer_info_get_metadata (
3384
- CDitto_t const * ditto);
3385
-
3386
- /** \brief
3387
- * Which peers to replicate the `__small_peer_info` collection to.
3388
- *
3389
- * The syncing behavior is dictated by internal [`SyncScope`]s.
3390
- *
3391
- * By default, the small peer info does not sync to other peers as dictated by
3392
- * the default `LocalPeerOnly` scope. To enable syncing small peer info to the
3393
- * big peer, set the `BigPeerOnly` scope.
3394
- *
3395
- * NOTE: Currently SDKs can only set [`BigPeerOnly`] or [`LocalPeerOnly`]
3396
- * sync scopes. [`AllPeers`] and [`SmallPeersOnly`] sync scopes are currently
3397
- * unsupported. Support for `AllPeers` and `SmallPeersOnly` will be added in the
3398
- * future, but for that we will need an API for users to subscribe to the small
3399
- * peer info of other peers.
3400
- *
3401
- * [`SyncScope`]: ::ditto_store::sync_scope::SyncScope
3402
- * [`BigPeerOnly`]: ::ditto_store::sync_scope::SyncScope::BigPeerOnly
3403
- * [`LocalPeerOnly`]: ::ditto_store::sync_scope::SyncScope::LocalPeerOnly
3404
- * [`AllPeers`]: ::ditto_store::sync_scope::SyncScope::AllPeers
3405
- * [`SmallPeersOnly`]: ::ditto_store::sync_scope::SyncScope::SmallPeersOnly
3406
- */
3407
- typedef enum DittoSmallPeerInfoSyncScope {
3408
- /** <No documentation available> */
3409
- DITTO_SMALL_PEER_INFO_SYNC_SCOPE_BIG_PEER_ONLY,
3410
- /** <No documentation available> */
3411
- DITTO_SMALL_PEER_INFO_SYNC_SCOPE_LOCAL_PEER_ONLY,
3412
- } DittoSmallPeerInfoSyncScope_t;
3413
-
3414
- /** \brief
3415
- * Gets the sync scope for the Small Peer Info collection.
3416
- *
3417
- * A collection's [SyncScope] determines which "kind" of peers it will
3418
- * replicate to. The collection does not need to exist locally for this
3419
- * function to succeed. If no custom sync scope has been set or if the
3420
- * collection does not exist, the returned scope will be the default
3421
- * [`LocalPeerOnly`]. Currently, only [`BigPeerOnly`] and [`LocalPeerOnly`] are
3422
- * supported for small peer info; see [`DittoSmallPeerInfoSyncScope`] for
3423
- * details.
3424
- *
3425
- * # Return Values
3426
- *
3427
- * - Always returns a sync scope - either the custom override set by the user, or the default
3428
- * scope.
3429
- *
3430
- * The function currently has no error conditions.
3431
- *
3432
- * [`SyncScope`]: DittoSmallPeerInfoSyncScope
3433
- * [`BigPeerOnly`]: DittoSmallPeerInfoSyncScope::BigPeerOnly
3434
- * [`LocalPeerOnly`]: DittoSmallPeerInfoSyncScope::LocalPeerOnly
3435
- */
3436
- DittoSmallPeerInfoSyncScope_t
3437
- /* fn */ ditto_small_peer_info_get_sync_scope (
3438
- CDitto_t const * ditto);
3439
-
3440
- /** \brief
3441
- * Enables or disables the small peer info feature.
3442
- *
3443
- * Small peer info consists of information scraped into a system collection at
3444
- * repeated intervals.
3445
- *
3446
- * Note: whether the background ingestion process is enabled or not is a
3447
- * separate decision to whether this information is allowed to sync to other
3448
- * peers (including the big peer). This is controlled by [`SyncScope`]s. For
3449
- * the FFI function to set sync scopes, see
3450
- * [`ditto_small_peer_info_set_sync_scope`]. By default, the small peer info
3451
- * document will not sync to any other peers. To sync this document with the
3452
- * big peer for dashboard and debugging purposes, set a sync scope of
3453
- * `BigPeerOnly`.
3454
- *
3455
- * [`SyncScope`]: DittoSmallPeerInfoSyncScope
3456
- */
3457
- void
3458
- /* fn */ ditto_small_peer_info_set_enabled (
3459
- CDitto_t const * ditto,
3460
- bool set_enabled);
3461
-
3462
- /** \brief
3463
- * Sets the JSON metadata to be used in the small peer info document.
3464
- *
3465
- * The metadata is free-form, user-provided JSON data that is inserted into
3466
- * the small peer info system doc at each collection interval. The data has no
3467
- * schema and is provided as a char_p, so data validation must be performed
3468
- * here. We validate:
3469
- * 1. The size of the metadata does not exceed [`SMALL_PEER_INFO_METADATA_SIZE_BYTES_MAX`]
3470
- * 2. The metadata can be parsed as a JSON string and its max depth does not exceed
3471
- * [`SMALL_PEER_INFO_METADATA_DEPTH_MAX`]
3472
- * 3. The metadata represents a JSON object that can be deserialized into a Map<String, Value>
3473
- *
3474
- * # Return Values
3475
- *
3476
- * - Returns `0` if the input passes validation and is successfully set to be
3477
- * used in the small peer info document.
3478
- * - Returns `-1` in case the observability subsystem is unavailable (which
3479
- * should never be the case for the small peer).
3480
- * - Returns `1` if the amount of data is too large according to our
3481
- * self-imposed limits.
3482
- * - Returns `2` if the amount of JSON data is too nested according to our
3483
- * self-imposed limits, or if the data cannot be parsed to determine the depth.
3484
- * - Returns `3` if the data cannot be parsed as a Map<String, Value>
3485
- */
3486
- int32_t
3487
- /* fn */ ditto_small_peer_info_set_metadata (
3488
- CDitto_t const * ditto,
3489
- char const * metadata);
3490
-
3491
- /** \brief
3492
- * Set the sync scope for the Small Peer Info collection.
3493
- *
3494
- * A collection's [SyncScope] determines which "kind" of peers it will
3495
- * replicate to. This function can be used even if the Small Peer Info
3496
- * collection does not yet exist. Currently, only [`BigPeerOnly`] and
3497
- * [`LocalPeerOnly`] sync scopes are supported for small peer info; see
3498
- * [`DittoSmallPeerInfoSyncScope`] for details.
3499
- *
3500
- * The function currently has no error conditions.
3501
- *
3502
- * [`SyncScope`]: DittoSmallPeerInfoSyncScope
3503
- * [`BigPeerOnly`]: DittoSmallPeerInfoSyncScope::BigPeerOnly
3504
- * [`LocalPeerOnly`]: DittoSmallPeerInfoSyncScope::LocalPeerOnly
3505
- */
3506
- void
3507
- /* fn */ ditto_small_peer_info_set_sync_scope (
3508
- CDitto_t const * ditto,
3509
- DittoSmallPeerInfoSyncScope_t scope);
3510
-
3511
- /** \brief
3512
- * Sets the transport config data contained in the small peer info.
3513
- *
3514
- * Important note: This is not configuration data used to configure the SDK
3515
- * (yet) - it's simply another info field inserted into the small peer info
3516
- * document.
3517
- *
3518
- * It's assumed that CBOR deserialization will succeed. If it fails then we'll
3519
- * panic. This is because this isn't something that should happen any time
3520
- * other than at (our (Ditto's)) development time.
3521
- */
3522
- void
3523
- /* fn */ ditto_small_peer_info_set_transport_config_data (
3524
- CDitto_t const * ditto,
3525
- slice_ref_uint8_t cbor);
3526
-
3527
- /** \brief
3528
- * Whether or not to offer a WebSocket sync server on the HTTP server.
3529
- */
3530
- typedef enum WebSocketMode {
3531
- /** <No documentation available> */
3532
- WEB_SOCKET_MODE_ENABLED,
3533
- /** <No documentation available> */
3534
- WEB_SOCKET_MODE_DISABLED,
3535
- } WebSocketMode_t;
3536
-
3537
- /** \brief
3538
- * Start the WebSocket server
3539
- *
3540
- * * `bind` - optional bind string of the form "ip:port"
3541
- * * `static_path` - optional absolute path to content on disk that should be served from `/`
3542
- * * `enable_websocket` - whether to enable a WebSocket server at the reserved path `/_ditto/ws`
3543
- * * `tls_cert_path` - path to this server's TLS certificate file, or null if not using TLS
3544
- * * `tls_key_path` - path to this server's TLS private key file, or null if not using TLS
3545
- */
3546
- int32_t
3547
- /* fn */ ditto_start_http_server (
3548
- CDitto_t const * ditto,
3549
- char const * bind,
3550
- char const * static_path,
3551
- WebSocketMode_t enable_websocket,
3552
- char const * tls_cert_path,
3553
- char const * tls_key_path);
3554
-
3555
- /** \brief
3556
- * Start the WebSocket server
3557
- */
3558
- int32_t
3559
- /* fn */ ditto_start_tcp_server (
3560
- CDitto_t const * ditto,
3561
- char const * bind);
3562
-
3563
- /** <No documentation available> */
3564
- int32_t
3565
- /* fn */ ditto_stop_http_server (
3566
- CDitto_t const * ditto);
3567
-
3568
- /** <No documentation available> */
3569
- int32_t
3570
- /* fn */ ditto_stop_tcp_server (
3571
- CDitto_t const * ditto);
3572
-
3573
- /** \brief
3574
- * Listen address of `tcp_listen_transport`.
3575
- *
3576
- * Must be called after `transport_go_online()`.
3577
- * The return value must be freed with `ditto_c_string_free()`.
3578
- */
3579
- char *
3580
- /* fn */ ditto_tcp_server_listen_addr (
3581
- CDitto_t const * ditto);
3582
-
3583
- /** \brief
3584
- * Request bulk status information about the transports. Intended mostly for
3585
- * statistical or debugging purposes.
3586
- */
3587
- char *
3588
- /* fn */ ditto_transports_diagnostics (
3589
- CDitto_t const * ditto);
3590
-
3591
- /** <No documentation available> */
3592
- void
3593
- /* fn */ ditto_unregister_local_auth_server (
3594
- CDitto_t * ditto);
3595
-
3596
- /** <No documentation available> */
3597
- uint32_t
3598
- /* fn */ ditto_validate_document_id (
3599
- slice_ref_uint8_t cbor,
3600
- slice_boxed_uint8_t * out_cbor);
3601
-
3602
- /** <No documentation available> */
3603
- void
3604
- /* fn */ ditto_vec_char_ptr_free (
3605
- Vec_char_ptr_t char_p);
3606
-
3607
- /** <No documentation available> */
3608
- void
3609
- /* fn */ ditto_vec_slice_boxed_uint8_t_free (
3610
- Vec_slice_boxed_uint8_t slice_boxed);
3611
-
3612
- /** \brief
3613
- * Same as [`Vec<T>`][`rust::Vec`], but with guaranteed `#[repr(C)]` layout
3614
- */
3615
- typedef struct Vec_size {
3616
- /** <No documentation available> */
3617
- size_t * ptr;
3618
-
3619
- /** <No documentation available> */
3620
- size_t len;
3621
-
3622
- /** <No documentation available> */
3623
- size_t cap;
3624
- } Vec_size_t;
3625
-
3626
- /** <No documentation available> */
3627
- void
3628
- /* fn */ ditto_vec_usizes_free (
3629
- Vec_size_t usizes);
3630
-
3631
- /** <No documentation available> */
3632
- typedef enum LicenseVerificationResult {
3633
- /** <No documentation available> */
3634
- LICENSE_VERIFICATION_RESULT_LICENSE_OK = 0,
3635
- /** <No documentation available> */
3636
- LICENSE_VERIFICATION_RESULT_VERIFICATION_FAILED = -1,
3637
- /** <No documentation available> */
3638
- LICENSE_VERIFICATION_RESULT_LICENSE_EXPIRED = -2,
3639
- /** <No documentation available> */
3640
- LICENSE_VERIFICATION_RESULT_UNSUPPORTED_FUTURE_VERSION = -3,
3641
- } LicenseVerificationResult_t;
3642
-
3643
- /** \brief
3644
- * Verify a base64 encoded license string
3645
- *
3646
- * # Parameters
3647
- * - `license`: A base64 encoded license string. This should be the output of
3648
- * `ditto_licenser::license_mgr::generate()`.
3649
- * - `out_error_msg`: An optional error message out parameter which will be written to if the
3650
- * license verification. This error message is simplified and appropriate to show directly to an
3651
- * SDK user.
3652
- */
3653
- LicenseVerificationResult_t
3654
- /* fn */ ditto_verify_license (
3655
- char const * license,
3656
- char * * out_err_msg);
3657
-
3658
- /** \brief
3659
- * The SDK requests to drop its handle to the WifiAware discovery transport
3660
- *
3661
- * At some point dropping this events channel will effectively shut down and
3662
- * remove the Transport. At time of writing, the Transport is still owned
3663
- * within Peer.
3664
- */
3665
- void
3666
- /* fn */ ditto_wifi_aware_client_free_handle (
3667
- TransportHandle_WifiAwareClientPlatformEvent_t * handle);
3668
-
3669
- /** \brief
3670
- * The platform advises Rust that we have resolved a peer's hostname and port
3671
- */
3672
- void
3673
- /* fn */ ditto_wifi_aware_client_network_did_create (
3674
- TransportHandle_WifiAwareClientPlatformEvent_t const * handle,
3675
- char const * announce_string,
3676
- char const * hostname,
3677
- uint16_t port);
3678
-
3679
- /** \brief
3680
- * The platform advises Rust that a peer has been identified.
3681
- */
3682
- void
3683
- /* fn */ ditto_wifi_aware_client_peer_appeared (
3684
- TransportHandle_WifiAwareClientPlatformEvent_t const * handle,
3685
- char const * announce_string);
3686
-
3687
- /** \brief
3688
- * The platform advises Rust that we failed to resolve a peer's hostname and
3689
- * port
3690
- */
3691
- void
3692
- /* fn */ ditto_wifi_aware_client_peer_did_not_connect (
3693
- TransportHandle_WifiAwareClientPlatformEvent_t const * handle,
3694
- char const * announce_string);
3695
-
3696
- /** \brief
3697
- * The platform advises Rust that a peer's service has disappeared from WifiAware.
3698
- */
3699
- void
3700
- /* fn */ ditto_wifi_aware_client_peer_disappeared (
3701
- TransportHandle_WifiAwareClientPlatformEvent_t const * handle,
3702
- char const * announce_string);
3703
-
3704
- /** \brief
3705
- * The platform advises Rust that the status of searching for services has
3706
- * changed.
3707
- */
3708
- void
3709
- /* fn */ ditto_wifi_aware_client_scanning_state_changed (
3710
- TransportHandle_WifiAwareClientPlatformEvent_t const * handle,
3711
- OnlineState_t state,
3712
- TransportCondition_t condition);
3713
-
3714
- /** \brief
3715
- * The platform advises Rust that the status of publishing our service has
3716
- * changed.
3717
- */
3718
- void
3719
- /* fn */ ditto_wifi_aware_server_advertising_state_changed (
3720
- TransportHandle_WifiAwareServerPlatformEvent_t const * handle,
3721
- OnlineState_t state,
3722
- TransportCondition_t condition);
3723
-
3724
- /** \brief
3725
- * The SDK requests to drop its handle to the WifiAware advertising service.
3726
- *
3727
- * Ideally this should remove the advertiser automatically.
3728
- * At time of writing now this must be done manually through Peer.
3729
- */
3730
- void
3731
- /* fn */ ditto_wifi_aware_server_free_handle (
3732
- TransportHandle_WifiAwareServerPlatformEvent_t * handle);
3733
-
3734
- /** <No documentation available> */
3735
- typedef struct CWriteTransactionResult {
3736
- /** <No documentation available> */
3737
- int32_t status_code;
3738
-
3739
- /** <No documentation available> */
3740
- CWriteTransaction_t * txn;
3741
- } CWriteTransactionResult_t;
3742
-
3743
- /** <No documentation available> */
3744
- CWriteTransactionResult_t
3745
- /* fn */ ditto_write_transaction (
3746
- CDitto_t const * ditto,
3747
- char const * log_hint);
3748
-
3749
- /** \brief
3750
- * Sets some arbitrary metadata on a write transaction.
3751
- *
3752
- * This is currently only useful and relevant if history tracking is enabled in
3753
- * the store that the write transaction relates to. If history tracking is
3754
- * enabled and metadata is set on a write transaction then the document
3755
- * inserted into the `__history` collection will have (at least) the provided
3756
- * metadata stored under the `meta` key of the document.
3757
- *
3758
- * Return codes:
3759
- *
3760
- * * `0` -- success
3761
- * * `1` -- invalid metadata CBOR
3762
- * * `-1` -- valid metadata CBOR but the CBOR does not represent an object
3763
- * * `-2` -- [js only] missing `await`s
3764
- */
3765
- int32_t
3766
- /* fn */ ditto_write_transaction_add_metadata (
3767
- CWriteTransaction_t * transaction,
3768
- slice_ref_uint8_t metadata_cbor);
3769
-
3770
- /** \brief
3771
- * Commits the given txn.
3772
- *
3773
- * [js only]: returns -1 on failure, in case of missing `await`s.
3774
- */
3775
- int32_t
3776
- /* fn */ ditto_write_transaction_commit (
3777
- CDitto_t const * ditto,
3778
- CWriteTransaction_t * transaction);
3779
-
3780
- /** \brief
3781
- * Frees the txn handle, *falling back* to a rollback, which requires
3782
- * `async`-in-drop. Only useful as a safeguard for RAII-with-proper-ownership
3783
- * languages, _i.e._, the Rust SDK.
3784
- *
3785
- * For other languages, favor using `ditto_write_transaction_rollback`
3786
- */
3787
- void
3788
- /* fn */ ditto_write_transaction_free (
3789
- CWriteTransaction_t * transaction);
3790
-
3791
- /** \brief
3792
- * For SDKs using the batched/scoped write-txn APIs, if an error occurs
3793
- * mid-operation (_e.g._, customer callback throwing an exception), then the
3794
- * txn must not be committed, but it ought to be disposed of, _via_ a rollback.
3795
- *
3796
- * [js only]: returns -1 on failure, in case of missing `await`s.
3797
- */
3798
- int32_t
3799
- /* fn */ ditto_write_transaction_rollback (
3800
- CDitto_t const * _ditto,
3801
- CWriteTransaction_t * transaction);
3802
-
3803
- /** \brief
3804
- * To be used when base64 encoding or decoding.
3805
- *
3806
- * When encoding, specifies whether to produce padded or unpadded output. When decoding, specifies
3807
- * whether or not to accept a padded input string.
3808
- */
3809
- typedef enum Base64PaddingMode {
3810
- /** <No documentation available> */
3811
- BASE64_PADDING_MODE_PADDED = 1,
3812
- /** <No documentation available> */
3813
- BASE64_PADDING_MODE_UNPADDED,
3814
- } Base64PaddingMode_t;
3815
-
3816
- /** \brief
3817
- * Encodes a slice of bytes as a URL-safe base64 string. The caller can specify whether or not they
3818
- * want the output to be padded.
3819
- *
3820
- * The returned string needs to be freed by the caller using `ditto_c_string_free`.
3821
- */
3822
- char *
3823
- /* fn */ dittoffi_base64_encode (
3824
- slice_ref_uint8_t bytes,
3825
- Base64PaddingMode_t padding_mode);
3826
-
3827
- /** <No documentation available> */
3828
- BoolResult_t
3829
- /* fn */ dittoffi_check_doc_cbor_against_provided_cbor (
3830
- slice_ref_uint8_t document_cbor,
3831
- slice_ref_uint8_t provided_cbor);
3832
-
3833
- /** \brief
3834
- * Opaque type encapsulating the different args provided to the `.on_connecting()`
3835
- * callback in a future-proof fashion.
3836
- *
3837
- * This is the lowest-level "wrapped" callback, i.e. the most convenient set of types for
3838
- * passing across the FFI barrier.
3839
- *
3840
- * Typically, SDKs will have a wrapping method that does the (de)serialization to/from CBOR
3841
- * to create a more user-friendly function signature for `connecting_peer`.
3842
- */
3843
- typedef struct dittoffi_connection_request dittoffi_connection_request_t;
3844
-
3845
- /** <No documentation available> */
3846
- typedef enum dittoffi_connection_request_authorization {
3847
- /** <No documentation available> */
3848
- DITTOFFI_CONNECTION_REQUEST_AUTHORIZATION_DENY,
3849
- /** <No documentation available> */
3850
- DITTOFFI_CONNECTION_REQUEST_AUTHORIZATION_ALLOW,
3851
- } dittoffi_connection_request_authorization_t;
3852
-
3853
- /** \brief
3854
- * Answer/output of the `connection_request_handler`, communicated through the `connection_request`
3855
- * object.
3856
- * `true` allows the connection, `false` rejects it.
3857
- */
3858
- void
3859
- /* fn */ dittoffi_connection_request_authorize (
3860
- dittoffi_connection_request_t const * r,
3861
- dittoffi_connection_request_authorization_t authorized);
3862
-
3863
- /** \brief
3864
- * A simplified [`ConnectionType`] exposed to the SDKs
3865
- */
3866
- typedef enum dittoffi_connection_type {
3867
- /** <No documentation available> */
3868
- DITTOFFI_CONNECTION_TYPE_BLUETOOTH,
3869
- /** <No documentation available> */
3870
- DITTOFFI_CONNECTION_TYPE_ACCESS_POINT,
3871
- /** <No documentation available> */
3872
- DITTOFFI_CONNECTION_TYPE_P2_P_WI_FI,
3873
- /** <No documentation available> */
3874
- DITTOFFI_CONNECTION_TYPE_WEB_SOCKET,
3875
- } dittoffi_connection_type_t;
3876
-
3877
- /** \brief
3878
- * The connecting peer's (pub) key (empty for legacy peers).
3879
- */
3880
- dittoffi_connection_type_t
3881
- /* fn */ dittoffi_connection_request_connection_type (
3882
- dittoffi_connection_request_t const * r);
3883
-
3884
- /** <No documentation available> */
3885
- void
3886
- /* fn */ dittoffi_connection_request_free (
3887
- dittoffi_connection_request_t * __arg_0);
3888
-
3889
- /** \brief
3890
- * Getter for the `identity_service` as a JSON (string / UTF-8 data).
3891
- */
3892
- slice_ref_uint8_t
3893
- /* fn */ dittoffi_connection_request_identity_service_metadata_json (
3894
- dittoffi_connection_request_t const * r);
3895
-
3896
- /** \brief
3897
- * The connecting peer's (pub) key (empty for legacy peers), hex-encoded as a string
3898
- */
3899
- char *
3900
- /* fn */ dittoffi_connection_request_peer_key_string (
3901
- dittoffi_connection_request_t const * r);
3902
-
3903
- /** \brief
3904
- * Getter for the `peer_metadata` as a JSON (string / UTF-8 data).
3905
- */
3906
- slice_ref_uint8_t
3907
- /* fn */ dittoffi_connection_request_peer_metadata_json (
3908
- dittoffi_connection_request_t const * r);
3909
-
3910
- /** \brief
3911
- * The ditto error type, opaque.
3912
- */
3913
- typedef struct dittoffi_error dittoffi_error_t;
3914
-
3915
- /** <No documentation available> */
3916
- typedef struct dittoffi_result_CDitto_ptr {
3917
- /** \brief
3918
- * Non-`NULL` pointer to opaque object on error, `NULL` otherwise.
3919
- */
3920
- dittoffi_error_t * error;
3921
-
3922
- /** \brief
3923
- * When no error occurred, the success value payload can be retrieved here.
3924
- *
3925
- * Otherwise, the value is to be ignored.
3926
- */
3927
- CDitto_t * success;
3928
- } dittoffi_result_CDitto_ptr_t;
3929
-
3930
- /** \brief
3931
- * Same as `ditto_make`, but properly fallible (but not yet `async`).
3932
- */
3933
- dittoffi_result_CDitto_ptr_t
3934
- /* fn */ dittoffi_ditto_try_new_blocking (
3935
- char const * working_dir,
3936
- CIdentityConfig_t * identity_config,
3937
- HistoryTracking_t history_tracking,
3938
- char const * experimental_passphrase);
3939
-
3940
- /** \brief
3941
- * The error codes for `ditto_error_t`
3942
- */
3943
- typedef enum dittoffi_error_code {
3944
- /** \brief
3945
- * The license signature failed verification. This could be due to incorrectly
3946
- * encoded/truncated data or could indicate tampering.
3947
- */
3948
- DITTOFFI_ERROR_CODE_ACTIVATION_LICENSE_TOKEN_INVALID,
3949
- /** \brief
3950
- * The license is valid but expired.
3951
- */
3952
- DITTOFFI_ERROR_CODE_ACTIVATION_LICENSE_TOKEN_EXPIRED,
3953
- /** \brief
3954
- * The provided license data was from a future version of Ditto and is incompatible with this
3955
- * version.
3956
- */
3957
- DITTOFFI_ERROR_CODE_ACTIVATION_LICENSE_UNSUPPORTED_FUTURE_VERSION,
3958
- /** \brief
3959
- * The operation failed because the Ditto instance is not yet activated.
3960
- */
3961
- DITTOFFI_ERROR_CODE_ACTIVATION_NOT_ACTIVATED,
3962
- /** \brief
3963
- * Invalid CBOR-encoded input.
3964
- */
3965
- DITTOFFI_ERROR_CODE_CBOR_INVALID,
3966
- /** \brief
3967
- * Unsupported CBOR type.
3968
- */
3969
- DITTOFFI_ERROR_CODE_CBOR_UNSUPPORTED,
3970
- /** \brief
3971
- * Found an invalid document id.
3972
- */
3973
- DITTOFFI_ERROR_CODE_STORE_DOCUMENT_ID,
3974
- /** \brief
3975
- * The requested document could not be found.
3976
- */
3977
- DITTOFFI_ERROR_CODE_STORE_DOCUMENT_NOT_FOUND,
3978
- /** <No documentation available> */
3979
- DITTOFFI_ERROR_CODE_STORE_DATABASE,
3980
- /** <No documentation available> */
3981
- DITTOFFI_ERROR_CODE_STORE_QUERY,
3982
- /** \brief
3983
- * A query to alter or retrieve a system parameter (ALTER SYSTEM or SHOW) failed.
3984
- */
3985
- DITTOFFI_ERROR_CODE_PARAMETER_QUERY,
3986
- /** <No documentation available> */
3987
- DITTOFFI_ERROR_CODE_CRDT,
3988
- /** \brief
3989
- * Javascript only. Missing `await` on outstanding store operation.
3990
- */
3991
- DITTOFFI_ERROR_CODE_JS_FLOATING_STORE_OPERATION,
3992
- /** \brief
3993
- * Failed to compile the given query.
3994
- *
3995
- * For more information on Ditto's query language see:
3996
- * <https://docs.ditto.live/dql-guide>
3997
- */
3998
- DITTOFFI_ERROR_CODE_DQL_QUERY_COMPILATION,
3999
- /** \brief
4000
- * Invalid CBOR-encoded query arguments.
4001
- */
4002
- DITTOFFI_ERROR_CODE_DQL_INVALID_QUERY_ARGS,
4003
- /** \brief
4004
- * Unsupported features were used in a DQL statement or query.
4005
- */
4006
- DITTOFFI_ERROR_CODE_DQL_UNSUPPORTED,
4007
- /** \brief
4008
- * Exceeded a depth limit.
4009
- */
4010
- DITTOFFI_ERROR_CODE_VALIDATION_DEPTH_LIMIT_EXCEEDED,
4011
- /** \brief
4012
- * The value was not a map.
4013
- */
4014
- DITTOFFI_ERROR_CODE_VALIDATION_NOT_A_MAP,
4015
- /** \brief
4016
- * Exceeded the size limit.
4017
- */
4018
- DITTOFFI_ERROR_CODE_VALIDATION_SIZE_LIMIT_EXCEEDED,
4019
- /** \brief
4020
- * Invalid JSON provided.
4021
- */
4022
- DITTOFFI_ERROR_CODE_VALIDATION_INVALID_JSON,
4023
- /** \brief
4024
- * Invalid CBOR provided.
4025
- */
4026
- DITTOFFI_ERROR_CODE_VALIDATION_INVALID_CBOR,
4027
- /** \brief
4028
- * Invalid input provided for base64 decoding.
4029
- */
4030
- DITTOFFI_ERROR_CODE_BASE64_INVALID,
4031
- /** \brief
4032
- * Outstanding usage of ditto's working directory detected when trying to instantiate a new
4033
- * `Ditto`, which would have led to concurrent usage of the backing database files.
4034
- */
4035
- DITTOFFI_ERROR_CODE_LOCKED_DITTO_WORKING_DIRECTORY,
4036
- /** \brief
4037
- * An error occurred accessing the filesystem.
4038
- */
4039
- DITTOFFI_ERROR_CODE_FILESYSTEM_ERROR,
4040
- /** \brief
4041
- * Some not-yet-categorized error occurred.
4042
- */
4043
- DITTOFFI_ERROR_CODE_INTERNAL,
4044
- } dittoffi_error_code_t;
4045
-
4046
- /** <No documentation available> */
4047
- dittoffi_error_code_t
4048
- /* fn */ dittoffi_error_code (
4049
- dittoffi_error_t const * error);
4050
-
4051
- /** <No documentation available> */
4052
- char *
4053
- /* fn */ dittoffi_error_description (
4054
- dittoffi_error_t const * error);
4055
-
4056
- /** <No documentation available> */
4057
- void
4058
- /* fn */ dittoffi_error_free (
4059
- dittoffi_error_t * error);
4060
-
4061
- /** \brief
4062
- * Returns a human-readable SDK version string, restricted to the SemVer
4063
- * "number" (including the pre-release specifier, if any).
4064
- *
4065
- * The returned string must be freed.
4066
- */
4067
- char *
4068
- /* fn */ dittoffi_get_sdk_semver (void);
4069
-
4070
- /** \brief
4071
- * Getter for the `peer_metadata` as a JSON (string / UTF-8 data).
4072
- */
4073
- slice_boxed_uint8_t
4074
- /* fn */ dittoffi_presence_peer_metadata_json (
4075
- CDitto_t const * ditto);
4076
-
4077
- /** <No documentation available> */
4078
- typedef struct Erased Erased_t;
4079
-
4080
- /** <No documentation available> */
4081
- typedef struct FfiConnectionRequestHandlerVTable {
4082
- /** <No documentation available> */
4083
- void (*release_vptr)(Erased_t *);
4084
-
4085
- /** <No documentation available> */
4086
- Erased_t * (*retain_vptr)(Erased_t const *);
4087
-
4088
- /** <No documentation available> */
4089
- void (*on_connecting)(Erased_t const *, dittoffi_connection_request_t *);
4090
- } FfiConnectionRequestHandlerVTable_t;
4091
-
4092
- /** <No documentation available> */
4093
- typedef struct VirtualPtr__Erased_ptr_FfiConnectionRequestHandlerVTable {
4094
- /** <No documentation available> */
4095
- Erased_t * ptr;
4096
-
4097
- /** <No documentation available> */
4098
- FfiConnectionRequestHandlerVTable_t vtable;
4099
- } VirtualPtr__Erased_ptr_FfiConnectionRequestHandlerVTable_t;
4100
-
4101
- /** \brief
4102
- * Register a function that will be called every time a peer connection attempt is made.
4103
- * The function can return true to continue connecting, and false to reject the connection,
4104
- * based on the supplied metadata about the peer.
4105
- */
4106
- void
4107
- /* fn */ dittoffi_presence_set_connection_request_handler (
4108
- CDitto_t const * ditto,
4109
- VirtualPtr__Erased_ptr_FfiConnectionRequestHandlerVTable_t ffi_handler);
4110
-
4111
- /** <No documentation available> */
4112
- typedef struct dittoffi_result_void {
4113
- /** \brief
4114
- * Non-`NULL` pointer to opaque object on error, `NULL` otherwise.
4115
- */
4116
- dittoffi_error_t * error;
4117
- } dittoffi_result_void_t;
4118
-
4119
- /** \brief
4120
- * Sets the signed peer info / peer metadata to which the `on_connecting` /
4121
- * `connectionRequestHandler` callback shall have access.
4122
- *
4123
- * The `peer_info` is expected to represent the UTF-8 bytes of a serialized JSON instead of CBOR.
4124
- */
4125
- dittoffi_result_void_t
4126
- /* fn */ dittoffi_presence_try_set_peer_metadata_json (
4127
- CDitto_t const * ditto,
4128
- slice_ref_uint8_t peer_info);
4129
-
4130
- /** <No documentation available> */
4131
- typedef struct dittoffi_query_result dittoffi_query_result_t;
4132
-
4133
- /** <No documentation available> */
4134
- void
4135
- /* fn */ dittoffi_query_result_free (
4136
- dittoffi_query_result_t * result);
4137
-
4138
- /** <No documentation available> */
4139
- typedef struct dittoffi_query_result_item dittoffi_query_result_item_t;
4140
-
4141
- /** <No documentation available> */
4142
- dittoffi_query_result_item_t *
4143
- /* fn */ dittoffi_query_result_item_at (
4144
- dittoffi_query_result_t const * result,
4145
- size_t idx);
4146
-
4147
- /** <No documentation available> */
4148
- slice_boxed_uint8_t
4149
- /* fn */ dittoffi_query_result_item_cbor (
4150
- dittoffi_query_result_item_t const * item);
4151
-
4152
- /** <No documentation available> */
4153
- size_t
4154
- /* fn */ dittoffi_query_result_item_count (
4155
- dittoffi_query_result_t const * result);
4156
-
4157
- /** <No documentation available> */
4158
- void
4159
- /* fn */ dittoffi_query_result_item_free (
4160
- dittoffi_query_result_item_t * item);
4161
-
4162
- /** <No documentation available> */
4163
- char *
4164
- /* fn */ dittoffi_query_result_item_json (
4165
- dittoffi_query_result_item_t const * item);
4166
-
4167
- /** <No documentation available> */
4168
- slice_boxed_uint8_t
4169
- /* fn */ dittoffi_query_result_mutated_document_id_at (
4170
- dittoffi_query_result_t const * result,
4171
- size_t idx);
4172
-
4173
- /** <No documentation available> */
4174
- size_t
4175
- /* fn */ dittoffi_query_result_mutated_document_id_count (
4176
- dittoffi_query_result_t const * result);
4177
-
4178
- /** <No documentation available> */
4179
- dittoffi_result_void_t
4180
- /* fn */ dittoffi_try_add_subscription (
4181
- CDitto_t const * ditto,
4182
- char const * collection,
4183
- char const * query,
4184
- slice_ref_uint8_t query_args_cbor,
4185
- slice_ref_COrderByParam_t order_by,
4186
- int32_t limit,
4187
- uint32_t offset);
4188
-
4189
- /** \brief
4190
- * Adds a DQL sync subscription.
4191
- *
4192
- * Only `SELECT` statements are supported here.
4193
- *
4194
- * Returns no meaningful value but for the resulting potential `.error`.
4195
- */
4196
- dittoffi_result_void_t
4197
- /* fn */ dittoffi_try_add_sync_subscription (
4198
- CDitto_t const * ditto,
4199
- char const * query,
4200
- slice_ref_uint8_t query_args_cbor);
4201
-
4202
- /** <No documentation available> */
4203
- typedef struct dittoffi_result_slice_boxed_uint8 {
4204
- /** \brief
4205
- * Non-`NULL` pointer to opaque object on error, `NULL` otherwise.
4206
- */
4207
- dittoffi_error_t * error;
4208
-
4209
- /** \brief
4210
- * When no error occurred, the success value payload can be retrieved here.
4211
- *
4212
- * Otherwise, the value is to be ignored.
4213
- */
4214
- slice_boxed_uint8_t success;
4215
- } dittoffi_result_slice_boxed_uint8_t;
4216
-
4217
- /** \brief
4218
- * Decodes a URL-safe base64-encoded string. The caller can specify whether or not they want to
4219
- * allow padded input. By default, both padded and unpadded input is accepted.
4220
- *
4221
- * In the success case, the returned bytes need to be freed by the caller using
4222
- * `ditto_c_bytes_free`.
4223
- *
4224
- * Throws `FfiError::Base64Invalid` if:
4225
- * - the input string is not a valid base64-encoded string, or
4226
- * - the desired padding mode is specified as `Unpadded` and the input string is padded.
4227
- */
4228
- dittoffi_result_slice_boxed_uint8_t
4229
- /* fn */ dittoffi_try_base64_decode (
4230
- char const * str,
4231
- Base64PaddingMode_t padding_mode);
4232
-
4233
- /** <No documentation available> */
4234
- dittoffi_result_void_t
4235
- /* fn */ dittoffi_try_collection (
4236
- CDitto_t const * ditto,
4237
- char const * name);
4238
-
4239
- /** <No documentation available> */
4240
- typedef struct dittoffi_result_bool {
4241
- /** \brief
4242
- * Non-`NULL` pointer to opaque object on error, `NULL` otherwise.
4243
- */
4244
- dittoffi_error_t * error;
4245
-
4246
- /** \brief
4247
- * When no error occurred, the success value payload can be retrieved here.
4248
- *
4249
- * Otherwise, the value is to be ignored.
4250
- */
4251
- bool success;
4252
- } dittoffi_result_bool_t;
4253
-
4254
- /** <No documentation available> */
4255
- dittoffi_result_bool_t
4256
- /* fn */ dittoffi_try_collection_evict (
4257
- CDitto_t const * ditto,
4258
- char const * coll_name,
4259
- CWriteTransaction_t * transaction,
4260
- slice_ref_uint8_t id);
4261
-
4262
- /** <No documentation available> */
4263
- typedef struct dittoffi_result_Vec_slice_boxed_uint8 {
4264
- /** \brief
4265
- * Non-`NULL` pointer to opaque object on error, `NULL` otherwise.
4266
- */
4267
- dittoffi_error_t * error;
4268
-
4269
- /** \brief
4270
- * When no error occurred, the success value payload can be retrieved here.
4271
- *
4272
- * Otherwise, the value is to be ignored.
4273
- */
4274
- Vec_slice_boxed_uint8_t success;
4275
- } dittoffi_result_Vec_slice_boxed_uint8_t;
4276
-
4277
- /** <No documentation available> */
4278
- dittoffi_result_Vec_slice_boxed_uint8_t
4279
- /* fn */ dittoffi_try_collection_evict_by_ids (
4280
- CDitto_t const * ditto,
4281
- char const * coll_name,
4282
- CWriteTransaction_t * transaction,
4283
- slice_ref_slice_boxed_uint8_t ids);
4284
-
4285
- /** <No documentation available> */
4286
- dittoffi_result_Vec_slice_boxed_uint8_t
4287
- /* fn */ dittoffi_try_collection_evict_query_str (
4288
- CDitto_t const * ditto,
4289
- char const * coll_name,
4290
- CWriteTransaction_t * transaction,
4291
- char const * query,
4292
- slice_ref_uint8_t query_args_cbor,
4293
- slice_ref_COrderByParam_t order_by_params,
4294
- int32_t limit,
4295
- uint32_t offset);
4296
-
4297
- /** <No documentation available> */
4298
- typedef struct docs_and_ids {
4299
- /** <No documentation available> */
4300
- Vec_CDocument_ptr_t documents;
4301
-
4302
- /** <No documentation available> */
4303
- Vec_slice_boxed_uint8_t ids;
4304
- } docs_and_ids_t;
4305
-
4306
- /** <No documentation available> */
4307
- typedef struct dittoffi_result_docs_and_ids {
4308
- /** \brief
4309
- * Non-`NULL` pointer to opaque object on error, `NULL` otherwise.
4310
- */
4311
- dittoffi_error_t * error;
4312
-
4313
- /** \brief
4314
- * When no error occurred, the success value payload can be retrieved here.
4315
- *
4316
- * Otherwise, the value is to be ignored.
4317
- */
4318
- docs_and_ids_t success;
4319
- } dittoffi_result_docs_and_ids_t;
4320
-
4321
- /** <No documentation available> */
4322
- dittoffi_result_docs_and_ids_t
4323
- /* fn */ dittoffi_try_collection_find_by_ids (
4324
- CDitto_t const * ditto,
4325
- char const * coll_name,
4326
- slice_ref_slice_boxed_uint8_t ids,
4327
- CReadTransaction_t * transaction);
4328
-
4329
- /** <No documentation available> */
4330
- typedef struct dittoffi_result_CDocument_ptr {
4331
- /** \brief
4332
- * Non-`NULL` pointer to opaque object on error, `NULL` otherwise.
4333
- */
4334
- dittoffi_error_t * error;
4335
-
4336
- /** \brief
4337
- * When no error occurred, the success value payload can be retrieved here.
4338
- *
4339
- * Otherwise, the value is to be ignored.
4340
- */
4341
- CDocument_t * success;
4342
- } dittoffi_result_CDocument_ptr_t;
4343
-
4344
- /** \brief
4345
- * [js only] Returns `-1` in case of outstanding non-`awaited` transaction operation.
4346
- */
4347
- dittoffi_result_CDocument_ptr_t
4348
- /* fn */ dittoffi_try_collection_get (
4349
- CDitto_t const * ditto,
4350
- char const * coll_name,
4351
- slice_ref_uint8_t id,
4352
- CReadTransaction_t * transaction);
4353
-
4354
- /** <No documentation available> */
4355
- dittoffi_result_slice_boxed_uint8_t
4356
- /* fn */ dittoffi_try_collection_insert_value (
4357
- CDitto_t const * ditto,
4358
- char const * coll_name,
4359
- slice_ref_uint8_t doc_cbor,
4360
- WriteStrategyRs_t write_strategy,
4361
- char const * log_hint,
4362
- CWriteTransaction_t * txn);
4363
-
4364
- /** <No documentation available> */
4365
- dittoffi_result_bool_t
4366
- /* fn */ dittoffi_try_collection_remove (
4367
- CDitto_t const * ditto,
4368
- char const * coll_name,
4369
- CWriteTransaction_t * transaction,
4370
- slice_ref_uint8_t id);
4371
-
4372
- /** <No documentation available> */
4373
- dittoffi_result_Vec_slice_boxed_uint8_t
4374
- /* fn */ dittoffi_try_collection_remove_by_ids (
4375
- CDitto_t const * ditto,
4376
- char const * coll_name,
4377
- CWriteTransaction_t * transaction,
4378
- slice_ref_slice_boxed_uint8_t ids);
4379
-
4380
- /** <No documentation available> */
4381
- dittoffi_result_Vec_slice_boxed_uint8_t
4382
- /* fn */ dittoffi_try_collection_remove_query_str (
4383
- CDitto_t const * ditto,
4384
- char const * coll_name,
4385
- CWriteTransaction_t * transaction,
4386
- char const * query,
4387
- slice_ref_uint8_t query_args_cbor,
4388
- slice_ref_COrderByParam_t order_by_params,
4389
- int32_t limit,
4390
- uint32_t offset);
4391
-
4392
- /** <No documentation available> */
4393
- dittoffi_result_void_t
4394
- /* fn */ dittoffi_try_collection_update (
4395
- CDitto_t const * ditto,
4396
- char const * coll_name,
4397
- CWriteTransaction_t * transaction,
4398
- CDocument_t * document);
4399
-
4400
- /** <No documentation available> */
4401
- dittoffi_result_void_t
4402
- /* fn */ dittoffi_try_collection_update_multiple (
4403
- CDitto_t const * ditto,
4404
- char const * coll_name,
4405
- CWriteTransaction_t * transaction,
4406
- Vec_CDocument_ptr_t documents);
4407
-
4408
- /** <No documentation available> */
4409
- dittoffi_result_slice_boxed_uint8_t
4410
- /* fn */ dittoffi_try_document_get_cbor_with_path_type (
4411
- CDocument_t const * document,
4412
- char const * pointer,
4413
- PathAccessorType_t path_type);
4414
-
4415
- /** <No documentation available> */
4416
- typedef struct dittoffi_result_dittoffi_query_result_ptr {
4417
- /** \brief
4418
- * Non-`NULL` pointer to opaque object on error, `NULL` otherwise.
4419
- */
4420
- dittoffi_error_t * error;
4421
-
4422
- /** \brief
4423
- * When no error occurred, the success value payload can be retrieved here.
4424
- *
4425
- * Otherwise, the value is to be ignored.
4426
- */
4427
- dittoffi_query_result_t * success;
4428
- } dittoffi_result_dittoffi_query_result_ptr_t;
4429
-
4430
- /** \brief
4431
- * Execute specified DQL statement
4432
- *
4433
- * Returns a DqlResponse, which contains vector of DqlResuls.
4434
- * DqlResult contains values of Register field currently.
4435
- *
4436
- * This is replacement for the old FFI, which was returning documents.
4437
- */
4438
- dittoffi_result_dittoffi_query_result_ptr_t
4439
- /* fn */ dittoffi_try_exec_statement (
4440
- CDitto_t const * ditto,
4441
- CWriteTransaction_t * txn,
4442
- char const * statement,
4443
- slice_ref_uint8_t args_cbor);
4444
-
4445
- /** <No documentation available> */
4446
- typedef struct ChangeHandlerWithQueryResult {
4447
- /** \brief
4448
- * Must be freed with `dittoffi_query_result_free`.
4449
- */
4450
- dittoffi_query_result_t * query_result;
4451
- } ChangeHandlerWithQueryResult_t;
4452
-
4453
- /** <No documentation available> */
4454
- typedef struct dittoffi_result_int64 {
4455
- /** \brief
4456
- * Non-`NULL` pointer to opaque object on error, `NULL` otherwise.
4457
- */
4458
- dittoffi_error_t * error;
4459
-
4460
- /** \brief
4461
- * When no error occurred, the success value payload can be retrieved here.
4462
- *
4463
- * Otherwise, the value is to be ignored.
4464
- */
4465
- int64_t success;
4466
- } dittoffi_result_int64_t;
4467
-
4468
- /** <No documentation available> */
4469
- dittoffi_result_int64_t
4470
- /* fn */ dittoffi_try_experimental_register_change_observer_str (
4471
- CDitto_t const * ditto,
4472
- char const * query,
4473
- slice_ref_uint8_t query_args_cbor,
4474
- LiveQueryAvailability_t lq_availability,
4475
- void * ctx,
4476
- void (*retain)(void *),
4477
- void (*release)(void *),
4478
- void (*c_cb)(void *, ChangeHandlerWithQueryResult_t));
4479
-
4480
- /** <No documentation available> */
4481
- typedef struct dittoffi_result_Vec_char_ptr {
4482
- /** \brief
4483
- * Non-`NULL` pointer to opaque object on error, `NULL` otherwise.
4484
- */
4485
- dittoffi_error_t * error;
4486
-
4487
- /** \brief
4488
- * When no error occurred, the success value payload can be retrieved here.
4489
- *
4490
- * Otherwise, the value is to be ignored.
4491
- */
4492
- Vec_char_ptr_t success;
4493
- } dittoffi_result_Vec_char_ptr_t;
4494
-
4495
- /** <No documentation available> */
4496
- dittoffi_result_Vec_char_ptr_t
4497
- /* fn */ dittoffi_try_get_collection_names (
4498
- CDitto_t const * ditto);
4499
-
4500
- /** <No documentation available> */
4501
- dittoffi_result_void_t
4502
- /* fn */ dittoffi_try_live_query_start (
4503
- CDitto_t const * ditto,
4504
- int64_t id);
4505
-
4506
- /** <No documentation available> */
4507
- dittoffi_result_void_t
4508
- /* fn */ dittoffi_try_live_query_webhook_generate_new_api_secret (
4509
- CDitto_t const * ditto);
4510
-
4511
- /** <No documentation available> */
4512
- dittoffi_result_slice_boxed_uint8_t
4513
- /* fn */ dittoffi_try_live_query_webhook_register_str (
4514
- CDitto_t const * ditto,
4515
- char const * coll_name,
4516
- char const * query,
4517
- slice_ref_COrderByParam_t order_by,
4518
- int32_t limit,
4519
- uint32_t offset,
4520
- char const * url);
4521
-
4522
- /** <No documentation available> */
4523
- dittoffi_result_void_t
4524
- /* fn */ dittoffi_try_live_query_webhook_start_all (
4525
- CDitto_t const * ditto);
4526
-
4527
- /** <No documentation available> */
4528
- dittoffi_result_void_t
4529
- /* fn */ dittoffi_try_live_query_webhook_start_by_id (
4530
- CDitto_t const * ditto,
4531
- slice_ref_uint8_t doc_id);
4532
-
4533
- /** <No documentation available> */
4534
- typedef struct dittoffi_result_uint64 {
4535
- /** \brief
4536
- * Non-`NULL` pointer to opaque object on error, `NULL` otherwise.
4537
- */
4538
- dittoffi_error_t * error;
4539
-
4540
- /** \brief
4541
- * When no error occurred, the success value payload can be retrieved here.
4542
- *
4543
- * Otherwise, the value is to be ignored.
4544
- */
4545
- uint64_t success;
4546
- } dittoffi_result_uint64_t;
4547
-
4548
- /** <No documentation available> */
4549
- dittoffi_result_uint64_t
4550
- /* fn */ dittoffi_try_queries_hash (
4551
- CDitto_t const * ditto,
4552
- slice_ref_char_const_ptr_t coll_names,
4553
- slice_ref_char_const_ptr_t queries);
4554
-
4555
- /** <No documentation available> */
4556
- typedef struct dittoffi_result_char_ptr {
4557
- /** \brief
4558
- * Non-`NULL` pointer to opaque object on error, `NULL` otherwise.
4559
- */
4560
- dittoffi_error_t * error;
4561
-
4562
- /** \brief
4563
- * When no error occurred, the success value payload can be retrieved here.
4564
- *
4565
- * Otherwise, the value is to be ignored.
4566
- */
4567
- char * success;
4568
- } dittoffi_result_char_ptr_t;
4569
-
4570
- /** <No documentation available> */
4571
- dittoffi_result_char_ptr_t
4572
- /* fn */ dittoffi_try_queries_hash_mnemonic (
4573
- CDitto_t const * ditto,
4574
- slice_ref_char_const_ptr_t coll_names,
4575
- slice_ref_char_const_ptr_t queries);
4576
-
4577
- /** <No documentation available> */
4578
- dittoffi_result_int64_t
4579
- /* fn */ dittoffi_try_register_store_observer (
4580
- CDitto_t const * ditto,
4581
- char const * coll_name,
4582
- char const * query,
4583
- slice_ref_uint8_t query_args_cbor,
4584
- slice_ref_COrderByParam_t order_by,
4585
- int32_t limit,
4586
- uint32_t offset,
4587
- LiveQueryAvailability_t lq_availability,
4588
- void * ctx,
4589
- void (*retain)(void *),
4590
- void (*release)(void *),
4591
- void (*c_cb)(void *, c_cb_params_t));
4592
-
4593
- /** <No documentation available> */
4594
- dittoffi_result_slice_boxed_uint8_t
4595
- /* fn */ dittoffi_try_register_store_observer_webhook (
4596
- CDitto_t const * ditto,
4597
- char const * query,
4598
- slice_ref_uint8_t query_args_cbor,
4599
- char const * url);
4600
-
4601
- /** <No documentation available> */
4602
- dittoffi_result_void_t
4603
- /* fn */ dittoffi_try_remove_subscription (
4604
- CDitto_t const * ditto,
4605
- char const * collection,
4606
- char const * query,
4607
- slice_ref_uint8_t query_args_cbor,
4608
- slice_ref_COrderByParam_t order_by,
4609
- int32_t limit,
4610
- uint32_t offset);
4611
-
4612
- /** \brief
4613
- * Removes a DQL sync subscription.
4614
- *
4615
- * The arguments should be identical to the ones used during adding the subscription.
4616
- * Returns no meaningful value but for the resulting potential `.error`.
4617
- */
4618
- dittoffi_result_void_t
4619
- /* fn */ dittoffi_try_remove_sync_subscription (
4620
- CDitto_t const * ditto,
4621
- char const * query,
4622
- slice_ref_uint8_t query_args_cbor);
4623
-
4624
- /** \brief
4625
- * Verify a base64 encoded license string.
4626
- *
4627
- * # Parameters
4628
- * - `license`: A base64 encoded license string. This should be the output of
4629
- * `ditto_licenser::license_mgr::generate()`.
4630
- */
4631
- dittoffi_result_void_t
4632
- /* fn */ dittoffi_try_verify_license (
4633
- char const * license);
4634
-
4635
- /** <No documentation available> */
4636
- void
4637
- /* fn */ free_c_string_vec (
4638
- Vec_char_ptr_t * strings);
4639
-
4640
- /** \brief
4641
- * The platform advises Rust that the status of publishing our service has
4642
- * changed.
4643
- */
4644
- void
4645
- /* fn */ mdns_advertising_state_changed (
4646
- TransportHandle_MdnsServerPlatformEvent_t const * handle,
4647
- OnlineState_t state,
4648
- TransportCondition_t condition);
4649
-
4650
- /** \brief
4651
- * The SDK requests to drop its handle to the mDNS discovery transport
4652
- *
4653
- * At some point dropping this events channel will effectively shut down and
4654
- * remove the Transport. At time of writing, the Transport is still owned
4655
- * within Peer.
4656
- */
4657
- void
4658
- /* fn */ mdns_client_free_handle (
4659
- TransportHandle_MdnsClientPlatformEvent_t * handle);
4660
-
4661
- /** \brief
4662
- * The platform advises Rust that a peer has been identified.
4663
- */
4664
- void
4665
- /* fn */ mdns_platform_peer_appeared (
4666
- TransportHandle_MdnsClientPlatformEvent_t const * handle,
4667
- char const * announce_string);
4668
-
4669
- /** \brief
4670
- * The platform advises Rust that a peer's service has disappeared from mDNS.
4671
- */
4672
- void
4673
- /* fn */ mdns_platform_peer_disappeared (
4674
- TransportHandle_MdnsClientPlatformEvent_t const * handle,
4675
- char const * announce_string);
4676
-
4677
- /** \brief
4678
- * The platform advises Rust that the status of searching for services has
4679
- * changed.
4680
- */
4681
- void
4682
- /* fn */ mdns_scanning_state_changed (
4683
- TransportHandle_MdnsClientPlatformEvent_t const * handle,
4684
- OnlineState_t state,
4685
- TransportCondition_t condition);
4686
-
4687
- /** \brief
4688
- * The SDK requests to drop its handle to the mDNS advertising service.
4689
- *
4690
- * Ideally this should remove the advertiser automatically.
4691
- * At time of writing now this must be done manually through Peer.
4692
- */
4693
- void
4694
- /* fn */ mdns_server_free_handle (
4695
- TransportHandle_MdnsServerPlatformEvent_t * handle);
4696
-
4697
- /** \brief
4698
- * The platform advises Rust that we failed to resolve a peer's hostname and
4699
- * port
4700
- */
4701
- void
4702
- /* fn */ mdns_service_did_not_resolve (
4703
- TransportHandle_MdnsClientPlatformEvent_t const * handle,
4704
- char const * announce_string);
4705
-
4706
- /** \brief
4707
- * The platform advises Rust that we have resolved a peer's hostname and port
4708
- */
4709
- void
4710
- /* fn */ mdns_service_did_resolve (
4711
- TransportHandle_MdnsClientPlatformEvent_t const * handle,
4712
- char const * announce_string,
4713
- char const * hostname,
4714
- uint16_t port);
4715
-
4716
- /** <No documentation available> */
4717
- Vec_char_ptr_t *
4718
- /* fn */ new_c_string_vec (void);
4719
-
4720
- /** \brief
4721
- * An FFI-safe `Poll<()>`.
4722
- */
4723
- /** \remark Has the same ABI as `int8_t` **/
4724
- #ifdef DOXYGEN
4725
- typedef
4726
- #endif
4727
- enum PollFuture {
4728
- /** <No documentation available> */
4729
- POLL_FUTURE_COMPLETED = 0,
4730
- /** <No documentation available> */
4731
- POLL_FUTURE_PENDING = -1,
4732
- }
4733
- #ifndef DOXYGEN
4734
- ; typedef int8_t
4735
- #endif
4736
- PollFuture_t;
4737
-
4738
- /** \brief
4739
- * The layout of `core::task::wake::Context` is opaque/subject to changes.
4740
- */
4741
- typedef struct Opaque_Context Opaque_Context_t;
4742
-
4743
- /** <No documentation available> */
4744
- typedef struct FfiFutureVTable {
4745
- /** <No documentation available> */
4746
- void (*release_vptr)(Erased_t *);
4747
-
4748
- /** <No documentation available> */
4749
- PollFuture_t (*dyn_poll)(Erased_t *, Opaque_Context_t *);
4750
- } FfiFutureVTable_t;
4751
-
4752
- /** <No documentation available> */
4753
- typedef struct VirtualPtr__Erased_ptr_FfiFutureVTable {
4754
- /** <No documentation available> */
4755
- Erased_t * ptr;
4756
-
4757
- /** <No documentation available> */
4758
- FfiFutureVTable_t vtable;
4759
- } VirtualPtr__Erased_ptr_FfiFutureVTable_t;
4760
-
4761
- /** \brief
4762
- * `Box<dyn 'static + Send + FnMut() -> Ret>`
4763
- */
4764
- typedef struct BoxDynFnMut0_void {
4765
- /** <No documentation available> */
4766
- void * env_ptr;
4767
-
4768
- /** <No documentation available> */
4769
- void (*call)(void *);
4770
-
4771
- /** <No documentation available> */
4772
- void (*free)(void *);
4773
- } BoxDynFnMut0_void_t;
4774
-
4775
- /** <No documentation available> */
4776
- typedef struct DropGlueVTable {
4777
- /** <No documentation available> */
4778
- void (*release_vptr)(Erased_t *);
4779
- } DropGlueVTable_t;
4780
-
4781
- /** <No documentation available> */
4782
- typedef struct VirtualPtr__Erased_ptr_DropGlueVTable {
4783
- /** <No documentation available> */
4784
- Erased_t * ptr;
4785
-
4786
- /** <No documentation available> */
4787
- DropGlueVTable_t vtable;
4788
- } VirtualPtr__Erased_ptr_DropGlueVTable_t;
4789
-
4790
- /** <No documentation available> */
4791
- typedef struct FfiFutureExecutorVTable {
4792
- /** <No documentation available> */
4793
- void (*release_vptr)(Erased_t *);
4794
-
4795
- /** <No documentation available> */
4796
- Erased_t * (*retain_vptr)(Erased_t const *);
4797
-
4798
- /** <No documentation available> */
4799
- VirtualPtr__Erased_ptr_FfiFutureVTable_t (*dyn_spawn)(Erased_t const *, VirtualPtr__Erased_ptr_FfiFutureVTable_t);
4800
-
4801
- /** <No documentation available> */
4802
- VirtualPtr__Erased_ptr_FfiFutureVTable_t (*dyn_spawn_blocking)(Erased_t const *, BoxDynFnMut0_void_t);
4803
-
4804
- /** <No documentation available> */
4805
- void (*dyn_block_on)(Erased_t const *, VirtualPtr__Erased_ptr_FfiFutureVTable_t);
4806
-
4807
- /** <No documentation available> */
4808
- VirtualPtr__Erased_ptr_DropGlueVTable_t (*dyn_enter)(Erased_t const *);
4809
- } FfiFutureExecutorVTable_t;
4810
-
4811
- /** <No documentation available> */
4812
- typedef struct VirtualPtr__Erased_ptr_FfiFutureExecutorVTable {
4813
- /** <No documentation available> */
4814
- Erased_t * ptr;
4815
-
4816
- /** <No documentation available> */
4817
- FfiFutureExecutorVTable_t vtable;
4818
- } VirtualPtr__Erased_ptr_FfiFutureExecutorVTable_t;
4819
-
4820
- /** <No documentation available> */
4821
- typedef struct FfiFnMutVTable {
4822
- /** <No documentation available> */
4823
- void (*release_vptr)(Erased_t *);
4824
-
4825
- /** <No documentation available> */
4826
- void (*call)(Erased_t *);
4827
- } FfiFnMutVTable_t;
4828
-
4829
- /** <No documentation available> */
4830
- typedef struct VirtualPtr__Erased_ptr_FfiFnMutVTable {
4831
- /** <No documentation available> */
4832
- Erased_t * ptr;
4833
-
4834
- /** <No documentation available> */
4835
- FfiFnMutVTable_t vtable;
4836
- } VirtualPtr__Erased_ptr_FfiFnMutVTable_t;
4837
-
4838
- /** \brief
4839
- * Keep in sync with `/rust/dittolive-ditto/dittoffi.rs`
4840
- */
4841
- typedef struct ExecutorFunctions {
4842
- /** <No documentation available> */
4843
- VirtualPtr__Erased_ptr_FfiFutureExecutorVTable_t (*get_current_handle)(void);
4844
-
4845
- /** <No documentation available> */
4846
- void (*block_in_place)(VirtualPtr__Erased_ptr_FfiFnMutVTable_t);
4847
- } ExecutorFunctions_t;
4848
-
4849
- /** <No documentation available> */
4850
- void
4851
- /* fn */ register_executor_functions (
4852
- ExecutorFunctions_t fns);
4853
-
4854
- /** \brief
4855
- * The SDK requests to drop its handle to this TCP Client transport
4856
- */
4857
- void
4858
- /* fn */ static_tcp_client_free_handle (
4859
- TransportHandle_StaticTcpClientPlatformEvent_t * handle);
4860
-
4861
- /** \brief
4862
- * The SDK requests to drop its handle to this WebSocket Client transport
4863
- */
4864
- void
4865
- /* fn */ websocket_client_free_handle (
4866
- TransportHandle_WebsocketClientPlatformEvent_t * handle);
4867
-
4868
-
4869
- #ifdef __cplusplus
4870
- } /* extern \"C\" */
4871
- #endif
4872
-
4873
- #endif /* __RUST_DITTOFFI__ */