rustorb-dds 0.3.0

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.
@@ -0,0 +1,955 @@
1
+ /*
2
+ * rustorb/dds.h: the C ABI of rustorb-dds (crate rustorb-dds-ffi).
3
+ *
4
+ * SPDX-License-Identifier: MIT OR Apache-2.0
5
+ *
6
+ * The C++ binding (cpp/include) and the Java binding are built on these
7
+ * functions; they can be used from C too.
8
+ *
9
+ * Rules every caller follows:
10
+ *
11
+ * - Handles. Every rdds_* object (rdds_participant, rdds_topic, ...) is
12
+ * opaque and made by a function of this header that stores it in an
13
+ * output pointer. It is freed with its rdds_*_release function, once;
14
+ * releasing NULL does nothing. Releasing a writer or reader deletes it;
15
+ * releasing a participant deletes it and its entities stop working.
16
+ * A handle may be used from any thread.
17
+ * - Errors. Functions that can fail return rdds_status, a DDS
18
+ * ReturnCode_t (RDDS_RETCODE_OK and the others below). After a failure
19
+ * rdds_last_error_message() tells why, on the same thread. Pointers
20
+ * the caller passes must be valid for the call; output pointers must
21
+ * not be NULL.
22
+ * - Strings are UTF-8 and NUL-terminated, except in sample streams
23
+ * (rdds_out_string, rdds_in_string), where they carry a length. Wide
24
+ * strings and wide characters are UTF-16 code units.
25
+ * - Samples. The caller writes the values of a sample in the order of its
26
+ * type into an rdds_out, and reads them in the same order from an
27
+ * rdds_in (see "Samples" below). The library encodes them.
28
+ * - Listeners are called on a thread of the library, or, for a reader of
29
+ * the same participant as the writer, inside the rdds_writer_* call that
30
+ * wrote, on the caller's thread. No lock of the library is held: they
31
+ * may call any function, but must not block for long.
32
+ */
33
+ #ifndef RUSTORB_DDS_H
34
+ #define RUSTORB_DDS_H
35
+
36
+ #include <stdbool.h>
37
+ #include <stddef.h>
38
+ #include <stdint.h>
39
+
40
+ #ifdef __cplusplus
41
+ extern "C" {
42
+ #endif
43
+
44
+ /* The version of this ABI; compare with rdds_abi_version(). */
45
+ #define RDDS_ABI_VERSION 1u
46
+
47
+ uint32_t rdds_abi_version(void);
48
+
49
+ /* ------------------------------------------------------------------ */
50
+ /* Return codes (DDS 1.4, 2.2.1.1) */
51
+
52
+ typedef int32_t rdds_status;
53
+
54
+ #define RDDS_RETCODE_OK 0
55
+ #define RDDS_RETCODE_ERROR 1
56
+ #define RDDS_RETCODE_UNSUPPORTED 2
57
+ #define RDDS_RETCODE_BAD_PARAMETER 3
58
+ #define RDDS_RETCODE_PRECONDITION_NOT_MET 4
59
+ #define RDDS_RETCODE_OUT_OF_RESOURCES 5
60
+ #define RDDS_RETCODE_NOT_ENABLED 6
61
+ #define RDDS_RETCODE_IMMUTABLE_POLICY 7
62
+ #define RDDS_RETCODE_INCONSISTENT_POLICY 8
63
+ #define RDDS_RETCODE_ALREADY_DELETED 9
64
+ #define RDDS_RETCODE_TIMEOUT 10
65
+ #define RDDS_RETCODE_NO_DATA 11
66
+ #define RDDS_RETCODE_ILLEGAL_OPERATION 12
67
+
68
+ /* The message of the last failure on this thread; valid until the next. */
69
+ const char *rdds_last_error_message(void);
70
+
71
+ /* ------------------------------------------------------------------ */
72
+ /* Plain values */
73
+
74
+ typedef struct rdds_duration {
75
+ int32_t sec;
76
+ uint32_t nanosec;
77
+ } rdds_duration;
78
+
79
+ #define RDDS_DURATION_INFINITE_SEC 0x7fffffff
80
+ #define RDDS_DURATION_INFINITE_NSEC 0x7fffffffu
81
+
82
+ /* Since 1970-01-01T00:00:00Z. */
83
+ typedef struct rdds_time {
84
+ int32_t sec;
85
+ uint32_t nanosec;
86
+ } rdds_time;
87
+
88
+ #define RDDS_TIME_INVALID_SEC (-1)
89
+ #define RDDS_TIME_INVALID_NSEC 0xffffffffu
90
+
91
+ typedef struct rdds_guid {
92
+ uint8_t value[16];
93
+ } rdds_guid;
94
+
95
+ /* All zeros is HANDLE_NIL. */
96
+ typedef struct rdds_instance_handle {
97
+ uint8_t value[16];
98
+ } rdds_instance_handle;
99
+
100
+ /* ------------------------------------------------------------------ */
101
+ /* Types (DDS-XTypes 1.3, 7.5.2.2) */
102
+
103
+ typedef struct rdds_type rdds_type;
104
+ typedef struct rdds_enum_builder rdds_enum_builder;
105
+ typedef struct rdds_bitmask_builder rdds_bitmask_builder;
106
+ typedef struct rdds_bitset_builder rdds_bitset_builder;
107
+ typedef struct rdds_struct_builder rdds_struct_builder;
108
+ typedef struct rdds_union_builder rdds_union_builder;
109
+
110
+ /* Type kinds of the primitive types (DDS-XTypes 1.3, 7.3.4.6). */
111
+ #define RDDS_TK_BOOLEAN 0x01
112
+ #define RDDS_TK_BYTE 0x02
113
+ #define RDDS_TK_INT16 0x03
114
+ #define RDDS_TK_INT32 0x04
115
+ #define RDDS_TK_INT64 0x05
116
+ #define RDDS_TK_UINT16 0x06
117
+ #define RDDS_TK_UINT32 0x07
118
+ #define RDDS_TK_UINT64 0x08
119
+ #define RDDS_TK_FLOAT32 0x09
120
+ #define RDDS_TK_FLOAT64 0x0A
121
+ #define RDDS_TK_FLOAT128 0x0B
122
+ #define RDDS_TK_INT8 0x0C
123
+ #define RDDS_TK_UINT8 0x0D
124
+ #define RDDS_TK_CHAR8 0x10
125
+ #define RDDS_TK_CHAR16 0x11
126
+
127
+ /* Extensibility. */
128
+ #define RDDS_FINAL 0
129
+ #define RDDS_APPENDABLE 1
130
+ #define RDDS_MUTABLE 2
131
+
132
+ /* Flags of a struct or union. */
133
+ #define RDDS_TYPE_NESTED 1u
134
+ #define RDDS_TYPE_AUTOID_HASH 2u
135
+
136
+ /* Flags of a member. */
137
+ #define RDDS_MEMBER_KEY 1u
138
+ #define RDDS_MEMBER_OPTIONAL 2u
139
+ #define RDDS_MEMBER_MUST_UNDERSTAND 4u
140
+ #define RDDS_MEMBER_EXTERNAL 8u
141
+ #define RDDS_MEMBER_TRY_CONSTRUCT_USE_DEFAULT 16u
142
+ #define RDDS_MEMBER_TRY_CONSTRUCT_TRIM 32u
143
+ #define RDDS_MEMBER_DEFAULT_LABEL 64u
144
+
145
+ /* Every function that makes a type copies the types it is given. A type
146
+ * cannot refer to itself. */
147
+ rdds_status rdds_type_primitive(uint8_t kind, rdds_type **out);
148
+ /* bound 0: unbounded. */
149
+ rdds_status rdds_type_string(bool wide, uint32_t bound, rdds_type **out);
150
+ rdds_status rdds_type_sequence(const rdds_type *element, uint32_t bound,
151
+ rdds_type **out);
152
+ rdds_status rdds_type_array(const rdds_type *element, const uint32_t *dimensions,
153
+ size_t dimensions_len, rdds_type **out);
154
+ rdds_status rdds_type_map(const rdds_type *key, const rdds_type *element,
155
+ uint32_t bound, rdds_type **out);
156
+ /* A typedef; the name is fully scoped ("A::B::T"). */
157
+ rdds_status rdds_type_alias(const char *name, const rdds_type *related,
158
+ rdds_type **out);
159
+
160
+ rdds_status rdds_enum_builder_new(const char *name, uint16_t bit_bound,
161
+ int32_t extensibility,
162
+ rdds_enum_builder **out);
163
+ rdds_status rdds_enum_builder_add_literal(rdds_enum_builder *b, const char *name,
164
+ int32_t value, bool is_default);
165
+ rdds_status rdds_enum_builder_build(const rdds_enum_builder *b, rdds_type **out);
166
+ void rdds_enum_builder_release(rdds_enum_builder *b);
167
+
168
+ rdds_status rdds_bitmask_builder_new(const char *name, uint16_t bit_bound,
169
+ int32_t extensibility,
170
+ rdds_bitmask_builder **out);
171
+ rdds_status rdds_bitmask_builder_add_flag(rdds_bitmask_builder *b,
172
+ const char *name, uint16_t position);
173
+ rdds_status rdds_bitmask_builder_build(const rdds_bitmask_builder *b,
174
+ rdds_type **out);
175
+ void rdds_bitmask_builder_release(rdds_bitmask_builder *b);
176
+
177
+ /* A bitset: fields of bitcount bits from position, read and written as
178
+ * holder (RDDS_TK_BOOLEAN or an integer kind). In a sample stream a
179
+ * bitset is one integer, as a bitmask (rdds_out_bitmask). */
180
+ rdds_status rdds_bitset_builder_new(const char *name, rdds_bitset_builder **out);
181
+ rdds_status rdds_bitset_builder_add_field(rdds_bitset_builder *b,
182
+ const char *name, uint16_t position,
183
+ uint8_t bitcount, uint8_t holder);
184
+ rdds_status rdds_bitset_builder_build(const rdds_bitset_builder *b,
185
+ rdds_type **out);
186
+ void rdds_bitset_builder_release(rdds_bitset_builder *b);
187
+
188
+ /* A recursive type: a forward declaration of its name, used inside it
189
+ * (in a sequence, a map or an optional member), then defined as the type
190
+ * once it is built. Use the defined type for a topic. */
191
+ rdds_status rdds_type_forward(const char *name, rdds_type **out);
192
+ rdds_status rdds_type_define(const rdds_type *forward, const rdds_type *target);
193
+
194
+ /* base: NULL for none. */
195
+ rdds_status rdds_struct_builder_new(const char *name, int32_t extensibility,
196
+ uint32_t flags, const rdds_type *base,
197
+ rdds_struct_builder **out);
198
+ /* hash_id: the string of @hashid ("" when none is given), or NULL. */
199
+ rdds_status rdds_struct_builder_add_member(rdds_struct_builder *b,
200
+ const char *name, uint32_t id,
201
+ const rdds_type *type, uint32_t flags,
202
+ const char *hash_id);
203
+ rdds_status rdds_struct_builder_build(const rdds_struct_builder *b,
204
+ rdds_type **out);
205
+ void rdds_struct_builder_release(rdds_struct_builder *b);
206
+
207
+ /* discriminator_flags: RDDS_MEMBER_KEY and the try-construct flags. */
208
+ rdds_status rdds_union_builder_new(const char *name, int32_t extensibility,
209
+ uint32_t flags, const rdds_type *discriminator,
210
+ uint32_t discriminator_flags,
211
+ rdds_union_builder **out);
212
+ rdds_status rdds_union_builder_add_member(rdds_union_builder *b,
213
+ const char *name, uint32_t id,
214
+ const rdds_type *type,
215
+ const int32_t *labels,
216
+ size_t labels_len, uint32_t flags,
217
+ const char *hash_id);
218
+ rdds_status rdds_union_builder_build(const rdds_union_builder *b,
219
+ rdds_type **out);
220
+ void rdds_union_builder_release(rdds_union_builder *b);
221
+
222
+ rdds_status rdds_type_clone(const rdds_type *t, rdds_type **out);
223
+ void rdds_type_release(rdds_type *t);
224
+
225
+ /* The 14-octet equivalence hashes of the minimal and complete TypeObjects
226
+ * of a topic type (DDS-XTypes 1.3, 7.3.4.9). A recursive type has none:
227
+ * it is identified by its strongly connected component (7.3.4.9.2). */
228
+ rdds_status rdds_type_hashes(const rdds_type *t, uint8_t minimal[14],
229
+ uint8_t complete[14]);
230
+
231
+ /* ------------------------------------------------------------------ */
232
+ /* Samples */
233
+ /*
234
+ * The values of a sample, in the order of its type:
235
+ *
236
+ * - a struct: its members in order, those of its base first; before an
237
+ * optional member, rdds_out_present(true or false), then its value
238
+ * only if present;
239
+ * - a union: rdds_out_discriminator, then the value of the member it
240
+ * selects, if any;
241
+ * - a sequence: rdds_out_length, then its elements; a map: its length,
242
+ * then key, value, key, value...;
243
+ * - an array: its elements, every dimension row by row;
244
+ * - the elements of a sequence or array of a primitive type other than
245
+ * float128 go in one call, rdds_out_<primitive>_array (after the length
246
+ * of a sequence); every element of an array of several dimensions;
247
+ * - an enum: rdds_out_enum with the value of the literal; a bitmask:
248
+ * rdds_out_bitmask with its bits;
249
+ * - typedefs and @external are transparent.
250
+ *
251
+ * An rdds_out does not know the type: a writer checks the values against
252
+ * the type of its topic and fails with RDDS_RETCODE_BAD_PARAMETER when
253
+ * they do not fit. An rdds_in gives the values in the same order; a read
254
+ * that does not fit the sample returns zero and sets an error that sticks
255
+ * (rdds_in_status).
256
+ */
257
+
258
+ typedef struct rdds_out rdds_out;
259
+ typedef struct rdds_in rdds_in;
260
+
261
+ rdds_status rdds_out_new(rdds_out **out);
262
+ /* Empties the stream, to write the next sample. */
263
+ void rdds_out_clear(rdds_out *s);
264
+ void rdds_out_release(rdds_out *s);
265
+
266
+ void rdds_out_boolean(rdds_out *s, bool v);
267
+ void rdds_out_octet(rdds_out *s, uint8_t v);
268
+ void rdds_out_int8(rdds_out *s, int8_t v);
269
+ void rdds_out_uint8(rdds_out *s, uint8_t v);
270
+ void rdds_out_int16(rdds_out *s, int16_t v);
271
+ void rdds_out_uint16(rdds_out *s, uint16_t v);
272
+ void rdds_out_int32(rdds_out *s, int32_t v);
273
+ void rdds_out_uint32(rdds_out *s, uint32_t v);
274
+ void rdds_out_int64(rdds_out *s, int64_t v);
275
+ void rdds_out_uint64(rdds_out *s, uint64_t v);
276
+ void rdds_out_float32(rdds_out *s, float v);
277
+ void rdds_out_float64(rdds_out *s, double v);
278
+ /* The IEEE 754 binary128 bits. */
279
+ void rdds_out_float128(rdds_out *s, uint64_t high, uint64_t low);
280
+ /* char8 as one octet (ISO-8859-1), char16 as one UTF-16 code unit. */
281
+ void rdds_out_char8(rdds_out *s, char v);
282
+ void rdds_out_char16(rdds_out *s, uint16_t v);
283
+ void rdds_out_string(rdds_out *s, const char *v, size_t len);
284
+ void rdds_out_wstring(rdds_out *s, const uint16_t *v, size_t len);
285
+ void rdds_out_length(rdds_out *s, uint32_t v);
286
+ void rdds_out_present(rdds_out *s, bool v);
287
+ void rdds_out_discriminator(rdds_out *s, int64_t v);
288
+ void rdds_out_enum(rdds_out *s, int32_t v);
289
+ void rdds_out_bitmask(rdds_out *s, uint64_t v);
290
+
291
+ void rdds_out_boolean_array(rdds_out *s, const bool *v, size_t n);
292
+ void rdds_out_octet_array(rdds_out *s, const uint8_t *v, size_t n);
293
+ void rdds_out_int8_array(rdds_out *s, const int8_t *v, size_t n);
294
+ void rdds_out_uint8_array(rdds_out *s, const uint8_t *v, size_t n);
295
+ void rdds_out_int16_array(rdds_out *s, const int16_t *v, size_t n);
296
+ void rdds_out_uint16_array(rdds_out *s, const uint16_t *v, size_t n);
297
+ void rdds_out_int32_array(rdds_out *s, const int32_t *v, size_t n);
298
+ void rdds_out_uint32_array(rdds_out *s, const uint32_t *v, size_t n);
299
+ void rdds_out_int64_array(rdds_out *s, const int64_t *v, size_t n);
300
+ void rdds_out_uint64_array(rdds_out *s, const uint64_t *v, size_t n);
301
+ void rdds_out_float32_array(rdds_out *s, const float *v, size_t n);
302
+ void rdds_out_float64_array(rdds_out *s, const double *v, size_t n);
303
+ void rdds_out_char8_array(rdds_out *s, const char *v, size_t n);
304
+ void rdds_out_char16_array(rdds_out *s, const uint16_t *v, size_t n);
305
+
306
+ /* RDDS_RETCODE_OK, or RDDS_RETCODE_BAD_PARAMETER after a read that did
307
+ * not fit (the message set as for any failure). */
308
+ rdds_status rdds_in_status(const rdds_in *s);
309
+ /* Whether every value was read. */
310
+ bool rdds_in_at_end(const rdds_in *s);
311
+ void rdds_in_release(rdds_in *s);
312
+
313
+ bool rdds_in_boolean(rdds_in *s);
314
+ uint8_t rdds_in_octet(rdds_in *s);
315
+ int8_t rdds_in_int8(rdds_in *s);
316
+ uint8_t rdds_in_uint8(rdds_in *s);
317
+ int16_t rdds_in_int16(rdds_in *s);
318
+ uint16_t rdds_in_uint16(rdds_in *s);
319
+ int32_t rdds_in_int32(rdds_in *s);
320
+ uint32_t rdds_in_uint32(rdds_in *s);
321
+ int64_t rdds_in_int64(rdds_in *s);
322
+ uint64_t rdds_in_uint64(rdds_in *s);
323
+ float rdds_in_float32(rdds_in *s);
324
+ double rdds_in_float64(rdds_in *s);
325
+ void rdds_in_float128(rdds_in *s, uint64_t *high, uint64_t *low);
326
+ char rdds_in_char8(rdds_in *s);
327
+ uint16_t rdds_in_char16(rdds_in *s);
328
+ /* Not NUL-terminated; valid until the stream is released. */
329
+ void rdds_in_string(rdds_in *s, const char **v, size_t *len);
330
+ void rdds_in_wstring(rdds_in *s, const uint16_t **v, size_t *len);
331
+ uint32_t rdds_in_length(rdds_in *s);
332
+ bool rdds_in_present(rdds_in *s);
333
+ int64_t rdds_in_discriminator(rdds_in *s);
334
+ int32_t rdds_in_enum(rdds_in *s);
335
+ uint64_t rdds_in_bitmask(rdds_in *s);
336
+
337
+ /* Exactly n elements (the length read before, or the array's size). */
338
+ void rdds_in_boolean_array(rdds_in *s, bool *v, size_t n);
339
+ void rdds_in_octet_array(rdds_in *s, uint8_t *v, size_t n);
340
+ void rdds_in_int8_array(rdds_in *s, int8_t *v, size_t n);
341
+ void rdds_in_uint8_array(rdds_in *s, uint8_t *v, size_t n);
342
+ void rdds_in_int16_array(rdds_in *s, int16_t *v, size_t n);
343
+ void rdds_in_uint16_array(rdds_in *s, uint16_t *v, size_t n);
344
+ void rdds_in_int32_array(rdds_in *s, int32_t *v, size_t n);
345
+ void rdds_in_uint32_array(rdds_in *s, uint32_t *v, size_t n);
346
+ void rdds_in_int64_array(rdds_in *s, int64_t *v, size_t n);
347
+ void rdds_in_uint64_array(rdds_in *s, uint64_t *v, size_t n);
348
+ void rdds_in_float32_array(rdds_in *s, float *v, size_t n);
349
+ void rdds_in_float64_array(rdds_in *s, double *v, size_t n);
350
+ void rdds_in_char8_array(rdds_in *s, char *v, size_t n);
351
+ void rdds_in_char16_array(rdds_in *s, uint16_t *v, size_t n);
352
+
353
+ /* A sample's serialized payload with its encapsulation header (XCDR1, or
354
+ * XCDR2 with xcdr2, little endian), freed with rdds_bytes_free; and back.
355
+ * For tests and tools. */
356
+ rdds_status rdds_type_serialize(const rdds_type *t, const rdds_out *sample,
357
+ bool xcdr2, uint8_t **data, size_t *len);
358
+ rdds_status rdds_type_deserialize(const rdds_type *t, const uint8_t *data,
359
+ size_t len, rdds_in **out);
360
+ void rdds_bytes_free(uint8_t *data, size_t len);
361
+
362
+ /* ------------------------------------------------------------------ */
363
+ /* QoS */
364
+
365
+ #define RDDS_LENGTH_UNLIMITED (-1)
366
+
367
+ #define RDDS_BEST_EFFORT_RELIABILITY_QOS 0
368
+ #define RDDS_RELIABLE_RELIABILITY_QOS 1
369
+ #define RDDS_KEEP_LAST_HISTORY_QOS 0
370
+ #define RDDS_KEEP_ALL_HISTORY_QOS 1
371
+ #define RDDS_VOLATILE_DURABILITY_QOS 0
372
+ #define RDDS_TRANSIENT_LOCAL_DURABILITY_QOS 1
373
+ #define RDDS_TRANSIENT_DURABILITY_QOS 2
374
+ #define RDDS_PERSISTENT_DURABILITY_QOS 3
375
+ #define RDDS_AUTOMATIC_LIVELINESS_QOS 0
376
+ #define RDDS_MANUAL_BY_PARTICIPANT_LIVELINESS_QOS 1
377
+ #define RDDS_MANUAL_BY_TOPIC_LIVELINESS_QOS 2
378
+ #define RDDS_DISALLOW_TYPE_COERCION 0
379
+ #define RDDS_ALLOW_TYPE_COERCION 1
380
+ #define RDDS_XCDR_DATA_REPRESENTATION 0
381
+ #define RDDS_XCDR2_DATA_REPRESENTATION 2
382
+
383
+ /* Start from rdds_writer_qos_default. The arrays are read during the
384
+ * call that takes the QoS. An empty data_representation: XCDR. */
385
+ typedef struct rdds_writer_qos {
386
+ int32_t reliability_kind;
387
+ rdds_duration max_blocking_time;
388
+ int32_t history_kind;
389
+ int32_t history_depth;
390
+ int32_t max_samples;
391
+ int32_t max_instances;
392
+ int32_t max_samples_per_instance;
393
+ int32_t durability_kind;
394
+ rdds_duration deadline_period;
395
+ int32_t liveliness_kind;
396
+ rdds_duration lease_duration;
397
+ const uint8_t *user_data;
398
+ size_t user_data_len;
399
+ const int16_t *data_representation;
400
+ size_t data_representation_len;
401
+ bool autodispose_unregistered_instances;
402
+ /* DURABILITY_SERVICE of a TRANSIENT or PERSISTENT writer: what its
403
+ * participant keeps once it is deleted. */
404
+ rdds_duration service_cleanup_delay;
405
+ int32_t service_history_kind;
406
+ int32_t service_history_depth;
407
+ int32_t service_max_samples;
408
+ int32_t service_max_instances;
409
+ int32_t service_max_samples_per_instance;
410
+ } rdds_writer_qos;
411
+
412
+ typedef struct rdds_reader_qos {
413
+ int32_t reliability_kind;
414
+ rdds_duration max_blocking_time;
415
+ int32_t history_kind;
416
+ int32_t history_depth;
417
+ int32_t max_samples;
418
+ int32_t max_instances;
419
+ int32_t max_samples_per_instance;
420
+ int32_t durability_kind;
421
+ rdds_duration deadline_period;
422
+ int32_t liveliness_kind;
423
+ rdds_duration lease_duration;
424
+ const uint8_t *user_data;
425
+ size_t user_data_len;
426
+ const int16_t *data_representation;
427
+ size_t data_representation_len;
428
+ int32_t type_consistency_kind;
429
+ bool ignore_sequence_bounds;
430
+ bool ignore_string_bounds;
431
+ bool ignore_member_names;
432
+ bool prevent_type_widening;
433
+ bool force_type_validation;
434
+ } rdds_reader_qos;
435
+
436
+ /* The PARTITION of a publisher or subscriber. */
437
+ typedef struct rdds_group_qos {
438
+ const char *const *partition;
439
+ size_t partition_len;
440
+ } rdds_group_qos;
441
+
442
+ /* A property of the PROPERTY QoS (DDS Security 1.2, 7.2.5). */
443
+ typedef struct rdds_property {
444
+ const char *name;
445
+ const char *value;
446
+ } rdds_property;
447
+
448
+ /* property: the dds.sec.* properties of the builtin plugins
449
+ (dds.sec.auth.identity_ca, dds.sec.auth.identity_certificate,
450
+ dds.sec.auth.private_key, dds.sec.access.permissions_ca,
451
+ dds.sec.access.governance, dds.sec.access.permissions; values are
452
+ file: or data:, URIs) turn on DDS Security; all six are needed.
453
+ rustorb.dds.persistence.directory is where PERSISTENT writers keep
454
+ their files (by default $RUSTORB_DDS_PERSISTENCE_DIR, or
455
+ rustorb-dds-persistent in the current directory). Other properties
456
+ are ignored. */
457
+ typedef struct rdds_participant_qos {
458
+ const uint8_t *user_data;
459
+ size_t user_data_len;
460
+ const rdds_property *property;
461
+ size_t property_len;
462
+ } rdds_participant_qos;
463
+
464
+ rdds_status rdds_writer_qos_default(rdds_writer_qos *out);
465
+ /* data_representation points to static storage. */
466
+ rdds_status rdds_reader_qos_default(rdds_reader_qos *out);
467
+
468
+ /* ------------------------------------------------------------------ */
469
+ /* Statuses */
470
+
471
+ /* StatusKind bits (DDS 1.4, 2.2.4.1). */
472
+ #define RDDS_INCONSISTENT_TOPIC_STATUS (1u << 0)
473
+ #define RDDS_OFFERED_DEADLINE_MISSED_STATUS (1u << 1)
474
+ #define RDDS_REQUESTED_DEADLINE_MISSED_STATUS (1u << 2)
475
+ #define RDDS_OFFERED_INCOMPATIBLE_QOS_STATUS (1u << 5)
476
+ #define RDDS_REQUESTED_INCOMPATIBLE_QOS_STATUS (1u << 6)
477
+ #define RDDS_SAMPLE_LOST_STATUS (1u << 7)
478
+ #define RDDS_SAMPLE_REJECTED_STATUS (1u << 8)
479
+ #define RDDS_DATA_ON_READERS_STATUS (1u << 9)
480
+ #define RDDS_DATA_AVAILABLE_STATUS (1u << 10)
481
+ #define RDDS_LIVELINESS_LOST_STATUS (1u << 11)
482
+ #define RDDS_LIVELINESS_CHANGED_STATUS (1u << 12)
483
+ #define RDDS_PUBLICATION_MATCHED_STATUS (1u << 13)
484
+ #define RDDS_SUBSCRIPTION_MATCHED_STATUS (1u << 14)
485
+ #define RDDS_ALL_STATUS 0xffffffffu
486
+
487
+ typedef struct rdds_matched_status {
488
+ int32_t total_count;
489
+ int32_t total_count_change;
490
+ int32_t current_count;
491
+ int32_t current_count_change;
492
+ rdds_guid last_handle;
493
+ } rdds_matched_status;
494
+
495
+ typedef struct rdds_qos_policy_count {
496
+ int32_t policy_id;
497
+ int32_t count;
498
+ } rdds_qos_policy_count;
499
+
500
+ #define RDDS_MAX_POLICIES 32
501
+
502
+ typedef struct rdds_incompatible_qos_status {
503
+ int32_t total_count;
504
+ int32_t total_count_change;
505
+ int32_t last_policy_id;
506
+ uint32_t policies_len;
507
+ rdds_qos_policy_count policies[RDDS_MAX_POLICIES];
508
+ } rdds_incompatible_qos_status;
509
+
510
+ typedef struct rdds_liveliness_changed_status {
511
+ int32_t alive_count;
512
+ int32_t not_alive_count;
513
+ int32_t alive_count_change;
514
+ int32_t not_alive_count_change;
515
+ rdds_guid last_publication_handle;
516
+ } rdds_liveliness_changed_status;
517
+
518
+ /* LIVELINESS_LOST, SAMPLE_LOST and INCONSISTENT_TOPIC. */
519
+ typedef struct rdds_count_status {
520
+ int32_t total_count;
521
+ int32_t total_count_change;
522
+ } rdds_count_status;
523
+
524
+ typedef struct rdds_deadline_missed_status {
525
+ int32_t total_count;
526
+ int32_t total_count_change;
527
+ rdds_instance_handle last_instance_handle;
528
+ } rdds_deadline_missed_status;
529
+
530
+ #define RDDS_NOT_REJECTED 0
531
+ #define RDDS_REJECTED_BY_INSTANCES_LIMIT 1
532
+ #define RDDS_REJECTED_BY_SAMPLES_LIMIT 2
533
+ #define RDDS_REJECTED_BY_SAMPLES_PER_INSTANCE_LIMIT 3
534
+
535
+ typedef struct rdds_sample_rejected_status {
536
+ int32_t total_count;
537
+ int32_t total_count_change;
538
+ int32_t last_reason;
539
+ rdds_instance_handle last_instance_handle;
540
+ } rdds_sample_rejected_status;
541
+
542
+ /* Any function may be NULL; release, if not NULL, is called once when the
543
+ * listener is replaced or cleared or its entity is deleted. */
544
+ typedef struct rdds_writer_listener {
545
+ void *self;
546
+ void (*on_offered_deadline_missed)(void *self,
547
+ const rdds_deadline_missed_status *s);
548
+ void (*on_offered_incompatible_qos)(void *self,
549
+ const rdds_incompatible_qos_status *s);
550
+ void (*on_liveliness_lost)(void *self, const rdds_count_status *s);
551
+ void (*on_publication_matched)(void *self, const rdds_matched_status *s);
552
+ void (*release)(void *self);
553
+ } rdds_writer_listener;
554
+
555
+ typedef struct rdds_reader_listener {
556
+ void *self;
557
+ void (*on_requested_deadline_missed)(void *self,
558
+ const rdds_deadline_missed_status *s);
559
+ void (*on_requested_incompatible_qos)(void *self,
560
+ const rdds_incompatible_qos_status *s);
561
+ void (*on_sample_rejected)(void *self, const rdds_sample_rejected_status *s);
562
+ void (*on_liveliness_changed)(void *self,
563
+ const rdds_liveliness_changed_status *s);
564
+ void (*on_data_available)(void *self);
565
+ void (*on_subscription_matched)(void *self, const rdds_matched_status *s);
566
+ void (*on_sample_lost)(void *self, const rdds_count_status *s);
567
+ void (*release)(void *self);
568
+ } rdds_reader_listener;
569
+
570
+ typedef struct rdds_subscriber rdds_subscriber;
571
+
572
+ /* The writer or reader a status is of, given to an rdds_listener; the
573
+ * strings are valid for the call. */
574
+ typedef struct rdds_endpoint_info {
575
+ rdds_guid guid;
576
+ const char *topic_name;
577
+ const char *type_name;
578
+ } rdds_endpoint_info;
579
+
580
+ /* The listener of a participant, publisher, subscriber or topic. It takes
581
+ * the statuses of the writers and readers that their own listeners do
582
+ * not (DDS 1.4, 2.2.4.3.1): a writer's go to its publisher's listener,
583
+ * else the participant's; a reader's to its subscriber's, else the
584
+ * participant's; INCONSISTENT_TOPIC to the topic's, else the
585
+ * participant's. New data goes to on_data_on_readers of the subscriber's
586
+ * listener, else the participant's, and only when neither takes
587
+ * DATA_ON_READERS to on_data_available (2.2.4.3.2); the subscriber passed
588
+ * to on_data_on_readers is valid for the call (rdds_subscriber_clone
589
+ * keeps it). Functions that do not fit the entity are not called; any
590
+ * may be NULL; release as for rdds_writer_listener. */
591
+ typedef struct rdds_listener {
592
+ void *self;
593
+ void (*on_offered_deadline_missed)(void *self, const rdds_endpoint_info *w,
594
+ const rdds_deadline_missed_status *s);
595
+ void (*on_offered_incompatible_qos)(void *self, const rdds_endpoint_info *w,
596
+ const rdds_incompatible_qos_status *s);
597
+ void (*on_liveliness_lost)(void *self, const rdds_endpoint_info *w,
598
+ const rdds_count_status *s);
599
+ void (*on_publication_matched)(void *self, const rdds_endpoint_info *w,
600
+ const rdds_matched_status *s);
601
+ void (*on_data_on_readers)(void *self, const rdds_subscriber *s);
602
+ void (*on_requested_deadline_missed)(void *self, const rdds_endpoint_info *r,
603
+ const rdds_deadline_missed_status *s);
604
+ void (*on_requested_incompatible_qos)(void *self,
605
+ const rdds_endpoint_info *r,
606
+ const rdds_incompatible_qos_status *s);
607
+ void (*on_sample_rejected)(void *self, const rdds_endpoint_info *r,
608
+ const rdds_sample_rejected_status *s);
609
+ void (*on_liveliness_changed)(void *self, const rdds_endpoint_info *r,
610
+ const rdds_liveliness_changed_status *s);
611
+ void (*on_data_available)(void *self, const rdds_endpoint_info *r);
612
+ void (*on_subscription_matched)(void *self, const rdds_endpoint_info *r,
613
+ const rdds_matched_status *s);
614
+ void (*on_sample_lost)(void *self, const rdds_endpoint_info *r,
615
+ const rdds_count_status *s);
616
+ void (*on_inconsistent_topic)(void *self, const char *topic_name,
617
+ const rdds_count_status *s);
618
+ void (*release)(void *self);
619
+ } rdds_listener;
620
+
621
+ /* ------------------------------------------------------------------ */
622
+ /* Entities */
623
+
624
+ typedef struct rdds_participant rdds_participant;
625
+ typedef struct rdds_topic rdds_topic;
626
+ typedef struct rdds_cftopic rdds_cftopic;
627
+ typedef struct rdds_publisher rdds_publisher;
628
+ typedef struct rdds_writer rdds_writer;
629
+ typedef struct rdds_reader rdds_reader;
630
+ typedef struct rdds_samples rdds_samples;
631
+ typedef struct rdds_condition rdds_condition;
632
+ typedef struct rdds_waitset rdds_waitset;
633
+
634
+ /* Only the loopback interface, for tests. */
635
+ #define RDDS_PARTICIPANT_LOCALHOST 1u
636
+
637
+ /* qos: NULL for the default. */
638
+ rdds_status rdds_participant_new(uint32_t domain_id,
639
+ const rdds_participant_qos *qos,
640
+ uint32_t flags, rdds_participant **out);
641
+ void rdds_participant_release(rdds_participant *p);
642
+ uint32_t rdds_participant_domain_id(const rdds_participant *p);
643
+ rdds_status rdds_participant_guid(const rdds_participant *p, rdds_guid *out);
644
+ rdds_status rdds_participant_assert_liveliness(const rdds_participant *p);
645
+ /* How many other participants are known. */
646
+ size_t rdds_participant_discovered_participants(const rdds_participant *p);
647
+
648
+ /* A topic of the type, registered under the type's name. */
649
+ rdds_status rdds_participant_create_topic(const rdds_participant *p,
650
+ const char *name,
651
+ const rdds_type *type,
652
+ rdds_topic **out);
653
+ void rdds_topic_release(rdds_topic *t);
654
+ rdds_status rdds_topic_inconsistent_topic_status(const rdds_topic *t,
655
+ rdds_count_status *out);
656
+
657
+ /* A content filtered topic of related (DDS 1.4, 2.2.2.3.3): its readers
658
+ * get the samples that pass the filter expression (DDS 1.4, Annex B),
659
+ * with n parameters for its %0 .. %99. RDDS_RETCODE_BAD_PARAMETER for an
660
+ * expression not valid for the type. */
661
+ rdds_status rdds_participant_create_contentfilteredtopic(
662
+ const rdds_participant *p, const char *name, const rdds_topic *related,
663
+ const char *expression, const char *const *parameters, size_t n,
664
+ rdds_cftopic **out);
665
+ void rdds_cftopic_release(rdds_cftopic *t);
666
+ rdds_status rdds_cftopic_set_expression_parameters(
667
+ const rdds_cftopic *t, const char *const *parameters, size_t n);
668
+
669
+ /* qos: NULL for the default. */
670
+ rdds_status rdds_participant_create_publisher(const rdds_participant *p,
671
+ const rdds_group_qos *qos,
672
+ rdds_publisher **out);
673
+ void rdds_publisher_release(rdds_publisher *p);
674
+ rdds_status rdds_participant_create_subscriber(const rdds_participant *p,
675
+ const rdds_group_qos *qos,
676
+ rdds_subscriber **out);
677
+ void rdds_subscriber_release(rdds_subscriber *s);
678
+
679
+ /* Listeners of the participant, publisher, subscriber and topic (see
680
+ * rdds_listener); listener NULL clears it. */
681
+ rdds_status rdds_participant_set_listener(const rdds_participant *p,
682
+ const rdds_listener *listener,
683
+ uint32_t mask);
684
+ rdds_status rdds_publisher_set_listener(const rdds_publisher *p,
685
+ const rdds_listener *listener,
686
+ uint32_t mask);
687
+ rdds_status rdds_subscriber_set_listener(const rdds_subscriber *s,
688
+ const rdds_listener *listener,
689
+ uint32_t mask);
690
+ rdds_status rdds_topic_set_listener(const rdds_topic *t,
691
+ const rdds_listener *listener,
692
+ uint32_t mask);
693
+ /* Calls on_data_available of the listeners of the subscriber's readers
694
+ * that have new data (notify_datareaders). */
695
+ rdds_status rdds_subscriber_notify_datareaders(const rdds_subscriber *s);
696
+ /* Another handle of the same subscriber, to release on its own. */
697
+ rdds_status rdds_subscriber_clone(const rdds_subscriber *s,
698
+ rdds_subscriber **out);
699
+ /* Whether two handles are of the same subscriber. */
700
+ bool rdds_subscriber_same(const rdds_subscriber *a, const rdds_subscriber *b);
701
+
702
+ /* Writers. qos and listener may be NULL; the listener is set before the
703
+ * writer is matched. timestamp NULL: now. */
704
+ rdds_status rdds_publisher_create_writer(const rdds_publisher *p,
705
+ const rdds_topic *topic,
706
+ const rdds_writer_qos *qos,
707
+ const rdds_writer_listener *listener,
708
+ uint32_t mask, rdds_writer **out);
709
+ void rdds_writer_release(rdds_writer *w);
710
+ rdds_status rdds_writer_guid(const rdds_writer *w, rdds_guid *out);
711
+ rdds_status rdds_writer_write(const rdds_writer *w, const rdds_out *sample,
712
+ const rdds_time *timestamp);
713
+ rdds_status rdds_writer_register_instance(const rdds_writer *w,
714
+ const rdds_out *sample,
715
+ rdds_instance_handle *out);
716
+ rdds_status rdds_writer_unregister_instance(const rdds_writer *w,
717
+ const rdds_out *sample,
718
+ const rdds_time *timestamp);
719
+ rdds_status rdds_writer_dispose(const rdds_writer *w, const rdds_out *sample,
720
+ const rdds_time *timestamp);
721
+ /* HANDLE_NIL when the instance is not known. */
722
+ rdds_status rdds_writer_lookup_instance(const rdds_writer *w,
723
+ const rdds_out *sample,
724
+ rdds_instance_handle *out);
725
+ rdds_status rdds_writer_wait_for_acknowledgments(const rdds_writer *w,
726
+ rdds_duration max_wait);
727
+ /* Until count readers match, or RDDS_RETCODE_TIMEOUT. */
728
+ rdds_status rdds_writer_wait_for_subscriptions(const rdds_writer *w,
729
+ size_t count,
730
+ rdds_duration timeout);
731
+ /* Up to cap into buf; how many there are into *len. */
732
+ rdds_status rdds_writer_matched_subscriptions(const rdds_writer *w,
733
+ rdds_guid *buf, size_t cap,
734
+ size_t *len);
735
+ rdds_status rdds_writer_assert_liveliness(const rdds_writer *w);
736
+ /* The status getters reset the change counts. */
737
+ rdds_status rdds_writer_publication_matched_status(const rdds_writer *w,
738
+ rdds_matched_status *out);
739
+ rdds_status rdds_writer_offered_incompatible_qos_status(
740
+ const rdds_writer *w, rdds_incompatible_qos_status *out);
741
+ rdds_status rdds_writer_liveliness_lost_status(const rdds_writer *w,
742
+ rdds_count_status *out);
743
+ rdds_status rdds_writer_offered_deadline_missed_status(
744
+ const rdds_writer *w, rdds_deadline_missed_status *out);
745
+ uint32_t rdds_writer_status_changes(const rdds_writer *w);
746
+ rdds_status rdds_writer_status_condition(const rdds_writer *w,
747
+ rdds_condition **out);
748
+ /* listener NULL: clears it. */
749
+ rdds_status rdds_writer_set_listener(const rdds_writer *w,
750
+ const rdds_writer_listener *listener,
751
+ uint32_t mask);
752
+
753
+ /* Readers. */
754
+ rdds_status rdds_subscriber_create_reader(const rdds_subscriber *s,
755
+ const rdds_topic *topic,
756
+ const rdds_reader_qos *qos,
757
+ const rdds_reader_listener *listener,
758
+ uint32_t mask, rdds_reader **out);
759
+ /* A reader of a content filtered topic. */
760
+ rdds_status rdds_subscriber_create_filtered_reader(
761
+ const rdds_subscriber *s, const rdds_cftopic *topic,
762
+ const rdds_reader_qos *qos, const rdds_reader_listener *listener,
763
+ uint32_t mask, rdds_reader **out);
764
+ void rdds_reader_release(rdds_reader *r);
765
+ rdds_status rdds_reader_guid(const rdds_reader *r, rdds_guid *out);
766
+
767
+ /* Sample, view and instance states (DDS 1.4, 2.2.2.5.1.8). */
768
+ #define RDDS_READ_SAMPLE_STATE 1u
769
+ #define RDDS_NOT_READ_SAMPLE_STATE 2u
770
+ #define RDDS_ANY_SAMPLE_STATE 3u
771
+ #define RDDS_NEW_VIEW_STATE 1u
772
+ #define RDDS_NOT_NEW_VIEW_STATE 2u
773
+ #define RDDS_ANY_VIEW_STATE 3u
774
+ #define RDDS_ALIVE_INSTANCE_STATE 1u
775
+ #define RDDS_NOT_ALIVE_DISPOSED_INSTANCE_STATE 2u
776
+ #define RDDS_NOT_ALIVE_NO_WRITERS_INSTANCE_STATE 4u
777
+ #define RDDS_NOT_ALIVE_INSTANCE_STATE 6u
778
+ #define RDDS_ANY_INSTANCE_STATE 7u
779
+
780
+ #define RDDS_SELECT_ANY 0
781
+ #define RDDS_SELECT_INSTANCE 1
782
+ #define RDDS_SELECT_NEXT_INSTANCE 2
783
+
784
+ typedef struct rdds_sample_info {
785
+ uint32_t sample_state;
786
+ uint32_t view_state;
787
+ uint32_t instance_state;
788
+ int32_t disposed_generation_count;
789
+ int32_t no_writers_generation_count;
790
+ int32_t sample_rank;
791
+ int32_t generation_rank;
792
+ int32_t absolute_generation_rank;
793
+ rdds_time source_timestamp;
794
+ rdds_instance_handle instance_handle;
795
+ rdds_guid publication_handle;
796
+ int64_t sequence_number;
797
+ bool valid_data;
798
+ } rdds_sample_info;
799
+
800
+ /* Reads (or takes) at most max_samples (RDDS_LENGTH_UNLIMITED for any
801
+ * number) of the samples in the states of the masks, the first to arrive.
802
+ * With
803
+ * RDDS_SELECT_INSTANCE, those of *instance (the masks ignored); with
804
+ * RDDS_SELECT_NEXT_INSTANCE, those of the instance after *instance (NULL
805
+ * or HANDLE_NIL for the first). No samples is RDDS_RETCODE_OK with an
806
+ * empty rdds_samples. */
807
+ rdds_status rdds_reader_select(const rdds_reader *r, bool take,
808
+ int32_t max_samples, uint32_t sample_states, uint32_t view_states,
809
+ uint32_t instance_states, int32_t mode,
810
+ const rdds_instance_handle *instance,
811
+ rdds_samples **out);
812
+ rdds_status rdds_reader_select_w_condition(const rdds_reader *r, bool take,
813
+ int32_t max_samples,
814
+ const rdds_condition *condition,
815
+ rdds_samples **out);
816
+ size_t rdds_samples_count(const rdds_samples *s);
817
+ rdds_status rdds_samples_info(const rdds_samples *s, size_t i,
818
+ rdds_sample_info *out);
819
+ /* A new stream of sample i's values; RDDS_RETCODE_NO_DATA for a sample
820
+ * without data (valid_data false). */
821
+ rdds_status rdds_samples_data(const rdds_samples *s, size_t i, rdds_in **out);
822
+ void rdds_samples_release(rdds_samples *s);
823
+
824
+ rdds_status rdds_reader_lookup_instance(const rdds_reader *r,
825
+ const rdds_out *sample,
826
+ rdds_instance_handle *out);
827
+ rdds_status rdds_reader_get_key_value(const rdds_reader *r,
828
+ rdds_instance_handle instance,
829
+ rdds_in **out);
830
+ /* Until a sample is there, or RDDS_RETCODE_TIMEOUT. */
831
+ rdds_status rdds_reader_wait_for_data(const rdds_reader *r,
832
+ rdds_duration timeout);
833
+ rdds_status rdds_reader_wait_for_publications(const rdds_reader *r,
834
+ size_t count,
835
+ rdds_duration timeout);
836
+ rdds_status rdds_reader_matched_publications(const rdds_reader *r,
837
+ rdds_guid *buf, size_t cap,
838
+ size_t *len);
839
+ rdds_status rdds_reader_subscription_matched_status(const rdds_reader *r,
840
+ rdds_matched_status *out);
841
+ rdds_status rdds_reader_requested_incompatible_qos_status(
842
+ const rdds_reader *r, rdds_incompatible_qos_status *out);
843
+ rdds_status rdds_reader_liveliness_changed_status(
844
+ const rdds_reader *r, rdds_liveliness_changed_status *out);
845
+ rdds_status rdds_reader_requested_deadline_missed_status(
846
+ const rdds_reader *r, rdds_deadline_missed_status *out);
847
+ rdds_status rdds_reader_sample_lost_status(const rdds_reader *r,
848
+ rdds_count_status *out);
849
+ rdds_status rdds_reader_sample_rejected_status(
850
+ const rdds_reader *r, rdds_sample_rejected_status *out);
851
+ uint32_t rdds_reader_status_changes(const rdds_reader *r);
852
+ rdds_status rdds_reader_status_condition(const rdds_reader *r,
853
+ rdds_condition **out);
854
+ rdds_status rdds_reader_create_readcondition(const rdds_reader *r,
855
+ uint32_t sample_states,
856
+ uint32_t view_states,
857
+ uint32_t instance_states,
858
+ rdds_condition **out);
859
+ rdds_status rdds_reader_set_listener(const rdds_reader *r,
860
+ const rdds_reader_listener *listener,
861
+ uint32_t mask);
862
+
863
+ /* ------------------------------------------------------------------ */
864
+ /* Conditions and WaitSets */
865
+
866
+ /* Requests and replies (DDS-RPC 1.0). A request is known by its
867
+ * identity: the writer and sequence number of the request, which the
868
+ * replies name. */
869
+ typedef struct rdds_sample_identity {
870
+ rdds_guid writer;
871
+ int64_t sequence_number;
872
+ } rdds_sample_identity;
873
+
874
+ /* The related sample identity of sample i (what a reply names), or
875
+ * RDDS_RETCODE_NO_DATA. */
876
+ rdds_status rdds_samples_related_sample_identity(const rdds_samples *s,
877
+ size_t i,
878
+ rdds_sample_identity *out);
879
+
880
+ typedef struct rdds_requester rdds_requester;
881
+ typedef struct rdds_replier rdds_replier;
882
+
883
+ /* A requester sending requests on the topic request and getting the
884
+ * replies on reply; the QoS NULL for the default (RELIABLE, KEEP_ALL). */
885
+ rdds_status rdds_requester_new(const rdds_participant *p,
886
+ const rdds_topic *request,
887
+ const rdds_topic *reply,
888
+ const rdds_writer_qos *writer_qos,
889
+ const rdds_reader_qos *reader_qos,
890
+ rdds_requester **out);
891
+ void rdds_requester_release(rdds_requester *r);
892
+ /* Until a replier is matched (both of its endpoints), or
893
+ * RDDS_RETCODE_TIMEOUT. */
894
+ rdds_status rdds_requester_wait_for_service(const rdds_requester *r,
895
+ rdds_duration timeout);
896
+ /* The request's identity into *out (NULL to ignore it). */
897
+ rdds_status rdds_requester_send_request(const rdds_requester *r,
898
+ const rdds_out *sample,
899
+ rdds_sample_identity *out);
900
+ /* Waits for a reply to request, or RDDS_RETCODE_TIMEOUT. */
901
+ rdds_status rdds_requester_receive_reply(const rdds_requester *r,
902
+ const rdds_sample_identity *request,
903
+ rdds_duration timeout,
904
+ rdds_in **out);
905
+
906
+ /* A replier taking requests on the topic request and answering on reply;
907
+ * the QoS NULL for the default (RELIABLE, KEEP_ALL), instance_name NULL
908
+ * for none. */
909
+ rdds_status rdds_replier_new(const rdds_participant *p,
910
+ const rdds_topic *request,
911
+ const rdds_topic *reply,
912
+ const rdds_writer_qos *writer_qos,
913
+ const rdds_reader_qos *reader_qos,
914
+ const char *instance_name, rdds_replier **out);
915
+ void rdds_replier_release(rdds_replier *r);
916
+ /* Waits for a request, or RDDS_RETCODE_TIMEOUT: the request into *out,
917
+ * what its replies name into *id. */
918
+ rdds_status rdds_replier_receive_request(const rdds_replier *r,
919
+ rdds_duration timeout,
920
+ rdds_in **out,
921
+ rdds_sample_identity *id);
922
+ /* Sends sample as a reply to the request id. */
923
+ rdds_status rdds_replier_send_reply(const rdds_replier *r,
924
+ const rdds_out *sample,
925
+ const rdds_sample_identity *id);
926
+
927
+ rdds_status rdds_guard_condition_new(rdds_condition **out);
928
+ void rdds_condition_release(rdds_condition *c);
929
+ bool rdds_condition_trigger_value(const rdds_condition *c);
930
+ /* Whether two handles are the same condition. */
931
+ bool rdds_condition_equals(const rdds_condition *a, const rdds_condition *b);
932
+ rdds_status rdds_guard_condition_set_trigger_value(const rdds_condition *c,
933
+ bool value);
934
+ rdds_status rdds_status_condition_get_enabled_statuses(const rdds_condition *c,
935
+ uint32_t *out);
936
+ rdds_status rdds_status_condition_set_enabled_statuses(const rdds_condition *c,
937
+ uint32_t mask);
938
+
939
+ rdds_status rdds_waitset_new(rdds_waitset **out);
940
+ void rdds_waitset_release(rdds_waitset *w);
941
+ rdds_status rdds_waitset_attach_condition(const rdds_waitset *w,
942
+ const rdds_condition *c);
943
+ rdds_status rdds_waitset_detach_condition(const rdds_waitset *w,
944
+ const rdds_condition *c);
945
+ /* Until a condition is true, or RDDS_RETCODE_TIMEOUT. The indices of the
946
+ * true ones, in the order the attached conditions were attached, go into
947
+ * active (up to cap); how many there are into *len. */
948
+ rdds_status rdds_waitset_wait(const rdds_waitset *w, rdds_duration timeout,
949
+ size_t *active, size_t cap, size_t *len);
950
+
951
+ #ifdef __cplusplus
952
+ }
953
+ #endif
954
+
955
+ #endif /* RUSTORB_DDS_H */