00001 /* 00002 * 00003 * 00004 * Distributed under the OpenDDS License. 00005 * See: http://www.opendds.org/license.html 00006 */ 00007 00008 #include "RtpsUdpLoader.h" 00009 #include "RtpsUdpInst.h" 00010 00011 #include "dds/DCPS/transport/framework/TransportRegistry.h" 00012 #include "dds/DCPS/transport/framework/TransportType.h" 00013 00014 namespace { 00015 const char RTPS_UDP_NAME[] = "rtps_udp"; 00016 } 00017 00018 namespace OpenDDS { 00019 namespace DCPS { 00020 00021 class RtpsUdpType : public TransportType { 00022 public: 00023 const char* name() { return RTPS_UDP_NAME; } 00024 00025 TransportInst* new_inst(const OPENDDS_STRING& name) 00026 { 00027 return new RtpsUdpInst(name); 00028 } 00029 }; 00030 00031 int 00032 RtpsUdpLoader::init(int /*argc*/, ACE_TCHAR* /*argv*/[]) 00033 { 00034 static bool initialized(false); 00035 00036 if (initialized) return 0; // already initialized 00037 00038 TransportRegistry* registry = TheTransportRegistry; 00039 registry->register_type(new RtpsUdpType); 00040 // Don't create a default for RTPS. At least for the initial implementation, 00041 // the user needs to explicitly configure it... 00042 #ifdef OPENDDS_SAFETY_PROFILE 00043 // ...except for Safety Profile where RTPS is the only option. 00044 TransportInst_rch default_inst = 00045 registry->create_inst(TransportRegistry::DEFAULT_INST_PREFIX + 00046 OPENDDS_STRING("0600_RTPS_UDP"), 00047 RTPS_UDP_NAME); 00048 registry->get_config(TransportRegistry::DEFAULT_CONFIG_NAME) 00049 ->sorted_insert(default_inst); 00050 #endif 00051 initialized = true; 00052 00053 return 0; 00054 } 00055 00056 ACE_FACTORY_DEFINE(OpenDDS_Rtps_Udp, RtpsUdpLoader); 00057 ACE_STATIC_SVC_DEFINE( 00058 RtpsUdpLoader, 00059 ACE_TEXT("OpenDDS_Rtps_Udp"), 00060 ACE_SVC_OBJ_T, 00061 &ACE_SVC_NAME(RtpsUdpLoader), 00062 ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ, 00063 0) 00064 00065 } // namespace DCPS 00066 } // namespace OpenDDS