2 //=============================================================================
6 * @author Marina Spivak (marina@cs.wustl.edu)
8 //=============================================================================
11 #ifndef TAO_RT_POLICY_I_H
12 #define TAO_RT_POLICY_I_H
14 #include /**/ "ace/pre.h"
16 #include "tao/orbconf.h"
18 #if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
20 #if !defined (ACE_LACKS_PRAGMA_ONCE)
22 #endif /* ACE_LACKS_PRAGMA_ONCE */
24 #include "tao/RTCORBA/RTCORBA_includeC.h"
25 #include "tao/LocalObject.h"
26 #include "tao/Basic_Types.h"
28 #include "ace/SString.h"
32 #pragma warning(disable:4250)
35 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
38 * @class TAO_PriorityModelPolicy
40 * @brief RTCORBA::PriorityModelPolicy implementation
42 * This policy controls how the priority at which a server handles
43 * requests from clients is determined.
45 class TAO_RTCORBA_Export TAO_PriorityModelPolicy
46 : public RTCORBA::PriorityModelPolicy
,
47 public ::CORBA::LocalObject
51 TAO_PriorityModelPolicy (RTCORBA::PriorityModel priority_model
,
52 RTCORBA::Priority server_priority
);
55 TAO_PriorityModelPolicy (const TAO_PriorityModelPolicy
&rhs
);
58 * Accessor for the <priority_model_> attribute. This method is
59 * used internally by the orb. This is a more efficient
60 * (non-virtual, no exception handling) relative of the idl interface
61 * implementation <priority_model> below.
63 RTCORBA::PriorityModel
get_priority_model ();
65 RTCORBA::PriorityModel
priority_model ();
67 RTCORBA::Priority
server_priority ();
69 CORBA::PolicyType
policy_type ();
71 CORBA::Policy_ptr
copy ();
75 /// This method writes a CDR representation of the object state.
76 CORBA::Boolean
_tao_encode (TAO_OutputCDR
&out_cdr
);
78 /// This method reads the object state from a CDR representation.
79 CORBA::Boolean
_tao_decode (TAO_InputCDR
&in_cdr
);
81 // Return the cached policy type for this policy.
82 TAO_Cached_Policy_Type
_tao_cached_type () const;
84 // Returns the scope at which this policy can be applied. See orbconf.h.
85 TAO_Policy_Scope
_tao_scope () const;
87 /// Helper method for the implementation of
88 /// CORBA::ORB::create_policy.
89 static CORBA::Policy_ptr
create (const CORBA::Any
&val
);
92 /// Protected destructor to enforce proper memory management of this
93 /// reference counted object.
94 virtual ~TAO_PriorityModelPolicy ();
96 /// This constructor is used by TAO_RT_PolicyFactory when decoding
97 /// policies from tagged components in an IOR.
98 friend class TAO_RT_PolicyFactory
;
99 TAO_PriorityModelPolicy ();
103 RTCORBA::PriorityModel priority_model_
;
104 RTCORBA::Priority server_priority_
;
107 //*************************************************************************
110 * @class TAO_ThreadpoolPolicy
112 * @brief RTCORBA::ThreadpoolPolicy implementation
114 * This policy controls which threadpool is associated with a POA.
116 class TAO_RTCORBA_Export TAO_ThreadpoolPolicy
117 : public RTCORBA::ThreadpoolPolicy
,
118 public ::CORBA::LocalObject
122 TAO_ThreadpoolPolicy (RTCORBA::ThreadpoolId id
);
124 /// Copy constructor.
125 TAO_ThreadpoolPolicy (const TAO_ThreadpoolPolicy
&rhs
);
127 RTCORBA::ThreadpoolId
threadpool ();
129 CORBA::PolicyType
policy_type ();
131 CORBA::Policy_ptr
copy ();
135 // Return the cached policy type for this policy.
136 TAO_Cached_Policy_Type
_tao_cached_type () const;
138 // Returns the scope at which this policy can be applied. See orbconf.h.
139 TAO_Policy_Scope
_tao_scope () const;
141 /// Helper method for the implementation of
142 /// CORBA::ORB::create_policy.
143 static CORBA::Policy_ptr
create (const CORBA::Any
&val
);
146 /// Protected destructor to enforce proper memory management of this
147 /// reference counted object.
148 virtual ~TAO_ThreadpoolPolicy ();
152 RTCORBA::ThreadpoolId id_
;
155 //*************************************************************************
158 * @class TAO_PrivateConnectionPolicy
160 * @brief RTCORBA::PrivateConnectionPolicy implementation
162 * This policy controls whether the transport connection for the
163 * Object is private, i.e., not available for carrying out invocations on
166 class TAO_RTCORBA_Export TAO_PrivateConnectionPolicy
167 : public RTCORBA::PrivateConnectionPolicy
,
168 public ::CORBA::LocalObject
172 TAO_PrivateConnectionPolicy ();
174 /// Copy constructor.
175 TAO_PrivateConnectionPolicy (const TAO_PrivateConnectionPolicy
&rhs
);
177 CORBA::PolicyType
policy_type ();
179 CORBA::Policy_ptr
copy ();
183 // Return the cached policy type for this policy.
184 TAO_Cached_Policy_Type
_tao_cached_type () const;
186 // Returns the scope at which this policy can be applied. See orbconf.h.
187 TAO_Policy_Scope
_tao_scope () const;
189 /// Helper method for the implementation of
190 /// CORBA::ORB::create_policy.
191 static CORBA::Policy_ptr
create (const CORBA::Any
&val
);
194 /// Protected destructor to enforce proper memory management of this
195 /// reference counted object.
196 virtual ~TAO_PrivateConnectionPolicy ();
199 //*************************************************************************
202 * @class TAO_PriorityBandedConnectionPolicy
204 * @brief RTCORBA::PriorityBandedConnectionPolicy implementation
206 * RT CORBA provides facility for a client to communicate with a
207 * server via multiple connections, aka bands, with each connection handling
208 * invocations that are made at a different CORBA priority.
209 * This policy allows the specification of the number of such
210 * bands and their priorities.
212 class TAO_RTCORBA_Export TAO_PriorityBandedConnectionPolicy
213 : public RTCORBA::PriorityBandedConnectionPolicy
,
214 public ::CORBA::LocalObject
218 TAO_PriorityBandedConnectionPolicy (const RTCORBA::PriorityBands
&bands
);
220 /// Copy constructor.
221 TAO_PriorityBandedConnectionPolicy (const TAO_PriorityBandedConnectionPolicy
&rhs
);
224 * Accessor to the underlying priority bands of the policy (does not
225 * make a copy like the idl accessor <priority_bands> implementation
228 RTCORBA::PriorityBands
&priority_bands_rep ();
230 RTCORBA::PriorityBands
*priority_bands ();
232 CORBA::PolicyType
policy_type ();
234 CORBA::Policy_ptr
copy ();
238 /// This method writes a CDR representation of the current object.
239 CORBA::Boolean
_tao_encode (TAO_OutputCDR
&out_cdr
);
241 /// This method reads the object state from a CDR representation.
242 CORBA::Boolean
_tao_decode (TAO_InputCDR
&in_cdr
);
244 // Return the cached policy type for this policy.
245 TAO_Cached_Policy_Type
_tao_cached_type () const;
247 // Returns the scope at which this policy can be applied. See orbconf.h.
248 TAO_Policy_Scope
_tao_scope () const;
250 /// Helper method for the implementation of
251 /// CORBA::ORB::create_policy.
252 static CORBA::Policy_ptr
create (const CORBA::Any
&val
);
255 /// Protected destructor to enforce proper memory management of this
256 /// reference counted object.
257 virtual ~TAO_PriorityBandedConnectionPolicy ();
259 /// This constructor is used by TAO_RT_PolicyFactory when decoding
260 /// policies from tagged components in an IOR.
261 friend class TAO_RT_PolicyFactory
;
262 TAO_PriorityBandedConnectionPolicy ();
266 RTCORBA::PriorityBands priority_bands_
;
269 //*************************************************************************
272 * @class TAO_ServerProtocolPolicy
274 * @brief RTCORBA::ServerProtocolPolicy implementation
276 * This policy controls selection and configuration of
277 * communication protocols on the server-side of the RT ORB.
279 class TAO_RTCORBA_Export TAO_ServerProtocolPolicy
280 : public RTCORBA::ServerProtocolPolicy
,
281 public ::CORBA::LocalObject
285 TAO_ServerProtocolPolicy (const RTCORBA::ProtocolList
&protocols
);
287 /// Copy constructor.
288 TAO_ServerProtocolPolicy (const TAO_ServerProtocolPolicy
&rhs
);
291 * Accessor to the underlying protocols list of the policy (does not
292 * make a copy like the idl accessor <protocols> implementation
295 RTCORBA::ProtocolList
& protocols_rep ();
297 RTCORBA::ProtocolList
*protocols ();
299 CORBA::PolicyType
policy_type ();
301 CORBA::Policy_ptr
copy ();
305 // Return the cached policy type for this policy.
306 TAO_Cached_Policy_Type
_tao_cached_type () const;
308 // Returns the scope at which this policy can be applied. See orbconf.h.
309 TAO_Policy_Scope
_tao_scope () const;
311 /// Helper method for the implementation of
312 /// CORBA::ORB::create_policy.
313 static CORBA::Policy_ptr
create (const CORBA::Any
&val
);
316 /// Protected destructor to enforce proper memory management of this
317 /// reference counted object.
318 virtual ~TAO_ServerProtocolPolicy ();
322 RTCORBA::ProtocolList protocols_
;
325 //*************************************************************************
328 * @class TAO_ClientProtocolPolicy
330 * @brief RTCORBA::ClientProtocolPolicy implementation
332 * This policy controls selection and configuration of
333 * communication protocols on the client-side of the RT ORB.
335 class TAO_RTCORBA_Export TAO_ClientProtocolPolicy
336 : public RTCORBA::ClientProtocolPolicy
,
337 public ::CORBA::LocalObject
341 TAO_ClientProtocolPolicy (const RTCORBA::ProtocolList
&protocols
);
343 /// Copy constructor.
344 TAO_ClientProtocolPolicy (const TAO_ClientProtocolPolicy
&rhs
);
347 * Accessor to the underlying protocols list of the policy (does not
348 * make a copy like the idl accessor <protocols> implementation
351 RTCORBA::ProtocolList
& protocols_rep ();
353 RTCORBA::ProtocolList
*protocols ();
355 CORBA::PolicyType
policy_type ();
357 CORBA::Policy_ptr
copy ();
361 // = CDR Encoder/Decoder.
363 /// This method writes a CDR representation of the current object.
364 CORBA::Boolean
_tao_encode (TAO_OutputCDR
&out_cdr
);
366 /// This method reads the object state from a CDR representation.
367 CORBA::Boolean
_tao_decode (TAO_InputCDR
&in_cdr
);
369 // Return the cached policy type for this policy.
370 TAO_Cached_Policy_Type
_tao_cached_type () const;
372 // Returns the scope at which this policy can be applied. See orbconf.h.
373 TAO_Policy_Scope
_tao_scope () const;
375 /// Helper method for the implementation of
376 /// CORBA::ORB::create_policy.
377 static CORBA::Policy_ptr
create (const CORBA::Any
&val
);
380 /// Protected destructor to enforce proper memory management of this
381 /// reference counted object.
382 virtual ~TAO_ClientProtocolPolicy ();
384 /// This constructor is used by TAO_RT_PolicyFactory when decoding
385 /// policies from tagged components in an IOR.
386 friend class TAO_RT_PolicyFactory
;
387 TAO_ClientProtocolPolicy ();
391 RTCORBA::ProtocolList protocols_
;
394 //*************************************************************************
397 * @class TAO_TCP_Protocol_Properties
399 * @brief RTCORBA::TCPProtocolProperties implementation
401 * Stores TCP Protocol configuration properties.
403 class TAO_RTCORBA_Export TAO_TCP_Protocol_Properties
404 : public RTCORBA::TCPProtocolProperties
,
405 public ::CORBA::LocalObject
409 TAO_TCP_Protocol_Properties (CORBA::Long send_buffer_size
,
410 CORBA::Long recv_buffer_size
,
411 CORBA::Boolean keep_alive
,
412 CORBA::Boolean dont_route
,
413 CORBA::Boolean no_delay
,
414 CORBA::Boolean enable_network_priority
);
416 CORBA::Long
send_buffer_size ();
418 void send_buffer_size (CORBA::Long send_buffer_size
);
420 CORBA::Long
recv_buffer_size ();
422 void recv_buffer_size (CORBA::Long recv_buffer_size
);
424 CORBA::Boolean
keep_alive ();
426 void keep_alive (CORBA::Boolean keep_alive
);
428 CORBA::Boolean
dont_route ();
430 void dont_route (CORBA::Boolean dont_route
);
432 CORBA::Boolean
no_delay ();
434 void no_delay (CORBA::Boolean no_delay
);
436 CORBA::Boolean
enable_network_priority ();
438 void enable_network_priority (CORBA::Boolean enable
);
440 /// This method writes a CDR representation of TCPProtocolProperties.
441 CORBA::Boolean
_tao_encode (TAO_OutputCDR
&out_cdr
);
443 /// This method reads the object state from a CDR representation.
444 CORBA::Boolean
_tao_decode (TAO_InputCDR
&in_cdr
);
447 /// Protected destructor to enforce proper memory management of this
448 /// reference counted object.
449 virtual ~TAO_TCP_Protocol_Properties ();
454 CORBA::Long send_buffer_size_
;
455 CORBA::Long recv_buffer_size_
;
456 CORBA::Boolean keep_alive_
;
457 CORBA::Boolean dont_route_
;
458 CORBA::Boolean no_delay_
;
459 CORBA::Boolean enable_network_priority_
;
462 //*************************************************************************
465 * @class TAO_UnixDomain_Protocol_Properties
467 * @brief RTCORBA::UnixDomainProtocolProperties implementation.
469 * Stores Unix Domain Sockets (Local IPC) Protocol configuration
472 class TAO_RTCORBA_Export TAO_UnixDomain_Protocol_Properties
473 : public RTCORBA::UnixDomainProtocolProperties
,
474 public ::CORBA::LocalObject
478 TAO_UnixDomain_Protocol_Properties (CORBA::Long send_buffer_size
,
479 CORBA::Long recv_buffer_size
);
481 CORBA::Long
send_buffer_size ();
483 void send_buffer_size (CORBA::Long send_buffer_size
);
485 CORBA::Long
recv_buffer_size ();
487 void recv_buffer_size (CORBA::Long recv_buffer_size
);
490 * This method writes the CDR encapsulation of an instance of
491 * UnixDomainProperties. This Protocol Property in TAO specific,
492 * so there is no order of encapsulation specified in the
493 * RT CORBA Spec. The current implementation encodes the field
494 * according to the order of declaration (i.e. first is encoded
495 * send_buffer_size and then recv_buffer_size).
497 CORBA::Boolean
_tao_encode (TAO_OutputCDR
&out_cdr
);
500 * This method reads an instance of UnixDomainProperties from
501 * a CDR encapsulation. This Protocol Property in TAO specific,
502 * so there is no order of encapsulation specified in the
503 * RT CORBA Spec. The current implementation expect the field
504 * according to the order of declaration.
506 CORBA::Boolean
_tao_decode (TAO_InputCDR
&in_cdr
);
509 /// Protected destructor to enforce proper memory management of this
510 /// reference counted object.
511 virtual ~TAO_UnixDomain_Protocol_Properties ();
515 CORBA::Long send_buffer_size_
;
516 CORBA::Long recv_buffer_size_
;
519 //*************************************************************************
522 * @class TAO_SharedMemory_Protocol_Properties
524 * @brief RTCORBA::SharedMemoryProtocolProperties implementation.
526 * Stores Shared Memory Protocol configuration
529 class TAO_RTCORBA_Export TAO_SharedMemory_Protocol_Properties
530 : public RTCORBA::SharedMemoryProtocolProperties
,
531 public ::CORBA::LocalObject
535 TAO_SharedMemory_Protocol_Properties (CORBA::Long send_buffer_size
,
536 CORBA::Long recv_buffer_size
,
537 CORBA::Boolean keep_alive
,
538 CORBA::Boolean dont_route
,
539 CORBA::Boolean no_delay
,
540 CORBA::Long preallocate_buffer_size
,
541 const char *mmap_filename
,
542 const char *mmap_lockname
);
544 // = IDL interface methods.
546 CORBA::Long
send_buffer_size ();
548 void send_buffer_size (CORBA::Long send_buffer_size
);
550 CORBA::Long
recv_buffer_size ();
552 void recv_buffer_size (CORBA::Long recv_buffer_size
);
554 CORBA::Boolean
keep_alive ();
556 void keep_alive (CORBA::Boolean keep_alive
);
558 CORBA::Boolean
dont_route ();
560 void dont_route (CORBA::Boolean dont_route
);
562 CORBA::Boolean
no_delay ();
564 void no_delay (CORBA::Boolean no_delay
);
566 CORBA::Boolean
enable_network_priority ();
568 CORBA::Long
preallocate_buffer_size ();
570 void preallocate_buffer_size (CORBA::Long preallocate_buffer_size
);
572 char *mmap_filename ();
574 void mmap_filename (const char *mmap_filename
);
576 char *mmap_lockname ();
578 void mmap_lockname (const char *mmap_lockname
);
581 * This method writes the CDR encapsulation of an instance of
582 * SharedMemoryProperties. This Protocol Property in TAO specific,
583 * so there is no order of encapsulation specified in the
584 * RT CORBA Spec. The current implementation encodes the field
585 * according to the order of declaration.
587 CORBA::Boolean
_tao_encode (TAO_OutputCDR
&out_cdr
);
590 * This method reads an instance of SharedMemoryProperties from
591 * a CDR encapsulation. This Protocol Property in TAO specific,
592 * so there is no order of encapsulation specified in the
593 * RT CORBA Spec. The current implementation expect the field
594 * according to the order of declaration.
596 CORBA::Boolean
_tao_decode (TAO_InputCDR
&in_cdr
);
599 /// Protected destructor to enforce proper memory management of this
600 /// reference counted object.
601 virtual ~TAO_SharedMemory_Protocol_Properties ();
605 CORBA::Long send_buffer_size_
;
606 CORBA::Long recv_buffer_size_
;
607 CORBA::Boolean keep_alive_
;
608 CORBA::Boolean dont_route_
;
609 CORBA::Boolean no_delay_
;
610 CORBA::Long preallocate_buffer_size_
;
611 ACE_CString mmap_filename_
;
612 ACE_CString mmap_lockname_
;
615 //*************************************************************************
618 * @class TAO_UserDatagram_Protocol_Properties
620 * @brief RTCORBA::UserDatagramProtocolProperties implementation
622 * Stores UserDatagram Protocol configuration properties.
624 class TAO_RTCORBA_Export TAO_UserDatagram_Protocol_Properties
625 : public RTCORBA::UserDatagramProtocolProperties
,
626 public ::CORBA::LocalObject
630 TAO_UserDatagram_Protocol_Properties (CORBA::Long send_buffer_size
,
631 CORBA::Long recv_buffer_size
,
632 CORBA::Boolean enable_network_priority
);
634 CORBA::Boolean
enable_network_priority ();
636 void enable_network_priority (CORBA::Boolean enable
);
638 CORBA::Long
send_buffer_size ();
640 void send_buffer_size (CORBA::Long send_buffer_size
);
642 CORBA::Long
recv_buffer_size ();
644 void recv_buffer_size (CORBA::Long recv_buffer_size
);
646 /// This method writes a CDR representation of UserDatagramProtocolProperties.
647 CORBA::Boolean
_tao_encode (TAO_OutputCDR
&out_cdr
);
649 /// This method reads the object state from a CDR representation.
650 CORBA::Boolean
_tao_decode (TAO_InputCDR
&in_cdr
);
653 /// Protected destructor to enforce proper memory management of this
654 /// reference counted object.
655 virtual ~TAO_UserDatagram_Protocol_Properties ();
659 CORBA::Long send_buffer_size_
;
660 CORBA::Long recv_buffer_size_
;
662 CORBA::Boolean enable_network_priority_
;
665 //*************************************************************************
668 * @class TAO_StreamControl_Protocol_Properties
670 * @brief RTCORBA::StreamControlProtocolProperties implementation
672 * Stores StreamControl Protocol configuration properties.
674 class TAO_RTCORBA_Export TAO_StreamControl_Protocol_Properties
675 : public RTCORBA::StreamControlProtocolProperties
,
676 public ::CORBA::LocalObject
680 TAO_StreamControl_Protocol_Properties (CORBA::Long send_buffer_size
,
681 CORBA::Long recv_buffer_size
,
682 CORBA::Boolean keep_alive
,
683 CORBA::Boolean dont_route
,
684 CORBA::Boolean no_delay
,
685 CORBA::Boolean enable_network_priority
);
687 CORBA::Long
send_buffer_size ();
689 void send_buffer_size (CORBA::Long send_buffer_size
);
691 CORBA::Long
recv_buffer_size ();
693 void recv_buffer_size (CORBA::Long recv_buffer_size
);
695 CORBA::Boolean
keep_alive ();
697 void keep_alive (CORBA::Boolean keep_alive
);
699 CORBA::Boolean
dont_route ();
701 void dont_route (CORBA::Boolean dont_route
);
703 CORBA::Boolean
no_delay ();
705 void no_delay (CORBA::Boolean no_delay
);
707 CORBA::Boolean
enable_network_priority ();
709 void enable_network_priority (CORBA::Boolean enable
);
711 /// This method writes a CDR representation of StreamControlProtocolProperties.
712 CORBA::Boolean
_tao_encode (TAO_OutputCDR
&out_cdr
);
714 /// This method reads the object state from a CDR representation.
715 CORBA::Boolean
_tao_decode (TAO_InputCDR
&in_cdr
);
718 /// Protected destructor to enforce proper memory management of this
719 /// reference counted object.
720 virtual ~TAO_StreamControl_Protocol_Properties ();
725 CORBA::Long send_buffer_size_
;
726 CORBA::Long recv_buffer_size_
;
727 CORBA::Boolean keep_alive_
;
728 CORBA::Boolean dont_route_
;
729 CORBA::Boolean no_delay_
;
730 CORBA::Boolean enable_network_priority_
;
733 //*************************************************************************
735 class TAO_RTCORBA_Export TAO_GIOP_Protocol_Properties
736 : public RTCORBA::GIOPProtocolProperties
,
737 public ::CORBA::LocalObject
740 // = CDR encoding methods
741 CORBA::Boolean
_tao_encode (TAO_OutputCDR
&out_cdr
);
742 CORBA::Boolean
_tao_decode (TAO_InputCDR
&in_cdr
);
745 /// Protected destructor to enforce proper memory management of this
746 /// reference counted object.
747 virtual ~TAO_GIOP_Protocol_Properties ();
749 friend class TAO_Protocol_Properties_Factory
;
750 TAO_GIOP_Protocol_Properties ();
753 //*************************************************************************
755 class TAO_RTCORBA_Export TAO_Protocol_Properties_Factory
759 * Creates the proper transport ProtocolProperties subclass that matches
760 * the IOP::ProfileId.
761 * NOTE: Each IOP::ProfileId corresponds to two sets of protocol
762 * properties: one describes the transport protocol and the other
763 * describes the ORB messaging protocol.
765 static RTCORBA::ProtocolProperties
*create_transport_protocol_property (
767 TAO_ORB_Core
*orb_core
);
770 * Creates the proper orb ProtocolProperties subclass for
772 * NOTE: Each IOP::ProfileId corresponds to two sets of protocol
773 * properties: one describes the transport protocol and the other
774 * describes the ORB messaging protocol.
776 static RTCORBA::ProtocolProperties
*create_orb_protocol_property (IOP::ProfileId id
);
779 TAO_Protocol_Properties_Factory ();
782 TAO_END_VERSIONED_NAMESPACE_DECL
784 #if defined(_MSC_VER)
786 #endif /* _MSC_VER */
788 #endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */
790 #include /**/ "ace/post.h"
792 #endif /* TAO_RT_POLICY_I_H */