#include <UDP.h>
Inheritance diagram for TAO_AV_UDP_Acceptor:
Public Member Functions | |
TAO_AV_UDP_Acceptor (void) | |
virtual | ~TAO_AV_UDP_Acceptor (void) |
virtual int | open (TAO_Base_StreamEndPoint *endpoint, TAO_AV_Core *av_core, TAO_FlowSpec_Entry *entry, TAO_AV_Flow_Protocol_Factory *factory, TAO_AV_Core::Flow_Component flow_comp=TAO_AV_Core::TAO_AV_DATA) |
virtual int | open_default (TAO_Base_StreamEndPoint *endpoint, TAO_AV_Core *av_core, TAO_FlowSpec_Entry *entry, TAO_AV_Flow_Protocol_Factory *factory, TAO_AV_Core::Flow_Component flow_comp=TAO_AV_Core::TAO_AV_DATA) |
virtual int | open_i (ACE_INET_Addr *address, int is_default_open) |
virtual int | close (void) |
virtual int | activate_svc_handler (TAO_AV_Flow_Handler *handler) |
Protected Attributes | |
ACE_INET_Addr * | address_ |
ACE_INET_Addr * | control_inet_address_ |
TAO_Base_StreamEndPoint * | endpoint_ |
TAO_FlowSpec_Entry * | entry_ |
TAO_AV_Flow_Protocol_Factory * | flow_protocol_factory_ |
TAO_AV_Core::Flow_Component | flow_component_ |
Definition at line 141 of file UDP.h.
TAO_AV_UDP_Acceptor::TAO_AV_UDP_Acceptor | ( | void | ) |
Definition at line 325 of file UDP.cpp.
00326 : address_ (0), 00327 control_inet_address_ (0) 00328 { 00329 }
TAO_AV_UDP_Acceptor::~TAO_AV_UDP_Acceptor | ( | void | ) | [virtual] |
Definition at line 331 of file UDP.cpp.
References address_, TAO_FlowSpec_Entry::control_handler(), control_inet_address_, entry_, and TAO_AV_Core::TAO_AV_CONTROL.
00332 { 00333 if (this->flow_component_ == TAO_AV_Core::TAO_AV_CONTROL) 00334 delete this->entry_->control_handler (); 00335 00336 delete this->address_; 00337 delete this->control_inet_address_; 00338 }
int TAO_AV_UDP_Acceptor::activate_svc_handler | ( | TAO_AV_Flow_Handler * | handler | ) | [virtual] |
Definition at line 341 of file UDP.cpp.
References TAO_AV_Acceptor::av_core_, TAO_AV_Flow_Handler::event_handler(), TAO_AV_Core::reactor(), ACE_Event_Handler::READ_MASK, TAO_AV_Flow_Handler::schedule_timer(), and TAO_AV_Core::TAO_AV_CONTROL.
Referenced by open_i().
00342 { 00343 ACE_Event_Handler *event_handler = handler->event_handler (); 00344 int result = this->av_core_->reactor ()->register_handler (event_handler, 00345 ACE_Event_Handler::READ_MASK); 00346 00347 if (this->flow_component_ == TAO_AV_Core::TAO_AV_CONTROL) 00348 handler->schedule_timer (); 00349 00350 return result; 00351 }
int TAO_AV_UDP_Acceptor::close | ( | void | ) | [virtual] |
int TAO_AV_UDP_Acceptor::open | ( | TAO_Base_StreamEndPoint * | endpoint, | |
TAO_AV_Core * | av_core, | |||
TAO_FlowSpec_Entry * | entry, | |||
TAO_AV_Flow_Protocol_Factory * | factory, | |||
TAO_AV_Core::Flow_Component | flow_comp = TAO_AV_Core::TAO_AV_DATA | |||
) | [virtual] |
Implements TAO_AV_Acceptor.
Definition at line 354 of file UDP.cpp.
References ACE_DEBUG, TAO_FlowSpec_Entry::address(), TAO_AV_Acceptor::av_core_, TAO_FlowSpec_Entry::control_address(), endpoint_, entry_, flow_component_, flow_protocol_factory_, TAO_FlowSpec_Entry::flowname(), TAO_AV_Acceptor::flowname_, TAO_AV_Core::get_control_flowname(), inet_addr(), LM_DEBUG, open_i(), TAO_AV_Core::TAO_AV_CONTROL, and TAO_debug_level.
00359 { 00360 if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG,"TAO_AV_UDP_Acceptor::open\n")); 00361 this->av_core_ = av_core; 00362 this->endpoint_ = endpoint; 00363 this->entry_ = entry; 00364 this->flow_component_ = flow_comp; 00365 this->flow_protocol_factory_ = factory; 00366 ACE_INET_Addr *inet_addr; 00367 if (flow_comp == TAO_AV_Core::TAO_AV_CONTROL) 00368 { 00369 this->flowname_ = TAO_AV_Core::get_control_flowname (entry->flowname ()); 00370 inet_addr = (ACE_INET_Addr *) entry->control_address (); 00371 } 00372 else 00373 { 00374 this->flowname_ = entry->flowname (); 00375 inet_addr = (ACE_INET_Addr *) entry->address (); 00376 } 00377 00378 if (inet_addr != 0) 00379 { 00380 char buf[BUFSIZ]; 00381 inet_addr->addr_to_string (buf, 00382 BUFSIZ); 00383 00384 if (TAO_debug_level > 0) 00385 ACE_DEBUG ((LM_DEBUG, 00386 "TAO_AV_UDP_Acceptor::open: %s\n", 00387 buf)); 00388 } 00389 00390 int result = this->open_i (inet_addr, 0); 00391 00392 if (result < 0) 00393 return result; 00394 return 0; 00395 }
int TAO_AV_UDP_Acceptor::open_default | ( | TAO_Base_StreamEndPoint * | endpoint, | |
TAO_AV_Core * | av_core, | |||
TAO_FlowSpec_Entry * | entry, | |||
TAO_AV_Flow_Protocol_Factory * | factory, | |||
TAO_AV_Core::Flow_Component | flow_comp = TAO_AV_Core::TAO_AV_DATA | |||
) | [virtual] |
Implements TAO_AV_Acceptor.
Definition at line 398 of file UDP.cpp.
References ACE_NEW_RETURN, TAO_AV_Acceptor::av_core_, endpoint_, entry_, flow_component_, flow_protocol_factory_, TAO_FlowSpec_Entry::flowname(), TAO_AV_Acceptor::flowname_, TAO_AV_Core::get_control_flowname(), open_i(), and TAO_AV_Core::TAO_AV_CONTROL.
00403 { 00404 this->av_core_ = av_core; 00405 this->endpoint_ = endpoint; 00406 this->entry_ = entry; 00407 this->flow_component_ = flow_comp; 00408 this->flow_protocol_factory_ = factory; 00409 if (flow_comp == TAO_AV_Core::TAO_AV_CONTROL) 00410 { 00411 this->flowname_ = TAO_AV_Core::get_control_flowname (entry->flowname ()); 00412 } 00413 else 00414 { 00415 this->flowname_ = entry->flowname (); 00416 ACE_NEW_RETURN (this->address_, 00417 ACE_INET_Addr ("0"), 00418 -1); 00419 } 00420 00421 int result = this->open_i (this->address_, 1); 00422 if (result < 0) 00423 return result; 00424 00425 return 0; 00426 }
int TAO_AV_UDP_Acceptor::open_i | ( | ACE_INET_Addr * | address, | |
int | is_default_open | |||
) | [virtual] |
Definition at line 429 of file UDP.cpp.
References TAO_AV_UDP_Connection_Setup::ACCEPTOR, ACE_DEBUG, ACE_NEW_RETURN, activate_svc_handler(), ACE_INET_Addr::addr_to_string(), TAO_FlowSpec_Entry::address(), TAO_FlowSpec_Entry::control_address(), TAO_FlowSpec_Entry::control_handler(), TAO_FlowSpec_Entry::control_protocol_object(), endpoint_, entry_, flow_component_, flow_protocol_factory_, ACE_INET_Addr::get_host_name(), TAO_FlowSpec_Entry::get_local_control_addr(), ACE_INET_Addr::get_port_number(), TAO_FlowSpec_Entry::handler(), inet_addr(), ACE_INET_Addr::is_multicast(), LM_DEBUG, TAO_AV_Flow_Protocol_Factory::make_protocol_object(), TAO_FlowSpec_Entry::protocol_object(), TAO_AV_Flow_Handler::protocol_object(), ACE_INET_Addr::set(), TAO_Base_StreamEndPoint::set_control_flow_handler(), TAO_Base_StreamEndPoint::set_flow_handler(), TAO_FlowSpec_Entry::set_local_addr(), TAO_FlowSpec_Entry::set_local_control_addr(), TAO_AV_UDP_Connection_Setup::setup(), ACE_OS::strcasecmp(), TAO_AV_Core::TAO_AV_CONTROL, TAO_AV_Core::TAO_AV_DATA, TAO_debug_level, and TAO_AV_Flow_Handler::transport().
Referenced by open(), and open_default().
00431 { 00432 int result = -1; 00433 ACE_INET_Addr *local_addr = 0; 00434 00435 TAO_AV_Flow_Handler *flow_handler = 0; 00436 00437 // if using a default address and this is the control flow component, the 00438 // handler and local address are already set in the flow spec entry 00439 if (is_default_addr && 00440 (this->flow_component_ == TAO_AV_Core::TAO_AV_CONTROL) && 00441 (ACE_OS::strcasecmp(this->entry_->flow_protocol_str (), "RTP") == 0)) 00442 { 00443 flow_handler = this->entry_->control_handler (); 00444 00445 local_addr = dynamic_cast<ACE_INET_Addr*> (this->entry_->get_local_control_addr ()); 00446 } 00447 else 00448 { 00449 // this variable is only used for RTP/UDP; RFC 1889 requires an even/odd 00450 // consecutive port pair 00451 int get_new_port = 1; 00452 00453 while (get_new_port) 00454 { 00455 // assume the ports will be OK 00456 get_new_port = 0; 00457 00458 result = TAO_AV_UDP_Connection_Setup::setup (flow_handler, 00459 inet_addr, 00460 local_addr, 00461 this->entry_->is_multicast (), 00462 TAO_AV_UDP_Connection_Setup::ACCEPTOR); 00463 00464 if (result < 0) 00465 { 00466 ACE_DEBUG((LM_DEBUG,"(%N,%l) Error during connection setup: %d\n", result)); 00467 } 00468 00469 local_addr->set (local_addr->get_port_number (), 00470 local_addr->get_host_name ()); 00471 00472 if (is_default_addr) 00473 { 00474 if ((ACE_OS::strcasecmp(this->entry_->flow_protocol_str (), "RTP") == 0) && 00475 (this->flow_component_ == TAO_AV_Core::TAO_AV_DATA)) 00476 { 00477 if (is_default_addr && local_addr->get_port_number ()%2 != 0) 00478 { 00479 // RTP port should be even 00480 delete local_addr; 00481 local_addr = 0; 00482 delete flow_handler; 00483 get_new_port = 1; 00484 } 00485 else 00486 { 00487 ACE_INET_Addr *local_control_addr = 0; 00488 TAO_AV_Flow_Handler *control_flow_handler = 0; 00489 00490 ACE_NEW_RETURN (this->control_inet_address_, 00491 ACE_INET_Addr ("0"), 00492 -1); 00493 00494 TAO_AV_UDP_Connection_Setup::setup(control_flow_handler, 00495 this->control_inet_address_, 00496 local_control_addr, 00497 this->entry_->is_multicast (), 00498 TAO_AV_UDP_Connection_Setup::ACCEPTOR); 00499 00500 if (local_control_addr->get_port_number () != 00501 local_addr->get_port_number () +1) 00502 { 00503 delete this->control_inet_address_; 00504 delete local_addr; 00505 local_addr = 0; 00506 delete flow_handler; 00507 delete local_control_addr; 00508 delete control_flow_handler; 00509 get_new_port = 1; 00510 } 00511 else 00512 { 00513 this->entry_->control_address (this->control_inet_address_); 00514 this->entry_->set_local_control_addr (local_control_addr); 00515 this->entry_->control_handler (control_flow_handler); 00516 } 00517 } 00518 } 00519 } 00520 } 00521 } 00522 00523 TAO_AV_Protocol_Object *object = 00524 this->flow_protocol_factory_->make_protocol_object (this->entry_, 00525 this->endpoint_, 00526 flow_handler, 00527 flow_handler->transport ()); 00528 flow_handler->protocol_object (object); 00529 00530 if (this->flow_component_ == TAO_AV_Core::TAO_AV_DATA) 00531 { 00532 this->endpoint_->set_flow_handler (this->flowname_.c_str (),flow_handler); 00533 00534 this->entry_->protocol_object (object); 00535 this->entry_->set_local_addr (local_addr); 00536 this->entry_->handler (flow_handler); 00537 //this->entry_->address (inet_addr); 00538 this->entry_->address (local_addr); 00539 } 00540 else 00541 { 00542 this->endpoint_->set_control_flow_handler (this->flowname_.c_str (),flow_handler); 00543 00544 this->entry_->control_protocol_object (object); 00545 this->entry_->set_local_control_addr (local_addr); 00546 this->entry_->control_handler (flow_handler); 00547 } 00548 00549 if (local_addr != 0) 00550 { 00551 char buf[BUFSIZ]; 00552 local_addr->addr_to_string (buf,BUFSIZ); 00553 if (TAO_debug_level > 0) 00554 ACE_DEBUG ((LM_DEBUG, 00555 "TAO_AV_UDP_ACCEPTOR::open:%s \n", 00556 buf)); 00557 } 00558 00559 // call activate svc handler. 00560 return this->activate_svc_handler (flow_handler); 00561 }
ACE_INET_Addr* TAO_AV_UDP_Acceptor::address_ [protected] |
Reimplemented from TAO_AV_Acceptor.
Definition at line 168 of file UDP.h.
Referenced by ~TAO_AV_UDP_Acceptor().
ACE_INET_Addr* TAO_AV_UDP_Acceptor::control_inet_address_ [protected] |
TAO_Base_StreamEndPoint* TAO_AV_UDP_Acceptor::endpoint_ [protected] |
TAO_FlowSpec_Entry* TAO_AV_UDP_Acceptor::entry_ [protected] |
Definition at line 171 of file UDP.h.
Referenced by open(), open_default(), open_i(), and ~TAO_AV_UDP_Acceptor().