00001
00002
00003
00004 #include "orbsvcs/AV/QoS_UDP.h"
00005
00006 #if defined (ACE_HAS_RAPI) || defined (ACE_HAS_WINSOCK2_GQOS)
00007
00008 #include "orbsvcs/AV/UDP.h"
00009 #include "orbsvcs/AV/AVStreams_i.h"
00010 #include "orbsvcs/AV/MCast.h"
00011 #include "orbsvcs/AV/Fill_ACE_QoS.h"
00012
00013 #if !defined (__ACE_INLINE__)
00014 #include "orbsvcs/AV/QoS_UDP.inl"
00015 #endif
00016
00017
00018
00019
00020
00021 static int resv_error = 0;
00022 static int resv_confirm = 0;
00023
00024 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00025
00026 int
00027 FillQoSParams (ACE_QoS_Params &qos_params,
00028 iovec* iov,
00029 ACE_QoS* qos)
00030 {
00031 qos_params.callee_data (iov);
00032 qos_params.caller_data (0);
00033 qos_params.socket_qos (qos);
00034 qos_params.group_socket_qos (0);
00035 qos_params.flags (ACE_JL_BOTH);
00036
00037 return 0;
00038 }
00039
00040 TAO_AV_UDP_QoS_Session_Helper::TAO_AV_UDP_QoS_Session_Helper (void)
00041 {
00042
00043 }
00044
00045 TAO_AV_UDP_QoS_Session_Helper::~TAO_AV_UDP_QoS_Session_Helper (void)
00046 {
00047 }
00048
00049 int
00050 TAO_AV_UDP_QoS_Session_Helper::set_qos (ACE_Flow_Spec &ace_flow_spec,
00051 TAO_AV_UDP_QoS_Flow_Handler *handler)
00052 {
00053 ACE_QoS* ace_qos = 0;
00054
00055 ACE_NEW_RETURN (ace_qos,
00056 ACE_QoS,
00057 -1);
00058
00059 Fill_ACE_QoS fill_ace_qos;
00060
00061 if (handler->flowspec_entry ()->role () == TAO_FlowSpec_Entry::TAO_AV_PRODUCER)
00062 {
00063 if (fill_ace_qos.fill_simplex_sender_qos (*ace_qos,
00064 &ace_flow_spec) !=0)
00065 ACE_ERROR_RETURN ((LM_ERROR,
00066 "Unable to fill simplex sender qos (%N|%l)\n"),
00067 -1);
00068 else
00069 if (TAO_debug_level > 0)
00070 ACE_DEBUG ((LM_DEBUG,
00071 "Filled up the Sender QoS parameters\n"));
00072 }
00073 else if (handler->flowspec_entry ()->role () == TAO_FlowSpec_Entry::TAO_AV_CONSUMER)
00074 {
00075 if (fill_ace_qos.fill_simplex_receiver_qos (*ace_qos,
00076 &ace_flow_spec) !=0)
00077 ACE_ERROR_RETURN ((LM_ERROR,
00078 "Unable to fill simplex receiver qos (%N|%l)\n"),
00079 -1);
00080 else
00081 if (TAO_debug_level > 0)
00082 ACE_DEBUG ((LM_DEBUG,
00083 "Filled up the Receiver QoS parameters\n"));
00084
00085 }
00086
00087 ACE_QoS_Manager qos_manager = handler->get_socket ()->qos_manager ();
00088
00089
00090
00091 if (handler->qos_session ()->qos (handler->get_socket (),
00092 &qos_manager,
00093 *ace_qos) == -1)
00094 ACE_ERROR_RETURN ((LM_ERROR,
00095 "Unable to set QoS (%N|%l)\n"),
00096 -1);
00097 else
00098 ACE_DEBUG ((LM_DEBUG,
00099 "Setting QOS succeeds\n"));
00100
00101 return 0;
00102 }
00103
00104 ACE_QoS_Session *
00105 TAO_AV_UDP_QoS_Session_Helper::open_qos_session (TAO_AV_UDP_QoS_Flow_Handler *handler,
00106 ACE_INET_Addr &addr)
00107 {
00108 ACE_QoS_Params qos_params;
00109
00110 ACE_QoS* ace_qos = 0;
00111
00112 FillQoSParams (qos_params,
00113 0,
00114 ace_qos);
00115
00116
00117
00118 ACE_QoS_Session_Factory session_factory;
00119
00120
00121 ACE_QoS_Session *qos_session = session_factory.create_session ();
00122
00123
00124
00125
00126
00127 ACE_INET_Addr dest_addr (addr);
00128
00129
00130
00131 if (qos_session->open (dest_addr,
00132 IPPROTO_UDP) == -1)
00133 ACE_ERROR_RETURN ((LM_ERROR,
00134 "Error in opening the QoS session\n"),
00135 0);
00136 else
00137 ACE_DEBUG ((LM_DEBUG,
00138 "QoS session opened successfully\n"));
00139
00140 if (handler->flowspec_entry ()->role () == TAO_FlowSpec_Entry::TAO_AV_PRODUCER)
00141 {
00142
00143 qos_session->flags (ACE_QoS_Session::ACE_QOS_SENDER);
00144 }
00145 else if (handler->flowspec_entry ()->role () == TAO_FlowSpec_Entry::TAO_AV_CONSUMER)
00146 {
00147
00148 qos_session->flags (ACE_QoS_Session::ACE_QOS_RECEIVER);
00149 }
00150
00151 return qos_session;
00152 }
00153
00154 int
00155 TAO_AV_UDP_QoS_Session_Helper::activate_qos_handler (ACE_QoS_Session *qos_session,
00156 TAO_AV_UDP_QoS_Flow_Handler *handler)
00157 {
00158 ACE_QoS_Decorator* qos_decorator;
00159
00160
00161 ACE_NEW_RETURN (qos_decorator,
00162 ACE_QoS_Decorator (handler,
00163 qos_session,
00164 handler->av_core ()->reactor ()),
00165 -1);
00166
00167
00168 if (qos_decorator->init () != 0)
00169 ACE_ERROR_RETURN ((LM_ERROR,
00170 "QoS Decorator init () failed (%N|%l)\n"),
00171 -1);
00172
00173
00174 int result = handler->av_core ()->reactor ()->register_handler (qos_decorator,
00175 ACE_Event_Handler::QOS_MASK |
00176 ACE_Event_Handler::READ_MASK);
00177 if (result == -1)
00178 ACE_ERROR_RETURN ((LM_ERROR,
00179 "Error in registering the Decorator with the Reactor (%N|%l)\n"),
00180 -1);
00181
00182 return 0;
00183
00184 }
00185
00186 TAO_AV_UDP_QoS_Flow_Handler::TAO_AV_UDP_QoS_Flow_Handler (void)
00187 {
00188 ACE_NEW (this->transport_,
00189 TAO_AV_UDP_QoS_Transport (this));
00190 }
00191
00192 TAO_AV_UDP_QoS_Flow_Handler::~TAO_AV_UDP_QoS_Flow_Handler (void)
00193 {
00194 delete this->transport_;
00195 }
00196
00197 TAO_AV_Transport *
00198 TAO_AV_UDP_QoS_Flow_Handler::transport (void)
00199 {
00200 return this->transport_;
00201 }
00202
00203 int
00204 TAO_AV_UDP_QoS_Flow_Handler::handle_input (ACE_HANDLE )
00205 {
00206 this->protocol_object_->handle_input ();
00207 return 0;
00208 }
00209
00210 int
00211 TAO_AV_UDP_QoS_Flow_Handler::translate (CosPropertyService::Properties &qos_params,
00212 ACE_Flow_Spec *ace_flow_spec)
00213 {
00214 for (unsigned int i = 0;
00215 i < qos_params.length ();
00216 i++)
00217 {
00218 if (ACE_OS::strcmp (qos_params [i].property_name, "Service_Type") == 0)
00219 {
00220 CORBA::Short type;
00221 qos_params [i].property_value >>= type;
00222 ace_flow_spec->service_type (type);
00223 }
00224 else if (ACE_OS::strcmp (qos_params [i].property_name, "Token_Rate") == 0)
00225 {
00226 CORBA::ULong tok_rate;
00227 qos_params [i].property_value >>= tok_rate;
00228 ace_flow_spec->token_rate (tok_rate);
00229 }
00230 else if (ACE_OS::strcmp (qos_params [i].property_name, "Token_Bucket_Size") == 0)
00231 {
00232 CORBA::ULong tok_buck_size;
00233 qos_params [i].property_value >>= tok_buck_size;
00234 ace_flow_spec->token_bucket_size (tok_buck_size);
00235 }
00236 else if (ACE_OS::strcmp (qos_params [i].property_name, "Peak_Bandwidth") == 0)
00237 {
00238 CORBA::ULong peak_bw;
00239 qos_params [i].property_value >>= peak_bw;
00240 ace_flow_spec->peak_bandwidth (peak_bw);
00241 }
00242 else if (ACE_OS::strcmp (qos_params [i].property_name, "Latency") == 0)
00243 {
00244 CORBA::ULong lat;
00245 qos_params [i].property_value >>= lat;
00246 ace_flow_spec->latency (lat);
00247 }
00248 else if (ACE_OS::strcmp (qos_params [i].property_name, "Delay_Variation") == 0)
00249 {
00250 CORBA::ULong delay_var;
00251 qos_params [i].property_value >>= delay_var;
00252 ace_flow_spec->delay_variation (delay_var);
00253 }
00254 else if (ACE_OS::strcmp (qos_params [i].property_name, "Max_SDU_Size") == 0)
00255 {
00256 CORBA::ULong max_sdu;
00257 qos_params [i].property_value >>= max_sdu;
00258 ace_flow_spec->max_sdu_size (max_sdu);
00259 }
00260 else if (ACE_OS::strcmp (qos_params [i].property_name, "Minimum_Policed_Size") == 0)
00261 {
00262 CORBA::ULong min_pol_size;
00263 qos_params [i].property_value >>= min_pol_size;
00264 ace_flow_spec->minimum_policed_size (min_pol_size);
00265 }
00266 else if (ACE_OS::strcmp (qos_params [i].property_name, "TTL") == 0)
00267 {
00268 CORBA::ULong ttl;
00269 qos_params [i].property_value >>= ttl;
00270 ace_flow_spec->ttl (ttl);
00271 }
00272 else if (ACE_OS::strcmp (qos_params [i].property_name, "Priority") == 0)
00273 {
00274 CORBA::ULong priority;
00275 qos_params [i].property_value >>= priority;
00276 ace_flow_spec->priority (priority);
00277 }
00278 }
00279
00280 return 0;
00281 }
00282
00283 int
00284 TAO_AV_UDP_QoS_Flow_Handler::translate (ACE_Flow_Spec *ace_flow_spec,
00285 CosPropertyService::Properties &qos_params)
00286 {
00287 qos_params.length (9);
00288
00289 qos_params [0].property_name = CORBA::string_dup ("Service_Type");
00290 qos_params [0].property_value <<= (CORBA::Short) ace_flow_spec->service_type ();
00291
00292 qos_params [1].property_name = CORBA::string_dup ("Token_Rate");
00293 qos_params [1].property_value <<= (CORBA::ULong) ace_flow_spec->token_rate ();
00294
00295 qos_params [2].property_name = CORBA::string_dup ("Token_Bucket_Size");
00296 qos_params [2].property_value <<= (CORBA::ULong) ace_flow_spec->token_bucket_size ();
00297
00298 qos_params [3].property_name = CORBA::string_dup ("Peak_Bandwidth");
00299 qos_params [3].property_value <<= (CORBA::ULong) ace_flow_spec->peak_bandwidth ();
00300
00301 qos_params [4].property_name = CORBA::string_dup ("Latency");
00302 qos_params [4].property_value <<= (CORBA::ULong) ace_flow_spec->latency ();
00303
00304 qos_params [5].property_name = CORBA::string_dup ("Delay_Variation");
00305 qos_params [5].property_value <<= (CORBA::ULong) ace_flow_spec->delay_variation ();
00306
00307 qos_params [6].property_name = CORBA::string_dup ("Max_SDU_Size");
00308 qos_params [6].property_value <<= (CORBA::ULong) ace_flow_spec->max_sdu_size ();
00309
00310 qos_params [7].property_name = CORBA::string_dup ("Minimum_Policed_Size");
00311 qos_params [7].property_value <<= (CORBA::ULong) ace_flow_spec->minimum_policed_size ();
00312
00313 qos_params [8].property_name = CORBA::string_dup ("TTL");
00314 qos_params [8].property_value <<= (CORBA::ULong) ace_flow_spec->ttl ();
00315
00316 return 0;
00317 }
00318
00319 int
00320 TAO_AV_UDP_QoS_Flow_Handler::handle_qos (ACE_HANDLE )
00321 {
00322
00323 if (TAO_debug_level > 0)
00324 ACE_DEBUG ((LM_DEBUG,
00325 "(%N,%l) TAO_AV_UDP_QoS_Flow_Handler::handle_qos\n"));
00326
00327 if (this->qos_session_->update_qos () == -1)
00328 ACE_ERROR_RETURN ((LM_ERROR,
00329 "Error in updating QoS\n"),
00330 -1);
00331 else
00332 {
00333 if(TAO_debug_level > 0)
00334 ACE_DEBUG ((LM_DEBUG,
00335 "(%N,%l) Updating QOS succeeds.\n"));
00336 }
00337
00338 if (this->qos_session_->rsvp_event_type () == ACE_QoS_Session::RSVP_RESV_ERROR)
00339 {
00340 resv_error = 1;
00341 }
00342
00343 if (this->qos_session_->rsvp_event_type () == ACE_QoS_Session::RSVP_RESV_CONFIRM)
00344 {
00345 resv_confirm = 1;
00346 }
00347
00348 if (this->qos_session_->flags () == ACE_QoS_Session::ACE_QOS_SENDER)
00349 {
00350 if (this->qos_session_->rsvp_event_type () == ACE_QoS_Session::RSVP_RESV_EVENT)
00351 {
00352 if( TAO_debug_level > 0 )
00353 {
00354 ACE_DEBUG ((LM_DEBUG,
00355 "(%N,%l) Resv Event Received\n"));
00356 }
00357 if (!CORBA::is_nil (this->negotiator_))
00358 {
00359 if( TAO_debug_level > 0 )
00360 {
00361 ACE_DEBUG ((LM_DEBUG,
00362 "(%N,%l) Negotiator Specified\n"));
00363 }
00364
00365 AVStreams::streamQoS new_qos;
00366 ACE_Flow_Spec *ace_flow_spec =
00367 this->qos_session_->qos ().sending_flowspec ();
00368
00369 if (ace_flow_spec != 0)
00370 {
00371 new_qos.length (1);
00372 this->translate (ace_flow_spec,
00373 new_qos [0].QoSParams);
00374 }
00375
00376 AVStreams::Negotiator_var remote_negotiator;
00377 this->negotiator_->negotiate (remote_negotiator.in (),
00378 new_qos);
00379 }
00380 }
00381 }
00382 else if (this->qos_session_->flags () == ACE_QoS_Session::ACE_QOS_RECEIVER)
00383 {
00384 if (this->qos_session_->rsvp_event_type () == ACE_QoS_Session::RSVP_PATH_EVENT)
00385 {
00386 ACE_QoS_Manager qos_manager =
00387 this->get_socket ()->qos_manager ();
00388
00389 ACE_QoS ace_qos = this->qos_session_->qos ();
00390
00391 this->qos_session_->qos (this->get_socket (),
00392 &qos_manager,
00393 ace_qos);
00394 }
00395 }
00396
00397 return 0;
00398 }
00399
00400 int
00401 TAO_AV_UDP_QoS_Flow_Handler::change_qos (AVStreams::QoS new_qos)
00402 {
00403 if( TAO_debug_level > 0 )
00404 {
00405 ACE_DEBUG ((LM_DEBUG,
00406 "(%N,%l) TAO_AV_UDP_QoS_Flow_Handler::change_qos\n"));
00407 }
00408
00409 ACE_QoS* ace_qos = 0;
00410
00411 ACE_NEW_RETURN (ace_qos,
00412 ACE_QoS,
00413 -1);
00414
00415 if (new_qos.QoSParams.length () != 0)
00416 {
00417 ACE_DEBUG ((LM_DEBUG,
00418 "New QoS Params are not Empty\n"));
00419
00420 ACE_Flow_Spec *ace_flow_spec;
00421
00422 ACE_NEW_RETURN (ace_flow_spec,
00423 ACE_Flow_Spec,
00424 -1);
00425
00426 this->translate (new_qos.QoSParams,
00427 ace_flow_spec);
00428
00429
00430 Fill_ACE_QoS fill_ace_qos;
00431
00432 if (this->qos_session_->flags () == ACE_QoS_Session::ACE_QOS_SENDER)
00433 {
00434 if (fill_ace_qos.fill_simplex_sender_qos (*ace_qos,
00435 ace_flow_spec) !=0)
00436 ACE_ERROR_RETURN ((LM_ERROR,
00437 "Unable to fill simplex sender qos\n"),
00438 -1);
00439 else
00440 {
00441 if( TAO_debug_level > 0 )
00442 ACE_DEBUG ((LM_DEBUG,
00443 "(%N,%l) Filled up the Sender QoS parameters\n"));
00444 }
00445 }
00446 else if (this->qos_session_->flags () == ACE_QoS_Session::ACE_QOS_RECEIVER)
00447 {
00448 if (fill_ace_qos.fill_simplex_receiver_qos (*ace_qos,
00449 ace_flow_spec) !=0)
00450 ACE_ERROR_RETURN ((LM_ERROR,
00451 "Unable to fill simplex receiver qos\n"),
00452 -1);
00453 else
00454 {
00455 if( TAO_debug_level > 0 )
00456 ACE_DEBUG ((LM_DEBUG,
00457 "(%N,%l) Filled up the Receiver QoS parameters\n"));
00458 }
00459
00460 }
00461
00462 ACE_QoS_Params qos_params;
00463 FillQoSParams (qos_params,
00464 0,
00465 ace_qos);
00466 }
00467
00468 ACE_QoS_Manager qos_manager =
00469 this->get_socket ()->qos_manager ();
00470
00471 int result = this->qos_session_->qos (this->get_socket (),
00472 &qos_manager,
00473 *ace_qos);
00474 if (result != 0)
00475 return result;
00476
00477 return 0;
00478 }
00479
00480 int
00481 TAO_AV_UDP_QoS_Flow_Handler::handle_timeout (const ACE_Time_Value &tv,
00482 const void *arg)
00483 {
00484 return TAO_AV_Flow_Handler::handle_timeout (tv,arg);
00485 }
00486
00487 int
00488 TAO_AV_UDP_QoS_Flow_Handler::set_remote_address (ACE_Addr *address)
00489 {
00490
00491 if (TAO_debug_level > 0)
00492 {
00493 ACE_TCHAR buf [BUFSIZ];
00494 ACE_INET_Addr *remote_addr = dynamic_cast<ACE_INET_Addr*> (address);
00495 remote_addr->addr_to_string (buf, BUFSIZ);
00496
00497 ACE_DEBUG ((LM_DEBUG,
00498 "(%N,%l) TAO_AV_UDP_QoS_Flow_Handler::set_remote_address %s\n",
00499 buf));
00500 }
00501
00502
00503 ACE_INET_Addr *inet_addr =
00504 dynamic_cast<ACE_INET_Addr*> (address);
00505
00506 this->peer_addr_ = *inet_addr;
00507
00508 TAO_AV_UDP_QoS_Transport *transport =
00509 dynamic_cast<TAO_AV_UDP_QoS_Transport*> (this->transport_);
00510
00511 if (this->entry_->role () == TAO_FlowSpec_Entry::TAO_AV_PRODUCER)
00512 {
00513
00514 TAO_AV_UDP_QoS_Session_Helper helper;
00515
00516 this->qos_session_ = helper.open_qos_session (this,
00517 *inet_addr);
00518
00519 if (this->qos_session_ == 0)
00520 ACE_ERROR_RETURN ((LM_ERROR,
00521 "QoS Session Open Failed (%N|%l)\n"),
00522 -1);
00523
00524 ACE_INET_Addr local_addr;
00525 this->get_socket ()->get_local_addr (local_addr);
00526
00527 ACE_INET_Addr* src_addr;
00528 ACE_NEW_RETURN (src_addr,
00529 ACE_INET_Addr (local_addr.get_port_number (),
00530 local_addr.get_host_name ()),
00531 -1);
00532
00533 this->qos_session_->source_addr (src_addr);
00534
00535 if (helper.activate_qos_handler (this->qos_session_,
00536 this) == -1)
00537 ACE_ERROR_RETURN ((LM_ERROR,
00538 "Activating QoS Handler Failed (%N|%l)\n"),
00539 -1);
00540 }
00541 return transport->set_remote_address (*inet_addr);
00542 }
00543
00544
00545 ACE_HANDLE
00546 TAO_AV_UDP_QoS_Flow_Handler::get_handle (void) const
00547 {
00548 if (TAO_debug_level > 0)
00549 ACE_DEBUG ((LM_DEBUG,
00550 "(%N,%l) TAO_AV_UDP_QoS_Flow_Handler::get_handle:%d\n",
00551 this->qos_sock_dgram_.get_handle ()));
00552
00553 return this->qos_sock_dgram_.get_handle () ;
00554 }
00555
00556
00557
00558
00559
00560 TAO_AV_UDP_QoS_Transport::TAO_AV_UDP_QoS_Transport (void)
00561 :handler_ (0)
00562 {
00563 }
00564
00565 TAO_AV_UDP_QoS_Transport::TAO_AV_UDP_QoS_Transport (TAO_AV_UDP_QoS_Flow_Handler *handler)
00566 :handler_ (handler),
00567 addr_ (0)
00568 {
00569 }
00570
00571 TAO_AV_UDP_QoS_Transport::~TAO_AV_UDP_QoS_Transport (void)
00572 {
00573 }
00574
00575 int
00576 TAO_AV_UDP_QoS_Transport::set_remote_address (const ACE_INET_Addr &address)
00577 {
00578 this->peer_addr_ = address;
00579 return 0;
00580 }
00581
00582 int
00583 TAO_AV_UDP_QoS_Transport::open (ACE_Addr * )
00584 {
00585 return 0;
00586 }
00587
00588 int
00589 TAO_AV_UDP_QoS_Transport::close (void)
00590 {
00591 return 0;
00592 }
00593
00594 int
00595 TAO_AV_UDP_QoS_Transport::mtu (void)
00596 {
00597 return ACE_MAX_DGRAM_SIZE;
00598 }
00599
00600 ACE_Addr*
00601 TAO_AV_UDP_QoS_Transport::get_peer_addr (void)
00602 {
00603 return &this->peer_addr_;
00604 }
00605
00606 ssize_t
00607 TAO_AV_UDP_QoS_Transport::send (const ACE_Message_Block *mblk,
00608 ACE_Time_Value *)
00609 {
00610
00611
00612
00613 iovec iov[IOV_MAX];
00614 int iovcnt = 0;
00615 ssize_t n = 0;
00616 ssize_t nbytes = 0;
00617
00618 for (const ACE_Message_Block *i = mblk;
00619 i != 0;
00620 i = i->cont ())
00621 {
00622
00623 if (i->length () > 0)
00624 {
00625 iov[iovcnt].iov_base = i->rd_ptr ();
00626 iov[iovcnt].iov_len = static_cast<u_long> (i->length ());
00627 iovcnt++;
00628
00629
00630
00631
00632
00633
00634
00635
00636 size_t bytes_sent = 0;
00637
00638 if (iovcnt == IOV_MAX)
00639 {
00640 if (this->handler_->get_socket ()->send (iov,
00641 1,
00642 bytes_sent,
00643 0,
00644 this->handler_->qos_session ()->dest_addr (),
00645 0,
00646 0) == -1)
00647 ACE_ERROR_RETURN ((LM_ERROR,
00648 "Error in dgram_mcast.send () (%N|%l)\n"),
00649 -1);
00650 else
00651 if (TAO_debug_level > 0)
00652 ACE_DEBUG ((LM_DEBUG,
00653 "Using ACE_OS::sendto () : Bytes sent : %d",
00654 bytes_sent));
00655
00656 if (n < 1)
00657 return n;
00658
00659 nbytes += bytes_sent;
00660 iovcnt = 0;
00661 }
00662 }
00663 }
00664
00665 size_t bytes_sent = 0;
00666
00667
00668 if (iovcnt != 0)
00669 {
00670 if (this->handler_->get_socket ()->send (iov,
00671 1,
00672 bytes_sent,
00673 0,
00674 this->handler_->qos_session ()->dest_addr (),
00675 0,
00676 0) == -1)
00677 ACE_ERROR_RETURN ((LM_ERROR,
00678 "Error in dgram_mcast.send ()\n"),
00679 -1);
00680 else
00681 if( TAO_debug_level > 0)
00682 ACE_DEBUG ((LM_DEBUG,
00683 "(%N,%l) Using ACE_OS::sendto () : Bytes sent : %d",
00684 bytes_sent));
00685
00686 if (n < 1)
00687 return n;
00688
00689 nbytes += bytes_sent;
00690 }
00691
00692 return nbytes;
00693 }
00694
00695 ssize_t
00696 TAO_AV_UDP_QoS_Transport::send (const char *buf,
00697 size_t len,
00698 ACE_Time_Value *)
00699 {
00700 if (TAO_debug_level > 0)
00701 ACE_DEBUG ((LM_DEBUG,
00702 "(%N,%l) TAO_AV_UDP_QoS_Transport::send "));
00703
00704 ACE_TCHAR addr [BUFSIZ];
00705 this->peer_addr_.addr_to_string (addr,BUFSIZ);
00706 if (TAO_debug_level > 0)
00707 ACE_DEBUG ((LM_DEBUG,
00708 "(%N,%l) to %s\n",
00709 addr));
00710
00711 return this->handler_->get_socket ()->send (buf,
00712 len,
00713 this->handler_->qos_session ()->dest_addr (),
00714 0,
00715 0,
00716 0);
00717 }
00718
00719 ssize_t
00720 TAO_AV_UDP_QoS_Transport::send (const iovec *iov,
00721 int ,
00722 ACE_Time_Value *)
00723 {
00724 size_t bytes_sent = 0;
00725 if (this->handler_->get_socket ()->send (iov,
00726 1,
00727 bytes_sent,
00728 0,
00729 this->handler_->qos_session ()->dest_addr (),
00730 0,
00731 0) == -1)
00732 ACE_ERROR_RETURN ((LM_ERROR,
00733 "Error in dgram_mcast.send ()\n"),
00734 -1);
00735 else
00736 {
00737 if( TAO_debug_level > 0)
00738 ACE_DEBUG ((LM_DEBUG,
00739 "(%N,%l) Using ACE_OS::sendto () : Bytes sent : %d",
00740 bytes_sent));
00741 }
00742
00743
00744 return bytes_sent;
00745 }
00746
00747 ssize_t
00748 TAO_AV_UDP_QoS_Transport::recv (char *buf,
00749 size_t len,
00750 ACE_Time_Value *)
00751 {
00752 return this->handler_->get_socket ()->recv (buf, len,this->peer_addr_);
00753 }
00754
00755 ssize_t
00756 TAO_AV_UDP_QoS_Transport::recv (char *buf,
00757 size_t len,
00758 int flags,
00759 ACE_Time_Value *timeout)
00760 {
00761 return this->handler_->get_socket ()->recv (buf,
00762 len,
00763 this->peer_addr_,
00764 flags,
00765 timeout);
00766 }
00767
00768 ssize_t
00769 TAO_AV_UDP_QoS_Transport::recv (iovec *iov,
00770 int ,
00771 ACE_Time_Value *timeout)
00772 {
00773 return handler_->get_socket ()->recv (iov,this->peer_addr_,0,timeout);
00774 }
00775
00776
00777
00778
00779
00780
00781 TAO_AV_UDP_QoS_Acceptor::TAO_AV_UDP_QoS_Acceptor (void)
00782 {
00783 }
00784
00785 TAO_AV_UDP_QoS_Acceptor::~TAO_AV_UDP_QoS_Acceptor (void)
00786 {
00787 }
00788
00789 int
00790 TAO_AV_UDP_QoS_Acceptor::activate_svc_handler (TAO_AV_UDP_QoS_Flow_Handler *handler)
00791 {
00792 int result = 0;
00793
00794 if (TAO_debug_level > 0)
00795 ACE_DEBUG ((LM_DEBUG,
00796 "(%N,%l) Acceptor Svc Handler QOS ENABLED\n"));
00797
00798 TAO_AV_UDP_QoS_Session_Helper helper;
00799
00800 result = helper.activate_qos_handler (handler->qos_session (),
00801 handler);
00802 if (result == -1)
00803 ACE_ERROR_RETURN ((LM_ERROR,
00804 "Error in registering the Decorator with the Reactor\n"),
00805 -1);
00806
00807 return result;
00808 }
00809
00810 int
00811 TAO_AV_UDP_QoS_Acceptor::open (TAO_Base_StreamEndPoint *endpoint,
00812 TAO_AV_Core *av_core,
00813 TAO_FlowSpec_Entry *entry,
00814 TAO_AV_Flow_Protocol_Factory *factory,
00815 TAO_AV_Core::Flow_Component flow_comp)
00816 {
00817 ACE_UNUSED_ARG (flow_comp);
00818
00819 if (TAO_debug_level > 0)
00820 ACE_DEBUG ((LM_DEBUG,
00821 "(%N,%l) TAO_AV_UDP_QoS_Acceptor::open "));
00822
00823 this->av_core_ = av_core;
00824 this->endpoint_ = endpoint;
00825 this->entry_ = entry;
00826
00827
00828 this->flow_protocol_factory_ = factory;
00829 this->flowname_ = entry->flowname ();
00830 ACE_INET_Addr *inet_addr = (ACE_INET_Addr *) entry->address ();
00831
00832
00833 ACE_TCHAR buf[BUFSIZ];
00834 inet_addr->addr_to_string (buf,
00835 BUFSIZ);
00836 if (TAO_debug_level > 0)
00837 ACE_DEBUG ((LM_DEBUG,
00838 "(%N,%l) TAO_AV_UDP_QoS_Acceptor::open: %s",
00839 buf));
00840
00841 int result = this->open_i (inet_addr);
00842
00843 if (result < 0)
00844 return result;
00845
00846 return 0;
00847 }
00848
00849 int
00850 TAO_AV_UDP_QoS_Acceptor::open_default (TAO_Base_StreamEndPoint *endpoint,
00851 TAO_AV_Core *av_core,
00852 TAO_FlowSpec_Entry *entry,
00853 TAO_AV_Flow_Protocol_Factory *factory,
00854 TAO_AV_Core::Flow_Component flow_comp)
00855 {
00856 ACE_UNUSED_ARG (flow_comp);
00857
00858 this->av_core_ = av_core;
00859 this->endpoint_ = endpoint;
00860 this->entry_ = entry;
00861 this->flow_protocol_factory_ = factory;
00862 this->flowname_ = entry->flowname ();
00863 char buf [BUFSIZ];
00864 ACE_OS::hostname (buf,
00865 BUFSIZ);
00866 qos_acceptor_addr_.set((u_short)0, buf);
00867
00868
00869
00870
00871
00872
00873
00874 ACE_DEBUG ((LM_DEBUG,
00875 "(%N,%l) ADDRESS IS %s:%d\n",
00876 buf, qos_acceptor_addr_.get_port_number() ));
00877
00878 int result = this->open_i (&qos_acceptor_addr_);
00879 if (result < 0)
00880 return result;
00881 return 0;
00882 }
00883
00884
00885 int
00886 TAO_AV_UDP_QoS_Acceptor::open_i (ACE_INET_Addr *inet_addr)
00887 {
00888 int result = 0;
00889
00890
00891
00892
00893 ACE_INET_Addr *local_addr;
00894
00895 ACE_NEW_RETURN (local_addr,
00896 ACE_INET_Addr (*inet_addr),
00897 -1);
00898
00899 ACE_QoS_Params qos_params;
00900
00901 ACE_QoS* ace_qos = 0;
00902
00903 FillQoSParams (qos_params,
00904 0,
00905 ace_qos);
00906
00907
00908 TAO_AV_UDP_QoS_Flow_Handler* handler;
00909 ACE_NEW_RETURN (handler,
00910 TAO_AV_UDP_QoS_Flow_Handler,
00911 -1);
00912
00913
00914 TAO_AV_Flow_Handler *flow_handler = 0;
00915 flow_handler = handler;
00916
00917 handler->endpoint (this->endpoint_);
00918 handler->flowspec_entry (this->entry_);
00919 handler->av_core (this->av_core_);
00920
00921 if (this->entry_->role () == TAO_FlowSpec_Entry::TAO_AV_CONSUMER)
00922 {
00923
00924 TAO_AV_UDP_QoS_Session_Helper helper;
00925
00926 int result = handler->get_socket ()->open (*inet_addr,
00927 qos_params,
00928 AF_INET,
00929 0,
00930 0,
00931 0,
00932 ACE_OVERLAPPED_SOCKET_FLAG
00933 | ACE_FLAG_MULTIPOINT_C_LEAF
00934 | ACE_FLAG_MULTIPOINT_D_LEAF,
00935 1);
00936
00937 if (result < 0)
00938 ACE_ERROR_RETURN ((LM_ERROR,
00939 "TAO_AV_QOS_UDP_MCast_Acceptor data socket open failed (%N|%l)\n"),
00940 -1);
00941
00942 result = handler->get_socket ()->get_local_addr (*local_addr);
00943 if (result < 0)
00944 ACE_ERROR_RETURN ((LM_ERROR,
00945 "Error in getting Local Address (%N|%l)\n"),
00946 -1);
00947
00948
00949
00950
00951
00952 ACE_INET_Addr dest_addr;
00953 dest_addr.set (local_addr->get_port_number (),
00954 local_addr->get_host_name ());
00955
00956 ACE_TCHAR dest_buf [BUFSIZ];
00957 dest_addr.addr_to_string (dest_buf,
00958 BUFSIZ);
00959
00960 if (TAO_debug_level > 0)
00961 ACE_DEBUG ((LM_DEBUG,
00962 "Session Address is %s\n",
00963 dest_buf));
00964
00965 this->qos_session_ = helper.open_qos_session (handler,
00966 dest_addr);
00967
00968 if (this->qos_session_ == 0)
00969 ACE_ERROR_RETURN ((LM_ERROR,
00970 "QoS Session Open Failed (%N|%l)\n"),
00971 -1);
00972
00973 handler->qos_session (this->qos_session_);
00974
00975 if (this->activate_svc_handler (handler) == -1)
00976 ACE_ERROR_RETURN ((LM_ERROR,
00977 "Activate Svc Handler Failed (%N|%l)\n"),
00978 -1);
00979
00980 AVStreams::QoS qos;
00981 int qos_available = this->endpoint_->qos ().get_flow_qos (this->flowname_.c_str (),
00982 qos);
00983
00984 if (qos_available == 0)
00985 {
00986
00987 ACE_Flow_Spec *ace_flow_spec = 0;
00988 ACE_NEW_RETURN (ace_flow_spec,
00989 ACE_Flow_Spec,
00990 -1);
00991
00992 handler->translate (qos.QoSParams,
00993 ace_flow_spec);
00994
00995 if (helper.set_qos (*ace_flow_spec,
00996 handler) == -1)
00997
00998 ACE_ERROR_RETURN ((LM_ERROR,
00999 "Set QoS Failed (%N|%l)\n"),
01000 -1);
01001 }
01002 }
01003 else
01004 {
01005
01006 int result = handler->get_socket ()->open (*inet_addr,
01007 qos_params,
01008 AF_INET,
01009 0,
01010 0,
01011 0,
01012 ACE_OVERLAPPED_SOCKET_FLAG
01013 | ACE_FLAG_MULTIPOINT_C_LEAF
01014 | ACE_FLAG_MULTIPOINT_D_LEAF,
01015 1);
01016
01017 if (result < 0)
01018 ACE_ERROR_RETURN ((LM_ERROR,
01019 "TAO_AV_QOS_UDP_MCast_Acceptor data socket open failed (%N|%l)\n"),
01020 -1);
01021 }
01022
01023 TAO_AV_Protocol_Object *object =
01024 this->flow_protocol_factory_->make_protocol_object (this->entry_,
01025 this->endpoint_,
01026 flow_handler,
01027 flow_handler->transport ());
01028 flow_handler->protocol_object (object);
01029
01030 AVStreams::Negotiator_ptr negotiator;
01031
01032 try
01033 {
01034 CORBA::Any_ptr negotiator_any =
01035 this->endpoint_->get_property_value ("Negotiator");
01036
01037 *negotiator_any >>= negotiator;
01038 handler->negotiator (negotiator);
01039 }
01040 catch (const CORBA::Exception&)
01041 {
01042 ACE_DEBUG ((LM_DEBUG,
01043 "(%N,%l) Negotiator Not Found\n"));
01044 }
01045
01046 this->endpoint_->set_flow_handler (this->flowname_.c_str (),flow_handler);
01047 this->entry_->protocol_object (object);
01048
01049 result = handler->get_socket ()->get_local_addr (*local_addr);
01050 if (result < 0)
01051 ACE_ERROR_RETURN ((LM_ERROR,"TAO_AV_Dgram_Connector::open: get_local_addr failed\n"),result);
01052 local_addr->set (local_addr->get_port_number (),
01053 local_addr->get_host_name ());
01054
01055 if (TAO_debug_level > 0)
01056 {
01057 ACE_TCHAR buf [BUFSIZ];
01058 local_addr->addr_to_string (buf,
01059 BUFSIZ);
01060 ACE_DEBUG ((LM_DEBUG,
01061 "Local Address is %s\n",
01062 buf));
01063 }
01064
01065 this->entry_->set_local_addr (local_addr);
01066 this->entry_->handler (flow_handler);
01067
01068 return 0;
01069
01070 }
01071
01072 int
01073 TAO_AV_UDP_QoS_Acceptor::close (void)
01074 {
01075 return 0;
01076 }
01077
01078
01079
01080
01081 TAO_AV_UDP_QoS_Connector::TAO_AV_UDP_QoS_Connector (void)
01082 {
01083 }
01084
01085 TAO_AV_UDP_QoS_Connector::~TAO_AV_UDP_QoS_Connector (void)
01086 {
01087 }
01088
01089 int
01090 TAO_AV_UDP_QoS_Connector::open (TAO_Base_StreamEndPoint *endpoint,
01091 TAO_AV_Core *av_core,
01092 TAO_AV_Flow_Protocol_Factory *factory)
01093
01094 {
01095 if (TAO_debug_level > 0)
01096 ACE_DEBUG ((LM_DEBUG,
01097 "TAO_AV_UDP_QoS_Connector::open "));
01098
01099 this->endpoint_ = endpoint;
01100 this->av_core_ = av_core;
01101 this->flow_protocol_factory_ = factory;
01102 return 0;
01103 }
01104
01105
01106
01107
01108
01109
01110
01111
01112
01113
01114
01115
01116
01117
01118
01119
01120
01121
01122
01123
01124
01125
01126
01127
01128
01129
01130
01131
01132
01133
01134
01135
01136
01137
01138
01139
01140
01141
01142
01143
01144
01145
01146
01147
01148
01149
01150
01151
01152
01153
01154
01155
01156 int
01157 TAO_AV_UDP_QoS_Connector::connect (TAO_FlowSpec_Entry *entry,
01158 TAO_AV_Transport *&transport,
01159 TAO_AV_Core::Flow_Component flow_comp)
01160 {
01161 ACE_UNUSED_ARG (flow_comp);
01162
01163 int result = 0;
01164 this->entry_ = entry;
01165 this->flowname_ = entry->flowname ();
01166
01167 ACE_INET_Addr *local_addr;
01168
01169 if (entry->get_peer_addr () != 0)
01170 {
01171 local_addr = dynamic_cast<ACE_INET_Addr*> (entry->get_peer_addr ());
01172 }
01173 else
01174 ACE_NEW_RETURN (local_addr,
01175 ACE_INET_Addr ("0"),
01176 -1);
01177
01178 TAO_AV_Flow_Handler *flow_handler = 0;
01179
01180 TAO_AV_UDP_QoS_Flow_Handler *handler;
01181 ACE_NEW_RETURN (handler,
01182 TAO_AV_UDP_QoS_Flow_Handler,
01183 -1);
01184
01185 flow_handler = handler;
01186
01187 handler->endpoint (this->endpoint_);
01188 handler->flowspec_entry (this->entry_);
01189 handler->av_core (this->av_core_);
01190
01191 ACE_INET_Addr *inet_addr = dynamic_cast<ACE_INET_Addr*> (entry->address ());
01192
01193 ACE_QoS_Params qos_params;
01194
01195 ACE_QoS* ace_qos = 0;
01196
01197 FillQoSParams (qos_params,
01198 0,
01199 ace_qos);
01200
01201 result = handler->get_socket ()->open (*local_addr,
01202 qos_params,
01203 AF_INET,
01204 0,
01205 0,
01206 0,
01207 ACE_OVERLAPPED_SOCKET_FLAG
01208 | ACE_FLAG_MULTIPOINT_C_LEAF
01209 | ACE_FLAG_MULTIPOINT_D_LEAF,
01210 1);
01211
01212 if (result < 0)
01213 ACE_ERROR_RETURN ((LM_ERROR,
01214 "Data socket open failed (%N|%l)\n"),
01215 -1);
01216
01217 result = handler->get_socket ()->get_local_addr (*local_addr);
01218
01219
01220 ACE_INET_Addr *session_addr = 0;
01221 if (this->entry_->role () == TAO_FlowSpec_Entry::TAO_AV_CONSUMER)
01222 {
01223 ACE_NEW_RETURN (session_addr,
01224 ACE_INET_Addr,
01225 -1);
01226
01227 session_addr->set (local_addr->get_port_number (),
01228 local_addr->get_host_name ());
01229
01230 }
01231 else
01232 {
01233 session_addr = inet_addr;
01234 }
01235
01236 ACE_TCHAR sess_buf [BUFSIZ];
01237 session_addr->addr_to_string (sess_buf,
01238 BUFSIZ);
01239
01240 if (TAO_debug_level > 0)
01241 ACE_DEBUG ((LM_DEBUG,
01242 "Session Address is %s\n",
01243 sess_buf));
01244
01245
01246
01247
01248
01249 ACE_INET_Addr dest_addr (*session_addr);
01250
01251 TAO_AV_UDP_QoS_Session_Helper helper;
01252
01253 this->qos_session_ = helper.open_qos_session (handler,
01254 *session_addr);
01255
01256 if (this->qos_session_ == 0)
01257 ACE_ERROR_RETURN ((LM_ERROR,
01258 "QoS Session Open Failed (%N|%l)\n"),
01259 -1);
01260 else
01261 ACE_DEBUG ((LM_DEBUG,
01262 "QoS session opened successfully\n"));
01263
01264 if (this->entry_->role () == TAO_FlowSpec_Entry::TAO_AV_PRODUCER)
01265 {
01266
01267 ACE_INET_Addr* src_addr;
01268 ACE_NEW_RETURN (src_addr,
01269 ACE_INET_Addr (local_addr->get_port_number (),
01270 local_addr->get_host_name ()),
01271 -1);
01272
01273 this->qos_session_->source_addr (src_addr);
01274
01275 }
01276
01277 handler->qos_session (this->qos_session_);
01278
01279 this->qos_manager_ =
01280 handler->get_socket ()->qos_manager ();
01281
01282 AVStreams::QoS qos;
01283
01284 int qos_available = this->endpoint_->qos ().get_flow_qos (this->flowname_.c_str (),
01285 qos);
01286 if (qos_available == 0)
01287 {
01288
01289 ACE_Flow_Spec* ace_flow_spec;
01290 ACE_NEW_RETURN (ace_flow_spec,
01291 ACE_Flow_Spec,
01292 -1);
01293
01294 handler->translate (qos.QoSParams,
01295 ace_flow_spec);
01296
01297 if (helper.set_qos (*ace_flow_spec,
01298 handler) == -1)
01299 ACE_ERROR_RETURN ((LM_ERROR,
01300 "Unable to set QoS (%N|%l)\n"),
01301 -1);
01302 else
01303 {
01304 if( TAO_debug_level > 0)
01305 ACE_DEBUG ((LM_DEBUG,
01306 "(%N,%l) Setting QOS succeeds.\n"));
01307 }
01308 }
01309
01310 TAO_AV_Protocol_Object *object =
01311 this->flow_protocol_factory_->make_protocol_object (this->entry_,
01312 this->endpoint_,
01313 flow_handler,
01314 flow_handler->transport ());
01315
01316 AVStreams::Negotiator_ptr negotiator;
01317
01318 try
01319 {
01320 CORBA::Any_ptr negotiator_any =
01321 this->endpoint_->get_property_value ("Negotiator");
01322
01323 *negotiator_any >>= negotiator;
01324 handler->negotiator (negotiator);
01325 }
01326 catch (const CORBA::Exception&)
01327 {
01328 ACE_DEBUG ((LM_DEBUG,
01329 "Negotiator not found for flow %s\n",
01330 this->entry_->flowname ()));
01331 }
01332
01333 flow_handler->protocol_object (object);
01334
01335 this->endpoint_->set_flow_handler (this->flowname_.c_str (),flow_handler);
01336 this->entry_->protocol_object (object);
01337
01338 result = handler->get_socket ()->get_local_addr (*local_addr);
01339 if (result < 0)
01340 ACE_ERROR_RETURN ((LM_ERROR,
01341 "Get local addr failed (%N|%l)\n"),
01342 result);
01343
01344 local_addr->set (local_addr->get_port_number (),
01345 local_addr->get_host_name ());
01346
01347 if (TAO_debug_level > 0)
01348 {
01349 ACE_TCHAR buf[BUFSIZ];
01350 local_addr->addr_to_string (buf,
01351 BUFSIZ);
01352
01353 ACE_DEBUG ((LM_DEBUG,
01354 "Local Address is %s\n",
01355 buf));
01356 }
01357
01358 entry->set_local_addr (local_addr);
01359 entry->handler (flow_handler);
01360 transport = flow_handler->transport ();
01361
01362
01363 return this->activate_svc_handler (handler);
01364 }
01365
01366 int
01367 TAO_AV_UDP_QoS_Connector::activate_svc_handler (TAO_AV_UDP_QoS_Flow_Handler *handler)
01368 {
01369 int result = 0;
01370
01371 TAO_AV_UDP_QoS_Session_Helper helper;
01372
01373 result = helper.activate_qos_handler (this->qos_session_,
01374 handler);
01375
01376 if (result == -1)
01377 ACE_ERROR_RETURN ((LM_ERROR,
01378 "(%N,%l) Error in registering the Decorator with the Reactor\n"),
01379 -1);
01380
01381 return result;
01382 }
01383
01384 int
01385 TAO_AV_UDP_QoS_Connector::close (void)
01386 {
01387 return 0;
01388 }
01389
01390
01391
01392
01393
01394 TAO_AV_UDP_QoS_Factory::TAO_AV_UDP_QoS_Factory (void)
01395 {
01396 if (TAO_debug_level > 0)
01397 ACE_DEBUG ((LM_DEBUG,
01398 "TAO_AV_UDP_QoS_Factory::TAO_AV_UDP_QoS_Factory\n"));
01399 }
01400
01401 TAO_AV_UDP_QoS_Factory::~TAO_AV_UDP_QoS_Factory (void)
01402 {
01403 }
01404
01405 int
01406 TAO_AV_UDP_QoS_Factory::match_protocol (const char *protocol_string)
01407 {
01408 if (TAO_debug_level > 0)
01409 ACE_DEBUG ((LM_DEBUG,
01410 "TAO_AV_UDP_QoS_Factory::match_protocol\n"));
01411
01412 if (ACE_OS::strcasecmp (protocol_string,"QoS_UDP") == 0)
01413 return 1;
01414 return 0;
01415 }
01416
01417 TAO_AV_Acceptor*
01418 TAO_AV_UDP_QoS_Factory::make_acceptor (void)
01419 {
01420 if (TAO_debug_level > 0)
01421 ACE_DEBUG ((LM_DEBUG,
01422 "TAO_AV_UDP_QoS_Factory::make_acceptor "));
01423
01424 TAO_AV_Acceptor *acceptor = 0;
01425 ACE_NEW_RETURN (acceptor,
01426 TAO_AV_UDP_QoS_Acceptor,
01427 0);
01428 return acceptor;
01429 }
01430
01431 TAO_AV_Connector*
01432 TAO_AV_UDP_QoS_Factory::make_connector (void)
01433 {
01434 if (TAO_debug_level > 0)
01435 ACE_DEBUG ((LM_DEBUG,
01436 "TAO_AV_UDP_QoS_Factory::make_connector "));
01437
01438 TAO_AV_Connector *connector = 0;
01439 ACE_NEW_RETURN (connector,
01440 TAO_AV_UDP_QoS_Connector,
01441 0);
01442 return connector;
01443 }
01444
01445 int
01446 TAO_AV_UDP_QoS_Factory::init (int ,
01447 ACE_TCHAR * [])
01448 {
01449 return 0;
01450 }
01451
01452
01453
01454
01455
01456 TAO_AV_UDP_QoS_Flow_Factory::TAO_AV_UDP_QoS_Flow_Factory (void)
01457 {
01458 if (TAO_debug_level > 0)
01459 ACE_DEBUG ((LM_DEBUG,
01460 "TAO_AV_UDP_QoS_Flow_Factory::TAO_AV_UDP_QoS_Flow_Factory\n"));
01461 }
01462
01463 TAO_AV_UDP_QoS_Flow_Factory::~TAO_AV_UDP_QoS_Flow_Factory (void)
01464 {
01465 }
01466
01467 int
01468 TAO_AV_UDP_QoS_Flow_Factory::init (int ,
01469 ACE_TCHAR * [])
01470 {
01471 return 0;
01472 }
01473
01474 int
01475 TAO_AV_UDP_QoS_Flow_Factory::match_protocol (const char *flow_string)
01476 {
01477 if (ACE_OS::strcasecmp (flow_string,"QoS_UDP") == 0)
01478 return 1;
01479 return 0;
01480 }
01481
01482 TAO_AV_Protocol_Object*
01483 TAO_AV_UDP_QoS_Flow_Factory::make_protocol_object (TAO_FlowSpec_Entry *entry,
01484 TAO_Base_StreamEndPoint *endpoint,
01485 TAO_AV_Flow_Handler *handler,
01486 TAO_AV_Transport *transport)
01487 {
01488 TAO_AV_Callback *callback = 0;
01489 endpoint->get_callback (entry->flowname (),
01490 callback);
01491
01492
01493 TAO_AV_UDP_Object *object = 0;
01494 ACE_NEW_RETURN (object,
01495 TAO_AV_UDP_Object (callback,
01496 transport),
01497 0);
01498 callback->open (object,
01499 handler);
01500 endpoint->set_protocol_object (entry->flowname (),
01501 object);
01502 return object;
01503 }
01504
01505 TAO_END_VERSIONED_NAMESPACE_DECL
01506
01507 ACE_FACTORY_DEFINE (TAO_AV, TAO_AV_UDP_QoS_Flow_Factory)
01508 ACE_STATIC_SVC_DEFINE (TAO_AV_UDP_QoS_Flow_Factory,
01509 ACE_TEXT ("UDP_QoS_Flow_Factory"),
01510 ACE_SVC_OBJ_T,
01511 &ACE_SVC_NAME (TAO_AV_UDP_QoS_Flow_Factory),
01512 ACE_Service_Type::DELETE_THIS |
01513 ACE_Service_Type::DELETE_OBJ,
01514 0)
01515
01516 ACE_FACTORY_DEFINE (TAO_AV, TAO_AV_UDP_QoS_Factory)
01517
01518 ACE_STATIC_SVC_DEFINE (TAO_AV_UDP_QoS_Factory,
01519 ACE_TEXT ("UDP_QoS_Factory"),
01520 ACE_SVC_OBJ_T,
01521 &ACE_SVC_NAME (TAO_AV_UDP_QoS_Factory),
01522 ACE_Service_Type::DELETE_THIS |
01523 ACE_Service_Type::DELETE_OBJ,
01524 0)
01525
01526 #endif