diff options
author | yamuna <yamuna@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2001-10-16 16:41:49 +0000 |
---|---|---|
committer | yamuna <yamuna@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2001-10-16 16:41:49 +0000 |
commit | fc183bba96cf40f91874014d8f5a0d9a63f3e9dc (patch) | |
tree | 16b55df1aa1095a3e3e0674abc22580889fb8d81 | |
parent | f153840d0d5808c065c35f6ed882e6a2c3a4ecca (diff) | |
download | ATCD-fc183bba96cf40f91874014d8f5a0d9a63f3e9dc.tar.gz |
ChangeLogTag: Tue Oct 16 11:19:17 2001 Yamuna Krishnamurthy <yamuna@cs.wustl.edu>
-rw-r--r-- | TAO/orbsvcs/orbsvcs/AV/AV_Core.cpp | 469 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/AV/AV_Core.h | 3 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/AV/QoS_UDP.cpp | 4 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/AV/RTCP.cpp | 5 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/AV/RTP.cpp | 2 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/AV/TCP.cpp | 5 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/AV/UDP.cpp | 86 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/AV/default_resource.cpp | 110 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/AV/default_resource.h | 60 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/AV/sfp.cpp | 2 |
10 files changed, 472 insertions, 274 deletions
diff --git a/TAO/orbsvcs/orbsvcs/AV/AV_Core.cpp b/TAO/orbsvcs/orbsvcs/AV/AV_Core.cpp index cbe489743fe..92d501b3133 100644 --- a/TAO/orbsvcs/orbsvcs/AV/AV_Core.cpp +++ b/TAO/orbsvcs/orbsvcs/AV/AV_Core.cpp @@ -9,6 +9,7 @@ #include "orbsvcs/AV/RTP.h" #include "orbsvcs/AV/RTCP.h" #include "orbsvcs/AV/sfp.h" +#include "orbsvcs/AV/default_resource.h" #ifdef ACE_HAS_RAPI #include "orbsvcs/AV/QoS_UDP.h" @@ -547,253 +548,337 @@ TAO_AV_Core::get_connector (const char *flowname) } int -TAO_AV_Core::init_transport_factories (void) +TAO_AV_Core::load_default_transport_factories (void) { - TAO_AV_TransportFactorySetItor end = this->transport_factories_.end (); - TAO_AV_TransportFactorySetItor factory = this->transport_factories_.begin (); - const char *udp_factory_str = "UDP_Factory"; const char *tcp_factory_str = "TCP_Factory"; - if (factory == end) + TAO_AV_Transport_Factory *udp_factory = 0; + TAO_AV_Transport_Item *udp_item = 0; + + udp_factory = + ACE_Dynamic_Service<TAO_AV_Transport_Factory>::instance (udp_factory_str); + if (udp_factory == 0) { - TAO_AV_Transport_Factory *udp_factory = 0; - TAO_AV_Transport_Item *udp_item = 0; - - udp_factory = - ACE_Dynamic_Service<TAO_AV_Transport_Factory>::instance (udp_factory_str); - if (udp_factory == 0) - { - if (TAO_debug_level) - ACE_ERROR ((LM_WARNING, - "(%P|%t) WARNING - No %s found in Service Repository." - " Using default instance.\n", - "UDP Factory")); - - ACE_NEW_RETURN (udp_factory, - TAO_AV_UDP_Factory, - -1); - } - - ACE_NEW_RETURN (udp_item, TAO_AV_Transport_Item ("UDP_Factory"), -1); - udp_item->factory (udp_factory); - - this->transport_factories_.insert (udp_item); - - TAO_AV_Transport_Factory *tcp_factory = 0; - TAO_AV_Transport_Item *tcp_item = 0; - - tcp_factory = - ACE_Dynamic_Service<TAO_AV_Transport_Factory>::instance (tcp_factory_str); - if (tcp_factory == 0) - { - if (TAO_debug_level) - ACE_ERROR ((LM_WARNING, - "(%P|%t) WARNING - No %s found in Service Repository." - " Using default instance.\n", - "TCP Factory")); - - ACE_NEW_RETURN (tcp_factory, - TAO_AV_TCP_Factory, + if (TAO_debug_level) + ACE_ERROR ((LM_WARNING, + "(%P|%t) WARNING - No %s found in Service Repository." + " Using default instance.\n", + "UDP Factory")); + + ACE_NEW_RETURN (udp_factory, + TAO_AV_UDP_Factory, + -1); + } + + ACE_NEW_RETURN (udp_item, TAO_AV_Transport_Item ("UDP_Factory"), -1); + udp_item->factory (udp_factory); + + this->transport_factories_.insert (udp_item); + + TAO_AV_Transport_Factory *tcp_factory = 0; + TAO_AV_Transport_Item *tcp_item = 0; + + tcp_factory = + ACE_Dynamic_Service<TAO_AV_Transport_Factory>::instance (tcp_factory_str); + if (tcp_factory == 0) + { + if (TAO_debug_level) + ACE_ERROR ((LM_WARNING, + "(%P|%t) WARNING - No %s found in Service Repository." + " Using default instance.\n", + "TCP Factory")); + + ACE_NEW_RETURN (tcp_factory, + TAO_AV_TCP_Factory, -1); - } - - ACE_NEW_RETURN (tcp_item, TAO_AV_Transport_Item ("TCP_Factory"), -1); - tcp_item->factory (tcp_factory); - - this->transport_factories_.insert (tcp_item); - + } + + ACE_NEW_RETURN (tcp_item, TAO_AV_Transport_Item ("TCP_Factory"), -1); + tcp_item->factory (tcp_factory); + + this->transport_factories_.insert (tcp_item); + #ifdef ACE_HAS_RAPI - const char *udp_qos_factory_str = "UDP_QoS_Factory"; - - TAO_AV_Transport_Factory *udp_qos_factory = 0; - TAO_AV_Transport_Item *udp_qos_item = 0; - - udp_qos_factory = + const char *udp_qos_factory_str = "UDP_QoS_Factory"; + + TAO_AV_Transport_Factory *udp_qos_factory = 0; + TAO_AV_Transport_Item *udp_qos_item = 0; + + udp_qos_factory = ACE_Dynamic_Service<TAO_AV_Transport_Factory>::instance (udp_qos_factory_str); - if (udp_qos_factory == 0) - { - if (TAO_debug_level) - ACE_ERROR ((LM_WARNING, - "(%P|%t) WARNING - No %s found in Service Repository." - " Using default instance.\n", - "UDP QoS Factory")); - + if (udp_qos_factory == 0) + { + if (TAO_debug_level) + ACE_ERROR ((LM_WARNING, + "(%P|%t) WARNING - No %s found in Service Repository." + " Using default instance.\n", + "UDP QoS Factory")); + ACE_NEW_RETURN (udp_qos_factory, TAO_AV_UDP_QoS_Factory, -1); - } - - ACE_NEW_RETURN (udp_qos_item, - TAO_AV_Transport_Item ("UDP_QoS_Factory"), - -1); + } + + ACE_NEW_RETURN (udp_qos_item, + TAO_AV_Transport_Item ("UDP_QoS_Factory"), + -1); - udp_qos_item->factory (udp_qos_factory); + udp_qos_item->factory (udp_qos_factory); - this->transport_factories_.insert (udp_qos_item); + this->transport_factories_.insert (udp_qos_item); #endif /*ACE_HAS_RAPI*/ - } return 0; } int -TAO_AV_Core::init_flow_protocol_factories (void) +TAO_AV_Core::init_transport_factories (void) { - TAO_AV_Flow_ProtocolFactorySetItor end = this->flow_protocol_factories_.end (); - TAO_AV_Flow_ProtocolFactorySetItor factory = this->flow_protocol_factories_.begin (); + TAO_AV_TransportFactorySetItor end = this->transport_factories_.end (); + TAO_AV_TransportFactorySetItor factory = this->transport_factories_.begin (); + + if (factory == end) + { + if (TAO_debug_level > 0) + ACE_DEBUG ((LM_DEBUG, + "Loading default transport protocols\n")); + this->load_default_transport_factories (); + } + else + { + for (; factory != end; factory++) + { + const ACE_CString &name = (*factory)->name (); + if (TAO_debug_level > 0) + ACE_DEBUG ((LM_DEBUG, + "%s \n", + name.c_str ())); + + (*factory)->factory ( + ACE_Dynamic_Service<TAO_AV_Transport_Factory>::instance (name.c_str ())); + if ((*factory)->factory () == 0) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("TAO (%P|%t) Unable to load ") + ACE_TEXT ("protocol <%s>, %p\n"), + name.c_str (), ""), + -1); + } + + if (TAO_debug_level > 0) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("TAO (%P|%t) Loaded protocol <%s>\n"), + name.c_str ())); + } + } + + } + + return 0; +} + +int +TAO_AV_Core::load_default_flow_protocol_factories (void) +{ const char *udp_flow = "UDP_Flow_Factory"; const char *tcp_flow = "TCP_Flow_Factory"; const char *rtp_flow = "RTP_Flow_Factory"; const char *rtcp_flow = "RTCP_Flow_Factory"; const char *sfp_flow = "SFP_Flow_Factory"; - if (factory == end) - { - TAO_AV_Flow_Protocol_Factory *udp_flow_factory = 0; - TAO_AV_Flow_Protocol_Item *udp_item = 0; + TAO_AV_Flow_Protocol_Factory *udp_flow_factory = 0; + TAO_AV_Flow_Protocol_Item *udp_item = 0; - udp_flow_factory = - ACE_Dynamic_Service<TAO_AV_Flow_Protocol_Factory>::instance (udp_flow); - if (udp_flow_factory == 0) - { - if (TAO_debug_level) - ACE_ERROR ((LM_WARNING, - "(%P|%t) WARNING - No %s found in Service Repository." - " Using default instance.\n", - "UDP Flow Factory")); - - ACE_NEW_RETURN (udp_flow_factory, - TAO_AV_UDP_Flow_Factory, - -1); - } + udp_flow_factory = + ACE_Dynamic_Service<TAO_AV_Flow_Protocol_Factory>::instance (udp_flow); + if (udp_flow_factory == 0) + { + if (TAO_debug_level) + ACE_ERROR ((LM_WARNING, + "(%P|%t) WARNING - No %s found in Service Repository." + " Using default instance.\n", + "UDP Flow Factory")); + + ACE_NEW_RETURN (udp_flow_factory, + TAO_AV_UDP_Flow_Factory, + -1); + } - ACE_NEW_RETURN (udp_item, TAO_AV_Flow_Protocol_Item ("UDP_Flow_Factory"), -1); - udp_item->factory (udp_flow_factory); + ACE_NEW_RETURN (udp_item, TAO_AV_Flow_Protocol_Item ("UDP_Flow_Factory"), -1); + udp_item->factory (udp_flow_factory); - this->flow_protocol_factories_.insert (udp_item); + this->flow_protocol_factories_.insert (udp_item); #ifdef ACE_HAS_RAPI - const char *udp_qos_flow = "UDP_QoS_Flow_Factory"; - TAO_AV_Flow_Protocol_Factory *udp_qos_flow_factory = 0; - TAO_AV_Flow_Protocol_Item *udp_qos_flow_item = 0; + const char *udp_qos_flow = "UDP_QoS_Flow_Factory"; + TAO_AV_Flow_Protocol_Factory *udp_qos_flow_factory = 0; + TAO_AV_Flow_Protocol_Item *udp_qos_flow_item = 0; - udp_qos_flow_factory = - ACE_Dynamic_Service<TAO_AV_Flow_Protocol_Factory>::instance (udp_qos_flow); - if (udp_qos_flow_factory == 0) - { - if (TAO_debug_level) - ACE_ERROR ((LM_WARNING, - "(%P|%t) WARNING - No %s found in Service Repository." - " Using default instance.\n", - "UDP QoS Flow Factory")); - - ACE_NEW_RETURN (udp_qos_flow_factory, - TAO_AV_UDP_QoS_Flow_Factory, - -1); - } + udp_qos_flow_factory = + ACE_Dynamic_Service<TAO_AV_Flow_Protocol_Factory>::instance (udp_qos_flow); + if (udp_qos_flow_factory == 0) + { + if (TAO_debug_level) + ACE_ERROR ((LM_WARNING, + "(%P|%t) WARNING - No %s found in Service Repository." + " Using default instance.\n", + "UDP QoS Flow Factory")); + + ACE_NEW_RETURN (udp_qos_flow_factory, + TAO_AV_UDP_QoS_Flow_Factory, + -1); + } - ACE_NEW_RETURN (udp_qos_flow_item, TAO_AV_Flow_Protocol_Item ("UDP_QoS_Flow_Factory"), -1); - udp_qos_flow_item->factory (udp_qos_flow_factory); + ACE_NEW_RETURN (udp_qos_flow_item, TAO_AV_Flow_Protocol_Item ("UDP_QoS_Flow_Factory"), -1); + udp_qos_flow_item->factory (udp_qos_flow_factory); - this->flow_protocol_factories_.insert (udp_qos_flow_item); + this->flow_protocol_factories_.insert (udp_qos_flow_item); #endif /*ACE_HAS_RAPI*/ - TAO_AV_Flow_Protocol_Factory *tcp_flow_factory = 0; - TAO_AV_Flow_Protocol_Item *tcp_item = 0; + TAO_AV_Flow_Protocol_Factory *tcp_flow_factory = 0; + TAO_AV_Flow_Protocol_Item *tcp_item = 0; - tcp_flow_factory = - ACE_Dynamic_Service<TAO_AV_Flow_Protocol_Factory>::instance (tcp_flow); - if (tcp_flow_factory == 0) - { - if (TAO_debug_level) - ACE_ERROR ((LM_WARNING, - "(%P|%t) WARNING - No %s found in Service Repository." - " Using default instance.\n", - "TCP Flow Factory")); - - ACE_NEW_RETURN (tcp_flow_factory, - TAO_AV_TCP_Flow_Factory, - -1); - } + tcp_flow_factory = + ACE_Dynamic_Service<TAO_AV_Flow_Protocol_Factory>::instance (tcp_flow); + if (tcp_flow_factory == 0) + { + if (TAO_debug_level) + ACE_ERROR ((LM_WARNING, + "(%P|%t) WARNING - No %s found in Service Repository." + " Using default instance.\n", + "TCP Flow Factory")); + + ACE_NEW_RETURN (tcp_flow_factory, + TAO_AV_TCP_Flow_Factory, + -1); + } - ACE_NEW_RETURN (tcp_item, TAO_AV_Flow_Protocol_Item ("TCP_Flow_Factory"), -1); - tcp_item->factory (tcp_flow_factory); + ACE_NEW_RETURN (tcp_item, TAO_AV_Flow_Protocol_Item ("TCP_Flow_Factory"), -1); + tcp_item->factory (tcp_flow_factory); - this->flow_protocol_factories_.insert (tcp_item); + this->flow_protocol_factories_.insert (tcp_item); - TAO_AV_Flow_Protocol_Factory *rtp_flow_factory = 0; - TAO_AV_Flow_Protocol_Item *rtp_item = 0; + TAO_AV_Flow_Protocol_Factory *rtp_flow_factory = 0; + TAO_AV_Flow_Protocol_Item *rtp_item = 0; - rtp_flow_factory = - ACE_Dynamic_Service<TAO_AV_Flow_Protocol_Factory>::instance (rtp_flow); - if (rtp_flow_factory == 0) - { - if (TAO_debug_level) - ACE_ERROR ((LM_WARNING, - "(%P|%t) WARNING - No %s found in Service Repository." - " Using default instance.\n", - "RTP Flow Factory")); - - ACE_NEW_RETURN (rtp_flow_factory, - TAO_AV_RTP_Flow_Factory, - -1); - } + rtp_flow_factory = + ACE_Dynamic_Service<TAO_AV_Flow_Protocol_Factory>::instance (rtp_flow); + if (rtp_flow_factory == 0) + { + if (TAO_debug_level) + ACE_ERROR ((LM_WARNING, + "(%P|%t) WARNING - No %s found in Service Repository." + " Using default instance.\n", + "RTP Flow Factory")); + + ACE_NEW_RETURN (rtp_flow_factory, + TAO_AV_RTP_Flow_Factory, + -1); + } - ACE_NEW_RETURN (rtp_item, TAO_AV_Flow_Protocol_Item ("RTP_Flow_Factory"), -1); - rtp_item->factory (rtp_flow_factory); + ACE_NEW_RETURN (rtp_item, TAO_AV_Flow_Protocol_Item ("RTP_Flow_Factory"), -1); + rtp_item->factory (rtp_flow_factory); - this->flow_protocol_factories_.insert (rtp_item); + this->flow_protocol_factories_.insert (rtp_item); - TAO_AV_Flow_Protocol_Factory *rtcp_flow_factory = 0; - TAO_AV_Flow_Protocol_Item *rtcp_item = 0; + TAO_AV_Flow_Protocol_Factory *rtcp_flow_factory = 0; + TAO_AV_Flow_Protocol_Item *rtcp_item = 0; - rtcp_flow_factory = - ACE_Dynamic_Service<TAO_AV_Flow_Protocol_Factory>::instance (rtcp_flow); - if (rtcp_flow_factory == 0) - { - if (TAO_debug_level) - ACE_ERROR ((LM_WARNING, - "(%P|%t) WARNING - No %s found in Service Repository." - " Using default instance.\n", - "RTCP Flow Factory")); - - ACE_NEW_RETURN (rtcp_flow_factory, - TAO_AV_RTCP_Flow_Factory, - -1); - } + rtcp_flow_factory = + ACE_Dynamic_Service<TAO_AV_Flow_Protocol_Factory>::instance (rtcp_flow); + if (rtcp_flow_factory == 0) + { + if (TAO_debug_level) + ACE_ERROR ((LM_WARNING, + "(%P|%t) WARNING - No %s found in Service Repository." + " Using default instance.\n", + "RTCP Flow Factory")); + + ACE_NEW_RETURN (rtcp_flow_factory, + TAO_AV_RTCP_Flow_Factory, + -1); + } - ACE_NEW_RETURN (rtcp_item, TAO_AV_Flow_Protocol_Item ("RTCP_Flow_Factory"), -1); - rtcp_item->factory (rtcp_flow_factory); + ACE_NEW_RETURN (rtcp_item, TAO_AV_Flow_Protocol_Item ("RTCP_Flow_Factory"), -1); + rtcp_item->factory (rtcp_flow_factory); - this->flow_protocol_factories_.insert (rtcp_item); + this->flow_protocol_factories_.insert (rtcp_item); - TAO_AV_Flow_Protocol_Factory *sfp_flow_factory = 0; - TAO_AV_Flow_Protocol_Item *sfp_item = 0; + TAO_AV_Flow_Protocol_Factory *sfp_flow_factory = 0; + TAO_AV_Flow_Protocol_Item *sfp_item = 0; - sfp_flow_factory = - ACE_Dynamic_Service<TAO_AV_Flow_Protocol_Factory>::instance (sfp_flow); - if (sfp_flow_factory == 0) - { - if (TAO_debug_level) - ACE_ERROR ((LM_WARNING, - "(%P|%t) WARNING - No %s found in Service Repository." - " Using default instance.\n", - "SFP Flow Factory")); - - ACE_NEW_RETURN (sfp_flow_factory, - TAO_AV_SFP_Factory, - -1); - } + sfp_flow_factory = + ACE_Dynamic_Service<TAO_AV_Flow_Protocol_Factory>::instance (sfp_flow); + if (sfp_flow_factory == 0) + { + if (TAO_debug_level) + ACE_ERROR ((LM_WARNING, + "(%P|%t) WARNING - No %s found in Service Repository." + " Using default instance.\n", + "SFP Flow Factory")); + + ACE_NEW_RETURN (sfp_flow_factory, + TAO_AV_SFP_Factory, + -1); + } + + ACE_NEW_RETURN (sfp_item, TAO_AV_Flow_Protocol_Item ("SFP_Flow_Factory"), -1); + sfp_item->factory (sfp_flow_factory); - ACE_NEW_RETURN (sfp_item, TAO_AV_Flow_Protocol_Item ("SFP_Flow_Factory"), -1); - sfp_item->factory (sfp_flow_factory); + this->flow_protocol_factories_.insert (sfp_item); + + return 0; +} + +int +TAO_AV_Core::init_flow_protocol_factories (void) +{ + TAO_AV_Flow_ProtocolFactorySetItor end = this->flow_protocol_factories_.end (); + TAO_AV_Flow_ProtocolFactorySetItor factory = this->flow_protocol_factories_.begin (); + + if (factory == end) + { + ACE_DEBUG ((LM_DEBUG, + "Loading default flow protocol factories\n")); + + this->load_default_flow_protocol_factories (); + } + else + { + for (; factory != end; factory++) + { + const ACE_CString &name = (*factory)->name (); + if (TAO_debug_level > 0) + ACE_DEBUG ((LM_DEBUG, + "%s \n", + name.c_str ())); + + (*factory)->factory ( + ACE_Dynamic_Service<TAO_AV_Flow_Protocol_Factory>::instance (name.c_str ())); + if ((*factory)->factory () == 0) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("TAO (%P|%t) Unable to load ") + ACE_TEXT ("protocol <%s>, %p\n"), + name.c_str (), ""), + -1); + } + + if (TAO_debug_level > 0) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("TAO (%P|%t) Loaded protocol <%s>\n"), + name.c_str ())); + } + } - this->flow_protocol_factories_.insert (sfp_item); } + return 0; } diff --git a/TAO/orbsvcs/orbsvcs/AV/AV_Core.h b/TAO/orbsvcs/orbsvcs/AV/AV_Core.h index 086d141b641..2e12c35b9a3 100644 --- a/TAO/orbsvcs/orbsvcs/AV/AV_Core.h +++ b/TAO/orbsvcs/orbsvcs/AV/AV_Core.h @@ -89,6 +89,9 @@ public: int init_transport_factories (void); int init_flow_protocol_factories (void); + int load_default_transport_factories (void); + int load_default_flow_protocol_factories (void); + /// = Get the acceptor registry TAO_AV_Acceptor *get_acceptor (const char *flowname); TAO_AV_Connector *get_connector (const char *flowname); diff --git a/TAO/orbsvcs/orbsvcs/AV/QoS_UDP.cpp b/TAO/orbsvcs/orbsvcs/AV/QoS_UDP.cpp index c54ce679c1b..d41fa1d5a16 100644 --- a/TAO/orbsvcs/orbsvcs/AV/QoS_UDP.cpp +++ b/TAO/orbsvcs/orbsvcs/AV/QoS_UDP.cpp @@ -1475,7 +1475,7 @@ TAO_AV_UDP_QoS_Flow_Factory::make_protocol_object (TAO_FlowSpec_Entry *entry, return object; } -ACE_FACTORY_DEFINE (AV, TAO_AV_UDP_QoS_Flow_Factory) +ACE_FACTORY_DEFINE (TAO_AV, TAO_AV_UDP_QoS_Flow_Factory) ACE_STATIC_SVC_DEFINE (TAO_AV_UDP_QoS_Flow_Factory, ACE_TEXT ("UDP_QoS_Flow_Factory"), ACE_SVC_OBJ_T, @@ -1484,7 +1484,7 @@ ACE_STATIC_SVC_DEFINE (TAO_AV_UDP_QoS_Flow_Factory, ACE_Service_Type::DELETE_OBJ, 0) -ACE_FACTORY_DEFINE (AV, TAO_AV_UDP_QoS_Factory) +ACE_FACTORY_DEFINE (TAO_AV, TAO_AV_UDP_QoS_Factory) ACE_STATIC_SVC_DEFINE (TAO_AV_UDP_QoS_Factory, ACE_TEXT ("UDP_QoS_Factory"), diff --git a/TAO/orbsvcs/orbsvcs/AV/RTCP.cpp b/TAO/orbsvcs/orbsvcs/AV/RTCP.cpp index ddbbf1b848e..966b0a68b95 100644 --- a/TAO/orbsvcs/orbsvcs/AV/RTCP.cpp +++ b/TAO/orbsvcs/orbsvcs/AV/RTCP.cpp @@ -939,7 +939,7 @@ TAO_AV_RTCP_Callback::demux (TAO_AV_RTP::rtphdr* rh, */ } -ACE_FACTORY_DEFINE (AV, TAO_AV_RTCP_Flow_Factory) +ACE_FACTORY_DEFINE (TAO_AV, TAO_AV_RTCP_Flow_Factory) ACE_STATIC_SVC_DEFINE (TAO_AV_RTCP_Flow_Factory, ACE_TEXT ("RTCP_Flow_Factory"), ACE_SVC_OBJ_T, @@ -947,3 +947,6 @@ ACE_STATIC_SVC_DEFINE (TAO_AV_RTCP_Flow_Factory, ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ, 0) + + + diff --git a/TAO/orbsvcs/orbsvcs/AV/RTP.cpp b/TAO/orbsvcs/orbsvcs/AV/RTP.cpp index 5734f0c210b..86004989792 100644 --- a/TAO/orbsvcs/orbsvcs/AV/RTP.cpp +++ b/TAO/orbsvcs/orbsvcs/AV/RTP.cpp @@ -348,7 +348,7 @@ TAO_AV_RTP_Flow_Factory::control_flow_factory (void) return "RTCP"; } -ACE_FACTORY_DEFINE (AV, TAO_AV_RTP_Flow_Factory) +ACE_FACTORY_DEFINE (TAO_AV, TAO_AV_RTP_Flow_Factory) ACE_STATIC_SVC_DEFINE (TAO_AV_RTP_Flow_Factory, ACE_TEXT ("RTP_Flow_Factory"), ACE_SVC_OBJ_T, diff --git a/TAO/orbsvcs/orbsvcs/AV/TCP.cpp b/TAO/orbsvcs/orbsvcs/AV/TCP.cpp index 9097381b985..06a7d21701d 100644 --- a/TAO/orbsvcs/orbsvcs/AV/TCP.cpp +++ b/TAO/orbsvcs/orbsvcs/AV/TCP.cpp @@ -702,7 +702,7 @@ ACE_STATIC_SVC_DEFINE (TAO_AV_TCP_Flow_Factory, ACE_Service_Type::DELETE_OBJ, 0) -ACE_FACTORY_DEFINE (AV, TAO_AV_TCP_Flow_Factory) +ACE_FACTORY_DEFINE (TAO_AV, TAO_AV_TCP_Flow_Factory) ACE_STATIC_SVC_DEFINE (TAO_AV_TCP_Factory, ACE_TEXT ("TCP_Factory"), @@ -712,4 +712,5 @@ ACE_STATIC_SVC_DEFINE (TAO_AV_TCP_Factory, ACE_Service_Type::DELETE_OBJ, 0) -ACE_FACTORY_DEFINE (AV, TAO_AV_TCP_Factory) +ACE_FACTORY_DEFINE (TAO_AV, TAO_AV_TCP_Factory) + diff --git a/TAO/orbsvcs/orbsvcs/AV/UDP.cpp b/TAO/orbsvcs/orbsvcs/AV/UDP.cpp index b7841a09443..1bfdbb9d4ba 100644 --- a/TAO/orbsvcs/orbsvcs/AV/UDP.cpp +++ b/TAO/orbsvcs/orbsvcs/AV/UDP.cpp @@ -72,79 +72,6 @@ TAO_AV_UDP_Flow_Handler::get_handle (void) const return this->sock_dgram_.get_handle () ; } -int -TAO_AV_UDP_Flow_Handler::change_qos(AVStreams::QoS qos) -{ - if( TAO_debug_level > 0 ) - { - ACE_DEBUG ((LM_DEBUG, - "(%N,%l) TAO_AV_UDP_Flow_Handler::change_qos\n")); - } - - unsigned int i=0; - - int ret = 0; - CORBA::Long dscp = 0; - CORBA::Long ecn = 0; - int dscp_flag=0; - for(i=0; i < qos.QoSParams.length(); i++) - { - - if( ACE_OS::strcmp( qos.QoSParams[i].property_name.in(), "Diffserv_Codepoint") == 0) - { - qos.QoSParams[i].property_value >>= dscp; - dscp_flag=1; - // DSCP value can only be 6 bits wide - if(!((dscp >= 0) && (dscp <= 63))) - { - dscp_flag = 0; - ACE_DEBUG((LM_DEBUG, "(%N,%l) ECN value can only be (0-3) not %d\n", ecn)); - return -1; - } - } - - if( ACE_OS::strcmp( qos.QoSParams[i].property_name.in(), "ECN") == 0) - { - qos.QoSParams[i].property_value >>= ecn; - // ECN value can only occupy bits 6 and 7 of the - // IP Diffserv byte - if(!((ecn >= 0) && (ecn <= 3))) - { - ACE_DEBUG((LM_DEBUG, "(%N,%l) ECN value can only be (0-3) not %d\n", ecn)); - ecn = 0; - } - - } - } - // Set the Diffserv byte only if we specified - // the Diffserv Codepoint (DSCP) or ECN via QoSParams - // passed into this method - if(dscp_flag || ecn) - { - int tos; - tos = (int)(dscp << 2); - if(ecn) - { - tos |= ecn; - } - ret = sock_dgram_.set_option(IPPROTO_IP, IP_TOS, (int *)&tos , (int)sizeof(tos)); - - if(TAO_debug_level > 1) - { - ACE_DEBUG((LM_DEBUG, "(%N,%l) set tos: ret: %d\n", ret)); - } - } - - if(TAO_debug_level > 1) - { - if(ret < 0 ) - { - ACE_DEBUG((LM_DEBUG, "(%N,%l) errno: %p\n")); - } - } - return ret; -} - //------------------------------------------------------------ // TAO_AV_UDP_Transport //------------------------------------------------------------ @@ -834,7 +761,7 @@ TAO_AV_UDP_Flow_Factory::make_protocol_object (TAO_FlowSpec_Entry *entry, return object; } -ACE_FACTORY_DEFINE (AV, TAO_AV_UDP_Flow_Factory) +ACE_FACTORY_DEFINE (TAO_AV, TAO_AV_UDP_Flow_Factory) ACE_STATIC_SVC_DEFINE (TAO_AV_UDP_Flow_Factory, ACE_TEXT ("UDP_Flow_Factory"), ACE_SVC_OBJ_T, @@ -843,7 +770,7 @@ ACE_STATIC_SVC_DEFINE (TAO_AV_UDP_Flow_Factory, ACE_Service_Type::DELETE_OBJ, 0) -ACE_FACTORY_DEFINE (AV, TAO_AV_UDP_Factory) +ACE_FACTORY_DEFINE (TAO_AV, TAO_AV_UDP_Factory) ACE_STATIC_SVC_DEFINE (TAO_AV_UDP_Factory, ACE_TEXT ("UDP_Factory"), @@ -852,3 +779,12 @@ ACE_STATIC_SVC_DEFINE (TAO_AV_UDP_Factory, ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ, 0) + + + + + + + + + diff --git a/TAO/orbsvcs/orbsvcs/AV/default_resource.cpp b/TAO/orbsvcs/orbsvcs/AV/default_resource.cpp new file mode 100644 index 00000000000..c9d934fd269 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/AV/default_resource.cpp @@ -0,0 +1,110 @@ +// $Id$ + +#include "orbsvcs/AV/default_resource.h" + +#include "tao/ORB_Core.h" +#include "tao/debug.h" + +TAO_AV_Default_Resource_Factory::TAO_AV_Default_Resource_Factory (void) +{ + if (TAO_debug_level > 0) + ACE_DEBUG ((LM_DEBUG, + "TAO_AV_Default_Resource_Factory::TAO_AV_Default_Resource_Factory %d\n")); +} + +TAO_AV_Default_Resource_Factory::~TAO_AV_Default_Resource_Factory (void) +{ + TAO_AV_TransportFactorySetItor t_end = TAO_AV_CORE::instance ()->transport_factories ()->end (); + for (TAO_AV_TransportFactorySetItor iterator = + TAO_AV_CORE::instance ()->transport_factories ()->begin (); + iterator != t_end; + ++iterator) + delete *iterator; + + TAO_AV_CORE::instance ()->transport_factories ()->reset (); + + TAO_AV_Flow_ProtocolFactorySetItor fp_end = TAO_AV_CORE::instance ()->flow_protocol_factories ()->end (); + for (TAO_AV_Flow_ProtocolFactorySetItor iterator = + TAO_AV_CORE::instance ()->flow_protocol_factories ()->begin (); + iterator != fp_end; + ++iterator) + delete *iterator; + + TAO_AV_CORE::instance ()->flow_protocol_factories ()->reset (); + + if (TAO_debug_level > 0) + ACE_DEBUG ((LM_DEBUG, + "TAO_AV_Default_Resource_Factory::~TAO_AV_Default_Resource_Factory\n")); +} + +int +TAO_AV_Default_Resource_Factory::init (int argc, char *argv[]) +{ + if (TAO_debug_level > 0) + ACE_DEBUG ((LM_DEBUG, + "TAO_AV_Default_Resource_Factory::init\n")); + + int curarg = 0; + + for (curarg = 0; curarg < argc; ++curarg) + { + if (ACE_OS::strcasecmp (argv[curarg], + "-AVTransportFactory") == 0) + { + TAO_AV_TransportFactorySet *tset = TAO_AV_CORE::instance ()->transport_factories (); + curarg++; + if (curarg < argc) + { + TAO_AV_Transport_Item *item = 0; + ACE_NEW_RETURN (item, + TAO_AV_Transport_Item (argv[curarg]), + -1); + if (tset->insert (item) == -1) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("(%P|%t) Unable to add transport factories for %s: %p\n"), + argv[curarg])); + } + } + else if (ACE_OS::strcasecmp (argv[curarg], + "-AVFlowProtocolFactory") == 0) + { + TAO_AV_Flow_ProtocolFactorySet *fpset = TAO_AV_CORE::instance ()->flow_protocol_factories (); + curarg++; + if (curarg < argc) + { + TAO_AV_Flow_Protocol_Item *item = 0; + ACE_NEW_RETURN (item, + TAO_AV_Flow_Protocol_Item (argv[curarg]), + -1); + if (fpset->insert (item) == -1) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("(%P|%t) Unable to add flow protocol factories for %s: %p\n"), + argv[curarg])); + } + } + + } + return 0; +} + + +// **************************************************************** + +ACE_STATIC_SVC_DEFINE (TAO_AV_Default_Resource_Factory, + ACE_TEXT ("AV_Default_Resource_Factory"), + ACE_SVC_OBJ_T, + &ACE_SVC_NAME (TAO_AV_Default_Resource_Factory), + ACE_Service_Type::DELETE_THIS + | ACE_Service_Type::DELETE_OBJ, + 0) +ACE_FACTORY_DEFINE (TAO_AV, TAO_AV_Default_Resource_Factory) + +// **************************************************************** + + + + + + + + diff --git a/TAO/orbsvcs/orbsvcs/AV/default_resource.h b/TAO/orbsvcs/orbsvcs/AV/default_resource.h new file mode 100644 index 00000000000..2135ce41276 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/AV/default_resource.h @@ -0,0 +1,60 @@ +//============================================================================= +/** + * @file default_resource.h + * + * $Id$ + * + * @author Yamuna Krishnamurthy + */ +//============================================================================= + + +#ifndef TAO_AV_DEFAULT_RESOURCE_H +#define TAO_AV_DEFAULT_RESOURCE_H +#include "ace/pre.h" + +#include "orbsvcs/AV/AVStreams_i.h" +#include "orbsvcs/AV/Resource_Factory.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Service_Config.h" + +/** + * @class TAO_AV_Default_Resource_Factory + * + * @brief TAO AV Streams default resource factory + * The AV Streams resource factory loads the + * pluggable transport and flow protocol factories + * in the corresponding factory sets. + * + * + */ + +class TAO_AV_Export TAO_AV_Default_Resource_Factory +: public TAO_AV_Resource_Factory +{ +public: + + /// Constructor. + TAO_AV_Default_Resource_Factory (void); + + /// Destructor. + virtual ~TAO_AV_Default_Resource_Factory (void); + + /** + * @name Service Configurator Hooks + */ + //@{ + /// Dynamic linking hook + virtual int init (int argc, char *argv[]); + +}; + +ACE_STATIC_SVC_DECLARE_EXPORT (TAO_AV, TAO_AV_Default_Resource_Factory) +ACE_FACTORY_DECLARE (TAO_AV, TAO_AV_Default_Resource_Factory) + +#include "ace/post.h" +#endif /* TAO_AV_DEFAULT_RESOURCE_H */ diff --git a/TAO/orbsvcs/orbsvcs/AV/sfp.cpp b/TAO/orbsvcs/orbsvcs/AV/sfp.cpp index be45504736e..70307b4f733 100644 --- a/TAO/orbsvcs/orbsvcs/AV/sfp.cpp +++ b/TAO/orbsvcs/orbsvcs/AV/sfp.cpp @@ -1372,7 +1372,7 @@ template class ACE_Singleton<TAO_SFP_Base, TAO_SYNCH_MUTEX>; #pragma instantiate ACE_Singleton<TAO_SFP_Base, TAO_SYNCH_MUTEX> #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ -ACE_FACTORY_DEFINE (AV, TAO_AV_SFP_Factory) +ACE_FACTORY_DEFINE (TAO_AV, TAO_AV_SFP_Factory) ACE_STATIC_SVC_DEFINE (TAO_AV_SFP_Factory, ACE_TEXT ("SFP_Factory"), ACE_SVC_OBJ_T, |