Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / TAO / tao / RTCORBA / RT_Policy_i.cpp
blobebe65f7c2eb7bdbc0640b2500cc28efbaf19e82e
1 #include "tao/RTCORBA/RT_Policy_i.h"
3 #if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
5 #include "tao/ORB_Core.h"
6 #include "tao/Policy_Manager.h"
7 #include "tao/debug.h"
8 #include "tao/CDR.h"
9 #include "tao/AnyTypeCode/Any.h"
10 #include "tao/SystemException.h"
12 #include "ace/OS_NS_string.h"
14 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
16 TAO_PriorityModelPolicy::TAO_PriorityModelPolicy (
17 RTCORBA::PriorityModel priority_model,
18 RTCORBA::Priority server_priority)
19 : ::CORBA::Object ()
20 , ::CORBA::Policy ()
21 , RTCORBA::PriorityModelPolicy ()
22 , ::CORBA::LocalObject ()
23 , priority_model_ (priority_model)
24 , server_priority_ (server_priority)
28 TAO_PriorityModelPolicy::TAO_PriorityModelPolicy (const TAO_PriorityModelPolicy &rhs)
29 : ::CORBA::Object ()
30 , ::CORBA::Policy ()
31 , RTCORBA::PriorityModelPolicy ()
32 , ::CORBA::LocalObject ()
33 , priority_model_ (rhs.priority_model_)
34 , server_priority_ (rhs.server_priority_)
38 TAO_PriorityModelPolicy::TAO_PriorityModelPolicy ()
39 : priority_model_ (RTCORBA::SERVER_DECLARED),
40 server_priority_ (0)
44 TAO_PriorityModelPolicy::~TAO_PriorityModelPolicy ()
48 CORBA::Policy_ptr
49 TAO_PriorityModelPolicy::create (const CORBA::Any &)
52 * @@ The following code should be changed once the OMG spec has
53 * been fixed such that a RTCORBA::PriorityModelPolicy can be
54 * created by using the ORB::create_policy interface.
56 throw ::CORBA::PolicyError (CORBA::BAD_POLICY_VALUE);
59 RTCORBA::PriorityModel
60 TAO_PriorityModelPolicy::get_priority_model ()
62 return this->priority_model_;
65 RTCORBA::PriorityModel
66 TAO_PriorityModelPolicy::priority_model ()
68 return this->priority_model_;
71 RTCORBA::Priority
72 TAO_PriorityModelPolicy::server_priority ()
74 return this->server_priority_;
77 CORBA::PolicyType
78 TAO_PriorityModelPolicy::policy_type ()
80 return RTCORBA::PRIORITY_MODEL_POLICY_TYPE;
83 CORBA::Policy_ptr
84 TAO_PriorityModelPolicy::copy ()
86 TAO_PriorityModelPolicy* tmp = 0;
87 ACE_NEW_THROW_EX (tmp,
88 TAO_PriorityModelPolicy (*this),
89 CORBA::NO_MEMORY (TAO::VMCID,
90 CORBA::COMPLETED_NO));
92 return tmp;
95 void
96 TAO_PriorityModelPolicy::destroy ()
100 CORBA::Boolean
101 TAO_PriorityModelPolicy::_tao_encode (TAO_OutputCDR &out_cdr)
103 // Note: the fields are encoded according to
104 // the order specified in the RTCORBA 1.0 spec (ptc/99-05-03)
105 // section 4.7.3.
107 return ((out_cdr << priority_model_) && (out_cdr << server_priority_));
110 CORBA::Boolean
111 TAO_PriorityModelPolicy::_tao_decode (TAO_InputCDR &in_cdr)
113 return ((in_cdr >> priority_model_) && (in_cdr >> server_priority_));
116 TAO_Cached_Policy_Type
117 TAO_PriorityModelPolicy::_tao_cached_type () const
119 return TAO_CACHED_POLICY_PRIORITY_MODEL;
122 TAO_Policy_Scope
123 TAO_PriorityModelPolicy::_tao_scope () const
125 // Note that this policy is propagated to the client even though
126 // it is not specified here. The reason for this is that the
127 // server priority field is set dynamically depending on the model
128 // and the servant's priority. Therefore, it can't be simply
129 // copied to the list of client exposed policies.
130 return static_cast<TAO_Policy_Scope> (TAO_POLICY_ORB_SCOPE |
131 TAO_POLICY_POA_SCOPE);
134 // ****************************************************************
136 TAO_ThreadpoolPolicy::TAO_ThreadpoolPolicy (RTCORBA::ThreadpoolId id)
137 : ::CORBA::Object ()
138 , ::CORBA::Policy ()
139 , RTCORBA::ThreadpoolPolicy ()
140 , ::CORBA::LocalObject ()
141 , id_ (id)
145 TAO_ThreadpoolPolicy::TAO_ThreadpoolPolicy (const TAO_ThreadpoolPolicy &rhs)
146 : ::CORBA::Object ()
147 , ::CORBA::Policy ()
148 , RTCORBA::ThreadpoolPolicy ()
149 , ::CORBA::LocalObject ()
150 , id_ (rhs.id_)
154 TAO_ThreadpoolPolicy::~TAO_ThreadpoolPolicy ()
158 CORBA::Policy_ptr
159 TAO_ThreadpoolPolicy::create (const CORBA::Any &val)
161 RTCORBA::ThreadpoolId value;
162 if (!(val >>= value))
163 throw ::CORBA::PolicyError (CORBA::BAD_POLICY_VALUE);
165 TAO_ThreadpoolPolicy *tmp = 0;
166 ACE_NEW_THROW_EX (tmp,
167 TAO_ThreadpoolPolicy (value),
168 CORBA::NO_MEMORY (TAO::VMCID,
169 CORBA::COMPLETED_NO));
171 return tmp;
174 RTCORBA::ThreadpoolId
175 TAO_ThreadpoolPolicy::threadpool ()
177 return this->id_;
180 CORBA::PolicyType
181 TAO_ThreadpoolPolicy::policy_type ()
183 return RTCORBA::THREADPOOL_POLICY_TYPE;
186 CORBA::Policy_ptr
187 TAO_ThreadpoolPolicy::copy ()
189 TAO_ThreadpoolPolicy* tmp = 0;
190 ACE_NEW_THROW_EX (tmp,
191 TAO_ThreadpoolPolicy (*this),
192 CORBA::NO_MEMORY (TAO::VMCID,
193 CORBA::COMPLETED_NO));
195 return tmp;
198 void
199 TAO_ThreadpoolPolicy::destroy ()
203 TAO_Cached_Policy_Type
204 TAO_ThreadpoolPolicy::_tao_cached_type () const
206 return TAO_CACHED_POLICY_THREADPOOL;
209 TAO_Policy_Scope
210 TAO_ThreadpoolPolicy::_tao_scope () const
212 return static_cast<TAO_Policy_Scope> (TAO_POLICY_ORB_SCOPE |
213 TAO_POLICY_POA_SCOPE);
216 // ****************************************************************
218 TAO_PrivateConnectionPolicy::TAO_PrivateConnectionPolicy ()
219 : ::CORBA::Object ()
220 , ::CORBA::Policy ()
221 , RTCORBA::PrivateConnectionPolicy ()
222 , ::CORBA::LocalObject ()
226 TAO_PrivateConnectionPolicy::TAO_PrivateConnectionPolicy (const TAO_PrivateConnectionPolicy &)
227 : ::CORBA::Object ()
228 , ::CORBA::Policy ()
229 , RTCORBA::PrivateConnectionPolicy ()
230 , ::CORBA::LocalObject ()
234 TAO_PrivateConnectionPolicy::~TAO_PrivateConnectionPolicy ()
238 CORBA::Policy_ptr
239 TAO_PrivateConnectionPolicy::create (const CORBA::Any &)
241 TAO_PrivateConnectionPolicy *tmp = 0;
242 ACE_NEW_THROW_EX (tmp,
243 TAO_PrivateConnectionPolicy (),
244 CORBA::NO_MEMORY (TAO::VMCID,
245 CORBA::COMPLETED_NO));
247 return tmp;
250 CORBA::PolicyType
251 TAO_PrivateConnectionPolicy::policy_type ()
253 return RTCORBA::PRIVATE_CONNECTION_POLICY_TYPE;
256 CORBA::Policy_ptr
257 TAO_PrivateConnectionPolicy::copy ()
259 TAO_PrivateConnectionPolicy* tmp = 0;
260 ACE_NEW_THROW_EX (tmp,
261 TAO_PrivateConnectionPolicy (*this),
262 CORBA::NO_MEMORY (TAO::VMCID,
263 CORBA::COMPLETED_NO));
265 return tmp;
268 void
269 TAO_PrivateConnectionPolicy::destroy ()
273 TAO_Cached_Policy_Type
274 TAO_PrivateConnectionPolicy::_tao_cached_type () const
276 return TAO_CACHED_POLICY_RT_PRIVATE_CONNECTION;
279 TAO_Policy_Scope
280 TAO_PrivateConnectionPolicy::_tao_scope () const
282 return static_cast<TAO_Policy_Scope> (TAO_POLICY_OBJECT_SCOPE |
283 TAO_POLICY_THREAD_SCOPE |
284 TAO_POLICY_ORB_SCOPE);
287 // ****************************************************************
289 TAO_PriorityBandedConnectionPolicy::TAO_PriorityBandedConnectionPolicy (const RTCORBA::PriorityBands &bands)
290 : ::CORBA::Object ()
291 , ::CORBA::Policy ()
292 , RTCORBA::PriorityBandedConnectionPolicy ()
293 , ::CORBA::LocalObject ()
294 , priority_bands_ (bands)
298 TAO_PriorityBandedConnectionPolicy::TAO_PriorityBandedConnectionPolicy (const TAO_PriorityBandedConnectionPolicy &rhs)
299 : ::CORBA::Object ()
300 , ::CORBA::Policy ()
301 , RTCORBA::PriorityBandedConnectionPolicy ()
302 , ::CORBA::LocalObject ()
303 , priority_bands_ (rhs.priority_bands_)
307 TAO_PriorityBandedConnectionPolicy::TAO_PriorityBandedConnectionPolicy ()
311 TAO_PriorityBandedConnectionPolicy::~TAO_PriorityBandedConnectionPolicy ()
315 CORBA::Policy_ptr
316 TAO_PriorityBandedConnectionPolicy::create (const CORBA::Any &val)
318 const RTCORBA::PriorityBands *value = 0;
319 if (!(val >>= value))
320 throw ::CORBA::PolicyError (CORBA::BAD_POLICY_VALUE);
322 TAO_PriorityBandedConnectionPolicy *tmp = 0;
323 ACE_NEW_THROW_EX (tmp,
324 TAO_PriorityBandedConnectionPolicy (*value),
325 CORBA::NO_MEMORY (TAO::VMCID,
326 CORBA::COMPLETED_NO));
328 return tmp;
331 RTCORBA::PriorityBands *
332 TAO_PriorityBandedConnectionPolicy::priority_bands ()
334 RTCORBA::PriorityBands *tmp = 0;
335 ACE_NEW_THROW_EX (tmp,
336 RTCORBA::PriorityBands (this->priority_bands_),
337 CORBA::NO_MEMORY (TAO::VMCID,
338 CORBA::COMPLETED_NO));
340 return tmp;
343 CORBA::PolicyType
344 TAO_PriorityBandedConnectionPolicy::policy_type ()
346 return RTCORBA::PRIORITY_BANDED_CONNECTION_POLICY_TYPE;
349 CORBA::Policy_ptr
350 TAO_PriorityBandedConnectionPolicy::copy ()
352 TAO_PriorityBandedConnectionPolicy *tmp = 0;
353 ACE_NEW_THROW_EX (tmp,
354 TAO_PriorityBandedConnectionPolicy (*this),
355 CORBA::NO_MEMORY (TAO::VMCID,
356 CORBA::COMPLETED_NO));
358 return tmp;
361 void
362 TAO_PriorityBandedConnectionPolicy::destroy ()
366 CORBA::Boolean
367 TAO_PriorityBandedConnectionPolicy::_tao_encode (TAO_OutputCDR &out_cdr)
369 return out_cdr << this->priority_bands_;
372 CORBA::Boolean
373 TAO_PriorityBandedConnectionPolicy::_tao_decode (TAO_InputCDR &in_cdr)
375 return in_cdr >> this->priority_bands_;
378 TAO_Cached_Policy_Type
379 TAO_PriorityBandedConnectionPolicy::_tao_cached_type () const
381 return TAO_CACHED_POLICY_RT_PRIORITY_BANDED_CONNECTION;
384 TAO_Policy_Scope
385 TAO_PriorityBandedConnectionPolicy::_tao_scope () const
387 return static_cast<TAO_Policy_Scope> (TAO_POLICY_DEFAULT_SCOPE |
388 TAO_POLICY_CLIENT_EXPOSED);
391 RTCORBA::PriorityBands &
392 TAO_PriorityBandedConnectionPolicy::priority_bands_rep ()
394 return this->priority_bands_;
397 // ****************************************************************
399 TAO_ServerProtocolPolicy::TAO_ServerProtocolPolicy (const RTCORBA::ProtocolList &protocols)
400 : ::CORBA::Object ()
401 , ::CORBA::Policy ()
402 , RTCORBA::ServerProtocolPolicy ()
403 , ::CORBA::LocalObject ()
404 , protocols_ (protocols)
408 TAO_ServerProtocolPolicy::TAO_ServerProtocolPolicy (const TAO_ServerProtocolPolicy &rhs)
409 : ::CORBA::Object ()
410 , ::CORBA::Policy ()
411 , RTCORBA::ServerProtocolPolicy ()
412 , ::CORBA::LocalObject ()
413 , protocols_ (rhs.protocols_)
417 TAO_ServerProtocolPolicy::~TAO_ServerProtocolPolicy ()
421 CORBA::Policy_ptr
422 TAO_ServerProtocolPolicy::create (const CORBA::Any &val)
424 const RTCORBA::ProtocolList *value = 0;
425 if (!(val >>= value))
426 throw ::CORBA::PolicyError (CORBA::BAD_POLICY_VALUE);
428 TAO_ServerProtocolPolicy *tmp = 0;
429 ACE_NEW_THROW_EX (tmp,
430 TAO_ServerProtocolPolicy (*value),
431 CORBA::NO_MEMORY (TAO::VMCID,
432 CORBA::COMPLETED_NO));
434 return tmp;
437 RTCORBA::ProtocolList *
438 TAO_ServerProtocolPolicy::protocols ()
440 RTCORBA::ProtocolList *tmp = 0;
441 ACE_NEW_THROW_EX (tmp,
442 RTCORBA::ProtocolList (this->protocols_),
443 CORBA::NO_MEMORY (TAO::VMCID,
444 CORBA::COMPLETED_NO));
446 return tmp;
449 CORBA::PolicyType
450 TAO_ServerProtocolPolicy::policy_type ()
452 return RTCORBA::SERVER_PROTOCOL_POLICY_TYPE;
455 CORBA::Policy_ptr
456 TAO_ServerProtocolPolicy::copy ()
458 TAO_ServerProtocolPolicy* tmp = 0;
459 ACE_NEW_THROW_EX (tmp,
460 TAO_ServerProtocolPolicy (*this),
461 CORBA::NO_MEMORY (TAO::VMCID,
462 CORBA::COMPLETED_NO));
464 return tmp;
467 void
468 TAO_ServerProtocolPolicy::destroy ()
472 TAO_Cached_Policy_Type
473 TAO_ServerProtocolPolicy::_tao_cached_type () const
475 return TAO_CACHED_POLICY_RT_SERVER_PROTOCOL;
478 TAO_Policy_Scope
479 TAO_ServerProtocolPolicy::_tao_scope () const
481 return static_cast<TAO_Policy_Scope> (TAO_POLICY_ORB_SCOPE |
482 TAO_POLICY_POA_SCOPE);
485 RTCORBA::ProtocolList &
486 TAO_ServerProtocolPolicy::protocols_rep ()
488 return protocols_;
491 // ****************************************************************
493 TAO_ClientProtocolPolicy::TAO_ClientProtocolPolicy ()
498 TAO_ClientProtocolPolicy::TAO_ClientProtocolPolicy (const RTCORBA::ProtocolList &protocols)
499 : ::CORBA::Object ()
500 , ::CORBA::Policy ()
501 , RTCORBA::ClientProtocolPolicy ()
502 , ::CORBA::LocalObject ()
503 , protocols_ (protocols)
507 TAO_ClientProtocolPolicy::TAO_ClientProtocolPolicy (const TAO_ClientProtocolPolicy &rhs)
508 : ::CORBA::Object ()
509 , ::CORBA::Policy ()
510 , RTCORBA::ClientProtocolPolicy ()
511 , ::CORBA::LocalObject ()
512 , protocols_ (rhs.protocols_)
516 TAO_ClientProtocolPolicy::~TAO_ClientProtocolPolicy ()
520 CORBA::Policy_ptr
521 TAO_ClientProtocolPolicy::create (const CORBA::Any &val)
523 const RTCORBA::ProtocolList *value = 0;
524 if (!(val >>= value))
525 throw ::CORBA::PolicyError (CORBA::BAD_POLICY_VALUE);
527 TAO_ClientProtocolPolicy *tmp = 0;
528 ACE_NEW_THROW_EX (tmp,
529 TAO_ClientProtocolPolicy (*value),
530 CORBA::NO_MEMORY (TAO::VMCID,
531 CORBA::COMPLETED_NO));
533 return tmp;
536 RTCORBA::ProtocolList *
537 TAO_ClientProtocolPolicy::protocols ()
539 RTCORBA::ProtocolList *tmp = 0;
540 ACE_NEW_THROW_EX (tmp,
541 RTCORBA::ProtocolList (this->protocols_),
542 CORBA::NO_MEMORY (TAO::VMCID,
543 CORBA::COMPLETED_NO));
545 return tmp;
548 CORBA::PolicyType
549 TAO_ClientProtocolPolicy::policy_type ()
551 return RTCORBA::CLIENT_PROTOCOL_POLICY_TYPE;
554 CORBA::Policy_ptr
555 TAO_ClientProtocolPolicy::copy ()
557 TAO_ClientProtocolPolicy* tmp = 0;
558 ACE_NEW_THROW_EX (tmp,
559 TAO_ClientProtocolPolicy (*this),
560 CORBA::NO_MEMORY (TAO::VMCID,
561 CORBA::COMPLETED_NO));
563 return tmp;
566 void
567 TAO_ClientProtocolPolicy::destroy ()
571 TAO_Cached_Policy_Type
572 TAO_ClientProtocolPolicy::_tao_cached_type () const
574 return TAO_CACHED_POLICY_RT_CLIENT_PROTOCOL;
577 TAO_Policy_Scope
578 TAO_ClientProtocolPolicy::_tao_scope () const
580 return static_cast<TAO_Policy_Scope> (TAO_POLICY_DEFAULT_SCOPE |
581 TAO_POLICY_CLIENT_EXPOSED);
584 CORBA::Boolean
585 TAO_ClientProtocolPolicy::_tao_encode (TAO_OutputCDR &out_cdr)
587 CORBA::Boolean is_write_ok = out_cdr << this->protocols_.length ();
589 for (CORBA::ULong i = 0;
590 (i < this->protocols_.length ()) && is_write_ok;
591 i++)
593 is_write_ok =
594 (out_cdr << this->protocols_[i].protocol_type)
596 this->protocols_[i].orb_protocol_properties->_tao_encode (out_cdr)
598 this->protocols_[i].transport_protocol_properties->_tao_encode (out_cdr);
601 return is_write_ok;
604 CORBA::Boolean
605 TAO_ClientProtocolPolicy::_tao_decode (TAO_InputCDR &in_cdr)
607 CORBA::ULong length;
608 CORBA::Boolean is_read_ok = in_cdr >> length;
610 this->protocols_.length (length);
612 for (CORBA::ULong i = 0; (i < length) && is_read_ok; i++)
614 is_read_ok = in_cdr >> this->protocols_[i].protocol_type;
616 this->protocols_[i].orb_protocol_properties =
617 TAO_Protocol_Properties_Factory::create_orb_protocol_property
618 (this->protocols_[i].protocol_type);
620 this->protocols_[i].transport_protocol_properties =
621 TAO_Protocol_Properties_Factory::create_transport_protocol_property
622 (this->protocols_[i].protocol_type, in_cdr.orb_core ());
624 if (is_read_ok
625 && (this->protocols_[i].orb_protocol_properties.ptr () != 0))
626 is_read_ok =
627 this->protocols_[i].orb_protocol_properties->_tao_decode (in_cdr);
629 if (is_read_ok
630 && (this->protocols_[i].transport_protocol_properties.ptr () != 0))
631 is_read_ok =
632 this->protocols_[i].transport_protocol_properties->_tao_decode (in_cdr);
635 return is_read_ok;
638 RTCORBA::ProtocolList &
639 TAO_ClientProtocolPolicy::protocols_rep ()
641 return protocols_;
644 // ****************************************************************
646 TAO_TCP_Protocol_Properties::TAO_TCP_Protocol_Properties (CORBA::Long send_buffer_size,
647 CORBA::Long recv_buffer_size,
648 CORBA::Boolean keep_alive,
649 CORBA::Boolean dont_route,
650 CORBA::Boolean no_delay,
651 CORBA::Boolean enable_network_priority)
652 : send_buffer_size_ (send_buffer_size),
653 recv_buffer_size_ (recv_buffer_size),
654 keep_alive_ (keep_alive),
655 dont_route_ (dont_route),
656 no_delay_ (no_delay),
657 enable_network_priority_ (enable_network_priority)
661 TAO_TCP_Protocol_Properties::~TAO_TCP_Protocol_Properties ()
665 CORBA::Long
666 TAO_TCP_Protocol_Properties::send_buffer_size ()
668 return this->send_buffer_size_;
671 void
672 TAO_TCP_Protocol_Properties::send_buffer_size (CORBA::Long send_buffer_size)
674 this->send_buffer_size_ = send_buffer_size;
677 CORBA::Long
678 TAO_TCP_Protocol_Properties::recv_buffer_size ()
680 return this->recv_buffer_size_;
683 void
684 TAO_TCP_Protocol_Properties::recv_buffer_size (CORBA::Long recv_buffer_size)
686 this->recv_buffer_size_ = recv_buffer_size;
689 CORBA::Boolean
690 TAO_TCP_Protocol_Properties::keep_alive ()
692 return this->keep_alive_;
695 void
696 TAO_TCP_Protocol_Properties::keep_alive (CORBA::Boolean keep_alive)
698 this->keep_alive_ = keep_alive;
701 CORBA::Boolean
702 TAO_TCP_Protocol_Properties::dont_route ()
704 return this->dont_route_;
707 void
708 TAO_TCP_Protocol_Properties::dont_route (CORBA::Boolean dont_route)
710 this->dont_route_ = dont_route;
713 CORBA::Boolean TAO_TCP_Protocol_Properties::no_delay ()
715 return this->no_delay_;
718 void
719 TAO_TCP_Protocol_Properties::no_delay (CORBA::Boolean no_delay)
721 this->no_delay_ = no_delay;
724 CORBA::Boolean
725 TAO_TCP_Protocol_Properties::enable_network_priority ()
727 return this->enable_network_priority_;
730 void
731 TAO_TCP_Protocol_Properties::enable_network_priority (CORBA::Boolean enable)
733 this->enable_network_priority_ = enable;
736 CORBA::Boolean
737 TAO_TCP_Protocol_Properties::_tao_encode (TAO_OutputCDR & out_cdr)
739 return ((out_cdr << this->send_buffer_size_)
741 (out_cdr << this->recv_buffer_size_)
743 (out_cdr.write_boolean (this->keep_alive_))
745 (out_cdr.write_boolean (this->dont_route_))
747 (out_cdr.write_boolean (this->no_delay_)));
750 CORBA::Boolean
751 TAO_TCP_Protocol_Properties::_tao_decode (TAO_InputCDR &in_cdr)
753 return ((in_cdr >> this->send_buffer_size_)
755 (in_cdr >> this->recv_buffer_size_)
757 (in_cdr.read_boolean (this->keep_alive_))
759 (in_cdr.read_boolean (this->dont_route_))
761 (in_cdr.read_boolean (this->no_delay_)));
764 // ****************************************************************
766 TAO_UnixDomain_Protocol_Properties::TAO_UnixDomain_Protocol_Properties
767 (CORBA::Long send_buffer_size,
768 CORBA::Long recv_buffer_size)
769 : send_buffer_size_ (send_buffer_size),
770 recv_buffer_size_ (recv_buffer_size)
774 TAO_UnixDomain_Protocol_Properties::~TAO_UnixDomain_Protocol_Properties ()
778 CORBA::Long
779 TAO_UnixDomain_Protocol_Properties::send_buffer_size ()
781 return this->send_buffer_size_;
784 void
785 TAO_UnixDomain_Protocol_Properties::send_buffer_size (CORBA::Long send_buffer_size)
787 this->send_buffer_size_ = send_buffer_size;
790 CORBA::Long
791 TAO_UnixDomain_Protocol_Properties::recv_buffer_size ()
793 return this->recv_buffer_size_;
796 void
797 TAO_UnixDomain_Protocol_Properties::recv_buffer_size (CORBA::Long recv_buffer_size)
799 this->recv_buffer_size_ = recv_buffer_size;
802 CORBA::Boolean
803 TAO_UnixDomain_Protocol_Properties::_tao_encode (TAO_OutputCDR &out_cdr)
805 return ((out_cdr << this->send_buffer_size_)
806 && (out_cdr << this->recv_buffer_size_));
809 CORBA::Boolean
810 TAO_UnixDomain_Protocol_Properties::_tao_decode (TAO_InputCDR &in_cdr)
812 return ((in_cdr >> this->send_buffer_size_)
813 && (in_cdr >> this->recv_buffer_size_));
816 // ****************************************************************
818 TAO_SharedMemory_Protocol_Properties::TAO_SharedMemory_Protocol_Properties (CORBA::Long send_buffer_size,
819 CORBA::Long recv_buffer_size,
820 CORBA::Boolean keep_alive,
821 CORBA::Boolean dont_route,
822 CORBA::Boolean no_delay,
823 CORBA::Long preallocate_buffer_size,
824 const char *mmap_filename,
825 const char *mmap_lockname)
826 : send_buffer_size_ (send_buffer_size),
827 recv_buffer_size_ (recv_buffer_size),
828 keep_alive_ (keep_alive),
829 dont_route_ (dont_route),
830 no_delay_ (no_delay),
831 preallocate_buffer_size_ (preallocate_buffer_size),
832 mmap_filename_ (mmap_filename),
833 mmap_lockname_ (mmap_lockname)
837 TAO_SharedMemory_Protocol_Properties::~TAO_SharedMemory_Protocol_Properties ()
842 CORBA::Long
843 TAO_SharedMemory_Protocol_Properties::send_buffer_size ()
845 return this->send_buffer_size_;
848 void
849 TAO_SharedMemory_Protocol_Properties::send_buffer_size (CORBA::Long send_buffer_size)
851 this->send_buffer_size_ = send_buffer_size;
854 CORBA::Long
855 TAO_SharedMemory_Protocol_Properties::recv_buffer_size ()
857 return this->recv_buffer_size_;
860 void
861 TAO_SharedMemory_Protocol_Properties::recv_buffer_size (CORBA::Long recv_buffer_size)
863 this->recv_buffer_size_ = recv_buffer_size;
866 CORBA::Boolean
867 TAO_SharedMemory_Protocol_Properties::keep_alive ()
869 return this->keep_alive_;
872 void
873 TAO_SharedMemory_Protocol_Properties::keep_alive (CORBA::Boolean keep_alive)
875 this->keep_alive_ = keep_alive;
878 CORBA::Boolean
879 TAO_SharedMemory_Protocol_Properties::dont_route ()
881 return this->dont_route_;
884 void
885 TAO_SharedMemory_Protocol_Properties::dont_route (CORBA::Boolean dont_route)
887 this->dont_route_ = dont_route;
890 CORBA::Boolean
891 TAO_SharedMemory_Protocol_Properties::no_delay ()
893 return this->no_delay_;
896 void
897 TAO_SharedMemory_Protocol_Properties::no_delay (CORBA::Boolean no_delay)
899 this->no_delay_ = no_delay;
902 CORBA::Long
903 TAO_SharedMemory_Protocol_Properties::preallocate_buffer_size ()
905 return this->preallocate_buffer_size_;
908 void
909 TAO_SharedMemory_Protocol_Properties::preallocate_buffer_size (CORBA::Long preallocate_buffer_size)
911 this->preallocate_buffer_size_ = preallocate_buffer_size;
914 char *
915 TAO_SharedMemory_Protocol_Properties::mmap_filename ()
917 return this->mmap_filename_.rep ();
920 void
921 TAO_SharedMemory_Protocol_Properties::mmap_filename (const char * mmap_filename)
923 this->mmap_filename_.set (mmap_filename);
926 char *
927 TAO_SharedMemory_Protocol_Properties::mmap_lockname ()
929 return this->mmap_lockname_.rep ();
932 void
933 TAO_SharedMemory_Protocol_Properties::mmap_lockname (const char * mmap_lockname)
935 this->mmap_lockname_.set (mmap_lockname);
938 CORBA::Boolean
939 TAO_SharedMemory_Protocol_Properties::_tao_encode (TAO_OutputCDR &out_cdr)
941 return ((out_cdr << this->send_buffer_size_)
943 (out_cdr << this->recv_buffer_size_)
945 (out_cdr.write_boolean (this->keep_alive_))
947 (out_cdr.write_boolean (this->dont_route_))
949 (out_cdr.write_boolean (this->no_delay_))
951 (out_cdr << this->preallocate_buffer_size_)
953 (out_cdr << this->mmap_filename_)
955 (out_cdr << this->mmap_lockname_));
958 CORBA::Boolean
959 TAO_SharedMemory_Protocol_Properties::_tao_decode (TAO_InputCDR &in_cdr)
961 return ((in_cdr >> this->send_buffer_size_)
963 (in_cdr >> this->recv_buffer_size_)
965 (in_cdr.read_boolean (this->keep_alive_))
967 (in_cdr.read_boolean (this->dont_route_))
969 (in_cdr.read_boolean (this->no_delay_))
971 (in_cdr >> this->preallocate_buffer_size_)
973 (in_cdr >> this->mmap_filename_)
975 (in_cdr >> this->mmap_lockname_));
978 // ****************************************************************
980 TAO_UserDatagram_Protocol_Properties::TAO_UserDatagram_Protocol_Properties (
981 CORBA::Long send_buffer_size,
982 CORBA::Long recv_buffer_size,
983 CORBA::Boolean enable_network_priority)
984 : send_buffer_size_ (send_buffer_size),
985 recv_buffer_size_ (recv_buffer_size),
986 enable_network_priority_ (enable_network_priority)
990 TAO_UserDatagram_Protocol_Properties::~TAO_UserDatagram_Protocol_Properties ()
994 CORBA::Boolean
995 TAO_UserDatagram_Protocol_Properties::enable_network_priority ()
997 return this->enable_network_priority_;
1000 void
1001 TAO_UserDatagram_Protocol_Properties::enable_network_priority (CORBA::Boolean enable)
1003 this->enable_network_priority_ = enable;
1006 CORBA::Long
1007 TAO_UserDatagram_Protocol_Properties::send_buffer_size ()
1009 return this->send_buffer_size_;
1012 void
1013 TAO_UserDatagram_Protocol_Properties::send_buffer_size (CORBA::Long send_buffer_size)
1015 this->send_buffer_size_ = send_buffer_size;
1018 CORBA::Long
1019 TAO_UserDatagram_Protocol_Properties::recv_buffer_size ()
1021 return this->recv_buffer_size_;
1024 void
1025 TAO_UserDatagram_Protocol_Properties::recv_buffer_size (CORBA::Long recv_buffer_size)
1027 this->recv_buffer_size_ = recv_buffer_size;
1030 CORBA::Boolean
1031 TAO_UserDatagram_Protocol_Properties::_tao_encode (TAO_OutputCDR &)
1033 return true;
1036 CORBA::Boolean
1037 TAO_UserDatagram_Protocol_Properties::_tao_decode (TAO_InputCDR &)
1039 return true;
1042 // ****************************************************************
1044 TAO_StreamControl_Protocol_Properties::TAO_StreamControl_Protocol_Properties (CORBA::Long send_buffer_size,
1045 CORBA::Long recv_buffer_size,
1046 CORBA::Boolean keep_alive,
1047 CORBA::Boolean dont_route,
1048 CORBA::Boolean no_delay,
1049 CORBA::Boolean enable_network_priority)
1050 : send_buffer_size_ (send_buffer_size),
1051 recv_buffer_size_ (recv_buffer_size),
1052 keep_alive_ (keep_alive),
1053 dont_route_ (dont_route),
1054 no_delay_ (no_delay),
1055 enable_network_priority_ (enable_network_priority)
1059 TAO_StreamControl_Protocol_Properties::~TAO_StreamControl_Protocol_Properties ()
1063 CORBA::Long
1064 TAO_StreamControl_Protocol_Properties::send_buffer_size ()
1066 return this->send_buffer_size_;
1069 void
1070 TAO_StreamControl_Protocol_Properties::send_buffer_size (CORBA::Long send_buffer_size)
1072 this->send_buffer_size_ = send_buffer_size;
1075 CORBA::Long
1076 TAO_StreamControl_Protocol_Properties::recv_buffer_size ()
1078 return this->recv_buffer_size_;
1081 void
1082 TAO_StreamControl_Protocol_Properties::recv_buffer_size (CORBA::Long recv_buffer_size)
1084 this->recv_buffer_size_ = recv_buffer_size;
1087 CORBA::Boolean
1088 TAO_StreamControl_Protocol_Properties::keep_alive ()
1090 return this->keep_alive_;
1093 void
1094 TAO_StreamControl_Protocol_Properties::keep_alive (CORBA::Boolean keep_alive)
1096 this->keep_alive_ = keep_alive;
1099 CORBA::Boolean
1100 TAO_StreamControl_Protocol_Properties::dont_route ()
1102 return this->dont_route_;
1105 void
1106 TAO_StreamControl_Protocol_Properties::dont_route (CORBA::Boolean dont_route)
1108 this->dont_route_ = dont_route;
1111 CORBA::Boolean TAO_StreamControl_Protocol_Properties::no_delay ()
1113 return this->no_delay_;
1116 void
1117 TAO_StreamControl_Protocol_Properties::no_delay (CORBA::Boolean no_delay)
1119 this->no_delay_ = no_delay;
1122 CORBA::Boolean
1123 TAO_StreamControl_Protocol_Properties::enable_network_priority ()
1125 return this->enable_network_priority_;
1128 void
1129 TAO_StreamControl_Protocol_Properties::enable_network_priority (CORBA::Boolean enable)
1131 this->enable_network_priority_ = enable;
1134 CORBA::Boolean
1135 TAO_StreamControl_Protocol_Properties::_tao_encode (TAO_OutputCDR & out_cdr)
1137 return ((out_cdr << this->send_buffer_size_)
1139 (out_cdr << this->recv_buffer_size_)
1141 (out_cdr.write_boolean (this->keep_alive_))
1143 (out_cdr.write_boolean (this->dont_route_))
1145 (out_cdr.write_boolean (this->no_delay_)));
1148 CORBA::Boolean
1149 TAO_StreamControl_Protocol_Properties::_tao_decode (TAO_InputCDR &in_cdr)
1151 return ((in_cdr >> this->send_buffer_size_)
1153 (in_cdr >> this->recv_buffer_size_)
1155 (in_cdr.read_boolean (this->keep_alive_))
1157 (in_cdr.read_boolean (this->dont_route_))
1159 (in_cdr.read_boolean (this->no_delay_)));
1162 // ****************************************************************
1164 TAO_GIOP_Protocol_Properties::TAO_GIOP_Protocol_Properties ()
1168 TAO_GIOP_Protocol_Properties::~TAO_GIOP_Protocol_Properties ()
1172 CORBA::Boolean
1173 TAO_GIOP_Protocol_Properties::_tao_encode (TAO_OutputCDR &)
1175 return true;
1178 CORBA::Boolean
1179 TAO_GIOP_Protocol_Properties::_tao_decode (TAO_InputCDR &)
1181 return true;
1184 // ****************************************************************
1186 RTCORBA::ProtocolProperties *
1187 TAO_Protocol_Properties_Factory::create_transport_protocol_property (IOP::ProfileId id,
1188 TAO_ORB_Core *orb_core)
1190 RTCORBA::ProtocolProperties* property = 0;
1192 if (id == IOP::TAG_INTERNET_IOP)
1194 int send_buffer_size = orb_core ? orb_core->orb_params ()->sock_sndbuf_size () : 0;
1195 int recv_buffer_size = orb_core ? orb_core->orb_params ()->sock_rcvbuf_size () : 0;
1196 int no_delay = orb_core ? orb_core->orb_params ()->nodelay () : 0;
1197 CORBA::Boolean keep_alive = orb_core ? orb_core->orb_params ()->sock_keepalive () : true;
1198 CORBA::Boolean dont_route = orb_core ? orb_core->orb_params ()->sock_dontroute () : false;
1199 CORBA::Boolean enable_network_priority = false;
1201 ACE_NEW_RETURN (property,
1202 TAO_TCP_Protocol_Properties (send_buffer_size,
1203 recv_buffer_size,
1204 keep_alive,
1205 dont_route,
1206 no_delay,
1207 enable_network_priority),
1211 else if (id == TAO_TAG_SHMEM_PROFILE)
1213 int send_buffer_size = orb_core ? orb_core->orb_params ()->sock_sndbuf_size () : 0;
1214 int recv_buffer_size = orb_core ? orb_core->orb_params ()->sock_rcvbuf_size () : 0;
1215 int no_delay = orb_core ? orb_core->orb_params ()->nodelay () : 0;
1216 CORBA::Boolean keep_alive = true;
1217 CORBA::Boolean dont_route = false;
1218 CORBA::Long preallocate_buffer_size = false;
1219 const char *mmap_filename = "";
1220 const char *mmap_lockname = "";
1222 ACE_NEW_RETURN (property,
1223 TAO_SharedMemory_Protocol_Properties (send_buffer_size,
1224 recv_buffer_size,
1225 keep_alive,
1226 dont_route,
1227 no_delay,
1228 preallocate_buffer_size,
1229 mmap_filename,
1230 mmap_lockname),
1234 else if (id == TAO_TAG_UIOP_PROFILE)
1236 int const send_buffer_size = orb_core ? orb_core->orb_params ()->sock_sndbuf_size () : 0;
1237 int const recv_buffer_size = orb_core ? orb_core->orb_params ()->sock_rcvbuf_size () : 0;
1239 ACE_NEW_RETURN (property,
1240 TAO_UnixDomain_Protocol_Properties (send_buffer_size,
1241 recv_buffer_size),
1245 else if (id == TAO_TAG_DIOP_PROFILE)
1247 int const send_buffer_size = orb_core ? orb_core->orb_params ()->sock_sndbuf_size () : 0;
1248 int const recv_buffer_size = orb_core ? orb_core->orb_params ()->sock_rcvbuf_size () : 0;
1249 CORBA::Boolean enable_network_priority = false;
1251 ACE_NEW_RETURN (property,
1252 TAO_UserDatagram_Protocol_Properties (send_buffer_size,
1253 recv_buffer_size,
1254 enable_network_priority),
1258 else if (id == TAO_TAG_SCIOP_PROFILE)
1260 int send_buffer_size = orb_core ? orb_core->orb_params ()->sock_sndbuf_size () : 0;
1261 int recv_buffer_size = orb_core ? orb_core->orb_params ()->sock_rcvbuf_size () : 0;
1262 int no_delay = orb_core ? orb_core->orb_params ()->nodelay () : 0;
1263 CORBA::Boolean keep_alive = true;
1264 CORBA::Boolean dont_route = false;
1265 CORBA::Boolean enable_network_priority = false;
1267 ACE_NEW_RETURN (property,
1268 TAO_StreamControl_Protocol_Properties (send_buffer_size,
1269 recv_buffer_size,
1270 keep_alive,
1271 dont_route,
1272 no_delay,
1273 enable_network_priority),
1277 return property;
1280 RTCORBA::ProtocolProperties*
1281 TAO_Protocol_Properties_Factory::create_orb_protocol_property (IOP::ProfileId id)
1283 RTCORBA::ProtocolProperties* property = 0;
1285 if (id == IOP::TAG_INTERNET_IOP)
1286 ACE_NEW_RETURN (property,
1287 TAO_GIOP_Protocol_Properties,
1290 // Right now the only supported ORB protocol is GIOP
1291 // so we couple this with every protocol property.
1292 // The else statement is not necessary, but it
1293 // is here just to make clear that as soon as
1294 // new ORB protocol are supported other case
1295 // should be considered.
1296 else
1297 ACE_NEW_RETURN (property,
1298 TAO_GIOP_Protocol_Properties,
1300 return property;
1303 TAO_END_VERSIONED_NAMESPACE_DECL
1305 #endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */