rustorb 0.7.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.
- checksums.yaml +7 -0
- data/README.md +42 -0
- data/ext/rustorb_ext/extconf.rb +33 -0
- data/ext/rustorb_ext/rustorb_ext.c +3805 -0
- data/lib/CosNamingC.rb +275 -0
- data/lib/CosNamingS.rb +74 -0
- data/lib/corba.rb +4 -0
- data/lib/rustorb/dii.rb +337 -0
- data/lib/rustorb/dynamic_any.rb +285 -0
- data/lib/rustorb/exceptions.rb +112 -0
- data/lib/rustorb/marshal.rb +405 -0
- data/lib/rustorb/messaging.rb +207 -0
- data/lib/rustorb/object.rb +278 -0
- data/lib/rustorb/orb.rb +152 -0
- data/lib/rustorb/pi.rb +526 -0
- data/lib/rustorb/portable_server.rb +453 -0
- data/lib/rustorb/servant_managers.rb +172 -0
- data/lib/rustorb/typecode.rb +448 -0
- data/lib/rustorb/types.rb +324 -0
- data/lib/rustorb/values.rb +389 -0
- data/lib/rustorb/version.rb +5 -0
- data/lib/rustorb.rb +30 -0
- data/vendor/include/rustorb/rustorb.h +1429 -0
- data/vendor/linux-aarch64/librustorb_ffi.a +4 -0
- data/vendor/linux-x86_64/librustorb_ffi.a +4 -0
- data/vendor/macos-aarch64/librustorb_ffi.a +0 -0
- metadata +84 -0
|
@@ -0,0 +1,1429 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* rustorb.h: the stable C ABI of rustorb (crates/rustorb-ffi).
|
|
3
|
+
*
|
|
4
|
+
* The C++ binding (cpp/include/rustorb) is written on top of this header,
|
|
5
|
+
* and so will the Java one be. It is not meant to be used directly by
|
|
6
|
+
* applications.
|
|
7
|
+
*
|
|
8
|
+
* Conventions
|
|
9
|
+
*
|
|
10
|
+
* - Handles (rorb_orb, rorb_object, rorb_poa, rorb_poa_manager,
|
|
11
|
+
* rorb_servant, rorb_typecode, rorb_any) are reference counted on the Rust side. A function that
|
|
12
|
+
* returns a handle gives the caller one reference, which it gives back
|
|
13
|
+
* with the matching *_release function. *_clone adds a reference.
|
|
14
|
+
* Handles may be used from any thread.
|
|
15
|
+
* - Fallible functions return an rorb_status and fill the rorb_exception
|
|
16
|
+
* the caller passes (never NULL). After RORB_SYSTEM_EXCEPTION or
|
|
17
|
+
* RORB_LOCAL_EXCEPTION the caller frees it with rorb_exception_clear.
|
|
18
|
+
* - Strings are UTF-8 and passed as a pointer and a length, without a
|
|
19
|
+
* terminating NUL. Wide strings are UTF-16 code units.
|
|
20
|
+
* - Memory returned in an rorb_bytes is freed with rorb_bytes_free.
|
|
21
|
+
* - Streams (rorb_out, rorb_in) and server replies (rorb_server_reply) are
|
|
22
|
+
* only valid during the callback that receives them, but for the owned
|
|
23
|
+
* input streams (see "owned input streams"). Errors on a stream are
|
|
24
|
+
* sticky: after the first one, writes do nothing and reads return zeros,
|
|
25
|
+
* and the error is reported when the callback returns.
|
|
26
|
+
* - Callbacks must not unwind (throw a C++ exception) into Rust.
|
|
27
|
+
*
|
|
28
|
+
* Licensed under MIT OR Apache-2.0, like the rest of the rustorb core.
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
#ifndef RUSTORB_RUSTORB_H
|
|
32
|
+
#define RUSTORB_RUSTORB_H
|
|
33
|
+
|
|
34
|
+
#include <stddef.h>
|
|
35
|
+
#include <stdint.h>
|
|
36
|
+
|
|
37
|
+
#ifdef __cplusplus
|
|
38
|
+
extern "C" {
|
|
39
|
+
#endif
|
|
40
|
+
|
|
41
|
+
/* Version of this ABI; rorb_abi_version() returns the library's. */
|
|
42
|
+
#define RORB_ABI_VERSION 3
|
|
43
|
+
|
|
44
|
+
typedef struct rorb_orb rorb_orb;
|
|
45
|
+
typedef struct rorb_object rorb_object;
|
|
46
|
+
typedef struct rorb_poa rorb_poa;
|
|
47
|
+
typedef struct rorb_poa_manager rorb_poa_manager;
|
|
48
|
+
typedef struct rorb_servant rorb_servant;
|
|
49
|
+
typedef struct rorb_out rorb_out;
|
|
50
|
+
typedef struct rorb_in rorb_in;
|
|
51
|
+
typedef struct rorb_server_reply rorb_server_reply;
|
|
52
|
+
typedef struct rorb_typecode rorb_typecode;
|
|
53
|
+
typedef struct rorb_any rorb_any;
|
|
54
|
+
typedef struct rorb_request rorb_request;
|
|
55
|
+
typedef struct rorb_server_request rorb_server_request;
|
|
56
|
+
|
|
57
|
+
/* --- status and exceptions ------------------------------------------- */
|
|
58
|
+
|
|
59
|
+
typedef int32_t rorb_status;
|
|
60
|
+
|
|
61
|
+
/* Success. */
|
|
62
|
+
#define RORB_OK 0
|
|
63
|
+
/* A CORBA system exception, described in the rorb_exception. */
|
|
64
|
+
#define RORB_SYSTEM_EXCEPTION 1
|
|
65
|
+
/* A user exception, taken by the read_user_exception callback. */
|
|
66
|
+
#define RORB_USER_EXCEPTION 2
|
|
67
|
+
/* An exception of a local interface (POA, POAManager, Current, ORB),
|
|
68
|
+
named by rorb_exception.local. */
|
|
69
|
+
#define RORB_LOCAL_EXCEPTION 3
|
|
70
|
+
/* A callback failed and keeps its own error (a C++ exception, say). */
|
|
71
|
+
#define RORB_CALLBACK_FAILED 4
|
|
72
|
+
|
|
73
|
+
/* CORBA::CompletionStatus */
|
|
74
|
+
#define RORB_COMPLETED_YES 0
|
|
75
|
+
#define RORB_COMPLETED_NO 1
|
|
76
|
+
#define RORB_COMPLETED_MAYBE 2
|
|
77
|
+
|
|
78
|
+
/* rorb_exception.local after RORB_LOCAL_EXCEPTION */
|
|
79
|
+
#define RORB_ADAPTER_ALREADY_EXISTS 1 /* POA::AdapterAlreadyExists */
|
|
80
|
+
#define RORB_ADAPTER_NON_EXISTENT 2 /* POA::AdapterNonExistent */
|
|
81
|
+
#define RORB_INVALID_POLICY 3 /* POA::InvalidPolicy (index in .index) */
|
|
82
|
+
#define RORB_SERVANT_ALREADY_ACTIVE 4 /* POA::ServantAlreadyActive */
|
|
83
|
+
#define RORB_OBJECT_ALREADY_ACTIVE 5 /* POA::ObjectAlreadyActive */
|
|
84
|
+
#define RORB_SERVANT_NOT_ACTIVE 6 /* POA::ServantNotActive */
|
|
85
|
+
#define RORB_OBJECT_NOT_ACTIVE 7 /* POA::ObjectNotActive */
|
|
86
|
+
#define RORB_WRONG_POLICY 8 /* POA::WrongPolicy */
|
|
87
|
+
#define RORB_WRONG_ADAPTER 9 /* POA::WrongAdapter */
|
|
88
|
+
#define RORB_ADAPTER_INACTIVE 10 /* POAManager::AdapterInactive */
|
|
89
|
+
#define RORB_NO_SERVANT 11 /* POA::NoServant */
|
|
90
|
+
#define RORB_NO_CONTEXT 12 /* Current::NoContext */
|
|
91
|
+
#define RORB_INVALID_NAME 13 /* ORB::InvalidName */
|
|
92
|
+
#define RORB_TC_BAD_KIND 14 /* TypeCode::BadKind */
|
|
93
|
+
#define RORB_TC_BOUNDS 15 /* TypeCode::Bounds */
|
|
94
|
+
#define RORB_POLICY_ERROR 16 /* CORBA::PolicyError (reason in .index) */
|
|
95
|
+
#define RORB_DYN_INVALID_VALUE 17 /* DynamicAny::DynAny::InvalidValue */
|
|
96
|
+
#define RORB_DYN_TYPE_MISMATCH 18 /* DynamicAny::DynAny::TypeMismatch */
|
|
97
|
+
#define RORB_DYN_INCONSISTENT_TYPECODE 19 /* DynamicAny::DynAnyFactory::InconsistentTypeCode */
|
|
98
|
+
#define RORB_DYN_MUST_TRUNCATE 20 /* DynamicAny::MustTruncate */
|
|
99
|
+
#define RORB_INVALID_SLOT 21 /* PortableInterceptor::InvalidSlot */
|
|
100
|
+
#define RORB_DUPLICATE_NAME 22 /* ORBInitInfo::DuplicateName */
|
|
101
|
+
#define RORB_UNKNOWN_ENCODING 23 /* IOP::CodecFactory::UnknownEncoding */
|
|
102
|
+
#define RORB_CODEC_INVALID_TYPE_FOR_ENCODING 24 /* IOP::Codec::InvalidTypeForEncoding */
|
|
103
|
+
#define RORB_CODEC_FORMAT_MISMATCH 25 /* IOP::Codec::FormatMismatch */
|
|
104
|
+
#define RORB_CODEC_TYPE_MISMATCH 26 /* IOP::Codec::TypeMismatch */
|
|
105
|
+
#define RORB_MANAGER_ALREADY_EXISTS 27 /* POAManagerFactory::ManagerAlreadyExists */
|
|
106
|
+
|
|
107
|
+
typedef struct rorb_exception {
|
|
108
|
+
/* RORB_SYSTEM_EXCEPTION: the repository id, such as
|
|
109
|
+
"IDL:omg.org/CORBA/TRANSIENT:1.0" (owned, NUL terminated). */
|
|
110
|
+
char* repository_id;
|
|
111
|
+
size_t repository_id_len;
|
|
112
|
+
uint32_t minor;
|
|
113
|
+
uint32_t completed;
|
|
114
|
+
/* RORB_LOCAL_EXCEPTION: which one, and the policy index of
|
|
115
|
+
RORB_INVALID_POLICY or the reason of RORB_POLICY_ERROR. */
|
|
116
|
+
uint32_t local;
|
|
117
|
+
uint32_t index;
|
|
118
|
+
} rorb_exception;
|
|
119
|
+
|
|
120
|
+
/* Frees what an rorb_exception holds and zeroes it. */
|
|
121
|
+
void rorb_exception_clear(rorb_exception* exc);
|
|
122
|
+
|
|
123
|
+
typedef struct rorb_bytes {
|
|
124
|
+
uint8_t* data;
|
|
125
|
+
size_t len;
|
|
126
|
+
} rorb_bytes;
|
|
127
|
+
|
|
128
|
+
void rorb_bytes_free(rorb_bytes bytes);
|
|
129
|
+
|
|
130
|
+
uint32_t rorb_abi_version(void);
|
|
131
|
+
|
|
132
|
+
/* --- TypeCodes and anys ------------------------------------------------ */
|
|
133
|
+
|
|
134
|
+
/* CORBA::TCKind values (tk_null = 0 ... tk_home = 36). */
|
|
135
|
+
#define RORB_TK_NULL 0
|
|
136
|
+
#define RORB_TK_VOID 1
|
|
137
|
+
#define RORB_TK_SHORT 2
|
|
138
|
+
#define RORB_TK_LONG 3
|
|
139
|
+
#define RORB_TK_USHORT 4
|
|
140
|
+
#define RORB_TK_ULONG 5
|
|
141
|
+
#define RORB_TK_FLOAT 6
|
|
142
|
+
#define RORB_TK_DOUBLE 7
|
|
143
|
+
#define RORB_TK_BOOLEAN 8
|
|
144
|
+
#define RORB_TK_CHAR 9
|
|
145
|
+
#define RORB_TK_OCTET 10
|
|
146
|
+
#define RORB_TK_ANY 11
|
|
147
|
+
#define RORB_TK_TYPECODE 12
|
|
148
|
+
#define RORB_TK_PRINCIPAL 13
|
|
149
|
+
#define RORB_TK_OBJREF 14
|
|
150
|
+
#define RORB_TK_STRUCT 15
|
|
151
|
+
#define RORB_TK_UNION 16
|
|
152
|
+
#define RORB_TK_ENUM 17
|
|
153
|
+
#define RORB_TK_STRING 18
|
|
154
|
+
#define RORB_TK_SEQUENCE 19
|
|
155
|
+
#define RORB_TK_ARRAY 20
|
|
156
|
+
#define RORB_TK_ALIAS 21
|
|
157
|
+
#define RORB_TK_EXCEPT 22
|
|
158
|
+
#define RORB_TK_LONGLONG 23
|
|
159
|
+
#define RORB_TK_ULONGLONG 24
|
|
160
|
+
#define RORB_TK_LONGDOUBLE 25
|
|
161
|
+
#define RORB_TK_WCHAR 26
|
|
162
|
+
#define RORB_TK_WSTRING 27
|
|
163
|
+
#define RORB_TK_FIXED 28
|
|
164
|
+
#define RORB_TK_VALUE 29
|
|
165
|
+
#define RORB_TK_VALUE_BOX 30
|
|
166
|
+
#define RORB_TK_NATIVE 31
|
|
167
|
+
#define RORB_TK_ABSTRACT_INTERFACE 32
|
|
168
|
+
#define RORB_TK_LOCAL_INTERFACE 33
|
|
169
|
+
#define RORB_TK_COMPONENT 34
|
|
170
|
+
#define RORB_TK_HOME 35
|
|
171
|
+
#define RORB_TK_EVENT 36
|
|
172
|
+
|
|
173
|
+
/* TypeCodes are immutable values. The constructors fail with BAD_PARAM
|
|
174
|
+
for parameters that make no valid type (an invalid name, duplicate
|
|
175
|
+
member names or labels, a member type that cannot be one...). The
|
|
176
|
+
queries fail with RORB_TC_BAD_KIND or RORB_TC_BOUNDS. */
|
|
177
|
+
rorb_typecode* rorb_tc_clone(const rorb_typecode* tc);
|
|
178
|
+
void rorb_tc_release(rorb_typecode* tc);
|
|
179
|
+
|
|
180
|
+
/* The TypeCode of a kind without parameters (tk_string and tk_wstring
|
|
181
|
+
are unbounded). */
|
|
182
|
+
rorb_status rorb_tc_simple(uint32_t kind, rorb_typecode** out, rorb_exception* exc);
|
|
183
|
+
/* string (wide 0) or wstring (wide 1) with a bound (0 for none). */
|
|
184
|
+
rorb_status rorb_tc_string(int32_t wide, uint32_t bound, rorb_typecode** out,
|
|
185
|
+
rorb_exception* exc);
|
|
186
|
+
rorb_status rorb_tc_fixed(uint16_t digits, int16_t scale, rorb_typecode** out,
|
|
187
|
+
rorb_exception* exc);
|
|
188
|
+
rorb_status rorb_tc_sequence(const rorb_typecode* content, uint32_t bound, rorb_typecode** out,
|
|
189
|
+
rorb_exception* exc);
|
|
190
|
+
rorb_status rorb_tc_array(const rorb_typecode* content, uint32_t length, rorb_typecode** out,
|
|
191
|
+
rorb_exception* exc);
|
|
192
|
+
/* kind is RORB_TK_ALIAS or RORB_TK_VALUE_BOX. */
|
|
193
|
+
rorb_status rorb_tc_alias(uint32_t kind, const char* id, size_t id_len, const char* name,
|
|
194
|
+
size_t name_len, const rorb_typecode* content, rorb_typecode** out,
|
|
195
|
+
rorb_exception* exc);
|
|
196
|
+
/* kind is RORB_TK_OBJREF, RORB_TK_ABSTRACT_INTERFACE,
|
|
197
|
+
RORB_TK_LOCAL_INTERFACE, RORB_TK_NATIVE, RORB_TK_COMPONENT or
|
|
198
|
+
RORB_TK_HOME. */
|
|
199
|
+
rorb_status rorb_tc_interface(uint32_t kind, const char* id, size_t id_len, const char* name,
|
|
200
|
+
size_t name_len, rorb_typecode** out, rorb_exception* exc);
|
|
201
|
+
/* kind is RORB_TK_STRUCT or RORB_TK_EXCEPT; count members, each a name
|
|
202
|
+
(names[i], name_lens[i]) and a type. */
|
|
203
|
+
rorb_status rorb_tc_struct(uint32_t kind, const char* id, size_t id_len, const char* name,
|
|
204
|
+
size_t name_len, size_t count, const char* const* names,
|
|
205
|
+
const size_t* name_lens, const rorb_typecode* const* types,
|
|
206
|
+
rorb_typecode** out, rorb_exception* exc);
|
|
207
|
+
/* One entry per label: labels[i] is the value of the discriminator as a
|
|
208
|
+
number (boolean 0 or 1, char and wchar their code, an enumerator its
|
|
209
|
+
position; signed values as two's complement), except for the entry
|
|
210
|
+
default_index (-1 for none), the default member. A member with several
|
|
211
|
+
labels has several consecutive entries with the same name. */
|
|
212
|
+
rorb_status rorb_tc_union(const char* id, size_t id_len, const char* name, size_t name_len,
|
|
213
|
+
const rorb_typecode* discriminator, size_t count,
|
|
214
|
+
const uint64_t* labels, int32_t default_index,
|
|
215
|
+
const char* const* names, const size_t* name_lens,
|
|
216
|
+
const rorb_typecode* const* types, rorb_typecode** out,
|
|
217
|
+
rorb_exception* exc);
|
|
218
|
+
rorb_status rorb_tc_enum(const char* id, size_t id_len, const char* name, size_t name_len,
|
|
219
|
+
size_t count, const char* const* names, const size_t* name_lens,
|
|
220
|
+
rorb_typecode** out, rorb_exception* exc);
|
|
221
|
+
/* A valuetype (kind RORB_TK_VALUE) or eventtype (RORB_TK_EVENT).
|
|
222
|
+
modifier is CORBA::ValueModifier (VM_NONE 0, VM_CUSTOM 1, VM_ABSTRACT 2,
|
|
223
|
+
VM_TRUNCATABLE 3), base the concrete base type or NULL, and each member
|
|
224
|
+
has a visibility (PRIVATE_MEMBER 0, PUBLIC_MEMBER 1). */
|
|
225
|
+
rorb_status rorb_tc_value(uint32_t kind, const char* id, size_t id_len, const char* name,
|
|
226
|
+
size_t name_len, int16_t modifier, const rorb_typecode* base,
|
|
227
|
+
size_t count, const char* const* names, const size_t* name_lens,
|
|
228
|
+
const rorb_typecode* const* types, const int16_t* visibilities,
|
|
229
|
+
rorb_typecode** out, rorb_exception* exc);
|
|
230
|
+
/* ORB::create_recursive_tc: a placeholder for the struct, union or
|
|
231
|
+
valuetype with this repository id, replaced when a TypeCode of that
|
|
232
|
+
type is made with it in its members. */
|
|
233
|
+
rorb_status rorb_tc_recursive(const char* id, size_t id_len, rorb_typecode** out,
|
|
234
|
+
rorb_exception* exc);
|
|
235
|
+
|
|
236
|
+
uint32_t rorb_tc_kind(const rorb_typecode* tc);
|
|
237
|
+
/* Strings valid while tc is. */
|
|
238
|
+
rorb_status rorb_tc_id(const rorb_typecode* tc, const char** s, size_t* len,
|
|
239
|
+
rorb_exception* exc);
|
|
240
|
+
rorb_status rorb_tc_name(const rorb_typecode* tc, const char** s, size_t* len,
|
|
241
|
+
rorb_exception* exc);
|
|
242
|
+
rorb_status rorb_tc_member_count(const rorb_typecode* tc, uint32_t* count, rorb_exception* exc);
|
|
243
|
+
rorb_status rorb_tc_member_name(const rorb_typecode* tc, uint32_t index, const char** s,
|
|
244
|
+
size_t* len, rorb_exception* exc);
|
|
245
|
+
rorb_status rorb_tc_member_type(const rorb_typecode* tc, uint32_t index, rorb_typecode** out,
|
|
246
|
+
rorb_exception* exc);
|
|
247
|
+
/* An any holding the label (the octet 0 for the default member). */
|
|
248
|
+
rorb_status rorb_tc_member_label(const rorb_typecode* tc, uint32_t index, rorb_any** out,
|
|
249
|
+
rorb_exception* exc);
|
|
250
|
+
rorb_status rorb_tc_discriminator_type(const rorb_typecode* tc, rorb_typecode** out,
|
|
251
|
+
rorb_exception* exc);
|
|
252
|
+
rorb_status rorb_tc_default_index(const rorb_typecode* tc, int32_t* index, rorb_exception* exc);
|
|
253
|
+
rorb_status rorb_tc_length(const rorb_typecode* tc, uint32_t* length, rorb_exception* exc);
|
|
254
|
+
rorb_status rorb_tc_content_type(const rorb_typecode* tc, rorb_typecode** out,
|
|
255
|
+
rorb_exception* exc);
|
|
256
|
+
rorb_status rorb_tc_fixed_digits(const rorb_typecode* tc, uint16_t* digits, rorb_exception* exc);
|
|
257
|
+
rorb_status rorb_tc_fixed_scale(const rorb_typecode* tc, int16_t* scale, rorb_exception* exc);
|
|
258
|
+
rorb_status rorb_tc_member_visibility(const rorb_typecode* tc, uint32_t index, int16_t* v,
|
|
259
|
+
rorb_exception* exc);
|
|
260
|
+
rorb_status rorb_tc_type_modifier(const rorb_typecode* tc, int16_t* v, rorb_exception* exc);
|
|
261
|
+
/* *out is NULL for a valuetype without one. */
|
|
262
|
+
rorb_status rorb_tc_concrete_base_type(const rorb_typecode* tc, rorb_typecode** out,
|
|
263
|
+
rorb_exception* exc);
|
|
264
|
+
int32_t rorb_tc_equal(const rorb_typecode* a, const rorb_typecode* b);
|
|
265
|
+
int32_t rorb_tc_equivalent(const rorb_typecode* a, const rorb_typecode* b);
|
|
266
|
+
/* TypeCode::get_compact_typecode */
|
|
267
|
+
rorb_typecode* rorb_tc_compact(const rorb_typecode* tc);
|
|
268
|
+
/* The TypeCode with its aliases removed. */
|
|
269
|
+
rorb_typecode* rorb_tc_unaliased(const rorb_typecode* tc);
|
|
270
|
+
|
|
271
|
+
/* An any: a TypeCode and a value of that type. rorb_any_new makes an
|
|
272
|
+
empty one (tk_null). */
|
|
273
|
+
rorb_any* rorb_any_new(void);
|
|
274
|
+
rorb_any* rorb_any_clone(const rorb_any* any);
|
|
275
|
+
/* An any of type tc without a value (the result and the out arguments of a
|
|
276
|
+
DII request before the call); marshalling it or taking its value out is
|
|
277
|
+
BAD_PARAM. */
|
|
278
|
+
rorb_any* rorb_any_typed(const rorb_typecode* tc);
|
|
279
|
+
void rorb_any_release(rorb_any* any);
|
|
280
|
+
rorb_typecode* rorb_any_type(const rorb_any* any);
|
|
281
|
+
/* Replaces the TypeCode with an equivalent one (an alias, say), else
|
|
282
|
+
BAD_TYPECODE. */
|
|
283
|
+
rorb_status rorb_any_set_type(rorb_any* any, const rorb_typecode* tc, rorb_exception* exc);
|
|
284
|
+
/* Whether the TypeCodes are equal and the values the same (floats
|
|
285
|
+
compared exactly, object references with is_equivalent). */
|
|
286
|
+
int32_t rorb_any_equal(const rorb_any* a, const rorb_any* b);
|
|
287
|
+
/* If the any holds a value of a discriminator type (an integer, boolean,
|
|
288
|
+
char, wchar or enum), stores it as a union label (see rorb_tc_union) and
|
|
289
|
+
returns 1; else returns 0. */
|
|
290
|
+
int32_t rorb_any_label(const rorb_any* any, uint64_t* label);
|
|
291
|
+
/* Makes an any of type tc holding the value write(context, out) writes,
|
|
292
|
+
as it writes an argument of that type (an exception without its
|
|
293
|
+
repository id). A value that does not fit the type is BAD_PARAM.
|
|
294
|
+
write returns RORB_OK or RORB_CALLBACK_FAILED. */
|
|
295
|
+
rorb_status rorb_any_insert(const rorb_typecode* tc,
|
|
296
|
+
rorb_status (*write)(void* context, rorb_out* out), void* context,
|
|
297
|
+
rorb_any** out, rorb_exception* exc);
|
|
298
|
+
/* Calls read(context, in) to read the value, as an argument of the type
|
|
299
|
+
of the any; the caller has checked that type. A stream error is
|
|
300
|
+
MARSHAL. Object references read belong to the ORB of the first one in
|
|
301
|
+
the value, else to the first ORB initialised; without either, they
|
|
302
|
+
are BAD_INV_ORDER. */
|
|
303
|
+
rorb_status rorb_any_extract(const rorb_any* any,
|
|
304
|
+
rorb_status (*read)(void* context, rorb_in* in), void* context,
|
|
305
|
+
rorb_exception* exc);
|
|
306
|
+
|
|
307
|
+
/* --- DynamicAny --------------------------------------------------------------
|
|
308
|
+
|
|
309
|
+
An rorb_dynany handle is one reference to a DynAny of the core; clones
|
|
310
|
+
are the same DynAny, released one by one. The operations of every
|
|
311
|
+
derived interface (DynStruct, DynUnion...) take any handle: on a DynAny
|
|
312
|
+
of another kind they are BAD_OPERATION. Failures are RORB_LOCAL_EXCEPTION
|
|
313
|
+
with RORB_DYN_* or system exceptions (OBJECT_NOT_EXIST after destroy).
|
|
314
|
+
Values go in and out as anys (see docs/dynany.md). Strings returned in
|
|
315
|
+
rorb_bytes are UTF-8. */
|
|
316
|
+
|
|
317
|
+
typedef struct rorb_dynany rorb_dynany;
|
|
318
|
+
|
|
319
|
+
/* DynAnyFactory: create_dyn_any (truncate 1) or
|
|
320
|
+
create_dyn_any_without_truncation (0), create_dyn_any_from_type_code. */
|
|
321
|
+
rorb_status rorb_dynany_create(const rorb_any* any, int32_t truncate, rorb_dynany** out,
|
|
322
|
+
rorb_exception* exc);
|
|
323
|
+
rorb_status rorb_dynany_from_typecode(const rorb_typecode* tc, rorb_dynany** out,
|
|
324
|
+
rorb_exception* exc);
|
|
325
|
+
rorb_dynany* rorb_dynany_clone(const rorb_dynany* d);
|
|
326
|
+
void rorb_dynany_release(rorb_dynany* d);
|
|
327
|
+
/* The kind of the unaliased type, which tells the derived interface. */
|
|
328
|
+
uint32_t rorb_dynany_kind(const rorb_dynany* d);
|
|
329
|
+
/* 1 if both handles are the same DynAny. */
|
|
330
|
+
int32_t rorb_dynany_same(const rorb_dynany* a, const rorb_dynany* b);
|
|
331
|
+
|
|
332
|
+
rorb_status rorb_dynany_type(const rorb_dynany* d, rorb_typecode** out, rorb_exception* exc);
|
|
333
|
+
/* The type of the DynAny insert and get work on: the current component,
|
|
334
|
+
else the DynAny itself. */
|
|
335
|
+
rorb_status rorb_dynany_target_type(const rorb_dynany* d, rorb_typecode** out,
|
|
336
|
+
rorb_exception* exc);
|
|
337
|
+
rorb_status rorb_dynany_assign(const rorb_dynany* d, const rorb_dynany* other,
|
|
338
|
+
rorb_exception* exc);
|
|
339
|
+
rorb_status rorb_dynany_from_any(const rorb_dynany* d, const rorb_any* any, rorb_exception* exc);
|
|
340
|
+
rorb_status rorb_dynany_to_any(const rorb_dynany* d, rorb_any** out, rorb_exception* exc);
|
|
341
|
+
rorb_status rorb_dynany_equal(const rorb_dynany* d, const rorb_dynany* other, int32_t* out,
|
|
342
|
+
rorb_exception* exc);
|
|
343
|
+
rorb_status rorb_dynany_destroy(const rorb_dynany* d, rorb_exception* exc);
|
|
344
|
+
rorb_status rorb_dynany_copy(const rorb_dynany* d, rorb_dynany** out, rorb_exception* exc);
|
|
345
|
+
/* insert_<type>: the value of the any (its type is not looked at) as a
|
|
346
|
+
value of the kind (RORB_TK_OBJREF for insert_reference, RORB_TK_VALUE for
|
|
347
|
+
insert_val). get_<type>: an any of the kind's type (string, wstring,
|
|
348
|
+
Object, the instance's type for RORB_TK_VALUE). */
|
|
349
|
+
rorb_status rorb_dynany_insert(const rorb_dynany* d, uint32_t kind, const rorb_any* value,
|
|
350
|
+
rorb_exception* exc);
|
|
351
|
+
rorb_status rorb_dynany_get(const rorb_dynany* d, uint32_t kind, rorb_any** out,
|
|
352
|
+
rorb_exception* exc);
|
|
353
|
+
/* insert_<type>_seq: the elements of an any of a sequence of the kind;
|
|
354
|
+
get_<type>_seq: an any of an unbounded sequence of the kind. */
|
|
355
|
+
rorb_status rorb_dynany_insert_seq(const rorb_dynany* d, uint32_t kind, const rorb_any* value,
|
|
356
|
+
rorb_exception* exc);
|
|
357
|
+
rorb_status rorb_dynany_get_seq(const rorb_dynany* d, uint32_t kind, rorb_any** out,
|
|
358
|
+
rorb_exception* exc);
|
|
359
|
+
rorb_status rorb_dynany_insert_dyn_any(const rorb_dynany* d, const rorb_dynany* value,
|
|
360
|
+
rorb_exception* exc);
|
|
361
|
+
rorb_status rorb_dynany_get_dyn_any(const rorb_dynany* d, rorb_dynany** out,
|
|
362
|
+
rorb_exception* exc);
|
|
363
|
+
/* NO_IMPLEMENT (abstract interfaces), or OBJECT_NOT_EXIST. */
|
|
364
|
+
rorb_status rorb_dynany_no_implement(const rorb_dynany* d, rorb_exception* exc);
|
|
365
|
+
rorb_status rorb_dynany_seek(const rorb_dynany* d, int32_t index, int32_t* out,
|
|
366
|
+
rorb_exception* exc);
|
|
367
|
+
rorb_status rorb_dynany_rewind(const rorb_dynany* d, rorb_exception* exc);
|
|
368
|
+
rorb_status rorb_dynany_next(const rorb_dynany* d, int32_t* out, rorb_exception* exc);
|
|
369
|
+
rorb_status rorb_dynany_component_count(const rorb_dynany* d, uint32_t* out,
|
|
370
|
+
rorb_exception* exc);
|
|
371
|
+
/* NULL in *out at position -1. */
|
|
372
|
+
rorb_status rorb_dynany_current_component(const rorb_dynany* d, rorb_dynany** out,
|
|
373
|
+
rorb_exception* exc);
|
|
374
|
+
|
|
375
|
+
/* DynFixed, DynEnum */
|
|
376
|
+
rorb_status rorb_dynany_get_fixed_value(const rorb_dynany* d, rorb_bytes* out,
|
|
377
|
+
rorb_exception* exc);
|
|
378
|
+
rorb_status rorb_dynany_set_fixed_value(const rorb_dynany* d, const char* value, size_t len,
|
|
379
|
+
int32_t* out, rorb_exception* exc);
|
|
380
|
+
rorb_status rorb_dynany_get_as_string(const rorb_dynany* d, rorb_bytes* out,
|
|
381
|
+
rorb_exception* exc);
|
|
382
|
+
rorb_status rorb_dynany_set_as_string(const rorb_dynany* d, const char* value, size_t len,
|
|
383
|
+
rorb_exception* exc);
|
|
384
|
+
rorb_status rorb_dynany_get_as_ulong(const rorb_dynany* d, uint32_t* out, rorb_exception* exc);
|
|
385
|
+
rorb_status rorb_dynany_set_as_ulong(const rorb_dynany* d, uint32_t value, rorb_exception* exc);
|
|
386
|
+
|
|
387
|
+
/* DynStruct, DynValue. get_members is member_count (failing as
|
|
388
|
+
get_members does) and member_at for each. */
|
|
389
|
+
rorb_status rorb_dynany_current_member_name(const rorb_dynany* d, rorb_bytes* out,
|
|
390
|
+
rorb_exception* exc);
|
|
391
|
+
rorb_status rorb_dynany_current_member_kind(const rorb_dynany* d, uint32_t* out,
|
|
392
|
+
rorb_exception* exc);
|
|
393
|
+
rorb_status rorb_dynany_member_count(const rorb_dynany* d, uint32_t* out, rorb_exception* exc);
|
|
394
|
+
rorb_status rorb_dynany_member_at(const rorb_dynany* d, uint32_t index, rorb_bytes* name,
|
|
395
|
+
rorb_dynany** out, rorb_exception* exc);
|
|
396
|
+
rorb_status rorb_dynany_set_members(const rorb_dynany* d, size_t count,
|
|
397
|
+
const char* const* names, const size_t* name_lens,
|
|
398
|
+
const rorb_any* const* values, rorb_exception* exc);
|
|
399
|
+
rorb_status rorb_dynany_set_members_as_dyn_any(const rorb_dynany* d, size_t count,
|
|
400
|
+
const char* const* names,
|
|
401
|
+
const size_t* name_lens,
|
|
402
|
+
const rorb_dynany* const* values,
|
|
403
|
+
rorb_exception* exc);
|
|
404
|
+
|
|
405
|
+
/* DynUnion */
|
|
406
|
+
rorb_status rorb_dynany_get_discriminator(const rorb_dynany* d, rorb_dynany** out,
|
|
407
|
+
rorb_exception* exc);
|
|
408
|
+
rorb_status rorb_dynany_set_discriminator(const rorb_dynany* d, const rorb_dynany* disc,
|
|
409
|
+
rorb_exception* exc);
|
|
410
|
+
rorb_status rorb_dynany_set_to_default_member(const rorb_dynany* d, rorb_exception* exc);
|
|
411
|
+
rorb_status rorb_dynany_set_to_no_active_member(const rorb_dynany* d, rorb_exception* exc);
|
|
412
|
+
rorb_status rorb_dynany_has_no_active_member(const rorb_dynany* d, int32_t* out,
|
|
413
|
+
rorb_exception* exc);
|
|
414
|
+
rorb_status rorb_dynany_discriminator_kind(const rorb_dynany* d, uint32_t* out,
|
|
415
|
+
rorb_exception* exc);
|
|
416
|
+
rorb_status rorb_dynany_member(const rorb_dynany* d, rorb_dynany** out, rorb_exception* exc);
|
|
417
|
+
rorb_status rorb_dynany_member_name(const rorb_dynany* d, rorb_bytes* out, rorb_exception* exc);
|
|
418
|
+
rorb_status rorb_dynany_member_kind(const rorb_dynany* d, uint32_t* out, rorb_exception* exc);
|
|
419
|
+
|
|
420
|
+
/* DynSequence, DynArray. get_elements is element_count and element_at. */
|
|
421
|
+
rorb_status rorb_dynany_get_length(const rorb_dynany* d, uint32_t* out, rorb_exception* exc);
|
|
422
|
+
rorb_status rorb_dynany_set_length(const rorb_dynany* d, uint32_t len, rorb_exception* exc);
|
|
423
|
+
rorb_status rorb_dynany_element_count(const rorb_dynany* d, uint32_t* out,
|
|
424
|
+
rorb_exception* exc);
|
|
425
|
+
rorb_status rorb_dynany_element_at(const rorb_dynany* d, uint32_t index, rorb_dynany** out,
|
|
426
|
+
rorb_exception* exc);
|
|
427
|
+
rorb_status rorb_dynany_set_elements(const rorb_dynany* d, size_t count,
|
|
428
|
+
const rorb_any* const* values, rorb_exception* exc);
|
|
429
|
+
rorb_status rorb_dynany_set_elements_as_dyn_any(const rorb_dynany* d, size_t count,
|
|
430
|
+
const rorb_dynany* const* values,
|
|
431
|
+
rorb_exception* exc);
|
|
432
|
+
|
|
433
|
+
/* DynValueCommon, DynValueBox */
|
|
434
|
+
rorb_status rorb_dynany_is_null(const rorb_dynany* d, int32_t* out, rorb_exception* exc);
|
|
435
|
+
rorb_status rorb_dynany_set_to_null(const rorb_dynany* d, rorb_exception* exc);
|
|
436
|
+
rorb_status rorb_dynany_set_to_value(const rorb_dynany* d, rorb_exception* exc);
|
|
437
|
+
rorb_status rorb_dynany_get_boxed_value(const rorb_dynany* d, rorb_any** out,
|
|
438
|
+
rorb_exception* exc);
|
|
439
|
+
rorb_status rorb_dynany_set_boxed_value(const rorb_dynany* d, const rorb_any* value,
|
|
440
|
+
rorb_exception* exc);
|
|
441
|
+
rorb_status rorb_dynany_get_boxed_value_as_dyn_any(const rorb_dynany* d, rorb_dynany** out,
|
|
442
|
+
rorb_exception* exc);
|
|
443
|
+
rorb_status rorb_dynany_set_boxed_value_as_dyn_any(const rorb_dynany* d,
|
|
444
|
+
const rorb_dynany* value,
|
|
445
|
+
rorb_exception* exc);
|
|
446
|
+
|
|
447
|
+
/* --- ORB --------------------------------------------------------------- */
|
|
448
|
+
|
|
449
|
+
/* CORBA::ORB_init: removes the ORB options (-ORB...) from argv and
|
|
450
|
+
*argc; argv[0] is kept. */
|
|
451
|
+
rorb_status rorb_orb_init(int* argc, char** argv, rorb_orb** orb, rorb_exception* exc);
|
|
452
|
+
rorb_orb* rorb_orb_clone(rorb_orb* orb);
|
|
453
|
+
void rorb_orb_release(rorb_orb* orb);
|
|
454
|
+
|
|
455
|
+
/* *obj is NULL for a nil reference. */
|
|
456
|
+
rorb_status rorb_orb_string_to_object(rorb_orb* orb, const char* s, size_t len,
|
|
457
|
+
rorb_object** obj, rorb_exception* exc);
|
|
458
|
+
/* obj may be NULL (a nil reference). */
|
|
459
|
+
rorb_status rorb_orb_object_to_string(rorb_orb* orb, rorb_object* obj, rorb_bytes* s,
|
|
460
|
+
rorb_exception* exc);
|
|
461
|
+
/* Not for "RootPOA" and "POACurrent", which are local objects: see
|
|
462
|
+
rorb_orb_root_poa. Unknown names give RORB_INVALID_NAME. */
|
|
463
|
+
rorb_status rorb_orb_resolve_initial_references(rorb_orb* orb, const char* name, size_t len,
|
|
464
|
+
rorb_object** obj, rorb_exception* exc);
|
|
465
|
+
/* Calls each(context, name, len) for each initial service. */
|
|
466
|
+
void rorb_orb_list_initial_services(rorb_orb* orb, void* context,
|
|
467
|
+
void (*each)(void* context, const char* name, size_t len));
|
|
468
|
+
rorb_status rorb_orb_root_poa(rorb_orb* orb, rorb_poa** poa, rorb_exception* exc);
|
|
469
|
+
/* Blocks until the ORB is shut down, running MAIN_THREAD_MODEL requests. */
|
|
470
|
+
void rorb_orb_run(rorb_orb* orb);
|
|
471
|
+
rorb_status rorb_orb_work_pending(rorb_orb* orb, int32_t* pending, rorb_exception* exc);
|
|
472
|
+
rorb_status rorb_orb_perform_work(rorb_orb* orb, rorb_exception* exc);
|
|
473
|
+
rorb_status rorb_orb_shutdown(rorb_orb* orb, int32_t wait_for_completion, rorb_exception* exc);
|
|
474
|
+
rorb_status rorb_orb_destroy(rorb_orb* orb, rorb_exception* exc);
|
|
475
|
+
/* Client timeouts in microseconds. For the ORB, 0 is no limit. For the
|
|
476
|
+
calling thread (every ORB) and for an object reference (and its
|
|
477
|
+
clones), negative unsets the timeout so that the next one applies, and
|
|
478
|
+
0 is no limit; a call uses the thread's, else the reference's, else the
|
|
479
|
+
ORB's. The getters return the same encoding. */
|
|
480
|
+
void rorb_orb_set_call_timeout(rorb_orb* orb, int64_t us);
|
|
481
|
+
int64_t rorb_orb_call_timeout(rorb_orb* orb);
|
|
482
|
+
void rorb_orb_set_connect_timeout(rorb_orb* orb, int64_t us);
|
|
483
|
+
int64_t rorb_orb_connect_timeout(rorb_orb* orb);
|
|
484
|
+
void rorb_set_thread_call_timeout(int64_t us);
|
|
485
|
+
int64_t rorb_thread_call_timeout(void);
|
|
486
|
+
/* The RootPOA of the first ORB initialised and not yet destroyed (the
|
|
487
|
+
default POA of servants). */
|
|
488
|
+
rorb_status rorb_default_root_poa(rorb_poa** poa, rorb_exception* exc);
|
|
489
|
+
/* A new handle of the first ORB initialised and not yet destroyed; NULL if
|
|
490
|
+
there is none. */
|
|
491
|
+
rorb_orb* rorb_default_orb(void);
|
|
492
|
+
|
|
493
|
+
/* --- policies ---------------------------------------------------------- */
|
|
494
|
+
|
|
495
|
+
/* A policy crosses the ABI as its type and a value: the enumerator of a
|
|
496
|
+
POA policy (types 16 to 22), the relative_expiry of a
|
|
497
|
+
Messaging::RelativeRoundtripTimeoutPolicy (type 32, units of 100 ns),
|
|
498
|
+
the synchronization of a Messaging::SyncScopePolicy (type 24, 0 to 3). */
|
|
499
|
+
#define RORB_RELATIVE_RT_TIMEOUT_POLICY_TYPE 32
|
|
500
|
+
#define RORB_SYNC_SCOPE_POLICY_TYPE 24
|
|
501
|
+
/* CORBA::SetOverrideType */
|
|
502
|
+
#define RORB_SET_OVERRIDE 0
|
|
503
|
+
#define RORB_ADD_OVERRIDE 1
|
|
504
|
+
|
|
505
|
+
/* Called with each policy of a list. */
|
|
506
|
+
typedef void (*rorb_each_policy)(void* context, uint32_t type, uint64_t value);
|
|
507
|
+
|
|
508
|
+
/* ORB::create_policy: the value of the policy of `type` in the any.
|
|
509
|
+
RORB_POLICY_ERROR with the reason (BAD_POLICY 0 for an unknown type,
|
|
510
|
+
BAD_POLICY_TYPE 2 for an any of the wrong type, BAD_POLICY_VALUE 3). */
|
|
511
|
+
rorb_status rorb_orb_create_policy(rorb_orb* orb, uint32_t type, const rorb_any* value,
|
|
512
|
+
uint64_t* raw_value, rorb_exception* exc);
|
|
513
|
+
/* ORB::register_initial_reference. RORB_INVALID_NAME for an empty name or
|
|
514
|
+
one that is already an initial reference of the core (-ORBInitRef or
|
|
515
|
+
registered); BAD_PARAM (minor 27) for a NULL obj. */
|
|
516
|
+
rorb_status rorb_orb_register_initial_reference(rorb_orb* orb, const char* name, size_t len,
|
|
517
|
+
rorb_object* obj, rorb_exception* exc);
|
|
518
|
+
/* register_initial_reference for an object of the binding that has no
|
|
519
|
+
rorb_object (a local object): the ORB keeps `object` until it is
|
|
520
|
+
destroyed, then calls release(object) (at once if registering fails).
|
|
521
|
+
Errors as above. resolve calls
|
|
522
|
+
each(context, object) and returns 1 if `name` is such an object, else
|
|
523
|
+
0; the object is only guaranteed to live during the call. */
|
|
524
|
+
rorb_status rorb_orb_register_local_initial_reference(rorb_orb* orb, const char* name,
|
|
525
|
+
size_t len, void* object,
|
|
526
|
+
void (*release)(void*),
|
|
527
|
+
rorb_exception* exc);
|
|
528
|
+
int32_t rorb_orb_resolve_local_initial_reference(rorb_orb* orb, const char* name, size_t len,
|
|
529
|
+
void* context,
|
|
530
|
+
void (*each)(void* context, void* object));
|
|
531
|
+
/* The overrides of the ORB (its PolicyManager), of the calling thread
|
|
532
|
+
(PolicyCurrent) and of an object reference. Setting them raises
|
|
533
|
+
NO_PERMISSION for a policy that is not a client side override (the POA
|
|
534
|
+
policies) and BAD_PARAM (minor 30) for two policies of one type. The
|
|
535
|
+
getters call `each` with the overrides of the `count` types (all types
|
|
536
|
+
if count is 0). The timeout overrides are the call timeouts of
|
|
537
|
+
rorb_orb_set_call_timeout and friends. */
|
|
538
|
+
rorb_status rorb_orb_set_policy_overrides(rorb_orb* orb, const uint32_t* types,
|
|
539
|
+
const uint64_t* values, size_t count,
|
|
540
|
+
uint32_t set_add, rorb_exception* exc);
|
|
541
|
+
void rorb_orb_get_policy_overrides(rorb_orb* orb, const uint32_t* types, size_t count,
|
|
542
|
+
void* context, rorb_each_policy each);
|
|
543
|
+
rorb_status rorb_set_thread_policy_overrides(const uint32_t* types, const uint64_t* values,
|
|
544
|
+
size_t count, uint32_t set_add,
|
|
545
|
+
rorb_exception* exc);
|
|
546
|
+
void rorb_thread_policy_overrides(const uint32_t* types, size_t count, void* context,
|
|
547
|
+
rorb_each_policy each);
|
|
548
|
+
/* Object::set_policy_overrides: a new reference in *result. */
|
|
549
|
+
rorb_status rorb_object_set_policy_overrides(rorb_object* obj, const uint32_t* types,
|
|
550
|
+
const uint64_t* values, size_t count,
|
|
551
|
+
uint32_t set_add, rorb_object** result,
|
|
552
|
+
rorb_exception* exc);
|
|
553
|
+
void rorb_object_get_policy_overrides(rorb_object* obj, const uint32_t* types, size_t count,
|
|
554
|
+
void* context, rorb_each_policy each);
|
|
555
|
+
/* Object::get_client_policy (and get_policy): 1 and the value if the
|
|
556
|
+
reference, the thread or the ORB has a policy of `type`, else 0. */
|
|
557
|
+
int32_t rorb_object_get_client_policy(rorb_object* obj, uint32_t type, uint64_t* raw_value);
|
|
558
|
+
/* Object::validate_connection: binds with a LocateRequest. 1 on success;
|
|
559
|
+
failures are system exceptions (OBJECT_NOT_EXIST when the server does
|
|
560
|
+
not have the object). */
|
|
561
|
+
rorb_status rorb_object_validate_connection(rorb_object* obj, int32_t* result,
|
|
562
|
+
rorb_exception* exc);
|
|
563
|
+
|
|
564
|
+
/* --- object references -------------------------------------------------- */
|
|
565
|
+
|
|
566
|
+
rorb_object* rorb_object_clone(rorb_object* obj);
|
|
567
|
+
void rorb_object_release(rorb_object* obj);
|
|
568
|
+
rorb_orb* rorb_object_orb(rorb_object* obj);
|
|
569
|
+
/* The repository id in the IOR (may be empty), valid while obj lives. */
|
|
570
|
+
const char* rorb_object_type_id(rorb_object* obj, size_t* len);
|
|
571
|
+
rorb_status rorb_object_is_a(rorb_object* obj, const char* id, size_t len, int32_t* result,
|
|
572
|
+
rorb_exception* exc);
|
|
573
|
+
rorb_status rorb_object_non_existent(rorb_object* obj, int32_t* result, rorb_exception* exc);
|
|
574
|
+
int32_t rorb_object_is_equivalent(rorb_object* a, rorb_object* b);
|
|
575
|
+
/* The same value for equivalent references, below maximum. */
|
|
576
|
+
uint32_t rorb_object_hash(rorb_object* obj, uint32_t maximum);
|
|
577
|
+
/* See rorb_orb_set_call_timeout. */
|
|
578
|
+
void rorb_object_set_call_timeout(rorb_object* obj, int64_t us);
|
|
579
|
+
int64_t rorb_object_call_timeout(rorb_object* obj);
|
|
580
|
+
|
|
581
|
+
/* How to make one invocation.
|
|
582
|
+
|
|
583
|
+
write_args writes the in and inout arguments; it may run more than once
|
|
584
|
+
(when the request is forwarded or sent again). read_reply reads the
|
|
585
|
+
result and the inout and out arguments. read_user_exception is called
|
|
586
|
+
for a user exception with its repository id; it returns
|
|
587
|
+
RORB_USER_EXCEPTION when it took the exception, RORB_SYSTEM_EXCEPTION
|
|
588
|
+
when the operation does not declare it (the invocation then fails with
|
|
589
|
+
UNKNOWN), or RORB_CALLBACK_FAILED. The other callbacks return RORB_OK
|
|
590
|
+
or RORB_CALLBACK_FAILED. Any callback may be NULL. */
|
|
591
|
+
typedef struct rorb_invocation {
|
|
592
|
+
const char* operation;
|
|
593
|
+
size_t operation_len;
|
|
594
|
+
int32_t oneway;
|
|
595
|
+
/* Reply timeout in microseconds; negative uses the timeout of the
|
|
596
|
+
thread, the reference or the ORB (rorb_orb_set_call_timeout), and 0
|
|
597
|
+
waits forever. */
|
|
598
|
+
int64_t timeout_us;
|
|
599
|
+
void* context;
|
|
600
|
+
rorb_status (*write_args)(void* context, rorb_out* out);
|
|
601
|
+
rorb_status (*read_reply)(void* context, rorb_in* in);
|
|
602
|
+
rorb_status (*read_user_exception)(void* context, const char* id, size_t id_len, rorb_in* in);
|
|
603
|
+
} rorb_invocation;
|
|
604
|
+
|
|
605
|
+
/* Returns RORB_OK, RORB_SYSTEM_EXCEPTION, RORB_USER_EXCEPTION or
|
|
606
|
+
RORB_CALLBACK_FAILED. A stream error in a read callback is MARSHAL. */
|
|
607
|
+
rorb_status rorb_object_invoke(rorb_object* obj, const rorb_invocation* inv, rorb_exception* exc);
|
|
608
|
+
|
|
609
|
+
/* Called once when an rorb_object_sendc invocation ends, on a thread of
|
|
610
|
+
the ORB's reply pool, after read_reply or read_user_exception. status is
|
|
611
|
+
RORB_OK, RORB_USER_EXCEPTION, RORB_SYSTEM_EXCEPTION (exc says which;
|
|
612
|
+
valid during the call) or RORB_CALLBACK_FAILED. No callback of the
|
|
613
|
+
invocation runs after it, so it may release the context. */
|
|
614
|
+
typedef void (*rorb_sendc_done_fn)(void* context, rorb_status status, const rorb_exception* exc);
|
|
615
|
+
|
|
616
|
+
/* Sends inv without waiting (AMI, docs/ami.md): returns once the request
|
|
617
|
+
is handed to the ORB, and done gets the outcome. inv is copied and the
|
|
618
|
+
operation name is not kept, but the context and the callbacks must stay
|
|
619
|
+
usable from any thread until done is called: write_args runs later, on
|
|
620
|
+
another thread (one of rustorb's, never one of the ORB's I/O threads),
|
|
621
|
+
once or more. inv may not be oneway (BAD_PARAM) and
|
|
622
|
+
done may not be NULL. Returns RORB_OK, or RORB_SYSTEM_EXCEPTION
|
|
623
|
+
(BAD_INV_ORDER once the ORB is shut down), and then done is not
|
|
624
|
+
called. */
|
|
625
|
+
rorb_status rorb_object_sendc(rorb_object* obj, const rorb_invocation* inv, rorb_sendc_done_fn done,
|
|
626
|
+
rorb_exception* exc);
|
|
627
|
+
|
|
628
|
+
/* --- streams --------------------------------------------------------------- */
|
|
629
|
+
|
|
630
|
+
/* Element kinds of rorb_out_write_array / rorb_in_read_array. */
|
|
631
|
+
#define RORB_PRIM_OCTET 0 /* also char */
|
|
632
|
+
#define RORB_PRIM_SHORT 1
|
|
633
|
+
#define RORB_PRIM_USHORT 2
|
|
634
|
+
#define RORB_PRIM_LONG 3
|
|
635
|
+
#define RORB_PRIM_ULONG 4
|
|
636
|
+
#define RORB_PRIM_LONGLONG 5
|
|
637
|
+
#define RORB_PRIM_ULONGLONG 6
|
|
638
|
+
#define RORB_PRIM_FLOAT 7
|
|
639
|
+
#define RORB_PRIM_DOUBLE 8
|
|
640
|
+
|
|
641
|
+
void rorb_out_write_boolean(rorb_out* out, int32_t v);
|
|
642
|
+
void rorb_out_write_octet(rorb_out* out, uint8_t v);
|
|
643
|
+
void rorb_out_write_char(rorb_out* out, char v);
|
|
644
|
+
void rorb_out_write_wchar(rorb_out* out, uint16_t v);
|
|
645
|
+
void rorb_out_write_short(rorb_out* out, int16_t v);
|
|
646
|
+
void rorb_out_write_ushort(rorb_out* out, uint16_t v);
|
|
647
|
+
void rorb_out_write_long(rorb_out* out, int32_t v);
|
|
648
|
+
void rorb_out_write_ulong(rorb_out* out, uint32_t v);
|
|
649
|
+
void rorb_out_write_longlong(rorb_out* out, int64_t v);
|
|
650
|
+
void rorb_out_write_ulonglong(rorb_out* out, uint64_t v);
|
|
651
|
+
void rorb_out_write_float(rorb_out* out, float v);
|
|
652
|
+
void rorb_out_write_double(rorb_out* out, double v);
|
|
653
|
+
/* A string in the negotiated code set; s must be UTF-8. */
|
|
654
|
+
void rorb_out_write_string(rorb_out* out, const char* s, size_t len);
|
|
655
|
+
void rorb_out_write_wstring(rorb_out* out, const uint16_t* s, size_t len);
|
|
656
|
+
/* obj may be NULL (a nil reference). */
|
|
657
|
+
void rorb_out_write_object(rorb_out* out, rorb_object* obj);
|
|
658
|
+
/* A TypeCode with an unresolved recursive placeholder is BAD_TYPECODE. */
|
|
659
|
+
void rorb_out_write_typecode(rorb_out* out, const rorb_typecode* tc);
|
|
660
|
+
void rorb_out_write_any(rorb_out* out, const rorb_any* any);
|
|
661
|
+
/* The value of the any, without its TypeCode. */
|
|
662
|
+
void rorb_out_write_any_value(rorb_out* out, const rorb_any* any);
|
|
663
|
+
/* A long double as its IEEE 754 binary128 bits: the high and the low 64. */
|
|
664
|
+
void rorb_out_write_longdouble(rorb_out* out, uint64_t hi, uint64_t lo);
|
|
665
|
+
/* binary128 bits from a double (exact), and the nearest double to them. */
|
|
666
|
+
void rorb_longdouble_from_double(double v, uint64_t* hi, uint64_t* lo);
|
|
667
|
+
double rorb_longdouble_to_double(uint64_t hi, uint64_t lo);
|
|
668
|
+
/* A fixed of count digits (0 to 9, most significant first) as packed
|
|
669
|
+
decimal; the scale is not on the wire. More than 31 digits is BAD_PARAM. */
|
|
670
|
+
void rorb_out_write_fixed(rorb_out* out, const uint8_t* digits, size_t count, int32_t negative);
|
|
671
|
+
/* count elements of kind, in the host's representation. */
|
|
672
|
+
void rorb_out_write_array(rorb_out* out, int32_t kind, const void* data, size_t count);
|
|
673
|
+
/* Whether an error happened on the stream. */
|
|
674
|
+
int32_t rorb_out_failed(rorb_out* out);
|
|
675
|
+
|
|
676
|
+
int32_t rorb_in_read_boolean(rorb_in* in);
|
|
677
|
+
uint8_t rorb_in_read_octet(rorb_in* in);
|
|
678
|
+
char rorb_in_read_char(rorb_in* in);
|
|
679
|
+
uint16_t rorb_in_read_wchar(rorb_in* in);
|
|
680
|
+
int16_t rorb_in_read_short(rorb_in* in);
|
|
681
|
+
uint16_t rorb_in_read_ushort(rorb_in* in);
|
|
682
|
+
int32_t rorb_in_read_long(rorb_in* in);
|
|
683
|
+
uint32_t rorb_in_read_ulong(rorb_in* in);
|
|
684
|
+
int64_t rorb_in_read_longlong(rorb_in* in);
|
|
685
|
+
uint64_t rorb_in_read_ulonglong(rorb_in* in);
|
|
686
|
+
float rorb_in_read_float(rorb_in* in);
|
|
687
|
+
double rorb_in_read_double(rorb_in* in);
|
|
688
|
+
void rorb_in_read_longdouble(rorb_in* in, uint64_t* hi, uint64_t* lo);
|
|
689
|
+
/* A string as UTF-8, valid until the next call on the stream. */
|
|
690
|
+
const char* rorb_in_read_string(rorb_in* in, size_t* len);
|
|
691
|
+
/* A wstring as UTF-16, valid until the next call on the stream. */
|
|
692
|
+
const uint16_t* rorb_in_read_wstring(rorb_in* in, size_t* len);
|
|
693
|
+
/* NULL for a nil reference (or an error). */
|
|
694
|
+
rorb_object* rorb_in_read_object(rorb_in* in);
|
|
695
|
+
/* NULL after an error. */
|
|
696
|
+
rorb_typecode* rorb_in_read_typecode(rorb_in* in);
|
|
697
|
+
rorb_any* rorb_in_read_any(rorb_in* in);
|
|
698
|
+
/* A value of type tc (no TypeCode on the stream) as a new any; NULL after
|
|
699
|
+
an error. */
|
|
700
|
+
rorb_any* rorb_in_read_any_value(rorb_in* in, const rorb_typecode* tc);
|
|
701
|
+
void rorb_in_read_array(rorb_in* in, int32_t kind, void* data, size_t count);
|
|
702
|
+
/* A fixed of count digits into digits[count]; returns 1 if it is negative. */
|
|
703
|
+
int32_t rorb_in_read_fixed(rorb_in* in, uint8_t* digits, size_t count);
|
|
704
|
+
/* A sequence length, checked against the bytes left for elements of at
|
|
705
|
+
least min_element_size bytes. */
|
|
706
|
+
uint32_t rorb_in_read_length(rorb_in* in, size_t min_element_size);
|
|
707
|
+
/* Marks the stream as failed (MARSHAL), for a value the caller rejects. */
|
|
708
|
+
void rorb_in_fail(rorb_in* in);
|
|
709
|
+
int32_t rorb_in_failed(rorb_in* in);
|
|
710
|
+
/* RORB_OK, or RORB_SYSTEM_EXCEPTION with the error of the stream (which
|
|
711
|
+
stays). */
|
|
712
|
+
rorb_status rorb_in_error(rorb_in* in, rorb_exception* exc);
|
|
713
|
+
|
|
714
|
+
/* --- owned input streams ---------------------------------------------------
|
|
715
|
+
|
|
716
|
+
Input streams that stay valid after the call that made them, until
|
|
717
|
+
rorb_in_release: the reply of rorb_object_invoke_stream, the bytes a
|
|
718
|
+
callback writes, the value of an any. They are for streams handed to
|
|
719
|
+
the caller's code, like the portable streams of the Java mapping
|
|
720
|
+
(ObjectImpl._invoke, create_input_stream). The caller checks for errors
|
|
721
|
+
with rorb_in_failed / rorb_in_error. Errors in a reply are completed yes,
|
|
722
|
+
the others completed no. */
|
|
723
|
+
|
|
724
|
+
/* Like rorb_object_invoke, with the arguments from inv->write_args (the
|
|
725
|
+
read callbacks are not used); *reply gets the reply. Returns RORB_OK
|
|
726
|
+
with the reply stream (NULL for a oneway call), RORB_USER_EXCEPTION with
|
|
727
|
+
a stream at the members of the user exception (rorb_in_exception_id
|
|
728
|
+
names it), RORB_SYSTEM_EXCEPTION or RORB_CALLBACK_FAILED. */
|
|
729
|
+
rorb_status rorb_object_invoke_stream(rorb_object* obj, const rorb_invocation* inv,
|
|
730
|
+
rorb_in** reply, rorb_exception* exc);
|
|
731
|
+
/* The repository id of the user exception of a reply stream; NULL (and
|
|
732
|
+
*len 0) for a normal reply or another stream. */
|
|
733
|
+
const char* rorb_in_exception_id(rorb_in* in, size_t* len);
|
|
734
|
+
/* A stream over what write(context, out) writes on a standalone stream (the
|
|
735
|
+
native code sets: UTF-8 and UTF-16). Object references read from it
|
|
736
|
+
belong to orb (may be NULL), else to the ORB of the first reference
|
|
737
|
+
written, else to the first ORB initialised. write returns RORB_OK or
|
|
738
|
+
RORB_CALLBACK_FAILED. */
|
|
739
|
+
rorb_status rorb_in_new(rorb_status (*write)(void* context, rorb_out* out), void* context,
|
|
740
|
+
rorb_orb* orb, rorb_in** in, rorb_exception* exc);
|
|
741
|
+
/* The bytes write(context, out) writes on a standalone stream: plain CDR
|
|
742
|
+
from offset 0 (not an encapsulation) in the byte order little_endian (1)
|
|
743
|
+
or big endian (0), with the native code sets (UTF-8 and UTF-16), as
|
|
744
|
+
Messaging::ExceptionHolder::marshaled_exception holds an exception
|
|
745
|
+
(docs/ami.md). *bytes is freed with rorb_bytes_free. */
|
|
746
|
+
rorb_status rorb_cdr_encode(rorb_status (*write)(void* context, rorb_out* out), void* context,
|
|
747
|
+
int32_t little_endian, rorb_bytes* bytes, rorb_exception* exc);
|
|
748
|
+
/* An owned stream over len bytes at data, in the form rorb_cdr_encode
|
|
749
|
+
writes. Object references read from it belong to orb (may be NULL), else
|
|
750
|
+
to the first ORB initialised. */
|
|
751
|
+
rorb_status rorb_in_from_bytes(const uint8_t* data, size_t len, int32_t little_endian,
|
|
752
|
+
rorb_orb* orb, rorb_in** in, rorb_exception* exc);
|
|
753
|
+
/* A stream over the value of the any (without its TypeCode), as
|
|
754
|
+
rorb_out_write_any_value writes it; an exception starts with its
|
|
755
|
+
repository id. */
|
|
756
|
+
rorb_status rorb_any_input(const rorb_any* any, rorb_in** in, rorb_exception* exc);
|
|
757
|
+
/* Releases an owned stream; does nothing for the stream of a callback. */
|
|
758
|
+
void rorb_in_release(rorb_in* in);
|
|
759
|
+
|
|
760
|
+
/* --- valuetypes ------------------------------------------------------------
|
|
761
|
+
|
|
762
|
+
The caller writes and reads the state of its instances; these functions
|
|
763
|
+
do the rest (CORBA 3.4 part 2, 9.3.4). On output, key names the
|
|
764
|
+
instance: an instance written again in the same message (the same key)
|
|
765
|
+
is sent as an indirection. The repository ids are the type's own, then
|
|
766
|
+
those of the bases it is truncatable to; chunked says to chunk the state
|
|
767
|
+
(for truncatable types; a value inside a chunked one is chunked too). */
|
|
768
|
+
|
|
769
|
+
void rorb_out_write_null_value(rorb_out* out);
|
|
770
|
+
/* Returns 1 if the caller now writes the state, then calls
|
|
771
|
+
rorb_out_end_value; 0 if an indirection was written (or the stream
|
|
772
|
+
failed). */
|
|
773
|
+
int32_t rorb_out_begin_value(rorb_out* out, uint64_t key, size_t count, const char* const* ids,
|
|
774
|
+
const size_t* id_lens, int32_t chunked);
|
|
775
|
+
void rorb_out_end_value(rorb_out* out);
|
|
776
|
+
|
|
777
|
+
/* Instances shared across anys. The stream of rorb_any_insert keeps the
|
|
778
|
+
caller's instances it writes: the any's core instance then stands for
|
|
779
|
+
the caller's instance (key), extracting the any gives that instance back
|
|
780
|
+
(below), and inserting the same instance again reuses the core instance,
|
|
781
|
+
its state replaced. One instance put in several anys thus stays one, as
|
|
782
|
+
in the arguments of a DII request. The core keeps the instance while one
|
|
783
|
+
of its anys does and then releases it, possibly on another thread. */
|
|
784
|
+
|
|
785
|
+
/* 1 if the stream keeps the caller's instances (it is that of
|
|
786
|
+
rorb_any_insert), else 0. */
|
|
787
|
+
int32_t rorb_out_keeps_hosts(rorb_out* out);
|
|
788
|
+
/* Like rorb_out_begin_value; takes host, a reference to the instance,
|
|
789
|
+
which the stream releases with release(host) when it does not keep it
|
|
790
|
+
(release may be NULL). */
|
|
791
|
+
int32_t rorb_out_begin_host_value(rorb_out* out, uint64_t key, void* host,
|
|
792
|
+
void (*release)(void* host), size_t count,
|
|
793
|
+
const char* const* ids, const size_t* id_lens, int32_t chunked);
|
|
794
|
+
|
|
795
|
+
/* Results of rorb_in_read_value_header. */
|
|
796
|
+
#define RORB_VALUE_NULL 0
|
|
797
|
+
#define RORB_VALUE_INDIRECTION 1
|
|
798
|
+
#define RORB_VALUE_NEW 2
|
|
799
|
+
|
|
800
|
+
/* What stands where a value is expected: null (also after an error), an
|
|
801
|
+
indirection to the value in *slot, or a new value with slot *slot and
|
|
802
|
+
*id_count repository ids (most derived first; none leaves the type to
|
|
803
|
+
the receiver). After RORB_VALUE_NEW the caller makes its instance, keeps
|
|
804
|
+
it with rorb_in_set_value (before reading the state, for cycles), reads
|
|
805
|
+
the state it knows and calls rorb_in_end_value, which skips the rest.
|
|
806
|
+
On the stream of rorb_any_extract, a value whose core instance stands
|
|
807
|
+
for an instance of the caller is RORB_VALUE_INDIRECTION: its slot then
|
|
808
|
+
holds the pointer the caller gave with rorb_in_set_host_value or
|
|
809
|
+
rorb_out_begin_host_value. */
|
|
810
|
+
int32_t rorb_in_read_value_header(rorb_in* in, size_t* slot, size_t* id_count);
|
|
811
|
+
/* Repository id index of the last header, valid until the next one. */
|
|
812
|
+
const char* rorb_in_value_id(rorb_in* in, size_t index, size_t* len);
|
|
813
|
+
void rorb_in_end_value(rorb_in* in);
|
|
814
|
+
/* Keeps ptr for slot until the stream ends, then calls release(ptr)
|
|
815
|
+
(unless release is NULL). */
|
|
816
|
+
void rorb_in_set_value(rorb_in* in, size_t slot, void* ptr, void (*release)(void* ptr));
|
|
817
|
+
/* The pointer kept for slot, or NULL. */
|
|
818
|
+
void* rorb_in_get_value(rorb_in* in, size_t slot);
|
|
819
|
+
/* Like rorb_in_set_value, with the key the caller writes the instance
|
|
820
|
+
with. On the stream of rorb_any_extract, the any's core instance then
|
|
821
|
+
keeps ptr instead of the stream (see rorb_out_begin_host_value). */
|
|
822
|
+
void rorb_in_set_host_value(rorb_in* in, size_t slot, uint64_t key, void* ptr,
|
|
823
|
+
void (*release)(void* ptr));
|
|
824
|
+
/* 1 if the stream gives the instances read to the core (it is that of
|
|
825
|
+
rorb_any_extract), else 0. */
|
|
826
|
+
int32_t rorb_in_keeps_hosts(rorb_in* in);
|
|
827
|
+
|
|
828
|
+
/* Makes the valuetype tc known to the core, so that values of it in anys
|
|
829
|
+
are read as that type where a base type is expected. */
|
|
830
|
+
void rorb_register_value_type(const rorb_typecode* tc);
|
|
831
|
+
/* Asks resolve(context, id, len) for the valuetypes the core reads (in
|
|
832
|
+
anys) that are not registered: it returns a new TypeCode (which the core
|
|
833
|
+
takes and registers) or NULL. It may be called from any thread. NULL
|
|
834
|
+
removes the resolver. */
|
|
835
|
+
void rorb_set_value_type_resolver(rorb_typecode* (*resolve)(void* context, const char* id,
|
|
836
|
+
size_t len),
|
|
837
|
+
void* context);
|
|
838
|
+
|
|
839
|
+
/* --- servants --------------------------------------------------------------- */
|
|
840
|
+
|
|
841
|
+
/* The callbacks of a servant. self is the pointer given to
|
|
842
|
+
rorb_servant_get. dispatch reads the arguments from in and writes the
|
|
843
|
+
result to reply; it returns RORB_OK (also after
|
|
844
|
+
rorb_server_reply_user_exception) or RORB_SYSTEM_EXCEPTION (after
|
|
845
|
+
rorb_server_reply_system_exception). _is_a, _non_existent, _interface
|
|
846
|
+
and _repository_id are answered by the ORB and do not reach dispatch. */
|
|
847
|
+
typedef struct rorb_servant_vtable {
|
|
848
|
+
rorb_status (*dispatch)(void* self, const char* op, size_t op_len, rorb_in* in,
|
|
849
|
+
rorb_server_reply* reply);
|
|
850
|
+
int32_t (*is_a)(void* self, const char* id, size_t len);
|
|
851
|
+
/* The Rust side took a reference to self... */
|
|
852
|
+
void (*add_ref)(void* self);
|
|
853
|
+
/* ...and gives it back. */
|
|
854
|
+
void (*remove_ref)(void* self);
|
|
855
|
+
} rorb_servant_vtable;
|
|
856
|
+
|
|
857
|
+
/* The Rust side of the servant self, made the first time (then
|
|
858
|
+
vtable->add_ref(self) is called) and the same while the POA or a handle
|
|
859
|
+
holds it. The vtable must outlive the servant. */
|
|
860
|
+
rorb_servant* rorb_servant_get(void* self, const char* repository_id, size_t len,
|
|
861
|
+
const rorb_servant_vtable* vtable);
|
|
862
|
+
void rorb_servant_release(rorb_servant* servant);
|
|
863
|
+
/* If the calling thread runs a request for servant, *obj is the target
|
|
864
|
+
object and the result is 1; otherwise 0. */
|
|
865
|
+
int32_t rorb_servant_current_reference(rorb_servant* servant, rorb_object** obj);
|
|
866
|
+
|
|
867
|
+
rorb_out* rorb_server_reply_output(rorb_server_reply* reply);
|
|
868
|
+
/* Replaces the reply with the user exception id; its members are written
|
|
869
|
+
to the stream returned. */
|
|
870
|
+
rorb_out* rorb_server_reply_user_exception(rorb_server_reply* reply, const char* id,
|
|
871
|
+
size_t len);
|
|
872
|
+
void rorb_server_reply_system_exception(rorb_server_reply* reply, const char* id, size_t len,
|
|
873
|
+
uint32_t minor, uint32_t completed);
|
|
874
|
+
|
|
875
|
+
/* --- the DII and the DSI ------------------------------------------------------
|
|
876
|
+
*
|
|
877
|
+
* CORBA::Request and CORBA::ServerRequest (docs/dii-dsi.md). Values go
|
|
878
|
+
* in and out as anys. Contexts are not supported.
|
|
879
|
+
*
|
|
880
|
+
* An rorb_request is one call: arguments, return type and exception list
|
|
881
|
+
* are given, then it is sent with rorb_request_invoke, _send_oneway or
|
|
882
|
+
* _send_deferred (then _poll_response / _get_response). It may be used
|
|
883
|
+
* from any thread, one call at a time.
|
|
884
|
+
*
|
|
885
|
+
* A DSI servant is an ordinary servant (rorb_servant_get): its dispatch
|
|
886
|
+
* calls rorb_server_request_new before reading anything from in, lets the
|
|
887
|
+
* application read the arguments and set the result, and ends with
|
|
888
|
+
* rorb_server_request_reply (or replies with a system exception). */
|
|
889
|
+
|
|
890
|
+
/* rorb_request_add_arg and rorb_server_request_add_param flags
|
|
891
|
+
(CORBA::ARG_IN, ARG_OUT, ARG_INOUT); other values are BAD_PARAM. */
|
|
892
|
+
#define RORB_ARG_IN 1
|
|
893
|
+
#define RORB_ARG_OUT 2
|
|
894
|
+
#define RORB_ARG_INOUT 3
|
|
895
|
+
|
|
896
|
+
/* A request for operation on target: no arguments, a void result. */
|
|
897
|
+
rorb_status rorb_request_new(rorb_object* target, const char* op, size_t len,
|
|
898
|
+
rorb_request** request, rorb_exception* exc);
|
|
899
|
+
void rorb_request_release(rorb_request* request);
|
|
900
|
+
/* Adds an argument: value is its value, or for RORB_ARG_OUT only its type. */
|
|
901
|
+
rorb_status rorb_request_add_arg(rorb_request* request, const char* name, size_t len,
|
|
902
|
+
uint32_t flags, const rorb_any* value, rorb_exception* exc);
|
|
903
|
+
void rorb_request_set_return_type(rorb_request* request, const rorb_typecode* tc);
|
|
904
|
+
/* A user exception the operation may raise. */
|
|
905
|
+
void rorb_request_add_exception(rorb_request* request, const rorb_typecode* tc);
|
|
906
|
+
/* As rorb_invocation.timeout_us: negative for the policies', 0 for none. */
|
|
907
|
+
void rorb_request_set_timeout(rorb_request* request, int64_t timeout_us);
|
|
908
|
+
/* Sends the request and waits for the reply. RORB_USER_EXCEPTION: the
|
|
909
|
+
operation raised a user exception of the list, which
|
|
910
|
+
rorb_request_exception gives; one not in the list is UNKNOWN (minor
|
|
911
|
+
0x4f4d0001, COMPLETED_YES). */
|
|
912
|
+
rorb_status rorb_request_invoke(rorb_request* request, rorb_exception* exc);
|
|
913
|
+
/* Oneway, as the SyncScope policy of the target says. */
|
|
914
|
+
rorb_status rorb_request_send_oneway(rorb_request* request, rorb_exception* exc);
|
|
915
|
+
/* Sends without waiting; BAD_INV_ORDER while a response is outstanding. */
|
|
916
|
+
rorb_status rorb_request_send_deferred(rorb_request* request, rorb_exception* exc);
|
|
917
|
+
/* *ready: whether the deferred response has arrived (BAD_INV_ORDER when
|
|
918
|
+
nothing was sent deferred). */
|
|
919
|
+
rorb_status rorb_request_poll_response(rorb_request* request, int32_t* ready,
|
|
920
|
+
rorb_exception* exc);
|
|
921
|
+
/* Waits for the deferred response; the outcome is that of invoke. */
|
|
922
|
+
rorb_status rorb_request_get_response(rorb_request* request, rorb_exception* exc);
|
|
923
|
+
/* The return value (only its type before a call). */
|
|
924
|
+
rorb_any* rorb_request_result(rorb_request* request);
|
|
925
|
+
/* The value of argument index (that received for out and inout ones after
|
|
926
|
+
a call; an out one has only its type before); NULL past the end. */
|
|
927
|
+
rorb_any* rorb_request_argument(rorb_request* request, size_t index);
|
|
928
|
+
/* The user exception of the last call; NULL if there was none. */
|
|
929
|
+
rorb_any* rorb_request_exception(rorb_request* request);
|
|
930
|
+
|
|
931
|
+
/* The request of a dispatch, whose arguments are in in (nothing read
|
|
932
|
+
from it yet, else INTERNAL). */
|
|
933
|
+
rorb_status rorb_server_request_new(rorb_in* in, const char* op, size_t len,
|
|
934
|
+
rorb_server_request** request, rorb_exception* exc);
|
|
935
|
+
void rorb_server_request_release(rorb_server_request* request);
|
|
936
|
+
/* Adds a parameter of type tc; then rorb_server_request_arguments reads
|
|
937
|
+
the in and inout ones (once, else BAD_INV_ORDER; arguments that do not
|
|
938
|
+
fit are MARSHAL). */
|
|
939
|
+
rorb_status rorb_server_request_add_param(rorb_server_request* request, const char* name,
|
|
940
|
+
size_t len, uint32_t flags, const rorb_typecode* tc,
|
|
941
|
+
rorb_exception* exc);
|
|
942
|
+
rorb_status rorb_server_request_arguments(rorb_server_request* request, rorb_exception* exc);
|
|
943
|
+
/* The value of parameter index; NULL for an out one not set, or past the
|
|
944
|
+
end. */
|
|
945
|
+
rorb_any* rorb_server_request_argument(rorb_server_request* request, size_t index);
|
|
946
|
+
/* Sets an out or inout value, of a type equivalent to the parameter's
|
|
947
|
+
(else BAD_PARAM). */
|
|
948
|
+
rorb_status rorb_server_request_set_argument(rorb_server_request* request, size_t index,
|
|
949
|
+
const rorb_any* value, rorb_exception* exc);
|
|
950
|
+
/* BAD_INV_ORDER before the arguments are read. */
|
|
951
|
+
rorb_status rorb_server_request_set_result(rorb_server_request* request, const rorb_any* value,
|
|
952
|
+
rorb_exception* exc);
|
|
953
|
+
/* value: an any of a user exception (else BAD_PARAM). */
|
|
954
|
+
rorb_status rorb_server_request_set_exception(rorb_server_request* request,
|
|
955
|
+
const rorb_any* value, rorb_exception* exc);
|
|
956
|
+
/* Writes the reply of the dispatch reply belongs to (once). A value that
|
|
957
|
+
does not fit its type, an out argument not set say, is BAD_PARAM: the
|
|
958
|
+
dispatch then replies with that exception. */
|
|
959
|
+
rorb_status rorb_server_request_reply(rorb_server_request* request, rorb_server_reply* reply,
|
|
960
|
+
rorb_exception* exc);
|
|
961
|
+
|
|
962
|
+
/* --- POA ------------------------------------------------------------------- */
|
|
963
|
+
|
|
964
|
+
/* Policy types (CORBA::PolicyType) and values (the IDL enumerators in
|
|
965
|
+
order, as in PortableServer.idl). */
|
|
966
|
+
#define RORB_THREAD_POLICY_ID 16
|
|
967
|
+
#define RORB_LIFESPAN_POLICY_ID 17
|
|
968
|
+
#define RORB_ID_UNIQUENESS_POLICY_ID 18
|
|
969
|
+
#define RORB_ID_ASSIGNMENT_POLICY_ID 19
|
|
970
|
+
#define RORB_IMPLICIT_ACTIVATION_POLICY_ID 20
|
|
971
|
+
#define RORB_SERVANT_RETENTION_POLICY_ID 21
|
|
972
|
+
#define RORB_REQUEST_PROCESSING_POLICY_ID 22
|
|
973
|
+
/* BiDirPolicy::BIDIRECTIONAL_POLICY_TYPE, for rorb_poa_create_poa: NORMAL 0,
|
|
974
|
+
BOTH 1 (bidirectional GIOP, docs/bidir-giop.md). */
|
|
975
|
+
#define RORB_BIDIRECTIONAL_POLICY_TYPE 37
|
|
976
|
+
|
|
977
|
+
typedef struct rorb_policy {
|
|
978
|
+
uint32_t type;
|
|
979
|
+
uint32_t value;
|
|
980
|
+
} rorb_policy;
|
|
981
|
+
|
|
982
|
+
rorb_poa* rorb_poa_clone(rorb_poa* poa);
|
|
983
|
+
void rorb_poa_release(rorb_poa* poa);
|
|
984
|
+
/* Valid while poa lives. */
|
|
985
|
+
const char* rorb_poa_name(rorb_poa* poa, size_t* len);
|
|
986
|
+
/* NULL for the RootPOA. */
|
|
987
|
+
rorb_poa* rorb_poa_parent(rorb_poa* poa);
|
|
988
|
+
void rorb_poa_children(rorb_poa* poa, void* context, void (*each)(void* context, rorb_poa* child));
|
|
989
|
+
rorb_poa_manager* rorb_poa_the_manager(rorb_poa* poa);
|
|
990
|
+
/* The seven policies of the POA, in the order of the policy ids. */
|
|
991
|
+
void rorb_poa_policies(rorb_poa* poa, rorb_policy policies[7]);
|
|
992
|
+
/* manager may be NULL for a new one. */
|
|
993
|
+
rorb_status rorb_poa_create_poa(rorb_poa* poa, const char* name, size_t len,
|
|
994
|
+
rorb_poa_manager* manager, const rorb_policy* policies,
|
|
995
|
+
size_t count, rorb_poa** child, rorb_exception* exc);
|
|
996
|
+
rorb_status rorb_poa_find_poa(rorb_poa* poa, const char* name, size_t len, int32_t activate_it,
|
|
997
|
+
rorb_poa** child, rorb_exception* exc);
|
|
998
|
+
rorb_status rorb_poa_destroy(rorb_poa* poa, int32_t etherealize, int32_t wait_for_completion,
|
|
999
|
+
rorb_exception* exc);
|
|
1000
|
+
rorb_status rorb_poa_activate_object(rorb_poa* poa, rorb_servant* servant, rorb_bytes* id,
|
|
1001
|
+
rorb_exception* exc);
|
|
1002
|
+
rorb_status rorb_poa_activate_object_with_id(rorb_poa* poa, const uint8_t* id, size_t len,
|
|
1003
|
+
rorb_servant* servant, rorb_exception* exc);
|
|
1004
|
+
rorb_status rorb_poa_deactivate_object(rorb_poa* poa, const uint8_t* id, size_t len,
|
|
1005
|
+
rorb_exception* exc);
|
|
1006
|
+
rorb_status rorb_poa_servant_to_id(rorb_poa* poa, rorb_servant* servant, rorb_bytes* id,
|
|
1007
|
+
rorb_exception* exc);
|
|
1008
|
+
rorb_status rorb_poa_servant_to_reference(rorb_poa* poa, rorb_servant* servant,
|
|
1009
|
+
rorb_object** obj, rorb_exception* exc);
|
|
1010
|
+
/* *self is a servant made with rorb_servant_get, with a reference added
|
|
1011
|
+
for the caller (vtable->add_ref). A servant of another kind is
|
|
1012
|
+
OBJ_ADAPTER. */
|
|
1013
|
+
rorb_status rorb_poa_id_to_servant(rorb_poa* poa, const uint8_t* id, size_t len, void** self,
|
|
1014
|
+
rorb_exception* exc);
|
|
1015
|
+
rorb_status rorb_poa_id_to_reference(rorb_poa* poa, const uint8_t* id, size_t len,
|
|
1016
|
+
rorb_object** obj, rorb_exception* exc);
|
|
1017
|
+
rorb_status rorb_poa_reference_to_id(rorb_poa* poa, rorb_object* obj, rorb_bytes* id,
|
|
1018
|
+
rorb_exception* exc);
|
|
1019
|
+
rorb_status rorb_poa_reference_to_servant(rorb_poa* poa, rorb_object* obj, void** self,
|
|
1020
|
+
rorb_exception* exc);
|
|
1021
|
+
rorb_status rorb_poa_create_reference(rorb_poa* poa, const char* intf, size_t len,
|
|
1022
|
+
rorb_object** obj, rorb_exception* exc);
|
|
1023
|
+
rorb_status rorb_poa_create_reference_with_id(rorb_poa* poa, const uint8_t* id, size_t id_len,
|
|
1024
|
+
const char* intf, size_t len, rorb_object** obj,
|
|
1025
|
+
rorb_exception* exc);
|
|
1026
|
+
/* The default servant (USE_DEFAULT_SERVANT). */
|
|
1027
|
+
rorb_status rorb_poa_get_servant(rorb_poa* poa, void** self, rorb_exception* exc);
|
|
1028
|
+
rorb_status rorb_poa_set_servant(rorb_poa* poa, rorb_servant* servant, rorb_exception* exc);
|
|
1029
|
+
|
|
1030
|
+
/* --- servant managers and adapter activators ------------------------------ */
|
|
1031
|
+
|
|
1032
|
+
/* What incarnate or preinvoke raised instead of providing a servant; only
|
|
1033
|
+
valid during the callback that receives it. */
|
|
1034
|
+
typedef struct rorb_manager_error rorb_manager_error;
|
|
1035
|
+
|
|
1036
|
+
/* PortableServer::ForwardRequest: the client is sent to obj (cloned). */
|
|
1037
|
+
void rorb_manager_error_forward(rorb_manager_error* error, rorb_object* obj);
|
|
1038
|
+
/* A system exception, returned to the client. */
|
|
1039
|
+
void rorb_manager_error_system(rorb_manager_error* error, const char* id, size_t len,
|
|
1040
|
+
uint32_t minor, uint32_t completed);
|
|
1041
|
+
|
|
1042
|
+
/* The callbacks of the objects below. self is the pointer given when
|
|
1043
|
+
setting it; like a servant, the POA calls add_ref when it takes self
|
|
1044
|
+
and remove_ref when it lets it go. They are called on upcall threads.
|
|
1045
|
+
|
|
1046
|
+
incarnate and preinvoke return RORB_OK with *servant set to a handle
|
|
1047
|
+
from rorb_servant_get (whose reference the POA takes over), or another
|
|
1048
|
+
status after rorb_manager_error_* (UNKNOWN when nothing was set). A
|
|
1049
|
+
NULL servant is OBJ_ADAPTER. The adapter handles are only valid during
|
|
1050
|
+
the callback (rorb_poa_clone keeps one). The servant given to
|
|
1051
|
+
etherealize and postinvoke is the self of a servant made with
|
|
1052
|
+
rorb_servant_get, valid during the callback without a reference added
|
|
1053
|
+
(NULL for a servant of another kind). etherealize and postinvoke may be
|
|
1054
|
+
NULL. */
|
|
1055
|
+
typedef struct rorb_servant_activator_vtable {
|
|
1056
|
+
rorb_status (*incarnate)(void* self, const uint8_t* id, size_t id_len, rorb_poa* adapter,
|
|
1057
|
+
rorb_servant** servant, rorb_manager_error* error);
|
|
1058
|
+
void (*etherealize)(void* self, const uint8_t* id, size_t id_len, rorb_poa* adapter,
|
|
1059
|
+
void* servant, int32_t cleanup_in_progress,
|
|
1060
|
+
int32_t remaining_activations);
|
|
1061
|
+
void (*add_ref)(void* self);
|
|
1062
|
+
void (*remove_ref)(void* self);
|
|
1063
|
+
} rorb_servant_activator_vtable;
|
|
1064
|
+
|
|
1065
|
+
typedef struct rorb_servant_locator_vtable {
|
|
1066
|
+
/* *cookie is passed to postinvoke as it is. */
|
|
1067
|
+
rorb_status (*preinvoke)(void* self, const uint8_t* id, size_t id_len, rorb_poa* adapter,
|
|
1068
|
+
const char* op, size_t op_len, rorb_servant** servant, void** cookie,
|
|
1069
|
+
rorb_manager_error* error);
|
|
1070
|
+
void (*postinvoke)(void* self, const uint8_t* id, size_t id_len, rorb_poa* adapter,
|
|
1071
|
+
const char* op, size_t op_len, void* cookie, void* servant);
|
|
1072
|
+
void (*add_ref)(void* self);
|
|
1073
|
+
void (*remove_ref)(void* self);
|
|
1074
|
+
} rorb_servant_locator_vtable;
|
|
1075
|
+
|
|
1076
|
+
typedef struct rorb_adapter_activator_vtable {
|
|
1077
|
+
/* Creates the child name of parent and returns 1, or returns 0. */
|
|
1078
|
+
int32_t (*unknown_adapter)(void* self, rorb_poa* parent, const char* name, size_t len);
|
|
1079
|
+
void (*add_ref)(void* self);
|
|
1080
|
+
void (*remove_ref)(void* self);
|
|
1081
|
+
} rorb_adapter_activator_vtable;
|
|
1082
|
+
|
|
1083
|
+
/* rorb_poa_get_servant_manager's *kind */
|
|
1084
|
+
#define RORB_NO_SERVANT_MANAGER 0
|
|
1085
|
+
#define RORB_SERVANT_ACTIVATOR 1
|
|
1086
|
+
#define RORB_SERVANT_LOCATOR 2
|
|
1087
|
+
|
|
1088
|
+
/* set_servant_manager (USE_SERVANT_MANAGER): an activator with RETAIN, a
|
|
1089
|
+
locator with NON_RETAIN. The vtables must outlive the POA. */
|
|
1090
|
+
rorb_status rorb_poa_set_servant_activator(rorb_poa* poa, void* self,
|
|
1091
|
+
const rorb_servant_activator_vtable* vtable,
|
|
1092
|
+
rorb_exception* exc);
|
|
1093
|
+
rorb_status rorb_poa_set_servant_locator(rorb_poa* poa, void* self,
|
|
1094
|
+
const rorb_servant_locator_vtable* vtable,
|
|
1095
|
+
rorb_exception* exc);
|
|
1096
|
+
/* *self is the manager given to set, with a reference added for the
|
|
1097
|
+
caller (add_ref), or NULL. */
|
|
1098
|
+
rorb_status rorb_poa_get_servant_manager(rorb_poa* poa, int32_t* kind, void** self,
|
|
1099
|
+
rorb_exception* exc);
|
|
1100
|
+
/* the_activator; self NULL removes it. */
|
|
1101
|
+
rorb_status rorb_poa_set_the_activator(rorb_poa* poa, void* self,
|
|
1102
|
+
const rorb_adapter_activator_vtable* vtable,
|
|
1103
|
+
rorb_exception* exc);
|
|
1104
|
+
/* The adapter activator given to set, with a reference added for the
|
|
1105
|
+
caller, or NULL. */
|
|
1106
|
+
void* rorb_poa_the_activator(rorb_poa* poa);
|
|
1107
|
+
|
|
1108
|
+
/* PortableServer::Current; outside a request RORB_NO_CONTEXT. */
|
|
1109
|
+
rorb_status rorb_current_get_poa(rorb_poa** poa, rorb_exception* exc);
|
|
1110
|
+
rorb_status rorb_current_get_object_id(rorb_bytes* id, rorb_exception* exc);
|
|
1111
|
+
rorb_status rorb_current_get_reference(rorb_object** obj, rorb_exception* exc);
|
|
1112
|
+
rorb_status rorb_current_get_servant(void** self, rorb_exception* exc);
|
|
1113
|
+
|
|
1114
|
+
/* POAManager::State */
|
|
1115
|
+
#define RORB_POA_MANAGER_HOLDING 0
|
|
1116
|
+
#define RORB_POA_MANAGER_ACTIVE 1
|
|
1117
|
+
#define RORB_POA_MANAGER_DISCARDING 2
|
|
1118
|
+
#define RORB_POA_MANAGER_INACTIVE 3
|
|
1119
|
+
|
|
1120
|
+
rorb_poa_manager* rorb_poa_manager_clone(rorb_poa_manager* manager);
|
|
1121
|
+
void rorb_poa_manager_release(rorb_poa_manager* manager);
|
|
1122
|
+
uint32_t rorb_poa_manager_get_state(rorb_poa_manager* manager);
|
|
1123
|
+
rorb_status rorb_poa_manager_activate(rorb_poa_manager* manager, rorb_exception* exc);
|
|
1124
|
+
rorb_status rorb_poa_manager_hold_requests(rorb_poa_manager* manager,
|
|
1125
|
+
int32_t wait_for_completion, rorb_exception* exc);
|
|
1126
|
+
rorb_status rorb_poa_manager_discard_requests(rorb_poa_manager* manager,
|
|
1127
|
+
int32_t wait_for_completion, rorb_exception* exc);
|
|
1128
|
+
rorb_status rorb_poa_manager_deactivate(rorb_poa_manager* manager, int32_t etherealize,
|
|
1129
|
+
int32_t wait_for_completion, rorb_exception* exc);
|
|
1130
|
+
/* POAManager::get_id. Valid while manager lives. */
|
|
1131
|
+
const char* rorb_poa_manager_get_id(rorb_poa_manager* manager, size_t* len);
|
|
1132
|
+
/* 1 if both handles are the same manager, else 0. */
|
|
1133
|
+
int32_t rorb_poa_manager_equal(rorb_poa_manager* a, rorb_poa_manager* b);
|
|
1134
|
+
|
|
1135
|
+
/* PortableServer::POAManagerFactory (CORBA 3), reached through any POA of
|
|
1136
|
+
the ORB (POA::the_POAManagerFactory). A manager exists until the last of
|
|
1137
|
+
its POAs is destroyed; create_poa with a manager that no longer exists
|
|
1138
|
+
raises OBJECT_NOT_EXIST. */
|
|
1139
|
+
/* create_POAManager: a new manager in the holding state.
|
|
1140
|
+
RORB_MANAGER_ALREADY_EXISTS if one with the id exists; RORB_POLICY_ERROR
|
|
1141
|
+
for any policy (UNSUPPORTED_POLICY 1 for a policy rustorb knows,
|
|
1142
|
+
BAD_POLICY 0 otherwise): none applies to POA managers. The policies are
|
|
1143
|
+
type and value pairs, as for rorb_orb_set_policy_overrides. */
|
|
1144
|
+
rorb_status rorb_poa_create_poa_manager(rorb_poa* poa, const char* id, size_t id_len,
|
|
1145
|
+
const uint32_t* types, const uint64_t* values,
|
|
1146
|
+
size_t count, rorb_poa_manager** manager,
|
|
1147
|
+
rorb_exception* exc);
|
|
1148
|
+
/* list: each manager that exists in the ORB, in the order of creation. */
|
|
1149
|
+
void rorb_poa_list_poa_managers(rorb_poa* poa, void* context,
|
|
1150
|
+
void (*each)(void* context, rorb_poa_manager* manager));
|
|
1151
|
+
/* find: *manager is NULL if no manager has the id. */
|
|
1152
|
+
rorb_status rorb_poa_find_poa_manager(rorb_poa* poa, const char* id, size_t id_len,
|
|
1153
|
+
rorb_poa_manager** manager, rorb_exception* exc);
|
|
1154
|
+
|
|
1155
|
+
/* --- Portable Interceptors and IOP::Codec ----------------------------------- */
|
|
1156
|
+
|
|
1157
|
+
/* docs/portable-interceptors.md. Interceptors and ORB initializers are the
|
|
1158
|
+
caller's objects behind a table of callbacks: like servant managers,
|
|
1159
|
+
the ORB calls add_ref when it takes self and remove_ref when it lets it
|
|
1160
|
+
go. The points are called on the thread of the call (client) or of the
|
|
1161
|
+
upcall (server), from any thread; the info handles they get are only
|
|
1162
|
+
valid during the callback and on its thread. A point returns RORB_OK,
|
|
1163
|
+
or another status after rorb_pi_error_* (UNKNOWN when nothing was
|
|
1164
|
+
set). Any point may be NULL (it does nothing), and so may destroy. */
|
|
1165
|
+
|
|
1166
|
+
typedef struct rorb_pi_error rorb_pi_error;
|
|
1167
|
+
typedef struct rorb_client_request_info rorb_client_request_info;
|
|
1168
|
+
typedef struct rorb_server_request_info rorb_server_request_info;
|
|
1169
|
+
typedef struct rorb_ior_info rorb_ior_info;
|
|
1170
|
+
typedef struct rorb_orb_init_info rorb_orb_init_info;
|
|
1171
|
+
typedef struct rorb_pi_current rorb_pi_current;
|
|
1172
|
+
typedef struct rorb_codec rorb_codec;
|
|
1173
|
+
|
|
1174
|
+
/* PortableInterceptor::ForwardRequest (obj is cloned): only in the points
|
|
1175
|
+
that may raise it; elsewhere it is BAD_INV_ORDER (minor 14). */
|
|
1176
|
+
void rorb_pi_error_forward(rorb_pi_error* error, rorb_object* obj);
|
|
1177
|
+
/* A system exception. */
|
|
1178
|
+
void rorb_pi_error_system(rorb_pi_error* error, const char* id, size_t len, uint32_t minor,
|
|
1179
|
+
uint32_t completed);
|
|
1180
|
+
|
|
1181
|
+
typedef struct rorb_client_interceptor_vtable {
|
|
1182
|
+
rorb_status (*send_request)(void* self, const rorb_client_request_info* ri,
|
|
1183
|
+
rorb_pi_error* error);
|
|
1184
|
+
rorb_status (*receive_reply)(void* self, const rorb_client_request_info* ri,
|
|
1185
|
+
rorb_pi_error* error);
|
|
1186
|
+
rorb_status (*receive_exception)(void* self, const rorb_client_request_info* ri,
|
|
1187
|
+
rorb_pi_error* error);
|
|
1188
|
+
rorb_status (*receive_other)(void* self, const rorb_client_request_info* ri,
|
|
1189
|
+
rorb_pi_error* error);
|
|
1190
|
+
void (*destroy)(void* self);
|
|
1191
|
+
void (*add_ref)(void* self);
|
|
1192
|
+
void (*remove_ref)(void* self);
|
|
1193
|
+
} rorb_client_interceptor_vtable;
|
|
1194
|
+
|
|
1195
|
+
typedef struct rorb_server_interceptor_vtable {
|
|
1196
|
+
rorb_status (*receive_request_service_contexts)(void* self, const rorb_server_request_info* ri,
|
|
1197
|
+
rorb_pi_error* error);
|
|
1198
|
+
rorb_status (*receive_request)(void* self, const rorb_server_request_info* ri,
|
|
1199
|
+
rorb_pi_error* error);
|
|
1200
|
+
rorb_status (*send_reply)(void* self, const rorb_server_request_info* ri,
|
|
1201
|
+
rorb_pi_error* error);
|
|
1202
|
+
rorb_status (*send_exception)(void* self, const rorb_server_request_info* ri,
|
|
1203
|
+
rorb_pi_error* error);
|
|
1204
|
+
rorb_status (*send_other)(void* self, const rorb_server_request_info* ri,
|
|
1205
|
+
rorb_pi_error* error);
|
|
1206
|
+
void (*destroy)(void* self);
|
|
1207
|
+
void (*add_ref)(void* self);
|
|
1208
|
+
void (*remove_ref)(void* self);
|
|
1209
|
+
} rorb_server_interceptor_vtable;
|
|
1210
|
+
|
|
1211
|
+
typedef struct rorb_ior_interceptor_vtable {
|
|
1212
|
+
rorb_status (*establish_components)(void* self, const rorb_ior_info* info,
|
|
1213
|
+
rorb_pi_error* error);
|
|
1214
|
+
void (*destroy)(void* self);
|
|
1215
|
+
void (*add_ref)(void* self);
|
|
1216
|
+
void (*remove_ref)(void* self);
|
|
1217
|
+
} rorb_ior_interceptor_vtable;
|
|
1218
|
+
|
|
1219
|
+
typedef struct rorb_orb_initializer_vtable {
|
|
1220
|
+
rorb_status (*pre_init)(void* self, rorb_orb_init_info* info, rorb_pi_error* error);
|
|
1221
|
+
rorb_status (*post_init)(void* self, rorb_orb_init_info* info, rorb_pi_error* error);
|
|
1222
|
+
void (*add_ref)(void* self);
|
|
1223
|
+
void (*remove_ref)(void* self);
|
|
1224
|
+
} rorb_orb_initializer_vtable;
|
|
1225
|
+
|
|
1226
|
+
typedef struct rorb_orb_initializer {
|
|
1227
|
+
void* self;
|
|
1228
|
+
const rorb_orb_initializer_vtable* vtable;
|
|
1229
|
+
} rorb_orb_initializer;
|
|
1230
|
+
|
|
1231
|
+
/* PortableInterceptor::register_orb_initializer: for every ORB created
|
|
1232
|
+
after it in the process. The vtable must outlive them. */
|
|
1233
|
+
void rorb_register_orb_initializer(void* self, const rorb_orb_initializer_vtable* vtable);
|
|
1234
|
+
/* rorb_orb_init with the ORB id (which -ORBid overrides) and initializers
|
|
1235
|
+
of this ORB only, run after the registered ones. A failing initializer
|
|
1236
|
+
fails the ORB with its exception. */
|
|
1237
|
+
rorb_status rorb_orb_init_pi(int* argc, char** argv, const char* orb_id, size_t orb_id_len,
|
|
1238
|
+
const rorb_orb_initializer* initializers, size_t count,
|
|
1239
|
+
rorb_orb** orb, rorb_exception* exc);
|
|
1240
|
+
|
|
1241
|
+
/* Called with each string of a list (valid during the call). */
|
|
1242
|
+
typedef void (*rorb_each_string)(void* context, const char* s, size_t len);
|
|
1243
|
+
/* Called with each tagged component of a list (valid during the call). */
|
|
1244
|
+
typedef void (*rorb_each_component)(void* context, uint32_t tag, const uint8_t* data,
|
|
1245
|
+
size_t len);
|
|
1246
|
+
/* Called with each parameter: an any the callee takes (release it), and
|
|
1247
|
+
the mode, 0 PARAM_IN, 1 PARAM_OUT, 2 PARAM_INOUT. */
|
|
1248
|
+
typedef void (*rorb_each_parameter)(void* context, rorb_any* argument, uint32_t mode);
|
|
1249
|
+
/* Called with each TypeCode, which the callee takes. */
|
|
1250
|
+
typedef void (*rorb_each_typecode)(void* context, rorb_typecode* tc);
|
|
1251
|
+
|
|
1252
|
+
/* ReplyStatus */
|
|
1253
|
+
#define RORB_PI_SUCCESSFUL 0
|
|
1254
|
+
#define RORB_PI_SYSTEM_EXCEPTION 1
|
|
1255
|
+
#define RORB_PI_USER_EXCEPTION 2
|
|
1256
|
+
#define RORB_PI_LOCATION_FORWARD 3
|
|
1257
|
+
#define RORB_PI_TRANSPORT_RETRY 4
|
|
1258
|
+
#define RORB_PI_UNKNOWN 5
|
|
1259
|
+
|
|
1260
|
+
/* RequestInfo, as rorb_cri_* (ClientRequestInfo) and rorb_sri_*
|
|
1261
|
+
(ServerRequestInfo). Strings returned as a pointer and *len point into
|
|
1262
|
+
the info. An attribute not available at the point is BAD_INV_ORDER
|
|
1263
|
+
(minor 14); arguments, exceptions and result are NO_RESOURCES (minor 1)
|
|
1264
|
+
but for the DII and the DSI. Service contexts that are not there are
|
|
1265
|
+
BAD_PARAM (minor 26). */
|
|
1266
|
+
uint32_t rorb_cri_request_id(const rorb_client_request_info* ri);
|
|
1267
|
+
const char* rorb_cri_operation(const rorb_client_request_info* ri, size_t* len);
|
|
1268
|
+
int32_t rorb_cri_response_expected(const rorb_client_request_info* ri);
|
|
1269
|
+
int16_t rorb_cri_sync_scope(const rorb_client_request_info* ri);
|
|
1270
|
+
rorb_status rorb_cri_reply_status(const rorb_client_request_info* ri, int16_t* status,
|
|
1271
|
+
rorb_exception* exc);
|
|
1272
|
+
rorb_status rorb_cri_forward_reference(const rorb_client_request_info* ri, rorb_object** obj,
|
|
1273
|
+
rorb_exception* exc);
|
|
1274
|
+
/* RORB_INVALID_SLOT for a slot not allocated. */
|
|
1275
|
+
rorb_status rorb_cri_get_slot(const rorb_client_request_info* ri, uint32_t id, rorb_any** any,
|
|
1276
|
+
rorb_exception* exc);
|
|
1277
|
+
rorb_status rorb_cri_get_request_service_context(const rorb_client_request_info* ri,
|
|
1278
|
+
uint32_t id, rorb_bytes* data,
|
|
1279
|
+
rorb_exception* exc);
|
|
1280
|
+
rorb_status rorb_cri_get_reply_service_context(const rorb_client_request_info* ri, uint32_t id,
|
|
1281
|
+
rorb_bytes* data, rorb_exception* exc);
|
|
1282
|
+
rorb_status rorb_cri_arguments(const rorb_client_request_info* ri, void* context,
|
|
1283
|
+
rorb_each_parameter each, rorb_exception* exc);
|
|
1284
|
+
rorb_status rorb_cri_exceptions(const rorb_client_request_info* ri, void* context,
|
|
1285
|
+
rorb_each_typecode each, rorb_exception* exc);
|
|
1286
|
+
rorb_status rorb_cri_result(const rorb_client_request_info* ri, rorb_any** any,
|
|
1287
|
+
rorb_exception* exc);
|
|
1288
|
+
rorb_object* rorb_cri_target(const rorb_client_request_info* ri);
|
|
1289
|
+
rorb_object* rorb_cri_effective_target(const rorb_client_request_info* ri);
|
|
1290
|
+
/* Returns the profile's tag; its data in *data. */
|
|
1291
|
+
uint32_t rorb_cri_effective_profile(const rorb_client_request_info* ri, rorb_bytes* data);
|
|
1292
|
+
rorb_status rorb_cri_received_exception(const rorb_client_request_info* ri, rorb_any** any,
|
|
1293
|
+
rorb_exception* exc);
|
|
1294
|
+
rorb_status rorb_cri_received_exception_id(const rorb_client_request_info* ri, rorb_bytes* id,
|
|
1295
|
+
rorb_exception* exc);
|
|
1296
|
+
/* BAD_PARAM (minor 28) when the effective profile has no such component. */
|
|
1297
|
+
rorb_status rorb_cri_get_effective_component(const rorb_client_request_info* ri, uint32_t tag,
|
|
1298
|
+
rorb_bytes* data, rorb_exception* exc);
|
|
1299
|
+
rorb_status rorb_cri_get_effective_components(const rorb_client_request_info* ri, uint32_t tag,
|
|
1300
|
+
void* context, rorb_each_component each,
|
|
1301
|
+
rorb_exception* exc);
|
|
1302
|
+
/* *found 1 with *raw_value set when a policy of the type is in effect;
|
|
1303
|
+
INV_POLICY (minor 2) for a type that is not a client policy. */
|
|
1304
|
+
rorb_status rorb_cri_get_request_policy(const rorb_client_request_info* ri, uint32_t type,
|
|
1305
|
+
int32_t* found, uint64_t* raw_value,
|
|
1306
|
+
rorb_exception* exc);
|
|
1307
|
+
/* Only in send_request; BAD_INV_ORDER (minor 15) for an id there already
|
|
1308
|
+
without replace, or one of the ORB's own (CodeSets, BI_DIR_IIOP). */
|
|
1309
|
+
rorb_status rorb_cri_add_request_service_context(const rorb_client_request_info* ri,
|
|
1310
|
+
uint32_t id, const uint8_t* data, size_t len,
|
|
1311
|
+
int32_t replace, rorb_exception* exc);
|
|
1312
|
+
|
|
1313
|
+
uint32_t rorb_sri_request_id(const rorb_server_request_info* ri);
|
|
1314
|
+
const char* rorb_sri_operation(const rorb_server_request_info* ri, size_t* len);
|
|
1315
|
+
int32_t rorb_sri_response_expected(const rorb_server_request_info* ri);
|
|
1316
|
+
int16_t rorb_sri_sync_scope(const rorb_server_request_info* ri);
|
|
1317
|
+
rorb_status rorb_sri_reply_status(const rorb_server_request_info* ri, int16_t* status,
|
|
1318
|
+
rorb_exception* exc);
|
|
1319
|
+
rorb_status rorb_sri_forward_reference(const rorb_server_request_info* ri, rorb_object** obj,
|
|
1320
|
+
rorb_exception* exc);
|
|
1321
|
+
rorb_status rorb_sri_get_slot(const rorb_server_request_info* ri, uint32_t id, rorb_any** any,
|
|
1322
|
+
rorb_exception* exc);
|
|
1323
|
+
/* The request scope slot, which the servant's thread then sees. */
|
|
1324
|
+
rorb_status rorb_sri_set_slot(const rorb_server_request_info* ri, uint32_t id,
|
|
1325
|
+
const rorb_any* any, rorb_exception* exc);
|
|
1326
|
+
rorb_status rorb_sri_get_request_service_context(const rorb_server_request_info* ri,
|
|
1327
|
+
uint32_t id, rorb_bytes* data,
|
|
1328
|
+
rorb_exception* exc);
|
|
1329
|
+
rorb_status rorb_sri_get_reply_service_context(const rorb_server_request_info* ri, uint32_t id,
|
|
1330
|
+
rorb_bytes* data, rorb_exception* exc);
|
|
1331
|
+
rorb_status rorb_sri_add_reply_service_context(const rorb_server_request_info* ri, uint32_t id,
|
|
1332
|
+
const uint8_t* data, size_t len,
|
|
1333
|
+
int32_t replace, rorb_exception* exc);
|
|
1334
|
+
rorb_status rorb_sri_arguments(const rorb_server_request_info* ri, void* context,
|
|
1335
|
+
rorb_each_parameter each, rorb_exception* exc);
|
|
1336
|
+
rorb_status rorb_sri_exceptions(const rorb_server_request_info* ri, void* context,
|
|
1337
|
+
rorb_each_typecode each, rorb_exception* exc);
|
|
1338
|
+
rorb_status rorb_sri_result(const rorb_server_request_info* ri, rorb_any** any,
|
|
1339
|
+
rorb_exception* exc);
|
|
1340
|
+
rorb_status rorb_sri_sending_exception(const rorb_server_request_info* ri, rorb_any** any,
|
|
1341
|
+
rorb_exception* exc);
|
|
1342
|
+
rorb_status rorb_sri_sending_exception_id(const rorb_server_request_info* ri, rorb_bytes* id,
|
|
1343
|
+
rorb_exception* exc);
|
|
1344
|
+
rorb_status rorb_sri_object_id(const rorb_server_request_info* ri, rorb_bytes* id,
|
|
1345
|
+
rorb_exception* exc);
|
|
1346
|
+
rorb_status rorb_sri_adapter_id(const rorb_server_request_info* ri, rorb_bytes* id,
|
|
1347
|
+
rorb_exception* exc);
|
|
1348
|
+
/* The names of the POAs from the RootPOA down. */
|
|
1349
|
+
rorb_status rorb_sri_adapter_name(const rorb_server_request_info* ri, void* context,
|
|
1350
|
+
rorb_each_string each, rorb_exception* exc);
|
|
1351
|
+
const char* rorb_sri_orb_id(const rorb_server_request_info* ri, size_t* len);
|
|
1352
|
+
const char* rorb_sri_server_id(const rorb_server_request_info* ri, size_t* len);
|
|
1353
|
+
rorb_status rorb_sri_target_most_derived_interface(const rorb_server_request_info* ri,
|
|
1354
|
+
rorb_bytes* id, rorb_exception* exc);
|
|
1355
|
+
rorb_status rorb_sri_target_is_a(const rorb_server_request_info* ri, const char* id, size_t len,
|
|
1356
|
+
int32_t* is_a, rorb_exception* exc);
|
|
1357
|
+
rorb_status rorb_sri_get_server_policy(const rorb_server_request_info* ri, uint32_t type,
|
|
1358
|
+
uint64_t* raw_value, rorb_exception* exc);
|
|
1359
|
+
|
|
1360
|
+
/* IORInfo */
|
|
1361
|
+
rorb_status rorb_ior_info_get_effective_policy(const rorb_ior_info* info, uint32_t type,
|
|
1362
|
+
uint64_t* raw_value, rorb_exception* exc);
|
|
1363
|
+
void rorb_ior_info_adapter_name(const rorb_ior_info* info, void* context, rorb_each_string each);
|
|
1364
|
+
void rorb_ior_info_add_ior_component(const rorb_ior_info* info, uint32_t tag,
|
|
1365
|
+
const uint8_t* data, size_t len);
|
|
1366
|
+
/* BAD_PARAM (minor 29) but for TAG_INTERNET_IOP (0). */
|
|
1367
|
+
rorb_status rorb_ior_info_add_ior_component_to_profile(const rorb_ior_info* info, uint32_t tag,
|
|
1368
|
+
const uint8_t* data, size_t len,
|
|
1369
|
+
uint32_t profile_id,
|
|
1370
|
+
rorb_exception* exc);
|
|
1371
|
+
|
|
1372
|
+
/* ORBInitInfo */
|
|
1373
|
+
void rorb_init_info_arguments(const rorb_orb_init_info* info, void* context,
|
|
1374
|
+
rorb_each_string each);
|
|
1375
|
+
const char* rorb_init_info_orb_id(const rorb_orb_init_info* info, size_t* len);
|
|
1376
|
+
/* The ORB being created; calls on it may not work yet. */
|
|
1377
|
+
rorb_orb* rorb_init_info_orb(const rorb_orb_init_info* info);
|
|
1378
|
+
rorb_status rorb_init_info_register_initial_reference(const rorb_orb_init_info* info,
|
|
1379
|
+
const char* name, size_t len,
|
|
1380
|
+
rorb_object* obj, rorb_exception* exc);
|
|
1381
|
+
/* Only in post_init (BAD_INV_ORDER in pre_init). */
|
|
1382
|
+
rorb_status rorb_init_info_resolve_initial_references(const rorb_orb_init_info* info,
|
|
1383
|
+
const char* name, size_t len,
|
|
1384
|
+
rorb_object** obj, rorb_exception* exc);
|
|
1385
|
+
/* RORB_DUPLICATE_NAME for a name (but "") already added. */
|
|
1386
|
+
rorb_status rorb_init_info_add_client_request_interceptor(
|
|
1387
|
+
rorb_orb_init_info* info, const char* name, size_t len, void* self,
|
|
1388
|
+
const rorb_client_interceptor_vtable* vtable, rorb_exception* exc);
|
|
1389
|
+
rorb_status rorb_init_info_add_server_request_interceptor(
|
|
1390
|
+
rorb_orb_init_info* info, const char* name, size_t len, void* self,
|
|
1391
|
+
const rorb_server_interceptor_vtable* vtable, rorb_exception* exc);
|
|
1392
|
+
rorb_status rorb_init_info_add_ior_interceptor(rorb_orb_init_info* info, const char* name,
|
|
1393
|
+
size_t len, void* self,
|
|
1394
|
+
const rorb_ior_interceptor_vtable* vtable,
|
|
1395
|
+
rorb_exception* exc);
|
|
1396
|
+
uint32_t rorb_init_info_allocate_slot_id(rorb_orb_init_info* info);
|
|
1397
|
+
/* PICurrent with the slots allocated so far. */
|
|
1398
|
+
rorb_pi_current* rorb_init_info_pi_current(const rorb_orb_init_info* info);
|
|
1399
|
+
rorb_status rorb_init_info_create_codec(const rorb_orb_init_info* info, int16_t format,
|
|
1400
|
+
uint8_t major, uint8_t minor, rorb_codec** codec,
|
|
1401
|
+
rorb_exception* exc);
|
|
1402
|
+
|
|
1403
|
+
/* PICurrent (resolve_initial_references("PICurrent")): the slots as the
|
|
1404
|
+
calling thread sees them. */
|
|
1405
|
+
rorb_pi_current* rorb_orb_pi_current(rorb_orb* orb);
|
|
1406
|
+
void rorb_pi_current_release(rorb_pi_current* current);
|
|
1407
|
+
rorb_status rorb_pi_current_get_slot(const rorb_pi_current* current, uint32_t id,
|
|
1408
|
+
rorb_any** any, rorb_exception* exc);
|
|
1409
|
+
rorb_status rorb_pi_current_set_slot(const rorb_pi_current* current, uint32_t id,
|
|
1410
|
+
const rorb_any* any, rorb_exception* exc);
|
|
1411
|
+
|
|
1412
|
+
/* IOP::Codec of CDR encapsulations (format 0, ENCODING_CDR_ENCAPS, 1.0 to
|
|
1413
|
+
1.2; RORB_UNKNOWN_ENCODING for others). Errors are RORB_CODEC_*. */
|
|
1414
|
+
#define RORB_ENCODING_CDR_ENCAPS 0
|
|
1415
|
+
rorb_status rorb_orb_create_codec(rorb_orb* orb, int16_t format, uint8_t major, uint8_t minor,
|
|
1416
|
+
rorb_codec** codec, rorb_exception* exc);
|
|
1417
|
+
void rorb_codec_release(rorb_codec* codec);
|
|
1418
|
+
/* encode, or encode_value when value_only is not 0. */
|
|
1419
|
+
rorb_status rorb_codec_encode(const rorb_codec* codec, const rorb_any* any, int32_t value_only,
|
|
1420
|
+
rorb_bytes* data, rorb_exception* exc);
|
|
1421
|
+
/* decode when tc is NULL, else decode_value of a value of type tc. */
|
|
1422
|
+
rorb_status rorb_codec_decode(const rorb_codec* codec, const uint8_t* data, size_t len,
|
|
1423
|
+
const rorb_typecode* tc, rorb_any** any, rorb_exception* exc);
|
|
1424
|
+
|
|
1425
|
+
#ifdef __cplusplus
|
|
1426
|
+
}
|
|
1427
|
+
#endif
|
|
1428
|
+
|
|
1429
|
+
#endif
|