Home | History | Annotate | Download | only in invo
      1 /*
      2  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
      3  * Use is subject to license terms.
      4  *
      5  *  corba.h
      6  *
      7  */
      8 
      9 #ifndef _CORBA_H
     10 #define	_CORBA_H
     11 
     12 #pragma ident	"@(#)corba.h	1.102	08/07/05 SMI"
     13 
     14 //
     15 // $XConsortium$
     16 //
     17 
     18 //
     19 // Copyright (c) 1993-94 Silicon Graphics, Inc.
     20 // Copyright (c) 1993-94 Fujitsu, Ltd.
     21 //
     22 // Permission to use, copy, modify, distribute, and sell this software and
     23 // its documentation for any purpose is hereby granted without fee, provided
     24 // that (i) the above copyright notices and this permission notice appear in
     25 // all copies of the software and related documentation, and (ii) the names of
     26 // Silicon Graphics and Fujitsu may not be used in any advertising or
     27 // publicity relating to the software without the specific, prior written
     28 // permission of Silicon Graphics and Fujitsu.
     29 //
     30 // THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
     31 // EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
     32 // WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
     33 //
     34 // IN NO EVENT SHALL SILICON GRAPHICS OR FUJITSU BE LIABLE FOR
     35 // ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
     36 // OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
     37 // WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
     38 // LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
     39 // OF THIS SOFTWARE.
     40 //
     41 
     42 #ifdef	linux
     43 // Dependencies: corba.h needs Ix_Forward from ix.h, which includes
     44 // ix_tmpl.h which uses CORBA:: defined in corba.h
     45 // So need to include ix.h first, which will define Ix_Forward.h
     46 // then include corba.h, then include ix_tmpl.h
     47 // So ix.h needs to be included first.
     48 #include <orb/invo/ix.h>
     49 #endif	/* linux */
     50 
     51 #include <orb/idl_datatypes/sequence.h>
     52 #include <orb/invo/ix_tmpl.h>
     53 #include <orb/invo/ix.h>
     54 #include <orb/invo/argfuncs.h>
     55 #include <orb/member/Node.h>
     56 #include <orb/idl_datatypes/idl_strings.h>
     57 #include <orb/idl_datatypes/string_seq.h>
     58 #include <orb/idl_datatypes/interfaceseq.h>
     59 
     60 #if defined(_KERNEL_ORB) && !defined(_KERNEL)
     61 #define	UNODE
     62 #else
     63 #undef	UNODE
     64 #endif
     65 
     66 #if (SOL_VERSION >= __s10) && !defined(UNODE)
     67 #include <sys/zone.h>
     68 #define	PHYSICAL_CLUSTER_ID 0
     69 #endif
     70 
     71 //
     72 // nil - represents an object reference to no object.
     73 //
     74 #ifndef nil
     75 #define	nil 0
     76 #endif
     77 
     78 // Forward declarations.
     79 class InterfaceDescriptor;
     80 class MarshalStream;
     81 class service;
     82 class generic_proxy;
     83 class inf_descriptor;
     84 
     85 template<class A, class A_ptr> class _A_var_;
     86 template<class A, class A_ptr> class _A_field_;
     87 template<class A, class A_ptr> class _A_out_;
     88 
     89 template<class T, class T_ptr> class _T_out_;
     90 
     91 template<class SEQUENCE_TYPE, class ELEMENT_TYPE> class _ManagedSeq_;
     92 
     93 class _string_seq;
     94 
     95 //
     96 // The CORBA namespace (defined as a class since namespaces are not
     97 // currently supported) provides common definitions for the IDL C++ mapping.
     98 //
     99 class CORBA {
    100 public:
    101 	class Environment;
    102 
    103 	typedef char					*String_ptr;
    104 	typedef _string_field				String_field;
    105 	typedef _string_var				String_var;
    106 	typedef _string_out				String_out;
    107 	typedef _string_seq				StringSeq;
    108 	typedef _T_out_<StringSeq, StringSeq *>		StringSeq_out;
    109 	typedef _ManagedSeq_<StringSeq, String_field>	StringSeq_var;
    110 
    111 	_Ix_Forward(Object)
    112 
    113 	static bool is_nil(Object_ptr object_p);
    114 	static void release(Object_ptr object_p);
    115 
    116 	_Ix_Forward(Type)
    117 
    118 	//
    119 	// A type id in memory is a pointer to the variable-length
    120 	// representation. Current implementation uses MD5, future
    121 	// implementations may include DCE UUID. Both of these are
    122 	// 128bits in length.
    123 	//
    124 	typedef type_identifier_p TypeId;
    125 
    126 	//
    127 	// We use MD5 encoding for typeids. This is a 128bit digest.
    128 	//
    129 	typedef uint32_t MD5_Tid[4];
    130 
    131 	//
    132 	// The IDL compiler will generate a function like the following
    133 	// for each interface:
    134 	//	type_info_t *<interface_name>::_get_type_info(int N)
    135 	// It returns a pointer to an internal data structure that
    136 	// represents the interface type information for the given version.
    137 	//
    138 	struct type_info_t;
    139 
    140 	// Returns a proxy object of the given type.
    141 	static Object_ptr create_proxy_obj(type_info_t *tp, handler *hp);
    142 
    143 	//
    144 	// These types are for the _generic_method().
    145 	//
    146 	typedef _FixedSeq_<uint8_t> octet_seq_t;
    147 	typedef _T_out_<octet_seq_t, octet_seq_t *> octet_seq_t_out;
    148 	typedef _ManagedSeq_<octet_seq_t, uint8_t> octet_seq_t_var;
    149 	typedef _Ix_InterfaceSeq_<Object, Object_field, Object_ptr>
    150 	    object_seq_t;
    151 	typedef _T_out_<object_seq_t, object_seq_t *> object_seq_t_out;
    152 	typedef _ManagedSeq_<object_seq_t, Object_field> object_seq_t_var;
    153 
    154 	//
    155 	// All objects support CORBA::Object operations, which
    156 	// includes access to an object's type and holding or
    157 	// releasing a reference to the object.
    158 	//
    159 	// Warning: the code generated by the IDL compiler and the
    160 	// implementation code for handlers assume CORBA::Object and the
    161 	// IDL interface class definitions contain no data members
    162 	// (only methods and type definitions). Data definitions are
    163 	// contained in the adaptor and proxy templates which inherit
    164 	// from the IDL class.
    165 	//
    166 	class Object {
    167 	public:
    168 		//
    169 		// Only those routines which absolutely know there is
    170 		// a handler down there should use this.
    171 		//
    172 		virtual handler		*_handler() = 0;
    173 
    174 		// _unreferenced has to be defined before instantiating
    175 		virtual void		_unreferenced(unref_t cookie = 0) = 0;
    176 
    177 		bool			_equiv(Object_ptr object2_p);
    178 
    179 		uint_t			_hash(uint_t sz);
    180 
    181 		// Return a pointer to the deep C++ object (or proxy).
    182 		virtual void		*_this_ptr();
    183 
    184 		// Return a pointer to the deep C++ object (or proxy).
    185 		Object_ptr		_this_obj();
    186 
    187 		//
    188 		// Return the compiled-in InterfaceDescriptor pointer for
    189 		// this class (i.e., the type of the actual C++ structure
    190 		// for this pointer).
    191 		//
    192 		virtual InterfaceDescriptor	*_interface_descriptor();
    193 
    194 		//
    195 		// Return the dynamic InterfaceDescriptor pointer for
    196 		// this class (i.e., the type of the object for this
    197 		// CORBA reference).  This is the same as the above for
    198 		// server-side implementation objects but can differ
    199 		// for proxy objects.
    200 		//
    201 		virtual InterfaceDescriptor	*_deep_type();
    202 
    203 		// Return a pointer to the C++ proxy object.
    204 		virtual generic_proxy	*_this_component_ptr();
    205 
    206 		//
    207 		// Convenience functions,
    208 		// might be better to call the handler operations directly
    209 		//
    210 		bool			_is_local();
    211 
    212 		// Increase the reference count for this object.
    213 		static Object_ptr	_duplicate(Object_ptr);
    214 
    215 		// Returns the nil object pointer.
    216 		static Object_ptr	_nil();
    217 
    218 		//
    219 		// This is a built-in generic method available for passing
    220 		// information. It is up to the caller and server object
    221 		// to understand the format of the data.
    222 		//
    223 		virtual void _generic_method(octet_seq_t &data,
    224 		    object_seq_t &objs, Environment &_environment);
    225 
    226 		//
    227 		// Return the version number of the given object or -1.
    228 		// Note this routine is not virtual on purpose. If you
    229 		// call CORBA::Object::_version(p), you will get the
    230 		// version of CORBA::Object that p supports. Since all
    231 		// objects support CORBA::Object, -1 can only be returned
    232 		// if p is nil. But, if A::_version(p) is called, -1
    233 		// is returned if the object doesn't support interface A.
    234 		//
    235 		static int		_version(Object_ptr);
    236 
    237 		// Return the type info for CORBA::Object.
    238 		static type_info_t	*_get_type_info(int v);
    239 
    240 		// Returns true if the object supports the given type.
    241 		bool			_supports_type(type_info_t *tp);
    242 
    243 		//
    244 		// Object constructor and destructor are public so that one can
    245 		// have local (stack-based) objects.
    246 		//
    247 		Object();
    248 		virtual ~Object();
    249 
    250 	private:
    251 		// Disallow assignments, pass by value.
    252 		Object(const Object &);
    253 		Object &operator = (const Object &);
    254 	};
    255 
    256 	//
    257 	// TCKind is an enumeration of the different categories of types.
    258 	//
    259 	enum TCKind { tk_null, tk_void,
    260 		tk_short, tk_long, tk_ushort, tk_ulong,
    261 		tk_float, tk_double, tk_boolean, tk_char,
    262 		tk_octet, tk_any,
    263 		tk_TypeCode, tk_Principal, tk_objref,
    264 		tk_struct, tk_union, tk_enum, tk_string,
    265 		tk_sequence, tk_array,
    266 		tk_longlong, tk_ulonglong,
    267 		tk_except, tk_module
    268 	};
    269 
    270 	//
    271 	// Base classes for exceptions
    272 	//
    273 	enum CompletionStatus { COMPLETED_YES, COMPLETED_NO, COMPLETED_MAYBE };
    274 
    275 	//
    276 	// ExceptionStatus identifies the result of an invocation.
    277 	//	NO_EXCEPTION  signifies successful completion.
    278 	// There are two fundamental types of error:
    279 	//	SYSTEM_EXCEPTION is thrown by orb/transport/HA infrastructure.
    280 	//	USER_EXCEPTION is thrown by other code.
    281 	// Both types involve marshal/unmarshal operations when the exception
    282 	// is passed over the wire.
    283 	//
    284 	// Other values identify intermediate states:
    285 	// UNINITIALIZED	- result not yet available.
    286 	// RETRY_EXCEPTION	- the operation should be retried.
    287 	// LOCAL_EXCEPTION	- system exception occurred on local node.
    288 	// REMOTE_EXCEPTION	- shows that an exception occurred on a
    289 	//	remote server. The msg contains either a user or system
    290 	//	exception.
    291 	//
    292 	enum ExceptionStatus { UNINITIALIZED = -1, NO_EXCEPTION,
    293 			USER_EXCEPTION, SYSTEM_EXCEPTION, LOCAL_EXCEPTION,
    294 			RETRY_EXCEPTION, REMOTE_EXCEPTION };
    295 
    296 	//
    297 	// enum representation for exceptions.
    298 	//
    299 	enum exception_enum_t {
    300 		user_exception = 0,
    301 		system_exception = 1,
    302 		bad_param = 2,
    303 		comm_failure = 3,
    304 		inv_objref = 4,
    305 		wouldblock = 5,
    306 		retry_needed = 6,
    307 		primary_frozen = 7,
    308 		version_exception = 8,
    309 		ctx_eaccess = 9,
    310 		ns_eperm = 10
    311 	};
    312 
    313 	//
    314 	// Exception is the parent class for objects representing errors.
    315 	// A virtual destructor exists because some of the user exceptions
    316 	// need to do something special.
    317 	//
    318 	class Exception {
    319 	public:
    320 		virtual void		_put(service &) const = 0;
    321 		virtual void		print_exception(char *) = 0;
    322 		virtual bool		is_system_exception() = 0;
    323 
    324 		virtual			~Exception();
    325 
    326 		bool			type_match(Exception *exceptp);
    327 		TypeId			get_typeid();
    328 		uint_t			_major() const;
    329 		const char		*_name() const;
    330 
    331 		exception_enum_t	exception_enum();
    332 
    333 	protected:
    334 		Exception(uint_t major, TypeId new_tid, const char *name);
    335 
    336 		TypeId			tid;
    337 		uint_t			_major_;
    338 		const char		*_name_;
    339 
    340 	private:
    341 		// Disallow constructor that does not do proper initialization
    342 		Exception();
    343 	};
    344 
    345 	class SystemException : public Exception {
    346 	public:
    347 		SystemException(uint_t major, uint_t minor,
    348 		    CompletionStatus compstatus);
    349 
    350 		bool			is_system_exception();
    351 
    352 		static SystemException	*_exnarrow(Exception *);
    353 
    354 		virtual void		print_exception(char *);
    355 
    356 		void			_put(service &) const;
    357 		void			_put(MarshalStream &) const;
    358 
    359 		uint_t			_minor();
    360 		void			_minor(uint_t mi);
    361 
    362 		void			completed(CompletionStatus cs);
    363 		CompletionStatus	completed();
    364 
    365 	protected:
    366 		uint_t			_minor_;
    367 		CompletionStatus 	_completed_;
    368 
    369 	private:
    370 		// Disallow constructor that does not do proper initialization
    371 		SystemException();
    372 	};
    373 
    374 	class UserException : public Exception {
    375 	public:
    376 		bool			is_system_exception();
    377 		static UserException	*_exnarrow(Exception *);
    378 		static void		*_try_cast(Exception *, TypeId);
    379 		void			_put(service &) const;
    380 		virtual void		print_exception(char *);
    381 
    382 	protected:
    383 		UserException(uint_t major, TypeId new_tid, const char *name);
    384 
    385 		// stubs generate code that requires pass by value
    386 		//	UserException(const UserException &);
    387 
    388 	private:
    389 		// Never create a plain UserException
    390 		UserException();
    391 
    392 		// Disallow assignments
    393 		UserException &operator = (const UserException &);
    394 	};
    395 
    396 	//
    397 	// List of System Exceptions.
    398 	//
    399 
    400 	//
    401 	// Bad Parameter.
    402 	// The exception may contain further info about what was wrong
    403 	// with the parameter.
    404 	//
    405 	class BAD_PARAM : public SystemException {
    406 	public:
    407 		BAD_PARAM(uint_t minor, CompletionStatus completed);
    408 
    409 		virtual			~BAD_PARAM();
    410 
    411 		static BAD_PARAM	*_exnarrow(Exception *exceptp);
    412 	};
    413 
    414 	//
    415 	// The destination is not reachable.
    416 	// Typically this means that the node containing the server is down.
    417 	//
    418 	class COMM_FAILURE : public SystemException {
    419 	public:
    420 		COMM_FAILURE(uint_t minor, CompletionStatus completed);
    421 
    422 		virtual			~COMM_FAILURE();
    423 
    424 		static COMM_FAILURE	*_exnarrow(Exception *exceptp);
    425 	};
    426 
    427 	//
    428 	// Invalid Object Reference
    429 	//
    430 	class INV_OBJREF : public SystemException {
    431 	public:
    432 		INV_OBJREF(uint_t minor, CompletionStatus completed);
    433 
    434 		virtual			~INV_OBJREF();
    435 
    436 		static INV_OBJREF	*_exnarrow(Exception *exceptp);
    437 	};
    438 
    439 	//
    440 	// This exception can be returned only to nonblocking requests.
    441 	// The ORB/transport returns this error whenever it
    442 	// would have blocked for any reason (e.g., memory allocation
    443 	// failures, long-term locks).
    444 	//
    445 	// Note that regular (non-interrupt thread)
    446 	// client/server code would not get this exception,
    447 	// because they would allow blocking.
    448 	// Invocations running in the interrupt thread must use
    449 	// nonblocking semantics.
    450 	//
    451 	// The system uses a server thread to process twoway requests reaching
    452 	// a server on a remote node. Twoway requests always allow blocking.
    453 	// A server processing twoway requests must NEVER generate this
    454 	// exception.
    455 	//
    456 	class WOULDBLOCK : public SystemException {
    457 	public:
    458 		WOULDBLOCK(uint_t minor, CompletionStatus completed);
    459 
    460 		virtual			~WOULDBLOCK();
    461 
    462 		static WOULDBLOCK	*_exnarrow(Exception *exceptp);
    463 	};
    464 
    465 	//
    466 	// This exception is used by the framework to report an error
    467 	// that can be overcome by retrying the operation.
    468 	//
    469 	class RETRY_NEEDED : public SystemException {
    470 	public:
    471 		RETRY_NEEDED(uint_t minor, CompletionStatus completed);
    472 
    473 		virtual			~RETRY_NEEDED();
    474 
    475 		static RETRY_NEEDED	*_exnarrow(Exception *exceptp);
    476 	};
    477 
    478 	//
    479 	// This exception is used by the ha framework to report that the
    480 	// primary has been frozen and that the client should retry the
    481 	// invocation after the service is unfrozen.
    482 	//
    483 	class PRIMARY_FROZEN : public SystemException {
    484 	public:
    485 		PRIMARY_FROZEN(uint_t minor, CompletionStatus completed);
    486 
    487 		virtual			~PRIMARY_FROZEN();
    488 
    489 		static PRIMARY_FROZEN	*_exnarrow(Exception *exceptp);
    490 	};
    491 
    492 	//
    493 	// This exception is thrown when a client tries to call a method
    494 	// and the version of the server object does not support that
    495 	// method.
    496 	//
    497 	class VERSION : public SystemException {
    498 	public:
    499 		//
    500 		// The default constructor should be used to throw
    501 		// the "this function is not implemented" exception.
    502 		//
    503 		// Minor number 0 means deep type doesn't support this method.
    504 		// (usually raised by the client)
    505 		// Minor number 1 means server doesn't implement this method.
    506 		// (usually raised by the server)
    507 		//
    508 		VERSION();
    509 		VERSION(uint_t minor, CompletionStatus completed);
    510 
    511 		virtual ~VERSION();
    512 
    513 		static VERSION *_exnarrow(Exception *exceptp);
    514 	};
    515 
    516 	//
    517 	// This exception is used by the name server software
    518 	// to deny permission to access the real root of the
    519 	// global and lcoal name server
    520 	//
    521 	class CTX_EACCESS : public SystemException {
    522 	public:
    523 		CTX_EACCESS(uint_t minor, CompletionStatus completed);
    524 
    525 		virtual			~CTX_EACCESS();
    526 
    527 		static CTX_EACCESS	*_exnarrow(Exception *exceptp);
    528 	};
    529 
    530 	//
    531 	// This exception used by the name server software. When
    532 	// this exception is raised, it means that the client does
    533 	// not have permission to perform the requested operation.
    534 	// It could be that the client zone is not the owner or
    535 	// the particular operation is not allowd in the context.
    536 	//
    537 	class NS_EPERM : public SystemException {
    538 	public:
    539 		NS_EPERM(uint_t minor, CompletionStatus completed);
    540 
    541 		virtual			~NS_EPERM();
    542 
    543 		static NS_EPERM	*_exnarrow(Exception *exceptp);
    544 	};
    545 
    546 	//
    547 	// Environment passed with each invocation.
    548 	// Stores system exceptions generated during the invocation.
    549 	// Has storage for one system exception to avoid doing a new.
    550 	//
    551 	class Environment {
    552 	public:
    553 		Environment();
    554 
    555 #ifdef _KERNEL_ORB
    556 		//
    557 		// This constructor is only for use by ORB internals.
    558 		//
    559 #if (SOL_VERSION >= __s10) && !defined(UNODE)
    560 #ifdef _KERNEL
    561 		Environment(ID_node &src_node,
    562 		    zoneid_t zone = GLOBAL_ZONEID,
    563 		    uint32_t cluster_id = PHYSICAL_CLUSTER_ID,
    564 		    uint64_t zone_uniq_id = GLOBAL_ZONEUNIQID);
    565 #else
    566 		Environment(ID_node &src_node,
    567 		    zoneid_t zone = GLOBAL_ZONEID,
    568 		    uint32_t cluster_id = PHYSICAL_CLUSTER_ID,
    569 		    uint64_t zone_uniq_id = 0);
    570 #endif	// _KERNEL
    571 
    572 #else	// SOL_VERSION >= __s10 && !defined(UNODE)
    573 		Environment(ID_node &src_node);
    574 #endif	// SOL_VERSION >= __s10 && !defined(UNODE)
    575 
    576 #endif	// _KERNEL_ORB
    577 
    578 		~Environment();
    579 
    580 #ifdef _KERNEL_ORB
    581 		//
    582 		// This method is only for use by ORB internals.
    583 		//
    584 		ID_node		&get_src_node();
    585 
    586 		//
    587 		// This method indicates whether the invocation this
    588 		// environment is a part of comes from a local client or not.
    589 		//
    590 		bool is_local_client();
    591 #endif
    592 
    593 		//
    594 		// Debug-only aids used to show that environment has been used
    595 		// for invocation or contains an exception and needs checking
    596 		//
    597 		void	mark_used();
    598 		void	has_checked();
    599 		void	check_used(char *s);
    600 
    601 		//
    602 		// Returns pointer to exception (either user or system)
    603 		// NULL if none
    604 		//
    605 		Exception	*exception();
    606 
    607 		//
    608 		// Check if a system_exception exists
    609 		//
    610 		SystemException	*sys_exception();
    611 
    612 		// To set any Exception
    613 		void		exception(Exception *p);
    614 
    615 		// To set system_exception without requiring to do a new
    616 		void		system_exception(const SystemException &s);
    617 
    618 		// To delete any old exception if any
    619 		void		clear();
    620 
    621 		// Disconnect exception from Environment object
    622 		CORBA::Exception	*Environment::release_exception();
    623 
    624 		//
    625 		// XXX - information about blocking should eventually move
    626 		// to the invocation_mode.
    627 		//
    628 		bool			is_nonblocking();
    629 		void			set_nonblocking();
    630 		void			clear_nonblocking();
    631 		os::mem_alloc_type	nonblocking_type();
    632 
    633 		//
    634 		// To manage the service_freezing member below.
    635 		//
    636 		bool			service_is_freezing();
    637 		void			set_freezing();
    638 		void			clear_freezing();
    639 
    640 		//
    641 		// To manage the freeze_retry member below.
    642 		//
    643 		bool			get_freeze_retry();
    644 		void			set_freeze_retry();
    645 		void			clear_freeze_retry();
    646 
    647 		//
    648 		// Invocations on HA objects have a transaction context.
    649 		// We keep a pointer to it.
    650 		// The replication framework sets the pointer and does
    651 		// any necessary casting.
    652 		//
    653 		void		*trans_ctxp;
    654 
    655 #ifdef _KERNEL_ORB
    656 		//
    657 		// Test whether the current invocation came from a client
    658 		// node that is dead. Invocations from dead nodes are called
    659 		// orphan requests.
    660 		//
    661 		// This test does not know anything about nested invocations.
    662 		//
    663 		// This test is only useful for the server side.
    664 		// While this test can be executed on the client side,
    665 		// a client side test will never find an orphan.
    666 		//
    667 		bool	is_orphan();
    668 #endif	// _KERNEL_ORB
    669 
    670 #if (SOL_VERSION >= __s10) && !defined(UNODE)
    671 		zoneid_t	get_zone_id() const;
    672 		uint64_t	get_zone_uniqid() const;
    673 		uint32_t	get_cluster_id() const;
    674 		void		set_zone_id(zoneid_t zone);
    675 		void		set_zone_uniqid(uint64_t zone_uniq_id);
    676 		void		set_cluster_id(uint32_t cluster_id);
    677 #endif	// (SOL_VERSION >= __s10) && !defined(UNODE)
    678 
    679 	private:
    680 		void done();
    681 
    682 		// Disallow assignments
    683 		Environment &operator = (const Environment &);
    684 
    685 		// Disallow Copy constructor.
    686 		Environment(const Environment &e);
    687 
    688 #ifdef DEBUG
    689 		//
    690 		// we use needs_checking flag to make sure that callers check
    691 		// and handle any exceptions resulting from a call
    692 		//
    693 		bool		needs_checking;
    694 #endif
    695 		bool		nonblocking;
    696 
    697 		//
    698 		// Set when an invocation on an HA service comes in
    699 		// while the service is freezing.
    700 		//
    701 		bool		service_freezing;
    702 
    703 		//
    704 		// Used by hxdoors to indicate that an invocation that came to
    705 		// the primary needs to be retried because the primary is
    706 		// freezing.
    707 		//
    708 		bool		freeze_retry;
    709 
    710 #ifdef _KERNEL_ORB
    711 		// Identifies the source node for this invocation.
    712 		ID_node		source_node;
    713 #endif
    714 
    715 		Exception	*_ptr;
    716 
    717 #if (SOL_VERSION >= __s10) && !defined(UNODE)
    718 		//
    719 		// Zone information
    720 		// We identify a running zone based on its zone_id,
    721 		// but zone ids can be recycled. So, a zone named "foo" could
    722 		// get a zone_id that is same as the zone_id it got in one
    723 		// of its previous generations. We use zone_uniqid to
    724 		// distinguish between such cases, as zone_uniqid is a unique
    725 		// generation number for zones.
    726 		//
    727 		zoneid_t	zone_id;
    728 		uint32_t	cluster_id;
    729 		uint32_t	pad;
    730 		uint64_t	zone_uniqid;
    731 #endif
    732 
    733 		//
    734 		// Place to hold one system exception
    735 		// Avoids need to do a new when generating a system exception
    736 		//
    737 		SystemException	sys_ex;
    738 
    739 	};
    740 
    741 	//
    742 	// This class is used to create a proxy for the CORBA::Object
    743 	// so the "builtin" methods can be called
    744 	// (see usr/src/common/cl/interfaces/idl/corba.idl).
    745 	//
    746 	class Object_stub : public Object {
    747 	public:
    748 		// Expand inf_typeid inline to avoid nested include files.
    749 		virtual inf_descriptor *_get_dynamic_descriptor(
    750 		    const uint32_t tid[4], Environment &_environment);
    751 		virtual void _generic_method(octet_seq_t &data,
    752 		    object_seq_t &objs, Environment &_environment);
    753 
    754 	protected:
    755 		Object_stub() {}
    756 		~Object_stub() {}
    757 	};
    758 };
    759 
    760 // Convenience typedefs
    761 typedef CORBA::Environment Environment;
    762 typedef CORBA::ExceptionStatus ExceptionStatus;
    763 
    764 //
    765 // exception_major_data - will hold the constant data for an exceptions
    766 // not generated by the IDL compiler.
    767 //
    768 class exception_major_data {
    769 public:
    770 	CORBA::TypeId	tid()	{ return (&id[0]); }
    771 
    772 	CORBA::MD5_Tid	id;
    773 	char		*name;
    774 };
    775 
    776 extern exception_major_data	major_translation[];
    777 
    778 // Define the major numbers for the predefined errors
    779 enum {
    780 	UserException_major	= CORBA::user_exception,
    781 	SystemException_major	= CORBA::system_exception,
    782 	BAD_PARAM_major		= CORBA::bad_param,
    783 	COMM_FAILURE_major	= CORBA::comm_failure,
    784 	INV_OBJREF_major	= CORBA::inv_objref,
    785 	WOULDBLOCK_major	= CORBA::wouldblock,
    786 	RETRY_NEEDED_major	= CORBA::retry_needed,
    787 	PRIMARY_FROZEN_major	= CORBA::primary_frozen,
    788 	VERSION_Exception_major	= CORBA::version_exception,
    789 	CTX_EACCESS_major	= CORBA::ctx_eaccess,
    790 	NS_EPERM_major		= CORBA::ns_eperm
    791 };
    792 
    793 extern bool	_ox_equal_tid(CORBA::TypeId t1, CORBA::TypeId t2);
    794 extern void	_ox_put_tid(service &, CORBA::TypeId);
    795 extern void	_ox_get_tid(service &, CORBA::TypeId);
    796 
    797 //
    798 // Cast is an internal operation for receive functions.
    799 // It assumes a non-nil object reference and a known type id.
    800 //
    801 extern void *_ox_cast(CORBA::Object_ptr, CORBA::TypeId);
    802 
    803 #include <orb/invo/corba_in.h>
    804 
    805 #endif	/* _CORBA_H */
    806