00001 // $Id: RT_Acceptor_Filters.cpp 83339 2008-10-21 10:32:41Z johnnyw $ 00002 00003 #include "tao/RTPortableServer/RT_Acceptor_Filters.h" 00004 00005 #if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0 00006 00007 #include "tao/Transport_Acceptor.h" 00008 #include "tao/MProfile.h" 00009 #include "tao/Profile.h" 00010 00011 ACE_RCSID (RTPortableServer, 00012 RT_Acceptor_Filter, 00013 "$Id: RT_Acceptor_Filters.cpp 83339 2008-10-21 10:32:41Z johnnyw $") 00014 00015 00016 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00017 00018 TAO_Server_Protocol_Acceptor_Filter::TAO_Server_Protocol_Acceptor_Filter ( 00019 RTCORBA::ProtocolList &protocols) 00020 : protocols_ (protocols) 00021 { 00022 } 00023 00024 int 00025 TAO_Server_Protocol_Acceptor_Filter::fill_profile ( 00026 const TAO::ObjectKey &object_key, 00027 TAO_MProfile &mprofile, 00028 TAO_Acceptor **acceptors_begin, 00029 TAO_Acceptor **acceptors_end, 00030 CORBA::Short priority) 00031 { 00032 // RTCORBA 1.0, Section 4.15.1: ServerProtocolPolicy determines 00033 // which protocols get included into IOR and in what order. 00034 for (CORBA::ULong j = 0; j < this->protocols_.length (); ++j) 00035 { 00036 CORBA::ULong const protocol_type = this->protocols_[j].protocol_type; 00037 00038 for (TAO_Acceptor** acceptor = acceptors_begin; 00039 acceptor != acceptors_end; 00040 ++acceptor) 00041 if ((*acceptor)->tag () == protocol_type && 00042 ((*acceptor)->create_profile (object_key, 00043 mprofile, 00044 priority) == -1)) 00045 return -1; 00046 } 00047 00048 return 0; 00049 } 00050 00051 int 00052 TAO_Server_Protocol_Acceptor_Filter::encode_endpoints (TAO_MProfile &mprofile) 00053 { 00054 // Encode endpoints. 00055 for (CORBA::ULong i = 0; i < mprofile.profile_count (); ++i) 00056 { 00057 TAO_Profile *profile = mprofile.get_profile (i); 00058 if (profile->encode_endpoints () == -1) 00059 return -1; 00060 } 00061 00062 return 0; 00063 } 00064 00065 TAO_END_VERSIONED_NAMESPACE_DECL 00066 00067 #endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */