-
Notifications
You must be signed in to change notification settings - Fork 2
/
clorb-iiop.lisp
640 lines (501 loc) · 21.2 KB
/
clorb-iiop.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
;;; clorb-iiop.lisp --- IIOP implementation
(in-package :clorb)
(defconstant +iiop-header-size+ 12)
;;;; GIOP Module
(define-enum GIOP:MsgType_1_0
:id "IDL:omg.org/GIOP/MsgType_1_0:1.0"
:name "MsgType_1_0"
:members ("Request" "Reply" "CancelRequest" "LocateRequest" "LocateReply"
"CloseConnection" "MessageError"))
(DEFINE-ENUM GIOP:MSGTYPE_1_1
:ID "IDL:omg.org/GIOP/MsgType_1_1:1.0"
:NAME "MsgType_1_1"
:MEMBERS ("Request" "Reply" "CancelRequest" "LocateRequest" "LocateReply"
"CloseConnection" "MessageError" "Fragment"))
(DEFINE-STRUCT GIOP:VERSION
:id "IDL:omg.org/GIOP/Version:1.0"
:name "Version"
:members (("major" OMG.ORG/CORBA:TC_OCTET)
("minor" OMG.ORG/CORBA:TC_OCTET)))
(DEFINE-STRUCT GIOP:MESSAGEHEADER_1_0
:id "IDL:omg.org/GIOP/MessageHeader_1_0:1.0"
:name "MessageHeader_1_0"
:members (("magic" (create-array-tc 4 OMG.ORG/CORBA:TC_CHAR))
("GIOP_version" (SYMBOL-TYPECODE 'GIOP:VERSION))
("byte_order" OMG.ORG/CORBA:TC_BOOLEAN)
("message_type" OMG.ORG/CORBA:TC_OCTET)
("message_size" OMG.ORG/CORBA:TC_ULONG)))
(DEFINE-STRUCT GIOP:MESSAGEHEADER_1_1
:ID "IDL:omg.org/GIOP/MessageHeader_1_1:1.0"
:NAME "MessageHeader_1_1"
:MEMBERS (("magic" (CREATE-ARRAY-TC 4 OMG.ORG/CORBA:TC_CHAR))
("GIOP_version" (SYMBOL-TYPECODE 'GIOP:VERSION))
("flags" OMG.ORG/CORBA:TC_OCTET)
("message_type" OMG.ORG/CORBA:TC_OCTET)
("message_size" OMG.ORG/CORBA:TC_ULONG)))
(DEFINE-STRUCT GIOP:LOCATEREQUESTHEADER
:id "IDL:omg.org/GIOP/LocateRequestHeader:1.0"
:name "LocateRequestHeader"
:members (("request_id" OMG.ORG/CORBA:TC_ULONG)
("object_key" (create-sequence-tc 0 OMG.ORG/CORBA:TC_OCTET))))
(define-enum GIOP:LocateStatusType
:id "IDL:omg.org/GIOP/LocateStatusType:1.0"
:name "LocateStatusType"
:members ("UNKNOWN_OBJECT" "OBJECT_HERE" "OBJECT_FORWARD"))
(DEFINE-STRUCT GIOP:LOCATEREPLYHEADER
:id "IDL:omg.org/GIOP/LocateReplyHeader:1.0"
:name "LocateReplyHeader"
:members (("request_id" OMG.ORG/CORBA:TC_ULONG REQUEST_ID)
("locate_status" (SYMBOL-TYPECODE 'GIOP:LOCATESTATUSTYPE))))
(DEFINE-STRUCT GIOP:CANCELREQUESTHEADER
:id "IDL:omg.org/GIOP/CancelRequestHeader:1.0"
:name "CancelRequestHeader"
:members (("request_id" OMG.ORG/CORBA:TC_ULONG)))
(DEFINE-STRUCT GIOP:REQUESTHEADER_1_0
:id "IDL:omg.org/GIOP/RequestHeader_1_0:1.0"
:name "RequestHeader_1_0"
:members (("service_context" (SYMBOL-TYPECODE 'IOP:SERVICECONTEXTLIST))
("request_id" OMG.ORG/CORBA:TC_ULONG)
("response_expected" OMG.ORG/CORBA:TC_BOOLEAN)
("object_key" (create-sequence-tc 0 OMG.ORG/CORBA:TC_OCTET))
("operation" OMG.ORG/CORBA:TC_STRING)
("requesting_principal" (SYMBOL-TYPECODE 'GIOP:PRINCIPAL))))
(DEFINE-STRUCT GIOP:REQUESTHEADER_1_1
:ID "IDL:omg.org/GIOP/RequestHeader_1_1:1.0"
:NAME "RequestHeader_1_1"
:MEMBERS (("service_context"
(SYMBOL-TYPECODE 'OMG.ORG/IOP:SERVICECONTEXTLIST))
("request_id" OMG.ORG/CORBA:TC_ULONG)
("response_expected" OMG.ORG/CORBA:TC_BOOLEAN)
("reserved" (CREATE-ARRAY-TC 3 OMG.ORG/CORBA:TC_OCTET))
("object_key" (CREATE-SEQUENCE-TC 0 OMG.ORG/CORBA:TC_OCTET))
("operation" OMG.ORG/CORBA:TC_STRING)
("requesting_principal" (SYMBOL-TYPECODE 'OMG.ORG/GIOP:PRINCIPAL))))
(define-enum GIOP:REPLYSTATUSTYPE
:id "IDL:omg.org/GIOP/ReplyStatusType:1.0"
:name "ReplyStatusType"
:members ("NO_EXCEPTION" "USER_EXCEPTION" "SYSTEM_EXCEPTION"
"LOCATION_FORWARD"))
(DEFINE-STRUCT GIOP:REPLYHEADER
:id "IDL:omg.org/GIOP/ReplyHeader:1.0"
:name "ReplyHeader"
:members (("service_context" (SYMBOL-TYPECODE 'IOP:SERVICECONTEXTLIST))
("request_id" OMG.ORG/CORBA:TC_ULONG)
("reply_status" (SYMBOL-TYPECODE 'GIOP:REPLYSTATUSTYPE))))
(define-alias GIOP:Principal
:id "IDL:omg.org/GIOP/Principal:1.0"
:name"Principal"
:type sequence
:typecode (create-sequence-tc 0 OMG.ORG/CORBA:TC_OCTET))
;;;; GIOP Versions
(defun make-giop-version (major minor)
(or (if (eql major 1)
(case minor
(0 :giop_1_0) (1 :giop_1_1) (2 :giop_1_2)))
:giop_unknown_version))
(defun giop-version-major (version)
(if (eql version :giop_unknown_version)
(error "Unknown version")
1))
(defun giop-version-minor (version)
(case version (:giop_1_0 0) (:giop_1_1 1) (:giop_1_2 2) (otherwise 9999)))
(defconstant giop-1-0 :giop_1_0)
(defconstant giop-1-1 :giop_1_1)
;;;; GIOP (un)marshal extras
(define-symbol-macro message-types
'#(:REQUEST :REPLY :CANCELREQUEST :LOCATEREQUEST :LOCATEREPLY
:CLOSECONNECTION :MESSAGEERROR :FRAGMENT))
(defun marshal-giop-header (type buffer &optional (version giop-1-0) fragmented)
(with-out-buffer (buffer)
#.(cons 'progn (loop for c across "GIOP"
collect `(put-octet ,(char-code c))))
(put-octet (giop-version-major version))
(put-octet (giop-version-minor version))
(put-octet (logior 1 ;byte-order
(if fragmented 2 0)))
(put-octet (cond ((numberp type) type)
((eq type 'request) 0)
((eq type 'reply) 1)
(t
(let ((n (position type message-types)))
(or n (error "Message type ~S" type))))))
;; Place for message length to be patched in later
(incf pos 4)))
(defun marshal-giop-set-message-length (buffer)
(with-out-buffer (buffer)
(let ((len pos))
(setf pos 8)
(marshal-ulong (- len +iiop-header-size+) buffer)
(setf pos len))))
(defun marshal-service-context (ctx buffer)
(marshal-sequence ctx
(lambda (service-context buffer)
(marshal-ulong (op:context_id service-context) buffer)
(marshal-osequence (op:context_data service-context) buffer))
buffer))
(defun unmarshal-service-context (buffer)
(unmarshal-sequence-m (buffer)
(IOP:ServiceContext :context_id (unmarshal-ulong buffer)
:context_data (unmarshal-osequence buffer))))
;;;; IIOP Module
(DEFINE-STRUCT IIOP:VERSION
:ID "IDL:omg.org/IIOP/Version:1.0"
:NAME "Version"
:MEMBERS (("major" OMG.ORG/CORBA:TC_OCTET)
("minor" OMG.ORG/CORBA:TC_OCTET)))
(DEFINE-STRUCT IIOP:PROFILEBODY_1_0
:ID "IDL:omg.org/IIOP/ProfileBody_1_0:1.0"
:NAME "ProfileBody_1_0"
:MEMBERS (("iiop_version" (SYMBOL-TYPECODE 'IIOP:VERSION))
("host" OMG.ORG/CORBA:TC_STRING)
("port" OMG.ORG/CORBA:TC_USHORT)
("object_key" (CREATE-SEQUENCE-TC 0 OMG.ORG/CORBA:TC_OCTET))))
(DEFINE-STRUCT IIOP:PROFILEBODY_1_1
:ID "IDL:omg.org/IIOP/ProfileBody_1_1:1.0"
:NAME "ProfileBody_1_1"
:MEMBERS (("iiop_version" (SYMBOL-TYPECODE 'IIOP:VERSION))
("host" OMG.ORG/CORBA:TC_STRING)
("port" OMG.ORG/CORBA:TC_USHORT)
("object_key" (CREATE-SEQUENCE-TC 0 OMG.ORG/CORBA:TC_OCTET))
("components" (CREATE-SEQUENCE-TC 0 (SYMBOL-TYPECODE 'OMG.ORG/IOP:TAGGEDCOMPONENT)))))
;;;; Version
(defun make-iiop-version (major minor)
(or (if (eql major 1)
(case minor
(0 '(1 . 0)) (1 '(1 . 1)) (2 '(1 . 2))))
:iiop_unknown_version))
(defun iiop-version-major (version) (car version))
(defun iiop-version-minor (version) (cdr version))
;;;; IIOP - Profiles
(defstruct IIOP-PROFILE
(version (make-iiop-version 1 0))
(host nil)
(port 0 :type fixnum)
(key nil)
(components nil))
(defmethod profile-short-desc ((profile IIOP-PROFILE) stream)
(format stream "~A@~A:~A"
(iiop-profile-version profile)
(iiop-profile-host profile)
(iiop-profile-port profile)))
(defmethod profile-equal ((profile1 iiop-profile) (profile2 iiop-profile))
(and (equal (iiop-profile-host profile1) (iiop-profile-host profile2))
(equal (iiop-profile-port profile1) (iiop-profile-port profile2))
(equalp (iiop-profile-key profile1) (iiop-profile-key profile2))))
(defmethod profile-hash ((profile iiop-profile))
(sxhash (list* (iiop-profile-host profile)
(iiop-profile-port profile)
(coerce (iiop-profile-key profile) 'list))))
(defmethod profile-component ((profile iiop-profile) tag)
(cdr (assoc tag (iiop-profile-components profile))))
(defmethod decode-ior-profile ((tag (eql 0)) encaps)
(unmarshal-encapsulation encaps #'unmarshal-iiop-profile-body))
(defun unmarshal-iiop-componets (buffer)
;; Try handle profiles without components such as IIOP 1.0,
;; this shouldn't realy be called for those but any way
(let ((len (if (< (buffer-in-pos buffer) (buffer-length buffer))
(unmarshal-ulong buffer)
0)))
(loop repeat len collect
(let ((tag (unmarshal-ulong buffer)))
(cond ((= tag IOP:TAG_ORB_TYPE)
(cons tag (with-encapsulation buffer (unmarshal-ulong buffer))))
(t
(cons tag (unmarshal-osequence buffer))))))))
(defun marshal-iiop-components (components buffer)
(marshal-ulong (length components) buffer)
(loop for (tag . component) in components do
(marshal-ulong tag buffer)
(cond ((= tag IOP:TAG_ORB_TYPE)
(marshal-add-encapsulation
(lambda (buffer) (marshal-ulong component buffer))
buffer))
(t
(marshal-add-encapsulation
(lambda (buffer) (marshal-osequence component buffer))
buffer)))))
(defun unmarshal-iiop-profile-body (buffer)
(let ((major (unmarshal-octet buffer))
(minor (unmarshal-octet buffer)))
(make-iiop-profile
:version (make-iiop-version major minor)
:host (unmarshal-string buffer)
:port (unmarshal-ushort buffer)
:key (unmarshal-osequence buffer)
:components (if (> minor 0)
(unmarshal-iiop-componets buffer)))))
(defmethod encode-profile ((profile iiop-profile) orb)
(IOP:TaggedProfile
:tag iop:tag_internet_iop
:profile_data
(marshal-make-encapsulation
(lambda (buffer)
(let ((version (iiop-profile-version profile)))
(marshal-octet (iiop-version-major version) buffer)
(marshal-octet (iiop-version-minor version) buffer)
(marshal-string (iiop-profile-host profile) buffer)
(marshal-ushort (iiop-profile-port profile) buffer)
(marshal-osequence (iiop-profile-key profile) buffer)
(if (> (iiop-version-minor version) 0)
(marshal-iiop-components
(iiop-profile-components profile)
buffer))))
orb)))
;;; IIOP->GIOP support
(defmethod profile-giop-version ((profile iiop-profile))
(if (> (iiop-version-minor (iiop-profile-version profile)) 0)
giop-1-1 giop-1-0))
(defmethod profile-giop-key ((profile iiop-profile))
(iiop-profile-key profile))
;;;; GIOP/IIOP message marshalling
(defun marshal-locate-request (buffer req-id profile)
(marshal-giop-header :locaterequest buffer)
(marshal-ulong req-id buffer)
(marshal-osequence (iiop-profile-key profile) buffer)
(marshal-giop-set-message-length buffer))
(defun marshal-request-message (buffer req-id service-context
response-expected effective-profile
operation output-func output-arg)
(marshal-giop-header :request buffer
(profile-giop-version effective-profile))
(marshal-service-context service-context buffer)
(marshal-ulong req-id buffer)
(marshal-octet (if response-expected 1 0) buffer)
(marshal-osequence (profile-giop-key effective-profile) buffer)
(marshal-string operation buffer)
(marshal-osequence *principal* buffer)
(funcall output-func output-arg buffer)
(marshal-giop-set-message-length buffer))
;;;; IIOP - Connection request preparation
(defun connection-get-buffer (conn)
(get-work-buffer (the-orb conn)))
#+unused-functions
(defun connection-start-request (conn req-id service-context response-expected
effective-profile operation)
(let ((buffer (get-work-buffer (the-orb conn))))
(marshal-giop-header :request buffer
(if (> (iiop-version-minor (iiop-profile-version effective-profile))
0)
giop-1-1 giop-1-0))
(marshal-service-context service-context buffer)
(marshal-ulong req-id buffer)
(marshal-octet (if response-expected 1 0) buffer)
(marshal-osequence
(iiop-profile-key effective-profile)
buffer)
(marshal-string operation buffer)
(marshal-osequence *principal* buffer)
buffer))
;;;; Connection Reply Handling
(defun connection-reply (conn giop-version reply-type request-id status
service-context result-func result-arg)
(let* ((orb (the-orb conn))
(buffer (get-work-buffer orb)))
(setf (buffer-giop-version buffer) giop-version)
(marshal-giop-header reply-type buffer giop-version)
(ecase reply-type
(:reply
(marshal-service-context service-context buffer)
(marshal-ulong request-id buffer)
(%jit-marshal status (symbol-typecode 'GIOP:REPLYSTATUSTYPE) buffer))
(:locatereply
(marshal-ulong request-id buffer)
(marshal-ulong (ecase status
(:unknown_object 0)
(:object_here 1)
(:location_forward 2))
buffer)))
(when result-func (funcall result-func result-arg buffer))
(mess 3 "#~D send ~S ~S" request-id reply-type status)
(marshal-giop-set-message-length buffer)
(connection-send-buffer conn buffer)))
(defun server-close-connection-msg (conn)
;; Do a server side close connection
(let ((buffer (get-work-buffer (the-orb conn))))
(marshal-giop-header :CLOSECONNECTION buffer)
(marshal-giop-set-message-length buffer)
buffer))
(defun connection-message-error (conn &optional (version giop-1-0))
(let* ((orb (the-orb conn))
(buffer (get-work-buffer orb)))
(marshal-giop-header :messageerror buffer version)
(marshal-giop-set-message-length buffer)
(connection-send-buffer conn buffer))
(connection-error conn))
;;;; IIOP - Response handling
(defun unmarshal-giop-header (buffer)
(with-in-buffer (buffer)
(if (loop for c in '#.(mapcar #'char-code '(#\G #\I #\O #\P))
always (eql c (get-octet)))
(let ((major (get-octet))
(minor (get-octet))
(flags (get-octet))
(msgtype (get-octet)))
(setf (buffer-byte-order buffer) (logand flags 1))
(values (if (> msgtype (length message-types))
:unknown
(aref message-types msgtype))
(if (> minor 0)
(logbitp 1 flags))
(make-giop-version major minor)))
(progn (warn "Not a GIOP message: ~/net.cddr.clorb::stroid/..."
(subseq octets 0 (min 10 (length octets))))
(values :unknown)))))
(defun get-fragment (conn)
(let ((buffer (read-buffer-of conn)))
(connection-add-fragment conn buffer +iiop-header-size+)
(setup-outgoing-connection conn)))
(defun get-fragment-last (conn)
(let ((buffer (read-buffer-of conn)))
(connection-add-fragment conn buffer +iiop-header-size+)
(let ((handler (assembled-handler conn)))
(setf (assembled-handler conn) nil)
(setf (fragment-buffer conn) nil)
(funcall handler conn))))
(defun get-response-0 (conn)
(let ((buffer (read-buffer-of conn)))
(multiple-value-bind (msgtype fragmented)
(unmarshal-giop-header buffer)
(let ((size (+ (unmarshal-ulong buffer) +iiop-header-size+))
(handler
(ecase msgtype
((:reply) #'get-response-reply)
((:locatereply) #'get-response-locate-reply)
((:closeconnection)
(mess 3 "Connection closed")
(connection-close conn)
nil)
((:messageerror)
(mess 6 "CORBA: Message error")
(connection-error conn)
nil)
((:fragment)
(prog1
(if fragmented #'get-fragment #'get-fragment-last)
(setf fragmented nil))))))
(when fragmented
(connection-init-defragmentation conn handler)
(setq handler #'get-fragment))
(if handler
(connection-init-read conn t size handler)
;; prehaps it is better to close it....
(setup-outgoing-connection conn))))))
(defun get-response-reply (conn)
(let* ((buffer (read-buffer-of conn))
(service-context (unmarshal-service-context buffer))
(request-id (unmarshal-ulong buffer))
(status (%jit-unmarshal 'GIOP:ReplyStatusType buffer)))
(setup-outgoing-connection conn)
(connection-receive-reply
conn request-id buffer status service-context)))
(defun get-response-locate-reply (conn)
(let* ((buffer (read-buffer-of conn))
(request-id (unmarshal-ulong buffer))
(status (%jit-unmarshal 'GIOP:LocateStatusType buffer)))
(setup-outgoing-connection conn)
(connection-receive-locate-reply
conn request-id buffer status)))
;;;; IIOP - Manage outgoing connections
(defun setup-outgoing-connection (conn)
(when (connection-working-p conn)
(connection-init-read conn nil +iiop-header-size+ #'get-response-0)))
;;; Connection pool
(defclass connection-pool (synchronized)
((host-table
:initform nil
:accessor %host-table
:documentation "All active client sockets.
Organized as two levels of a-lists:
( (host . ((port . socket) ...)) ...)
Where host is a string and port an integer.")))
(defun %get-iiop-connection-holder (connection-pool host port)
;; a cons cell where cdr is for connection
(let* ((host-list ; A host-ports pair
(assoc host (%host-table connection-pool) :test #'equal))
(holder ; A port-socket pair
(assoc port (cdr host-list))))
(unless holder
(unless host-list
(setq host-list (cons host nil))
(push host-list (%host-table connection-pool)))
(setq holder (cons port nil))
(push holder (cdr host-list)))
holder))
(defun get-connection-from-pool (pool host port
validate-connection
new-connection)
(let ((holder nil)
(conn nil)
(status nil))
(labels
((wait-for-holder ()
(loop while (eql (cdr holder) :connecting)
do (synch-locked-wait pool))
(setq conn (cdr holder)))
(set-connecting ()
(setf (cdr holder) (setq status :connecting)))
(get-holder ()
(with-synchronization pool
(setq holder (%get-iiop-connection-holder pool host port))
(wait-for-holder)
(setq conn (cdr holder))
(unless conn
(set-connecting))))
(release-holder ()
(with-synchronization pool
(setf (cdr holder) conn)
(synch-notify pool)))
(validate ()
(loop while (and conn (not (funcall validate-connection conn)))
do (with-synchronization pool
(let ((old-conn conn))
(wait-for-holder)
(when (or (null conn) (eql conn old-conn))
(setq conn nil)
(set-connecting)))))))
(unwind-protect
(progn (get-holder) (validate)
(or conn
(setq conn (funcall new-connection host port))))
(when (eql status :connecting)
(release-holder))))))
(defvar *iiop-connections* (make-instance 'connection-pool))
(defun get-iiop-connection (orb host port)
(get-connection-from-pool
*iiop-connections* host port
#'connection-working-p
(lambda (host port)
(when-let (conn (create-connection orb host port))
(setup-outgoing-connection conn)
conn))))
(defmethod profile-connection ((profile iiop-profile) orb)
(let ((host (iiop-profile-host profile))
(port (iiop-profile-port profile)))
(get-iiop-connection orb host port)))
(defmethod profile-connection ((profile vector) orb)
;; Multi profile
;; FIXME: not handled yet, should it be stored in the proxy ??
nil)
;;;; Locate
(defun locate (obj)
(let ((req (create-client-request (the-orb obj)
:target obj :operation 'locate)))
(loop
(multiple-value-bind (conn req-id buffer) (request-start-request req)
(marshal-locate-request buffer req-id
(request-effective-profile req))
(connection-send-request conn buffer req))
(request-wait-response req)
(cond ((eql (request-status req) :object_forward)
(setf (object-forward obj) (unmarshal-object (request-buffer req))))
(t
(return (request-status req)))))))
;;;; Attribute accessors
(defun get-attribute (obj getter result-tc)
(static-call (getter obj)
:output ((buffer))
:input ((buffer) (unmarshal result-tc buffer))))
(defun set-attribute (obj setter result-tc newval)
(static-call (setter obj)
:output ((buffer) (marshal newval result-tc buffer))
:input ((buffer))))