#include <UDP.h>
Inheritance diagram for TAO_AV_UDP_Connector:
Public Member Functions | |
TAO_AV_UDP_Connector (void) | |
~TAO_AV_UDP_Connector (void) | |
virtual int | open (TAO_Base_StreamEndPoint *endpoint, TAO_AV_Core *av_core, TAO_AV_Flow_Protocol_Factory *factory) |
virtual int | connect (TAO_FlowSpec_Entry *entry, TAO_AV_Transport *&transport, TAO_AV_Core::Flow_Component flow_comp=TAO_AV_Core::TAO_AV_DATA) |
virtual int | activate_svc_handler (TAO_AV_Flow_Handler *handler) |
virtual int | close (void) |
Protected Attributes | |
ACE_INET_Addr * | control_inet_address_ |
TAO_Base_StreamEndPoint * | endpoint_ |
TAO_AV_Core * | av_core_ |
TAO_FlowSpec_Entry * | entry_ |
TAO_AV_Flow_Protocol_Factory * | flow_protocol_factory_ |
TAO_AV_Core::Flow_Component | flow_component_ |
Definition at line 182 of file UDP.h.
TAO_AV_UDP_Connector::TAO_AV_UDP_Connector | ( | void | ) |
TAO_AV_UDP_Connector::~TAO_AV_UDP_Connector | ( | void | ) |
Definition at line 577 of file UDP.cpp.
References TAO_FlowSpec_Entry::control_handler(), control_inet_address_, entry_, and TAO_AV_Core::TAO_AV_CONTROL.
00578 { 00579 if (this->flow_component_ == TAO_AV_Core::TAO_AV_CONTROL) 00580 { 00581 delete this->entry_->control_handler (); 00582 } 00583 00584 if (this->control_inet_address_ != 0) 00585 delete this->control_inet_address_; 00586 }
int TAO_AV_UDP_Connector::activate_svc_handler | ( | TAO_AV_Flow_Handler * | handler | ) | [virtual] |
Definition at line 774 of file UDP.cpp.
References 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 connect().
00775 { 00776 ACE_Event_Handler *event_handler = handler->event_handler (); 00777 int result = this->av_core_->reactor ()->register_handler (event_handler, 00778 ACE_Event_Handler::READ_MASK); 00779 00780 if (this->flow_component_ == TAO_AV_Core::TAO_AV_CONTROL) 00781 handler->schedule_timer (); 00782 00783 return result; 00784 }
int TAO_AV_UDP_Connector::close | ( | void | ) | [virtual] |
int TAO_AV_UDP_Connector::connect | ( | TAO_FlowSpec_Entry * | entry, | |
TAO_AV_Transport *& | transport, | |||
TAO_AV_Core::Flow_Component | flow_comp = TAO_AV_Core::TAO_AV_DATA | |||
) | [virtual] |
Implements TAO_AV_Connector.
Definition at line 602 of file UDP.cpp.
References ACE_DEBUG, ACE_NEW_RETURN, activate_svc_handler(), ACE_INET_Addr::addr_to_string(), TAO_FlowSpec_Entry::address(), TAO_AV_UDP_Connection_Setup::CONNECTOR, TAO_FlowSpec_Entry::control_address(), TAO_FlowSpec_Entry::control_handler(), control_inet_address_, TAO_FlowSpec_Entry::control_protocol_object(), endpoint_, entry_, flow_component_, flow_protocol_factory_, TAO_FlowSpec_Entry::flowname(), TAO_AV_Connector::flowname_, TAO_AV_Core::get_control_flowname(), ACE_INET_Addr::get_host_name(), TAO_FlowSpec_Entry::get_local_control_addr(), TAO_FlowSpec_Entry::get_peer_addr(), ACE_INET_Addr::get_port_number(), TAO_FlowSpec_Entry::handler(), inet_addr(), TAO_FlowSpec_Entry::is_multicast(), ACE_OS::itoa(), LM_DEBUG, TAO_AV_Flow_Protocol_Factory::make_protocol_object(), TAO_FlowSpec_Entry::protocol_object(), 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, and TAO_debug_level.
00605 { 00606 ACE_INET_Addr *local_addr = 0; 00607 ACE_INET_Addr *control_inet_addr = 0; 00608 00609 this->entry_ = entry; 00610 this->flow_component_ = flow_component; 00611 00612 ACE_INET_Addr *inet_addr; 00613 00614 if (flow_component == TAO_AV_Core::TAO_AV_CONTROL) 00615 { 00616 this->flowname_ = TAO_AV_Core::get_control_flowname (entry->flowname()); 00617 inet_addr = dynamic_cast<ACE_INET_Addr*> (entry->control_address ()); 00618 } 00619 else 00620 { 00621 this->flowname_ = entry->flowname (); 00622 inet_addr = dynamic_cast<ACE_INET_Addr*> (entry->address ()); 00623 control_inet_addr = dynamic_cast<ACE_INET_Addr*> (entry->control_address ()); 00624 } 00625 00626 TAO_AV_Flow_Handler *flow_handler = 0; 00627 00628 // if this is the control flow component, the 00629 // handler and local address are already set in the flow spec entry 00630 if ((flow_component == TAO_AV_Core::TAO_AV_CONTROL) && 00631 (ACE_OS::strcasecmp(this->entry_->flow_protocol_str (), "RTP") == 0) && 00632 !entry->is_multicast ()) 00633 { 00634 flow_handler = this->entry_->control_handler (); 00635 flow_handler->set_remote_address (inet_addr); 00636 00637 local_addr = dynamic_cast<ACE_INET_Addr*> (this->entry_->get_local_control_addr ()); 00638 } 00639 else 00640 { 00641 // this variable is only used for RTP/UDP; RFC 1889 requires an even/odd 00642 // consecutive port pair 00643 int get_new_port = 1; 00644 00645 while (get_new_port) 00646 { 00647 // assume the ports will be OK 00648 get_new_port = 0; 00649 00650 ACE_Addr *addr; 00651 if ((addr = entry->get_peer_addr ()) != 0) 00652 { 00653 local_addr = dynamic_cast<ACE_INET_Addr*> (addr); 00654 char buf [BUFSIZ]; 00655 local_addr->addr_to_string (buf, BUFSIZ); 00656 } 00657 00658 TAO_AV_UDP_Connection_Setup::setup (flow_handler, 00659 inet_addr, 00660 local_addr, 00661 entry->is_multicast (), 00662 TAO_AV_UDP_Connection_Setup::CONNECTOR); 00663 00664 if ((ACE_OS::strcasecmp(this->entry_->flow_protocol_str (), "RTP") == 0) && 00665 (flow_component == TAO_AV_Core::TAO_AV_DATA) && 00666 !entry->is_multicast ()) 00667 { 00668 if (local_addr->get_port_number ()%2 != 0) 00669 { 00670 // RTP port should be even 00671 delete local_addr; 00672 local_addr = 0; 00673 delete flow_handler; 00674 get_new_port = 1; 00675 } 00676 else 00677 { 00678 ACE_INET_Addr *local_control_addr = 0; 00679 TAO_AV_Flow_Handler *control_flow_handler = 0; 00680 00681 if (entry->is_multicast ()) 00682 control_inet_addr = dynamic_cast<ACE_INET_Addr*> (entry->control_address ()) ; 00683 else 00684 { 00685 00686 if (local_addr != 0) 00687 { 00688 char buf [BUFSIZ]; 00689 ACE_CString addr_str (local_addr->get_host_name ()); 00690 addr_str += ":"; 00691 addr_str += ACE_OS::itoa (local_addr->get_port_number () + 1, buf, 10); 00692 ACE_NEW_RETURN (local_control_addr, 00693 ACE_INET_Addr (addr_str.c_str ()), 00694 -1); 00695 local_control_addr->addr_to_string (buf, BUFSIZ); 00696 } 00697 00698 00699 if (entry->control_address () == 0) 00700 ACE_NEW_RETURN (this->control_inet_address_, 00701 ACE_INET_Addr ("0"), 00702 -1); 00703 else 00704 control_inet_address_ = dynamic_cast<ACE_INET_Addr*> (entry->control_address ()); 00705 } 00706 00707 TAO_AV_UDP_Connection_Setup::setup (control_flow_handler, 00708 control_inet_addr, 00709 local_control_addr, 00710 entry->is_multicast (), 00711 TAO_AV_UDP_Connection_Setup::CONNECTOR); 00712 00713 if (local_control_addr->get_port_number () != 00714 local_addr->get_port_number () +1) 00715 { 00716 delete local_addr; 00717 local_addr = 0; 00718 delete flow_handler; 00719 delete local_control_addr; 00720 delete control_flow_handler; 00721 get_new_port = 1; 00722 } 00723 else 00724 { 00725 this->entry_->set_local_control_addr (local_control_addr); 00726 this->entry_->control_handler (control_flow_handler); 00727 } 00728 } 00729 } 00730 } 00731 } 00732 00733 TAO_AV_Protocol_Object *object = 00734 this->flow_protocol_factory_->make_protocol_object (this->entry_, 00735 this->endpoint_, 00736 flow_handler, 00737 flow_handler->transport ()); 00738 00739 flow_handler->protocol_object (object); 00740 00741 if (flow_component == TAO_AV_Core::TAO_AV_DATA) 00742 { 00743 this->endpoint_->set_flow_handler (this->flowname_.c_str (), 00744 flow_handler); 00745 this->entry_->protocol_object (object); 00746 entry->set_local_addr (local_addr); 00747 entry->handler (flow_handler); 00748 transport = flow_handler->transport (); 00749 } 00750 else 00751 { 00752 this->endpoint_->set_control_flow_handler (this->flowname_.c_str (), 00753 flow_handler); 00754 this->entry_->control_protocol_object (object); 00755 entry->set_local_control_addr (local_addr); 00756 entry->control_handler (flow_handler); 00757 transport = flow_handler->transport (); 00758 } 00759 00760 if (local_addr != 0) 00761 { 00762 char buf[BUFSIZ]; 00763 local_addr->addr_to_string (buf,BUFSIZ); 00764 00765 if (TAO_debug_level > 0) 00766 ACE_DEBUG ((LM_DEBUG,"TAO_AV_UDP_CONNECTOR::connect:%s \n",buf)); 00767 } 00768 00769 // call activate svc handler. 00770 return this->activate_svc_handler (flow_handler); 00771 }
int TAO_AV_UDP_Connector::open | ( | TAO_Base_StreamEndPoint * | endpoint, | |
TAO_AV_Core * | av_core, | |||
TAO_AV_Flow_Protocol_Factory * | factory | |||
) | [virtual] |
Implements TAO_AV_Connector.
Definition at line 589 of file UDP.cpp.
References ACE_DEBUG, av_core_, endpoint_, flow_protocol_factory_, LM_DEBUG, and TAO_debug_level.
00593 { 00594 if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG,"TAO_AV_UDP_Connector::open ")); 00595 this->endpoint_ = endpoint; 00596 this->av_core_ = av_core; 00597 this->flow_protocol_factory_ = factory; 00598 return 0; 00599 }
TAO_AV_Core* TAO_AV_UDP_Connector::av_core_ [protected] |
ACE_INET_Addr* TAO_AV_UDP_Connector::control_inet_address_ [protected] |
TAO_Base_StreamEndPoint* TAO_AV_UDP_Connector::endpoint_ [protected] |
TAO_FlowSpec_Entry* TAO_AV_UDP_Connector::entry_ [protected] |