Fri, 24 Sep 2010 22:42:14 -0700
6891766: Vulnerabilities in use of reflection in CORBA
Reviewed-by: hawtin
1 /*
2 * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
26 #ifndef _IOP_IDL_
27 #define _IOP_IDL_
29 #include "CORBAX.idl"
31 #pragma prefix "omg.org"
33 #ifndef CORBA3
34 #define local
35 #endif
37 module IOP {
38 //
39 // Standard Protocol Profile tag values
40 //
41 /** Profile ID */
42 typedef unsigned long ProfileId;
44 /**
45 * Identifies profiles that
46 * support the Internet Inter-ORB Protocol. The <code>ProfileBody</code>
47 * of this profile contains a CDR encapsulation of a structure
48 * containing addressing and object identification information used by
49 * IIOP. Version 1.1 of the <code>TAG_INTERNET_IOP</code> profile
50 * also includes an array of TaggedComponent objects that can
51 * contain additional information supporting optional IIOP features,
52 * ORB services such as security, and future protocol extensions.
53 * <p>
54 * Protocols other than IIOP (such as ESIOPs and other GIOPs) can share
55 * profile information (such as object identity or security
56 * information) with IIOP by encoding their additional profile information
57 * as components in the <code>TAG_INTERNET_IOP</code> profile. All
58 * <code>TAG_INTERNET_IOP</code> profiles support IIOP, regardless of
59 * whether they also support additional protocols. Interoperable
60 * ORBs are not required to create or understand any other profile,
61 * nor are they required to create or understand any of the components
62 * defined for other protocols that might share the
63 * <code>TAG_INTERNET_IOP</code> profile with IIOP.
64 * <p>
65 * The <code>profile_data</code> for the <code>TAG_INTERNET_IOP</code>
66 * profile is a CDR encapsulation of the <code>IIOP.ProfileBody_1_1</code>
67 * type.
68 */
69 const ProfileId TAG_INTERNET_IOP = 0;
71 /**
72 * Indicates that the value encapsulated is of type
73 * <code>MultipleComponentProfile</code>. In this case, the profile
74 * consists of a list of protocol components, the use of which must
75 * be specified by the protocol using this profile. This profile may
76 * be used to carry IOR components.
77 * <p>
78 * The <code>profile_data</code> for the
79 * <code>TAG_MULTIPLE_COMPONENTS</code> profile is a CDR encapsulation
80 * of the <code>MultipleComponentProfile</code> type shown above.
81 */
82 const ProfileId TAG_MULTIPLE_COMPONENTS = 1;
84 /**
85 * Object references have at least one tagged profile. Each profile
86 * supports one or more protocols and encapsulates all the basic
87 * information the protocols it supports need to identify an object.
88 * Any single profile holds enough information to drive a complete
89 * invocation using any of the protocols it supports; the content
90 * and structure of those profile entries are wholly specified by
91 * these protocols.
92 */
93 struct TaggedProfile {
94 /** The tag, represented as a profile id. */
95 ProfileId tag;
97 /** The associated profile data. */
98 sequence <octet> profile_data;
99 };
101 /**
102 * Captures information about a object references, such as whether the
103 * object is null, what type it is, what protocols are supported, and what
104 * ORB services are available.
105 * <p>
106 * This data structure need not be used internally to any given ORB,
107 * and is not intended to be visible to application-level ORB programmers.
108 * It should be used only when crossing object reference domain
109 * boundaries, within bridges.
110 * <p>
111 * This data structure is designed to be efficient in typical
112 * single-protocol configurations, while not penalizing multiprotocol ones.
113 * <p>
114 * Object references have at least one tagged profile. Each profile
115 * supports one or more protocols and encapsulates all the basic
116 * information the protocols it supports need to identify an object.
117 * Any single profile holds enough information to drive a complete
118 * invocation using any of the protocols it supports; the content
119 * and structure of those profile entries are wholly specified by
120 * these protocols. A bridge between two domains may need to know the
121 * detailed content of the profile for those domains' profiles,
122 * depending on the technique it uses to bridge the domains.
123 * <p>
124 * Each profile has a unique numeric tag, assigned by the OMG.
125 * Profile tags in the range 0x80000000 through 0xffffffff are reserved
126 * for future use, and are not currently available for assignment.
127 * <p>
128 * Null object references are indicated by an empty set of profiles,
129 * and by a "Null" type ID (a string which contains only a single
130 * terminating character). A Null <code>TypeID</code> is the only
131 * mechanism that can be used to represent the type
132 * <code>CORBA.Object</code>. Type IDs may only be "Null" in any message,
133 * requiring the client to use existing knowledge or to consult the
134 * object, to determine interface types supported. The type ID
135 * is a Repository ID identifying the interface type, and is provided
136 * to allow ORBs to preserve strong typing. This identifier is agreed
137 * on within the bridge and, for reasons outside the scope of the
138 * interoperability specification, needs to have a much broader scope to
139 * address various problems in system evolution and maintenance.
140 * Type IDs support detection of type equivalence, and in conjunction
141 * with an Interface Repository, allow processes to reason about the
142 * relationship of the type of the object referred to and any other type.
143 * <p>
144 * The type ID, if provided by the server, indicates the most derived
145 * type that the server wishes to publish, at the time the reference
146 * is generated. The object's actual most derived type may later change
147 * to a more derived type. Therefore, the type ID in the IOR can only
148 * be interpreted by the client as a hint that the object supports at
149 * least the indicated interface. The client can succeed in narrowing
150 * the reference to the indicated interface, or to one of its base
151 * interfaces, based solely on the type ID in the IOR, but must not fail
152 * to narrow the reference without consulting the object via the
153 * "_is_a" or "_get_interface" pseudo-operations.
154 */
155 struct IOR {
156 /** The type id, represented as a String. */
157 string type_id;
159 /**
160 * An array of tagged profiles associated with this
161 * object reference.
162 */
163 sequence <TaggedProfile> profiles;
164 };
166 /**
167 * Standard way of representing multicomponent profiles.
168 * This would be encapsulated in a TaggedProfile.
169 */
170 typedef unsigned long ComponentId;
172 /**
173 * <code>TaggedComponents</code> contained in
174 * <code>TAG_INTERNET_IOP</code> and
175 * <code>TAG_MULTIPLE_COMPONENTS</code> profiles are identified by
176 * unique numeric tags using a namespace distinct form that is used for
177 * profile tags. Component tags are assigned by the OMG.
178 * <p>
179 * Specifications of components must include the following information:
180 * <ul>
181 * <li><i>Component ID</i>: The compound tag that is obtained
182 * from OMG.</li>
183 * <li><i>Structure and encoding</i>: The syntax of the component
184 * data and the encoding rules. If the component value is
185 * encoded as a CDR encapsulation, the IDL type that is
186 * encapsulated and the GIOP version which is used for encoding
187 * the value, if different than GIOP 1.0, must be specified as
188 * part of the component definition.</li>
189 * <li><i>Semantics</i>: How the component data is intended to be
190 * used.</li>
191 * <li><i>Protocols</i>: The protocol for which the component is
192 * defined, and whether it is intended that the component be
193 * usable by other protocols.</li>
194 * <li><i>At most once</i>: whether more than one instance of this
195 * component can be included in a profile.</li>
196 * </ul>
197 * Specification of protocols must describe how the components affect
198 * the protocol. The following should be specified in any protocol
199 * definition for each <code>TaggedComponent</code> that the protocol uses:
200 * <ul>
201 * <li><i>Mandatory presence</i>: Whether inclusion of the component
202 * in profiles supporting the protocol is required (MANDATORY
203 * PRESENCE) or not required (OPTIONAL PRESENCE).</li>
204 * <li><i>Droppable</i>: For optional presence component, whether
205 * component, if present, must be retained or may be dropped.</li>
206 * </ul>
207 */
208 struct TaggedComponent {
209 /** The tag, represented as a component id. */
210 ComponentId tag;
212 /** The component data associated with the component id. */
213 sequence <octet> component_data;
214 };
216 /**
217 * It is often useful in the real world to be able to identify the
218 * particular kind of ORB an object reference is coming from, to work
219 * around problems with that particular ORB, or exploit shared
220 * efficiencies.
221 * <p>
222 * The <code>TAG_ORB_TYPE</code> component has an associated value of
223 * type unsigned long (Java long), encoded as a CDR encapsulation,
224 * designating an ORB type ID allocated by the OMG for the ORB type of the
225 * originating ORB. Anyone may register any ORB types by submitting
226 * a short (one-paragraph) description of the ORB type to the OMG,
227 * and will receive a new ORB type ID in return. A list of ORB type
228 * descriptions and values will be made available on the OMG web server.
229 * <p>
230 * The <code>TAG_ORB_TYPE</code> component can appear at most once in
231 * any IOR profile. For profiles supporting IIOP 1.1 or greater, it
232 * is optionally present.
233 */
234 const ComponentId TAG_ORB_TYPE = 0 ;
236 /**
237 * The code set component of the IOR multi-component profile structure
238 * contains:
239 * <ul>
240 * <li>server's native char code set and conversion code sets, and</li>
241 * <li>server's native wchar code set and conversion code sets.</li>
242 * </ul>
243 * Both char and wchar conversion code sets are listed in order of
244 * preference.
245 */
246 const ComponentId TAG_CODE_SETS = 1 ;
248 /**
249 * A profile component containing the sequence of QoS policies exported
250 * with the object reference by an object adapter.
251 */
252 const ComponentId TAG_POLICIES = 2 ;
254 /**
255 * In cases where the same object key is used for more than one
256 * internet location, the following standard IOR Component is defined
257 * for support in IIOP version 1.2.
258 * <p>
259 * The <code>TAG_ALTERNATE_IIOP_ADDRESS</code> component has an
260 * associated value of type:
261 * <code>
262 * <pre>
263 * struct {
264 * string HostID,
265 * short Port
266 * };
267 * </pre>
268 * </code>
269 * encoded as a CDR encapsulation.
270 * <p>
271 * Zero or more instances of the <code>TAG_ALTERNATE_IIOP_ADDRESS</code>
272 * component type may be included in a version 1.2
273 * <code>TAG_INTERNET_IOP</code> Profile. Each of these alternative
274 * addresses may be used by the client orb, in addition to the host
275 * and port address expressed in the body of the Profile. In cases
276 * where one or more <code>TAG_ALTERNATE_IIOP_ADDRESS</code> components
277 * are present in a <code>TAG_INTERNET_IOP</code> Profile, no order of
278 * use is prescribed by Version 1.2 of IIOP.
279 */
280 const ComponentId TAG_ALTERNATE_IIOP_ADDRESS = 3 ;
282 /**
283 * Class downloading is supported for stubs, ties, values, and
284 * value helpers. The specification allows transmission of codebase
285 * information on the wire for stubs and ties, and enables usage of
286 * pre-existing ClassLoaders when relevant.
287 * <p>
288 * For values and value helpers, the codebase is transmitted after the
289 * value tag. For stubs and ties, the codebase is transmitted as
290 * the TaggedComponent <code>TAG_JAVA_CODEBASE</code> in the IOR
291 * profile, where the <code>component_data</code> is a CDR encapsulation
292 * of the codebase written as an IDL string. The codebase is a
293 * space-separated list of one or more URLs.
294 */
295 const ComponentId TAG_JAVA_CODEBASE = 25 ;
297 /**
298 * RMI-IIOP has multiple stream format versions. A server
299 * can specify its maximum version by including the
300 * TAG_RMI_CUSTOM_MAX_STREAM_FORMAT tagged component or
301 * rely on the default of version 1 for GIOP 1.2 and less
302 * and version 2 for GIOP 1.3 and higher.
303 *
304 * See Java to IDL ptc/02-01-12 1.4.11.
305 */
306 const ComponentId TAG_RMI_CUSTOM_MAX_STREAM_FORMAT = 38 ;
308 /** An array of tagged components, forming a multiple component profile. */
309 typedef sequence <TaggedComponent> MultipleComponentProfile;
311 /** A service id, represented as an int */
312 typedef unsigned long ServiceId;
314 /**
315 * Service-specific information to be passed implicitly with requests
316 * and replies. Service contexts are composed of service ids and
317 * associated data.
318 */
319 struct ServiceContext {
320 /** The service context id */
321 ServiceId context_id;
323 /** The data associated with this service context */
324 sequence <octet> context_data;
325 };
327 /** An array of service contexts, forming a service context list. */
328 typedef sequence <ServiceContext>ServiceContextList;
330 /**
331 * Identifies a CDR encapsulation of the
332 * <code>CosTSInteroperation.PropogationContext</code> defined in
333 * <i>CORBAservices: Common Object Services Specifications.</i>
334 */
335 const ServiceId TransactionService = 0;
337 /**
338 * Identifies a CDR encapsulation of the
339 * <code>CONV_FRAME.CodeSetContext</code> defined in
340 * Section 13.10.2.5, "GIOP Code Set Service Context," on page 13-43.
341 */
342 const ServiceId CodeSets = 1;
344 /**
345 * Identifies a CDR encapsulation of the RMICustomMaxStreamFormat
346 * service context which contains a single byte specifying
347 * the client's maximum RMI-IIOP stream format version.
348 *
349 * See Java to IDL ptc/02-01-12 1.4.12.
350 */
351 const ServiceId RMICustomMaxStreamFormat = 17 ;
353 /**
354 * DCOM-CORBA Interworking uses three service contexts as defined in
355 * "DCOM-CORBA Interworking" in the "Interoperability with non-CORBA
356 * Systems" chapter.
357 * <p>
358 * <code>ChainBypassCheck</code> carries a CDR encapsulation of the
359 * <code>struct CosBridging.ChainBypassCheck</code>. This is carried
360 * only in a Request message as described in Section 20.9.1, "CORBA
361 * Chain Bypass," on page 20-19.
362 */
363 const ServiceId ChainBypassCheck = 2;
365 /**
366 * DCOM-CORBA Interworking uses three service contexts as defined in
367 * "DCOM-CORBA Interworking" in the "Interoperability with non-CORBA
368 * Systems" chapter.
369 * <p>
370 * <code>ChainBypassInfo</code> carries a CDR encapsulation of the
371 * <code>struct CosBridging.ChainBypassInfo</code>. This is carried
372 * only in a Reply message as described in Section 20.9.1, "CORBA Chain
373 * Bypass," on page 20-19.
374 */
375 const ServiceId ChainBypassInfo = 3;
377 /**
378 * DCOM-CORBA Interworking uses three service contexts as defined in
379 * "DCOM-CORBA Interworking" in the "Interoperability with non-CORBA
380 * Systems" chapter.
381 * <p>
382 * <code>LogicalThreadId</code>, carries a CDR encapsulation of
383 * the <code>struct CosBridging.LogicalThreadId</code> as described
384 * in Section 20.10, "Thread Identification," on page 20-21.
385 */
386 const ServiceId LogicalThreadId = 4;
388 /**
389 * Identifies a CDR encapsulation of the
390 * <code>IIOP.BiDirIIOPServiceContext</code> defined in Section 15.8,
391 * "Bi-Directional GIOP," on page 15-55.
392 */
393 const ServiceId BI_DIR_IIOP = 5;
395 /**
396 * Identifies a CDR encapsulation of the IOR of the
397 * <code>SendingContext.RunTime</code> object (see Section 5.6, "Access
398 * to the Sending Context Run Time," on page 5-15).
399 */
400 const ServiceId SendingContextRunTime = 6;
402 /**
403 * For information on <code>INVOCATION_POLICIES</code> refer to the
404 * Asynchronous Messaging specification - orbos/98-05-05.
405 */
406 const ServiceId INVOCATION_POLICIES = 7;
408 /**
409 * For information on <code>FORWARDED_IDENTITY</code> refer to the
410 * Firewall specification - orbos/98-05-04.
411 */
412 const ServiceId FORWARDED_IDENTITY = 8;
414 /**
415 * Identifies a CDR encapsulation of a marshaled instance of a
416 * java.lang.Throwable or one of its subclasses as described in Java
417 * to IDL Language Mapping, Section 1.4.8.1, "Mapping of
418 * UnknownExceptionInfo Service Context," on page 1-32.
419 */
420 const ServiceId UnknownExceptionInfo = 9;
422 /**
423 * CORBA formal/02-06-01: 13.7.1:
424 * ExceptionDetailMessage identifies a CDR encapsulation of a wstring,
425 * encoded using GIOP 1.2 with a TCS-W of UTF-16. This service context
426 * may be sent on Reply messages with a reply_status of SYSTEM_EXCEPTION
427 * or USER_EXCEPTION. The usage of this service context is defined
428 * by language mappings. <br/> <br/>
429 *
430 * IDL/Java: ptc/02-01-22: 1.15.2:
431 * When a System Exception is marshaled, its GIOP Reply message shall
432 * include an associated ExceptionDetailMessage service context. The
433 * callee's stack trace is often very valuable debugging information but
434 * may contain sensitive or unwanted information. The wstring within the
435 * service context will therefore contain additional information relating
436 * to the exception, for example the result of calling either
437 * printStackTrace(PrintWriter) or getMessage() on the exception. When
438 * unmarshaling a System Exception on the client side, the wstring from
439 * any ExceptionDetailMessage service context shall become the Java error
440 * message in the unmarshaled exception object.
441 */
442 const ServiceId ExceptionDetailMessage = 14;
445 // BEGIN part which lived in Interceptors.idl.
447 /**
448 * An array of <code>TaggedComponent</code> objects.
449 */
450 typedef sequence<IOP::TaggedComponent> TaggedComponentSeq;
452 /**
453 * The formats of IOR components and service context data used by ORB
454 * services are often defined as CDR encapsulations encoding instances
455 * of IDL defined data types. The <code>Codec</code> provides a mechanism
456 * to transfer these components between their IDL data types and their CDR
457 * encapsulation representations.
458 * <p>
459 * A <code>Codec</code> is obtained from the <code>CodecFactory</code>.
460 * The <code>CodecFactory</code> is obtained through a call to
461 * <code>ORB.resolve_initial_references( "CodecFactory" )</code>.
462 */
463 local interface Codec {
465 /**
466 * This exception is thrown by <code>Codec.encode</code> or
467 * <code>Codec.encode_value</code> when the type is invalid for the
468 * encoding. For example, this exception is thrown if the encoding is
469 * <code>ENCODING_CDR_ENCAPS</code> version 1.0 and a type
470 * that does not exist in that version, such as <code>wstring</code>,
471 * is passed to the operation.
472 */
473 exception InvalidTypeForEncoding {};
475 /**
476 * This exception is thrown by <code>Codec.decode</code> or
477 * <code>Codec.decode_value</code> when the data in the byte array
478 * cannot be decoded into an Any.
479 */
480 exception FormatMismatch {};
482 /**
483 * This exception is thrown by <code>decode_value</code> when the given
484 * <code>TypeCode</code> does not match the given byte array.
485 */
486 exception TypeMismatch {};
488 /**
489 * Converts the given any into a byte array based on the encoding
490 * format effective for this <code>Codec</code>.
491 *
492 * @param data The data, in the form of an any, to be encoded into
493 * a byte array.
494 * @return A byte array containing the encoded Any. This byte array
495 * contains both the <code>TypeCode</code> and the data of the type.
496 * @exception InvalidTypeForEncoding thrown if the type is not valid for
497 * the encoding format effective for this <code>Codec</code>.
498 */
499 CORBA::OctetSeq encode (in any data)
500 raises (InvalidTypeForEncoding);
502 /**
503 * Decodes the given byte array into an Any based on the encoding
504 * format effective for this <code>Codec</code>.
505 *
506 * @param data The data, in the form of a byte array, to be decoded into
507 * an Any.
508 * @return An Any containing the data from the decoded byte array.
509 * @exception FormatMismatch is thrown if the byte array cannot be
510 * decoded into an Any.
511 */
512 any decode (in CORBA::OctetSeq data) raises (FormatMismatch);
514 /**
515 * Converts the given any into a byte array based on the encoding
516 * format effective for this Codec. Only the data from the Any is
517 * encoded, not the <code>TypeCode</code>.
518 *
519 * @param data The data, in the form of an Any, to be encoded into
520 * a byte array.
521 * @return A byte array containing the data from the encoded any.
522 * @exception InvalidTypeForEncoding thrown if the type is not valid for
523 * the encoding format effective for this <code>Codec</code>.
524 */
525 CORBA::OctetSeq encode_value (in any data)
526 raises (InvalidTypeForEncoding);
528 /**
529 * Decodes the given byte array into an Any based on the given
530 * <code>TypeCode</code> and the encoding format effective for
531 * this <code>Codec</code>.
532 *
533 * @param data The data, in the form of a byte array, to be decoded
534 * into an Any.
535 * @param tc The TypeCode to be used to decode the data.
536 * @return An Any containing the data from the decoded byte array.
537 * @exception FormatMismatch thrown if the byte array cannot be
538 * decoded into an Any.
539 */
540 any decode_value (in CORBA::OctetSeq data, in CORBA::TypeCode tc)
541 raises (FormatMismatch, TypeMismatch);
542 };
544 /**
545 * Defines an encoding format of a <code>Codec</code>, such as
546 * CDR Encapsulation (<code>ENCODING_CDR_ENCAPS</code>).
547 */
548 typedef short EncodingFormat;
550 /**
551 * The CDR Encapsulation encoding.
552 * @see CodecFactory
553 */
554 const EncodingFormat ENCODING_CDR_ENCAPS = 0;
556 /**
557 * Defines the encoding format of a <code>Codec</code>. This class
558 * details the encoding format, such as CDR Encapsulation encoding, and
559 * the major and minor versions of that format.
560 * <p>
561 * The encodings currently supported are:
562 * <ul>
563 * <li><code>ENCODING_CDR_ENCAPS</code>, version 1.0;</li>
564 * <li><code>ENCODING_CDR_ENCAPS</code>, version 1.1;</li>
565 * <li><code>ENCODING_CDR_ENCAPS</code>, version 1.2;</li>
566 * <li><code>ENCODING_CDR_ENCAPS</code> for all future versions of GIOP as
567 * they arise.</li>
568 * </ul>
569 * Vendors are free to support additional encodings.
570 *
571 * @see ENCODING_CDR_ENCAPS
572 */
573 struct Encoding {
574 /**
575 * The encoding format.
576 */
577 EncodingFormat format;
579 /**
580 * The major version of this Encoding format.
581 */
582 octet major_version;
584 /**
585 * The minor version of this Encoding format.
586 */
587 octet minor_version;
588 };
590 /**
591 * <code>Codecs</code> are obtained from the <code>CodecFactory</code>.
592 * The <code>CodecFactory</code> is obtained through a call to
593 * <code>ORB.resolve_initial_references( "CodecFactory" )</code>.
594 */
595 local interface CodecFactory {
596 /**
597 * This exception is thrown by <code>CodecFactory.create_codec</code> when
598 * the factory cannot create a <code>Codec</code> for a given encoding.
599 */
600 exception UnknownEncoding {};
602 /**
603 * Create a <code>Codec</code> of the given encoding.
604 * <p>
605 * @param enc The encoding for which to create a <code>Codec</code>.
606 * @return A <code>Codec</code> obtained with the given encoding.
607 * @exception UnknownEncoding thrown if this factory cannot create a
608 * <code>Codec</code> of the given encoding.
609 */
610 Codec create_codec (in Encoding enc) raises (UnknownEncoding);
611 };
613 // END part which lived in Interceptors.idl.
615 };
617 #endif // _IOP_IDL_