00001 /* 00002 * 00003 * 00004 * Distributed under the OpenDDS License. 00005 * See: http://www.opendds.org/license.html 00006 */ 00007 00008 #include "UdpLoader.h" 00009 #include "UdpInst.h" 00010 00011 #include "dds/DCPS/transport/framework/TransportRegistry.h" 00012 #include "dds/DCPS/transport/framework/TransportType.h" 00013 00014 namespace { 00015 const char UDP_NAME[] = "udp"; 00016 } 00017 00018 namespace OpenDDS { 00019 namespace DCPS { 00020 00021 class UdpType : public TransportType { 00022 public: 00023 const char* name() { return UDP_NAME; } 00024 00025 TransportInst* new_inst(const std::string& name) 00026 { 00027 return new UdpInst(name); 00028 } 00029 }; 00030 00031 int 00032 UdpLoader::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 UdpType); 00040 TransportInst_rch default_inst = 00041 registry->create_inst(TransportRegistry::DEFAULT_INST_PREFIX + 00042 std::string("0300_UDP"), UDP_NAME); 00043 registry->get_config(TransportRegistry::DEFAULT_CONFIG_NAME) 00044 ->sorted_insert(default_inst); 00045 00046 initialized = true; 00047 00048 return 0; 00049 } 00050 00051 ACE_FACTORY_DEFINE(OpenDDS_Udp, UdpLoader); 00052 ACE_STATIC_SVC_DEFINE( 00053 UdpLoader, 00054 ACE_TEXT("OpenDDS_Udp"), 00055 ACE_SVC_OBJ_T, 00056 &ACE_SVC_NAME(UdpLoader), 00057 ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ, 00058 0) 00059 00060 } // namespace DCPS 00061 } // namespace OpenDDS