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
data/lib/CosNamingC.rb
ADDED
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
#
|
|
3
|
+
# Generated by rustorb-idl from CosNaming.idl. Do not edit.
|
|
4
|
+
#
|
|
5
|
+
# This file is not covered by the license of rustorb-idl.
|
|
6
|
+
|
|
7
|
+
require "rustorb"
|
|
8
|
+
|
|
9
|
+
::Rustorb.check_generated_code(1)
|
|
10
|
+
|
|
11
|
+
module CosNaming
|
|
12
|
+
module Istring
|
|
13
|
+
ID = "IDL:omg.org/CosNaming/Istring:1.0"
|
|
14
|
+
|
|
15
|
+
def self._tc
|
|
16
|
+
::Rustorb.lazy_tc(self, ID, recursive: false) { ::CORBA::TypeCode.create_alias_tc(ID, "Istring", ::CORBA._tc_string) }
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
class NameComponent < ::CORBA::Portable::Struct
|
|
21
|
+
ID = "IDL:omg.org/CosNaming/NameComponent:1.0"
|
|
22
|
+
MEMBERS = ["id", "kind"].freeze
|
|
23
|
+
attr_accessor :id, :kind
|
|
24
|
+
|
|
25
|
+
def self._tc
|
|
26
|
+
::Rustorb.lazy_tc(self, ID) { ::CORBA::TypeCode.create_struct_tc(ID, "NameComponent", [["id", ::CosNaming::Istring._tc], ["kind", ::CosNaming::Istring._tc]]) }
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
::Rustorb.register_type(NameComponent)
|
|
30
|
+
|
|
31
|
+
module Name
|
|
32
|
+
ID = "IDL:omg.org/CosNaming/Name:1.0"
|
|
33
|
+
|
|
34
|
+
def self._tc
|
|
35
|
+
::Rustorb.lazy_tc(self, ID, recursive: false) { ::CORBA::TypeCode.create_alias_tc(ID, "Name", ::CORBA::TypeCode.create_sequence_tc(0, ::CosNaming::NameComponent._tc)) }
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
module BindingType
|
|
40
|
+
ID = "IDL:omg.org/CosNaming/BindingType:1.0"
|
|
41
|
+
Nobject = 0
|
|
42
|
+
Ncontext = 1
|
|
43
|
+
ENUMERATORS = ["nobject", "ncontext"].freeze
|
|
44
|
+
|
|
45
|
+
def self._tc
|
|
46
|
+
::Rustorb.lazy_tc(self, ID) { ::CORBA::TypeCode.create_enum_tc(ID, "BindingType", ENUMERATORS) }
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
Nobject = 0
|
|
50
|
+
Ncontext = 1
|
|
51
|
+
|
|
52
|
+
class Binding < ::CORBA::Portable::Struct
|
|
53
|
+
ID = "IDL:omg.org/CosNaming/Binding:1.0"
|
|
54
|
+
MEMBERS = ["binding_name", "binding_type"].freeze
|
|
55
|
+
attr_accessor :binding_name, :binding_type
|
|
56
|
+
|
|
57
|
+
def self._tc
|
|
58
|
+
::Rustorb.lazy_tc(self, ID) { ::CORBA::TypeCode.create_struct_tc(ID, "Binding", [["binding_name", ::CosNaming::Name._tc], ["binding_type", ::CosNaming::BindingType._tc]]) }
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
::Rustorb.register_type(Binding)
|
|
62
|
+
|
|
63
|
+
module BindingList
|
|
64
|
+
ID = "IDL:omg.org/CosNaming/BindingList:1.0"
|
|
65
|
+
|
|
66
|
+
def self._tc
|
|
67
|
+
::Rustorb.lazy_tc(self, ID, recursive: false) { ::CORBA::TypeCode.create_alias_tc(ID, "BindingList", ::CORBA::TypeCode.create_sequence_tc(0, ::CosNaming::Binding._tc)) }
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
# forward declaration of interface BindingIterator
|
|
72
|
+
|
|
73
|
+
module NamingContext
|
|
74
|
+
ID = "IDL:omg.org/CosNaming/NamingContext:1.0"
|
|
75
|
+
extend ::Rustorb::InterfaceModule
|
|
76
|
+
|
|
77
|
+
def self._tc
|
|
78
|
+
@_tc ||= ::CORBA::TypeCode.create_interface_tc(ID, "NamingContext")
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
module NotFoundReason
|
|
82
|
+
ID = "IDL:omg.org/CosNaming/NamingContext/NotFoundReason:1.0"
|
|
83
|
+
Missing_node = 0
|
|
84
|
+
Not_context = 1
|
|
85
|
+
Not_object = 2
|
|
86
|
+
ENUMERATORS = ["missing_node", "not_context", "not_object"].freeze
|
|
87
|
+
|
|
88
|
+
def self._tc
|
|
89
|
+
::Rustorb.lazy_tc(self, ID) { ::CORBA::TypeCode.create_enum_tc(ID, "NotFoundReason", ENUMERATORS) }
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
Missing_node = 0
|
|
93
|
+
Not_context = 1
|
|
94
|
+
Not_object = 2
|
|
95
|
+
|
|
96
|
+
class NotFound < ::CORBA::UserException
|
|
97
|
+
ID = "IDL:omg.org/CosNaming/NamingContext/NotFound:1.0"
|
|
98
|
+
MEMBERS = ["why", "rest_of_name"].freeze
|
|
99
|
+
attr_accessor :why, :rest_of_name
|
|
100
|
+
|
|
101
|
+
def self._tc
|
|
102
|
+
::Rustorb.lazy_tc(self, ID) { ::CORBA::TypeCode.create_exception_tc(ID, "NotFound", [["why", ::CosNaming::NamingContext::NotFoundReason._tc], ["rest_of_name", ::CosNaming::Name._tc]]) }
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
::Rustorb.register_type(NotFound)
|
|
106
|
+
|
|
107
|
+
class CannotProceed < ::CORBA::UserException
|
|
108
|
+
ID = "IDL:omg.org/CosNaming/NamingContext/CannotProceed:1.0"
|
|
109
|
+
MEMBERS = ["cxt", "rest_of_name"].freeze
|
|
110
|
+
attr_accessor :cxt, :rest_of_name
|
|
111
|
+
|
|
112
|
+
def self._tc
|
|
113
|
+
::Rustorb.lazy_tc(self, ID) { ::CORBA::TypeCode.create_exception_tc(ID, "CannotProceed", [["cxt", ::CosNaming::NamingContext._tc], ["rest_of_name", ::CosNaming::Name._tc]]) }
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
::Rustorb.register_type(CannotProceed)
|
|
117
|
+
|
|
118
|
+
class InvalidName < ::CORBA::UserException
|
|
119
|
+
ID = "IDL:omg.org/CosNaming/NamingContext/InvalidName:1.0"
|
|
120
|
+
MEMBERS = [].freeze
|
|
121
|
+
|
|
122
|
+
def self._tc
|
|
123
|
+
::Rustorb.lazy_tc(self, ID) { ::CORBA::TypeCode.create_exception_tc(ID, "InvalidName", []) }
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
::Rustorb.register_type(InvalidName)
|
|
127
|
+
|
|
128
|
+
class AlreadyBound < ::CORBA::UserException
|
|
129
|
+
ID = "IDL:omg.org/CosNaming/NamingContext/AlreadyBound:1.0"
|
|
130
|
+
MEMBERS = [].freeze
|
|
131
|
+
|
|
132
|
+
def self._tc
|
|
133
|
+
::Rustorb.lazy_tc(self, ID) { ::CORBA::TypeCode.create_exception_tc(ID, "AlreadyBound", []) }
|
|
134
|
+
end
|
|
135
|
+
end
|
|
136
|
+
::Rustorb.register_type(AlreadyBound)
|
|
137
|
+
|
|
138
|
+
class NotEmpty < ::CORBA::UserException
|
|
139
|
+
ID = "IDL:omg.org/CosNaming/NamingContext/NotEmpty:1.0"
|
|
140
|
+
MEMBERS = [].freeze
|
|
141
|
+
|
|
142
|
+
def self._tc
|
|
143
|
+
::Rustorb.lazy_tc(self, ID) { ::CORBA::TypeCode.create_exception_tc(ID, "NotEmpty", []) }
|
|
144
|
+
end
|
|
145
|
+
end
|
|
146
|
+
::Rustorb.register_type(NotEmpty)
|
|
147
|
+
|
|
148
|
+
def self._ops
|
|
149
|
+
@_ops ||= {
|
|
150
|
+
"bind" => ::Rustorb::Operation.new("bind", params: [[:in, ::CosNaming::Name._tc], [:in, ::CORBA._tc_Object]], exceptions: [::CosNaming::NamingContext::NotFound, ::CosNaming::NamingContext::CannotProceed, ::CosNaming::NamingContext::InvalidName, ::CosNaming::NamingContext::AlreadyBound]),
|
|
151
|
+
"rebind" => ::Rustorb::Operation.new("rebind", params: [[:in, ::CosNaming::Name._tc], [:in, ::CORBA._tc_Object]], exceptions: [::CosNaming::NamingContext::NotFound, ::CosNaming::NamingContext::CannotProceed, ::CosNaming::NamingContext::InvalidName]),
|
|
152
|
+
"bind_context" => ::Rustorb::Operation.new("bind_context", params: [[:in, ::CosNaming::Name._tc], [:in, ::CosNaming::NamingContext._tc]], exceptions: [::CosNaming::NamingContext::NotFound, ::CosNaming::NamingContext::CannotProceed, ::CosNaming::NamingContext::InvalidName, ::CosNaming::NamingContext::AlreadyBound]),
|
|
153
|
+
"rebind_context" => ::Rustorb::Operation.new("rebind_context", params: [[:in, ::CosNaming::Name._tc], [:in, ::CosNaming::NamingContext._tc]], exceptions: [::CosNaming::NamingContext::NotFound, ::CosNaming::NamingContext::CannotProceed, ::CosNaming::NamingContext::InvalidName]),
|
|
154
|
+
"resolve" => ::Rustorb::Operation.new("resolve", result: ::CORBA._tc_Object, params: [[:in, ::CosNaming::Name._tc]], exceptions: [::CosNaming::NamingContext::NotFound, ::CosNaming::NamingContext::CannotProceed, ::CosNaming::NamingContext::InvalidName]),
|
|
155
|
+
"unbind" => ::Rustorb::Operation.new("unbind", params: [[:in, ::CosNaming::Name._tc]], exceptions: [::CosNaming::NamingContext::NotFound, ::CosNaming::NamingContext::CannotProceed, ::CosNaming::NamingContext::InvalidName]),
|
|
156
|
+
"new_context" => ::Rustorb::Operation.new("new_context", result: ::CosNaming::NamingContext._tc),
|
|
157
|
+
"bind_new_context" => ::Rustorb::Operation.new("bind_new_context", result: ::CosNaming::NamingContext._tc, params: [[:in, ::CosNaming::Name._tc]], exceptions: [::CosNaming::NamingContext::NotFound, ::CosNaming::NamingContext::AlreadyBound, ::CosNaming::NamingContext::CannotProceed, ::CosNaming::NamingContext::InvalidName]),
|
|
158
|
+
"destroy" => ::Rustorb::Operation.new("destroy", exceptions: [::CosNaming::NamingContext::NotEmpty]),
|
|
159
|
+
"list" => ::Rustorb::Operation.new("list", params: [[:in, ::CORBA._tc_ulong], [:out, ::CosNaming::BindingList._tc], [:out, ::CosNaming::BindingIterator._tc]])
|
|
160
|
+
}.freeze
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
def bind(n, obj) = _invoke(::CosNaming::NamingContext._ops["bind"], [n, obj])
|
|
164
|
+
|
|
165
|
+
def rebind(n, obj) = _invoke(::CosNaming::NamingContext._ops["rebind"], [n, obj])
|
|
166
|
+
|
|
167
|
+
def bind_context(n, nc) = _invoke(::CosNaming::NamingContext._ops["bind_context"], [n, nc])
|
|
168
|
+
|
|
169
|
+
def rebind_context(n, nc) = _invoke(::CosNaming::NamingContext._ops["rebind_context"], [n, nc])
|
|
170
|
+
|
|
171
|
+
def resolve(n) = _invoke(::CosNaming::NamingContext._ops["resolve"], [n])
|
|
172
|
+
|
|
173
|
+
def unbind(n) = _invoke(::CosNaming::NamingContext._ops["unbind"], [n])
|
|
174
|
+
|
|
175
|
+
def new_context = _invoke(::CosNaming::NamingContext._ops["new_context"], [])
|
|
176
|
+
|
|
177
|
+
def bind_new_context(n) = _invoke(::CosNaming::NamingContext._ops["bind_new_context"], [n])
|
|
178
|
+
|
|
179
|
+
def destroy = _invoke(::CosNaming::NamingContext._ops["destroy"], [])
|
|
180
|
+
|
|
181
|
+
def list(how_many) = _invoke(::CosNaming::NamingContext._ops["list"], [how_many])
|
|
182
|
+
|
|
183
|
+
::Rustorb.stub_class(self)
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
module BindingIterator
|
|
187
|
+
ID = "IDL:omg.org/CosNaming/BindingIterator:1.0"
|
|
188
|
+
extend ::Rustorb::InterfaceModule
|
|
189
|
+
|
|
190
|
+
def self._tc
|
|
191
|
+
@_tc ||= ::CORBA::TypeCode.create_interface_tc(ID, "BindingIterator")
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
def self._ops
|
|
195
|
+
@_ops ||= {
|
|
196
|
+
"next_one" => ::Rustorb::Operation.new("next_one", result: ::CORBA._tc_boolean, params: [[:out, ::CosNaming::Binding._tc]]),
|
|
197
|
+
"next_n" => ::Rustorb::Operation.new("next_n", result: ::CORBA._tc_boolean, params: [[:in, ::CORBA._tc_ulong], [:out, ::CosNaming::BindingList._tc]]),
|
|
198
|
+
"destroy" => ::Rustorb::Operation.new("destroy")
|
|
199
|
+
}.freeze
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
def next_one = _invoke(::CosNaming::BindingIterator._ops["next_one"], [])
|
|
203
|
+
|
|
204
|
+
def next_n(how_many) = _invoke(::CosNaming::BindingIterator._ops["next_n"], [how_many])
|
|
205
|
+
|
|
206
|
+
def destroy = _invoke(::CosNaming::BindingIterator._ops["destroy"], [])
|
|
207
|
+
|
|
208
|
+
::Rustorb.stub_class(self)
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
module NamingContextExt
|
|
212
|
+
ID = "IDL:omg.org/CosNaming/NamingContextExt:1.0"
|
|
213
|
+
extend ::Rustorb::InterfaceModule
|
|
214
|
+
include ::CosNaming::NamingContext
|
|
215
|
+
|
|
216
|
+
def self._tc
|
|
217
|
+
@_tc ||= ::CORBA::TypeCode.create_interface_tc(ID, "NamingContextExt")
|
|
218
|
+
end
|
|
219
|
+
|
|
220
|
+
module StringName
|
|
221
|
+
ID = "IDL:omg.org/CosNaming/NamingContextExt/StringName:1.0"
|
|
222
|
+
|
|
223
|
+
def self._tc
|
|
224
|
+
::Rustorb.lazy_tc(self, ID, recursive: false) { ::CORBA::TypeCode.create_alias_tc(ID, "StringName", ::CORBA._tc_string) }
|
|
225
|
+
end
|
|
226
|
+
end
|
|
227
|
+
|
|
228
|
+
module Address
|
|
229
|
+
ID = "IDL:omg.org/CosNaming/NamingContextExt/Address:1.0"
|
|
230
|
+
|
|
231
|
+
def self._tc
|
|
232
|
+
::Rustorb.lazy_tc(self, ID, recursive: false) { ::CORBA::TypeCode.create_alias_tc(ID, "Address", ::CORBA._tc_string) }
|
|
233
|
+
end
|
|
234
|
+
end
|
|
235
|
+
|
|
236
|
+
module URLString
|
|
237
|
+
ID = "IDL:omg.org/CosNaming/NamingContextExt/URLString:1.0"
|
|
238
|
+
|
|
239
|
+
def self._tc
|
|
240
|
+
::Rustorb.lazy_tc(self, ID, recursive: false) { ::CORBA::TypeCode.create_alias_tc(ID, "URLString", ::CORBA._tc_string) }
|
|
241
|
+
end
|
|
242
|
+
end
|
|
243
|
+
|
|
244
|
+
class InvalidAddress < ::CORBA::UserException
|
|
245
|
+
ID = "IDL:omg.org/CosNaming/NamingContextExt/InvalidAddress:1.0"
|
|
246
|
+
MEMBERS = [].freeze
|
|
247
|
+
|
|
248
|
+
def self._tc
|
|
249
|
+
::Rustorb.lazy_tc(self, ID) { ::CORBA::TypeCode.create_exception_tc(ID, "InvalidAddress", []) }
|
|
250
|
+
end
|
|
251
|
+
end
|
|
252
|
+
::Rustorb.register_type(InvalidAddress)
|
|
253
|
+
|
|
254
|
+
def self._ops
|
|
255
|
+
@_ops ||= {
|
|
256
|
+
"to_string" => ::Rustorb::Operation.new("to_string", result: ::CosNaming::NamingContextExt::StringName._tc, params: [[:in, ::CosNaming::Name._tc]], exceptions: [::CosNaming::NamingContext::InvalidName]),
|
|
257
|
+
"to_name" => ::Rustorb::Operation.new("to_name", result: ::CosNaming::Name._tc, params: [[:in, ::CosNaming::NamingContextExt::StringName._tc]], exceptions: [::CosNaming::NamingContext::InvalidName]),
|
|
258
|
+
"to_url" => ::Rustorb::Operation.new("to_url", result: ::CosNaming::NamingContextExt::URLString._tc, params: [[:in, ::CosNaming::NamingContextExt::Address._tc], [:in, ::CosNaming::NamingContextExt::StringName._tc]], exceptions: [::CosNaming::NamingContextExt::InvalidAddress, ::CosNaming::NamingContext::InvalidName]),
|
|
259
|
+
"resolve_str" => ::Rustorb::Operation.new("resolve_str", result: ::CORBA._tc_Object, params: [[:in, ::CosNaming::NamingContextExt::StringName._tc]], exceptions: [::CosNaming::NamingContext::NotFound, ::CosNaming::NamingContext::CannotProceed, ::CosNaming::NamingContext::InvalidName])
|
|
260
|
+
}.freeze
|
|
261
|
+
end
|
|
262
|
+
|
|
263
|
+
def to_string(n) = _invoke(::CosNaming::NamingContextExt._ops["to_string"], [n])
|
|
264
|
+
|
|
265
|
+
def to_name(sn) = _invoke(::CosNaming::NamingContextExt._ops["to_name"], [sn])
|
|
266
|
+
|
|
267
|
+
def to_url(addr, sn) = _invoke(::CosNaming::NamingContextExt._ops["to_url"], [addr, sn])
|
|
268
|
+
|
|
269
|
+
def resolve_str(n) = _invoke(::CosNaming::NamingContextExt._ops["resolve_str"], [n])
|
|
270
|
+
|
|
271
|
+
::Rustorb.stub_class(self)
|
|
272
|
+
end
|
|
273
|
+
|
|
274
|
+
end
|
|
275
|
+
|
data/lib/CosNamingS.rb
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
#
|
|
3
|
+
# Generated by rustorb-idl from CosNaming.idl. Do not edit.
|
|
4
|
+
#
|
|
5
|
+
# This file is not covered by the license of rustorb-idl.
|
|
6
|
+
|
|
7
|
+
require_relative "CosNamingC"
|
|
8
|
+
|
|
9
|
+
module POA
|
|
10
|
+
module CosNaming
|
|
11
|
+
class NamingContext < ::PortableServer::Servant
|
|
12
|
+
IDS = ["IDL:omg.org/CosNaming/NamingContext:1.0"].freeze
|
|
13
|
+
|
|
14
|
+
def self._operations
|
|
15
|
+
@_operations ||= {
|
|
16
|
+
"bind" => [:bind, ::CosNaming::NamingContext._ops["bind"]],
|
|
17
|
+
"rebind" => [:rebind, ::CosNaming::NamingContext._ops["rebind"]],
|
|
18
|
+
"bind_context" => [:bind_context, ::CosNaming::NamingContext._ops["bind_context"]],
|
|
19
|
+
"rebind_context" => [:rebind_context, ::CosNaming::NamingContext._ops["rebind_context"]],
|
|
20
|
+
"resolve" => [:resolve, ::CosNaming::NamingContext._ops["resolve"]],
|
|
21
|
+
"unbind" => [:unbind, ::CosNaming::NamingContext._ops["unbind"]],
|
|
22
|
+
"new_context" => [:new_context, ::CosNaming::NamingContext._ops["new_context"]],
|
|
23
|
+
"bind_new_context" => [:bind_new_context, ::CosNaming::NamingContext._ops["bind_new_context"]],
|
|
24
|
+
"destroy" => [:destroy, ::CosNaming::NamingContext._ops["destroy"]],
|
|
25
|
+
"list" => [:list, ::CosNaming::NamingContext._ops["list"]]
|
|
26
|
+
}.freeze
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
module POA
|
|
33
|
+
module CosNaming
|
|
34
|
+
class BindingIterator < ::PortableServer::Servant
|
|
35
|
+
IDS = ["IDL:omg.org/CosNaming/BindingIterator:1.0"].freeze
|
|
36
|
+
|
|
37
|
+
def self._operations
|
|
38
|
+
@_operations ||= {
|
|
39
|
+
"next_one" => [:next_one, ::CosNaming::BindingIterator._ops["next_one"]],
|
|
40
|
+
"next_n" => [:next_n, ::CosNaming::BindingIterator._ops["next_n"]],
|
|
41
|
+
"destroy" => [:destroy, ::CosNaming::BindingIterator._ops["destroy"]]
|
|
42
|
+
}.freeze
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
module POA
|
|
49
|
+
module CosNaming
|
|
50
|
+
class NamingContextExt < ::PortableServer::Servant
|
|
51
|
+
IDS = ["IDL:omg.org/CosNaming/NamingContextExt:1.0", "IDL:omg.org/CosNaming/NamingContext:1.0"].freeze
|
|
52
|
+
|
|
53
|
+
def self._operations
|
|
54
|
+
@_operations ||= {
|
|
55
|
+
"to_string" => [:to_string, ::CosNaming::NamingContextExt._ops["to_string"]],
|
|
56
|
+
"to_name" => [:to_name, ::CosNaming::NamingContextExt._ops["to_name"]],
|
|
57
|
+
"to_url" => [:to_url, ::CosNaming::NamingContextExt._ops["to_url"]],
|
|
58
|
+
"resolve_str" => [:resolve_str, ::CosNaming::NamingContextExt._ops["resolve_str"]],
|
|
59
|
+
"bind" => [:bind, ::CosNaming::NamingContext._ops["bind"]],
|
|
60
|
+
"rebind" => [:rebind, ::CosNaming::NamingContext._ops["rebind"]],
|
|
61
|
+
"bind_context" => [:bind_context, ::CosNaming::NamingContext._ops["bind_context"]],
|
|
62
|
+
"rebind_context" => [:rebind_context, ::CosNaming::NamingContext._ops["rebind_context"]],
|
|
63
|
+
"resolve" => [:resolve, ::CosNaming::NamingContext._ops["resolve"]],
|
|
64
|
+
"unbind" => [:unbind, ::CosNaming::NamingContext._ops["unbind"]],
|
|
65
|
+
"new_context" => [:new_context, ::CosNaming::NamingContext._ops["new_context"]],
|
|
66
|
+
"bind_new_context" => [:bind_new_context, ::CosNaming::NamingContext._ops["bind_new_context"]],
|
|
67
|
+
"destroy" => [:destroy, ::CosNaming::NamingContext._ops["destroy"]],
|
|
68
|
+
"list" => [:list, ::CosNaming::NamingContext._ops["list"]]
|
|
69
|
+
}.freeze
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
|
data/lib/corba.rb
ADDED
data/lib/rustorb/dii.rb
ADDED
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# The DII and the DSI: CORBA::NamedValue, NVList, Request and ServerRequest,
|
|
4
|
+
# and PortableServer::DynamicImplementation, on Rustorb::Native::Request
|
|
5
|
+
# and ServerRequest (rorb_request / rorb_server_request). Values are
|
|
6
|
+
# CORBA::Any. See docs/dii-dsi.md and docs/ruby-binding.md.
|
|
7
|
+
#
|
|
8
|
+
# Licensed under MIT OR Apache-2.0, like the rest of the rustorb core.
|
|
9
|
+
|
|
10
|
+
module CORBA
|
|
11
|
+
ARG_IN = 1
|
|
12
|
+
ARG_OUT = 2
|
|
13
|
+
ARG_INOUT = 3
|
|
14
|
+
|
|
15
|
+
# An argument: its name, value (argument, a CORBA::Any; for an out one
|
|
16
|
+
# only its type before the call) and mode (arg_modes, ARG_IN...).
|
|
17
|
+
class NamedValue
|
|
18
|
+
attr_accessor :name, :argument, :arg_modes
|
|
19
|
+
|
|
20
|
+
def initialize(name, argument, arg_modes)
|
|
21
|
+
@name = name
|
|
22
|
+
@argument = argument
|
|
23
|
+
@arg_modes = arg_modes
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def inspect = "#<CORBA::NamedValue #{@name.inspect} #{@argument.inspect} #{@arg_modes}>"
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
class Bounds < UserException
|
|
30
|
+
ID = "IDL:omg.org/CORBA/Bounds:1.0"
|
|
31
|
+
MEMBERS = [].freeze
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# A list of named values.
|
|
35
|
+
class NVList
|
|
36
|
+
include Enumerable
|
|
37
|
+
|
|
38
|
+
def initialize(items = [])
|
|
39
|
+
@items = items.to_a
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def count = @items.size
|
|
43
|
+
alias size count
|
|
44
|
+
alias length count
|
|
45
|
+
|
|
46
|
+
def add(flags) = add_item("", flags)
|
|
47
|
+
|
|
48
|
+
def add_item(item_name, flags)
|
|
49
|
+
add_value(item_name, CORBA::Any.to_any(nil, CORBA._tc_null), flags)
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def add_value(item_name, value, flags)
|
|
53
|
+
nv = NamedValue.new(item_name, value, flags)
|
|
54
|
+
@items << nv
|
|
55
|
+
nv
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def item(index)
|
|
59
|
+
raise Bounds unless index.between?(0, @items.size - 1)
|
|
60
|
+
|
|
61
|
+
@items[index]
|
|
62
|
+
end
|
|
63
|
+
alias [] item
|
|
64
|
+
|
|
65
|
+
def remove(index)
|
|
66
|
+
raise Bounds unless index.between?(0, @items.size - 1)
|
|
67
|
+
|
|
68
|
+
@items.delete_at(index)
|
|
69
|
+
nil
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def each(&block)
|
|
73
|
+
@items.each(&block)
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
def _check_modes
|
|
77
|
+
@items.each do |nv|
|
|
78
|
+
unless [ARG_IN, ARG_OUT, ARG_INOUT].include?(nv.arg_modes & 3)
|
|
79
|
+
raise BAD_PARAM.new("bad arg_modes #{nv.arg_modes}", 0, COMPLETED_NO)
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
class ORB
|
|
86
|
+
def create_list(_count = 0) = NVList.new
|
|
87
|
+
def create_named_value(name, value, flags) = NamedValue.new(name, value, flags)
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
# A call built at run time, from obj._request(operation) or
|
|
91
|
+
# obj._create_request(ctx, operation, arg_list, result).
|
|
92
|
+
#
|
|
93
|
+
# Arguments are added with add_in_arg(any), add_inout_arg(any) and
|
|
94
|
+
# add_out_arg(tc), or are the NVList given to _create_request;
|
|
95
|
+
# set_return_type(tc) gives the result type (void by default) and
|
|
96
|
+
# add_exception(tc) the user exceptions it may raise. After invoke (or
|
|
97
|
+
# send_deferred and get_response) the out and inout arguments hold the
|
|
98
|
+
# values sent back and return_value the result. A listed user exception
|
|
99
|
+
# is raised; an unlisted one is UNKNOWN.
|
|
100
|
+
class Request
|
|
101
|
+
attr_reader :target, :operation, :arguments, :result
|
|
102
|
+
|
|
103
|
+
def initialize(target, operation, arguments = nil, result = nil, exceptions = [])
|
|
104
|
+
@target = target
|
|
105
|
+
@operation = operation
|
|
106
|
+
@arguments = arguments || NVList.new
|
|
107
|
+
@result = result || NamedValue.new("", CORBA::Any.to_any(nil, CORBA._tc_void), 0)
|
|
108
|
+
@exceptions = exceptions.to_a.dup
|
|
109
|
+
@timeout = nil
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
def exceptions = @exceptions.dup
|
|
113
|
+
def ctx(*) = raise(NO_IMPLEMENT.new("contexts", 0, COMPLETED_NO))
|
|
114
|
+
alias contexts ctx
|
|
115
|
+
|
|
116
|
+
def add_in_arg(value, name = "") = @arguments.add_value(name, value, ARG_IN)
|
|
117
|
+
def add_inout_arg(value, name = "") = @arguments.add_value(name, value, ARG_INOUT)
|
|
118
|
+
def add_out_arg(tc, name = "") = @arguments.add_value(name, CORBA::Any.to_any(nil, tc), ARG_OUT)
|
|
119
|
+
|
|
120
|
+
def set_return_type(tc)
|
|
121
|
+
@result.argument = CORBA::Any.to_any(nil, tc)
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
def add_exception(tc) = @exceptions << tc
|
|
125
|
+
def return_value = @result.argument
|
|
126
|
+
|
|
127
|
+
# The call timeout in seconds (rustorb), nil for the policies'.
|
|
128
|
+
def _timeout=(seconds)
|
|
129
|
+
@timeout = seconds
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
def invoke(_invoke_flags = 0)
|
|
133
|
+
n = _new_native
|
|
134
|
+
_collect(n, n.invoke)
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
def send_oneway
|
|
138
|
+
_new_native.send_oneway
|
|
139
|
+
nil
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
def send_deferred
|
|
143
|
+
_new_native.send_deferred
|
|
144
|
+
nil
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
def send(_invoke_flags = 0) = send_deferred
|
|
148
|
+
|
|
149
|
+
def poll_response
|
|
150
|
+
raise BAD_INV_ORDER.new("nothing sent deferred", 0, COMPLETED_NO) unless @native
|
|
151
|
+
|
|
152
|
+
@native.poll_response
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
def get_response(_response_flags = 0)
|
|
156
|
+
raise BAD_INV_ORDER.new("nothing sent deferred", 0, COMPLETED_NO) unless @native
|
|
157
|
+
|
|
158
|
+
_collect(@native, @native.get_response)
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
private
|
|
162
|
+
|
|
163
|
+
def self._native_any(any)
|
|
164
|
+
raise BAD_PARAM.new("a CORBA::Any expected, got #{any.inspect}", 0, COMPLETED_NO) unless any.is_a?(CORBA::Any)
|
|
165
|
+
|
|
166
|
+
any._native
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
# A new native request for each call: the arguments may change.
|
|
170
|
+
def _new_native
|
|
171
|
+
@arguments._check_modes
|
|
172
|
+
n = Rustorb::Native::Request.create(@target._native_ref, @operation)
|
|
173
|
+
@arguments.each do |nv|
|
|
174
|
+
mode = nv.arg_modes & 3
|
|
175
|
+
native = if mode == ARG_OUT
|
|
176
|
+
tc = nv.argument.is_a?(CORBA::TypeCode) ? nv.argument : nv.argument._tc
|
|
177
|
+
Rustorb::Native::Any.typed(tc.resolve.native)
|
|
178
|
+
else
|
|
179
|
+
Request._native_any(nv.argument)
|
|
180
|
+
end
|
|
181
|
+
n.add_arg(nv.name.to_s, mode, native)
|
|
182
|
+
end
|
|
183
|
+
rt = @result.argument._tc
|
|
184
|
+
n.set_return_type(rt.resolve.native) unless rt.unaliased.kind == TK_VOID
|
|
185
|
+
@exceptions.each { |tc| n.add_exception(tc.resolve.native) }
|
|
186
|
+
n.set_timeout(@timeout ? (@timeout * 1_000_000).round : -1)
|
|
187
|
+
@native = n
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
def _collect(n, ok)
|
|
191
|
+
unless ok
|
|
192
|
+
any = CORBA::Any._from_native(n.exception)
|
|
193
|
+
e = any.value
|
|
194
|
+
raise e if e.is_a?(::Exception)
|
|
195
|
+
|
|
196
|
+
raise UNKNOWN.new("user exception #{any._tc.id}", 0x4f4d0001, COMPLETED_YES)
|
|
197
|
+
end
|
|
198
|
+
@arguments.each_with_index do |nv, i|
|
|
199
|
+
next if nv.arg_modes & 3 == ARG_IN
|
|
200
|
+
|
|
201
|
+
raw = n.argument(i)
|
|
202
|
+
nv.argument = CORBA::Any._from_native(raw) if raw
|
|
203
|
+
end
|
|
204
|
+
rt = @result.argument._tc
|
|
205
|
+
unless rt.unaliased.kind == TK_VOID
|
|
206
|
+
raw = n.result
|
|
207
|
+
@result.argument = CORBA::Any._from_native(raw) if raw
|
|
208
|
+
end
|
|
209
|
+
nil
|
|
210
|
+
end
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
class Object
|
|
214
|
+
def _request(operation) = Request.new(self, operation)
|
|
215
|
+
|
|
216
|
+
def _create_request(_ctx, operation, arg_list, result, exceptions = [], _ctxlist = nil)
|
|
217
|
+
Request.new(self, operation, arg_list, result, exceptions)
|
|
218
|
+
end
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
# A request to a PortableServer::DynamicImplementation, given to its
|
|
222
|
+
# invoke. arguments(nvlist) reads the in and inout arguments into the
|
|
223
|
+
# NVList, whose TypeCodes and modes describe the parameters (the values
|
|
224
|
+
# of its anys are not looked at). The servant then sets the argument of
|
|
225
|
+
# the out and inout items and calls set_result(any) or set_exception(any)
|
|
226
|
+
# (an any of a user exception). A system exception it raises is the
|
|
227
|
+
# reply.
|
|
228
|
+
class ServerRequest
|
|
229
|
+
def initialize(native, operation)
|
|
230
|
+
@native = native
|
|
231
|
+
@operation = operation
|
|
232
|
+
@params = nil
|
|
233
|
+
@raised = false
|
|
234
|
+
end
|
|
235
|
+
|
|
236
|
+
attr_reader :operation
|
|
237
|
+
alias op_name operation
|
|
238
|
+
|
|
239
|
+
def arguments(nvlist)
|
|
240
|
+
raise BAD_INV_ORDER.new("arguments already read", 0, COMPLETED_NO) if @params
|
|
241
|
+
|
|
242
|
+
nvlist._check_modes
|
|
243
|
+
nvlist.each do |nv|
|
|
244
|
+
tc = nv.argument.is_a?(CORBA::TypeCode) ? nv.argument : nv.argument._tc
|
|
245
|
+
@native.add_param(nv.name.to_s, nv.arg_modes & 3, tc.resolve.native)
|
|
246
|
+
end
|
|
247
|
+
@native.arguments
|
|
248
|
+
@unset = []
|
|
249
|
+
nvlist.each_with_index do |nv, i|
|
|
250
|
+
raw = nv.arg_modes & 3 == ARG_OUT ? nil : @native.argument(i)
|
|
251
|
+
nv.argument = CORBA::Any._from_native(raw) if raw
|
|
252
|
+
@unset << (raw ? nil : nv.argument)
|
|
253
|
+
end
|
|
254
|
+
@params = nvlist
|
|
255
|
+
nvlist
|
|
256
|
+
end
|
|
257
|
+
alias params arguments
|
|
258
|
+
|
|
259
|
+
def set_result(value)
|
|
260
|
+
@native.set_result(Request._native_any(value))
|
|
261
|
+
end
|
|
262
|
+
alias result= set_result
|
|
263
|
+
|
|
264
|
+
def set_exception(value)
|
|
265
|
+
@native.set_exception(Request._native_any(value))
|
|
266
|
+
@raised = true
|
|
267
|
+
end
|
|
268
|
+
alias except= set_exception
|
|
269
|
+
|
|
270
|
+
def ctx = raise(NO_IMPLEMENT.new("contexts", 0, COMPLETED_NO))
|
|
271
|
+
|
|
272
|
+
# The out and inout values the servant set, then the reply.
|
|
273
|
+
def _reply(reply)
|
|
274
|
+
if @params && !@raised
|
|
275
|
+
@params.each_with_index do |nv, i|
|
|
276
|
+
next if nv.arg_modes & 3 == ARG_IN || nv.argument.equal?(@unset[i])
|
|
277
|
+
|
|
278
|
+
@native.set_argument(i, Request._native_any(nv.argument))
|
|
279
|
+
end
|
|
280
|
+
end
|
|
281
|
+
@native.reply(reply)
|
|
282
|
+
end
|
|
283
|
+
end
|
|
284
|
+
end
|
|
285
|
+
|
|
286
|
+
module PortableServer
|
|
287
|
+
# A servant that gets every request as a CORBA::ServerRequest (the DSI):
|
|
288
|
+
# subclasses define invoke(request) and _primary_interface(oid, poa).
|
|
289
|
+
# The ORB answers _is_a with _primary_interface(nil, nil), asked when the
|
|
290
|
+
# servant is first activated (as the C and Python bindings do), or with
|
|
291
|
+
# the class's IDS when it has them.
|
|
292
|
+
class DynamicImplementation < Servant
|
|
293
|
+
def invoke(_request)
|
|
294
|
+
raise CORBA::NO_IMPLEMENT.new("#{self.class}#invoke", 0, CORBA::COMPLETED_NO)
|
|
295
|
+
end
|
|
296
|
+
|
|
297
|
+
def _primary_interface(_oid, _poa)
|
|
298
|
+
raise CORBA::NO_IMPLEMENT.new("#{self.class}#_primary_interface", 0, CORBA::COMPLETED_NO)
|
|
299
|
+
end
|
|
300
|
+
|
|
301
|
+
def _ids
|
|
302
|
+
return self.class::IDS unless self.class::IDS.empty?
|
|
303
|
+
|
|
304
|
+
[_primary_interface(nil, nil)]
|
|
305
|
+
end
|
|
306
|
+
|
|
307
|
+
def _is_a?(id)
|
|
308
|
+
_ids.include?(id) || id == "IDL:omg.org/CORBA/Object:1.0"
|
|
309
|
+
end
|
|
310
|
+
|
|
311
|
+
def _repository_id = _ids.first
|
|
312
|
+
|
|
313
|
+
def _servant_ref
|
|
314
|
+
PortableServer.ensure_dispatchers
|
|
315
|
+
@__rustorb_servant_ref ||= Rustorb::Native.servant_ref(self, _ids)
|
|
316
|
+
end
|
|
317
|
+
|
|
318
|
+
def _narrow_ref(ref)
|
|
319
|
+
mod = Rustorb.find_interface(_ids.first)
|
|
320
|
+
mod ? mod::Stub._from_ref(ref) : CORBA::Object._from_ref(ref)
|
|
321
|
+
end
|
|
322
|
+
|
|
323
|
+
def _rustorb_dispatch(op_name, inp, reply)
|
|
324
|
+
begin
|
|
325
|
+
req = CORBA::ServerRequest.new(Rustorb::Native::ServerRequest.create(inp, op_name), op_name)
|
|
326
|
+
invoke(req)
|
|
327
|
+
req._reply(reply)
|
|
328
|
+
true
|
|
329
|
+
rescue CORBA::SystemException => e
|
|
330
|
+
_system_reply(reply, e)
|
|
331
|
+
end
|
|
332
|
+
rescue StandardError, ScriptError => e
|
|
333
|
+
warn "rustorb: #{self.class}#invoke raised #{e.class}: #{e.message}" if $VERBOSE
|
|
334
|
+
_system_reply(reply, CORBA::UNKNOWN.new(e.message, 0, CORBA::COMPLETED_MAYBE))
|
|
335
|
+
end
|
|
336
|
+
end
|
|
337
|
+
end
|