📄 flowspec_entry.cpp
字号:
}
else
{
address_str = this->carrier_protocol_;
}
if ( (this->address_ != 0) &&
(this->control_address_ == 0) &&
(ACE_OS::strncasecmp (this->flow_protocol_.c_str(), "RTP", 3) == 0))
{
u_short control_port;
switch (this->protocol_)
{
case TAO_AV_Core::TAO_AV_SFP_UDP:
case TAO_AV_Core::TAO_AV_SFP_UDP_MCAST:
case TAO_AV_Core::TAO_AV_USERDEFINED_UDP:
case TAO_AV_Core::TAO_AV_USERDEFINED_UDP_MCAST:
case TAO_AV_Core::TAO_AV_RTP_UDP:
case TAO_AV_Core::TAO_AV_RTP_UDP_MCAST:
case TAO_AV_Core::TAO_AV_UDP:
case TAO_AV_Core::TAO_AV_QOS_UDP:
case TAO_AV_Core::TAO_AV_UDP_MCAST:
case TAO_AV_Core::TAO_AV_TCP:
case TAO_AV_Core::TAO_AV_SCTP_SEQ:
{
ACE_INET_Addr *inet_addr = ACE_dynamic_cast (ACE_INET_Addr*,this->address_);
control_port = inet_addr->get_port_number() + 1;
ACE_INET_Addr *inet_control_addr;
ACE_NEW_RETURN (inet_control_addr,
ACE_INET_Addr (control_port, inet_addr->get_host_addr ()),
"");
this->control_address_ = inet_control_addr;
}
break;
default:
break;
}
}
if (this->peer_addr_ != 0)
{
switch (this->protocol_)
{
case TAO_AV_Core::TAO_AV_SFP_UDP:
case TAO_AV_Core::TAO_AV_SFP_UDP_MCAST:
case TAO_AV_Core::TAO_AV_USERDEFINED_UDP:
case TAO_AV_Core::TAO_AV_USERDEFINED_UDP_MCAST:
case TAO_AV_Core::TAO_AV_RTP_UDP:
case TAO_AV_Core::TAO_AV_RTP_UDP_MCAST:
case TAO_AV_Core::TAO_AV_UDP:
case TAO_AV_Core::TAO_AV_QOS_UDP:
case TAO_AV_Core::TAO_AV_UDP_MCAST:
case TAO_AV_Core::TAO_AV_TCP:
case TAO_AV_Core::TAO_AV_SCTP_SEQ:
{
ACE_INET_Addr *inet_addr = ACE_dynamic_cast (ACE_INET_Addr*,this->peer_addr_);
inet_addr->addr_to_string (address,BUFSIZ);
//inet_addr->get_host_name (address, BUFSIZ);
//cstring += ACE_OS::itoa (address, BUFSIZ, inet_addr->get_port_number ());
}
break;
default:
break;
}
ACE_CString cstring (address);
//peer_address_str = this->carrier_protocol_;
//peer_address_str += "=";
peer_address_str += cstring;
if (this->protocol_ == TAO_AV_Core::TAO_AV_SCTP_SEQ)
{
for (int i = 0; i < this->num_peer_sec_addrs_; i++)
{
peer_address_str += ";";
peer_address_str += this->peer_sec_addr_ [i];
}
}
}
if (this->control_address_ != 0)
{
u_short control_port = 0;
switch (this->protocol_)
{
case TAO_AV_Core::TAO_AV_SFP_UDP:
case TAO_AV_Core::TAO_AV_SFP_UDP_MCAST:
case TAO_AV_Core::TAO_AV_USERDEFINED_UDP:
case TAO_AV_Core::TAO_AV_USERDEFINED_UDP_MCAST:
case TAO_AV_Core::TAO_AV_RTP_UDP:
case TAO_AV_Core::TAO_AV_RTP_UDP_MCAST:
case TAO_AV_Core::TAO_AV_UDP:
case TAO_AV_Core::TAO_AV_QOS_UDP:
case TAO_AV_Core::TAO_AV_UDP_MCAST:
case TAO_AV_Core::TAO_AV_TCP:
case TAO_AV_Core::TAO_AV_SCTP_SEQ:
{
ACE_INET_Addr *inet_addr = ACE_dynamic_cast (ACE_INET_Addr*,this->control_address_);
control_port = inet_addr->get_port_number();
}
break;
default:
break;
}
address_str += ";";
char port_str[10];
sprintf(port_str, "%u", control_port);
address_str += port_str;
}
this->entry_ = this->flowname_;
this->entry_ += "\\";
this->entry_ += this->direction_str_;
this->entry_ += "\\";
this->entry_ += this->format_;
this->entry_ += "\\";
this->entry_ += this->flow_protocol_;
this->entry_ += "\\";
this->entry_ += address_str;
if (this->peer_addr_ != 0)
{
this->entry_ += "\\";
this->entry_ += peer_address_str;
}
else ACE_DEBUG ((LM_DEBUG,
"No peer address specified\n"));
if (TAO_debug_level > 0)
ACE_DEBUG ((LM_DEBUG,"Forward entry_to_string: entry = %s\n",this->entry_.c_str()));
return this->entry_.c_str();
}
//------------------------------------------------------------
// TAO_Reverse_FlowSpec_Entry
//------------------------------------------------------------
//default constructor.
TAO_Reverse_FlowSpec_Entry::TAO_Reverse_FlowSpec_Entry (void)
{
// no-op
}
// constructor to construct an entry from the arguments.
TAO_Reverse_FlowSpec_Entry::TAO_Reverse_FlowSpec_Entry (const char *flowname,
const char *direction,
const char *format_name ,
const char *flow_protocol ,
const char *carrier_protocol,
ACE_Addr *address,
ACE_Addr *control_address )
:TAO_FlowSpec_Entry (flowname,
direction,
format_name,
flow_protocol,
carrier_protocol,
address,
control_address)
{
// no-op
}
// constructor to construct an entry from the arguments.
TAO_Reverse_FlowSpec_Entry::TAO_Reverse_FlowSpec_Entry (const char *flowname,
const char *direction,
const char *format_name ,
const char *flow_protocol ,
const char *address)
:TAO_FlowSpec_Entry (flowname,
direction,
format_name,
flow_protocol,
address)
{
// no-op.
}
TAO_Reverse_FlowSpec_Entry::~TAO_Reverse_FlowSpec_Entry (void)
{
// no-op.
}
TAO_FlowSpec_Entry::Role
TAO_Reverse_FlowSpec_Entry::role (void)
{
if (this->role_ != TAO_AV_INVALID_ROLE)
return this->role_;
switch (this->direction_)
{
case TAO_AV_DIR_IN:
// Forward IN means we're the Source.
return TAO_AV_CONSUMER;
case TAO_AV_DIR_OUT:
// Forward out means we're the sink.
return TAO_AV_PRODUCER;
default:
return TAO_AV_INVALID_ROLE;
}
}
int
TAO_Reverse_FlowSpec_Entry::parse (const char *flowSpec_entry)
{
TAO_Tokenizer tokenizer (flowSpec_entry,'\\');
this->flowname_ = tokenizer [TAO_AV_FLOWNAME];
if (TAO_debug_level > 0)
ACE_DEBUG ((LM_DEBUG,
"TAO_Reverse_FlowSpec_Entry::parse %s\n",
flowSpec_entry));
if (tokenizer [TAO_AV_ADDRESS] != 0)
if (this->parse_address (tokenizer [TAO_AV_ADDRESS], TAO_AV_Core::TAO_AV_BOTH) < 0)
return -1;
if (tokenizer [TAO_AV_FLOW_PROTOCOL] != 0)
if (this->parse_flow_protocol_string (tokenizer [TAO_AV_FLOW_PROTOCOL]) < 0)
return -1;
// if (tokenizer [TAO_AV_DIRECTION] != 0)
// this->set_direction (tokenizer [TAO_AV_DIRECTION]);
// if (tokenizer [TAO_AV_FORMAT] != 0)
// this->format_ = tokenizer [TAO_AV_FORMAT];
return 0;
}
const char *
TAO_Reverse_FlowSpec_Entry::entry_to_string (void)
{
if (this->flowname_.length() == 0)
return "";
char address [BUFSIZ];
ACE_CString address_str;
if (this->address_ != 0)
{
switch (this->protocol_)
{
case TAO_AV_Core::TAO_AV_RTP_UDP:
case TAO_AV_Core::TAO_AV_UDP:
case TAO_AV_Core::TAO_AV_QOS_UDP:
case TAO_AV_Core::TAO_AV_UDP_MCAST:
case TAO_AV_Core::TAO_AV_TCP:
case TAO_AV_Core::TAO_AV_SCTP_SEQ:
case TAO_AV_Core::TAO_AV_SFP_UDP:
case TAO_AV_Core::TAO_AV_USERDEFINED_UDP:
{
ACE_INET_Addr *inet_addr = ACE_dynamic_cast (ACE_INET_Addr*,this->address_);
inet_addr->addr_to_string (address,BUFSIZ);
}
break;
default:
break;
}
ACE_CString cstring (address);
address_str = this->carrier_protocol_;
address_str += "=";
address_str += cstring;
if (this->protocol_ == TAO_AV_Core::TAO_AV_SCTP_SEQ)
{
for (int i = 0; i < this->num_local_sec_addrs_; i++)
{
address_str += ";";
address_str += this->local_sec_addr_ [i];
}
}
}
else
{
address_str = "";
}
if (this->control_address_ != 0)
{
u_short control_port = 0;
switch (this->protocol_)
{
case TAO_AV_Core::TAO_AV_SFP_UDP:
case TAO_AV_Core::TAO_AV_SFP_UDP_MCAST:
case TAO_AV_Core::TAO_AV_USERDEFINED_UDP:
case TAO_AV_Core::TAO_AV_USERDEFINED_UDP_MCAST:
case TAO_AV_Core::TAO_AV_RTP_UDP:
case TAO_AV_Core::TAO_AV_RTP_UDP_MCAST:
case TAO_AV_Core::TAO_AV_UDP:
case TAO_AV_Core::TAO_AV_QOS_UDP:
case TAO_AV_Core::TAO_AV_UDP_MCAST:
case TAO_AV_Core::TAO_AV_TCP:
case TAO_AV_Core::TAO_AV_SCTP_SEQ:
{
ACE_INET_Addr *inet_addr = ACE_dynamic_cast (ACE_INET_Addr*,this->control_address_);
control_port = inet_addr->get_port_number();
}
break;
default:
break;
}
address_str += ";";
char port_str[10];
sprintf(port_str, "%u", control_port);
address_str += port_str;
}
this->entry_ = this->flowname_;
this->entry_ += "\\";
this->entry_ += address_str;
this->entry_ += "\\";
this->entry_ += this->flow_protocol_;
// this->entry_ += "\\";
// this->entry_ += this->direction_str_;
// this->entry_ += "\\";
// this->entry_ += format_;
if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG,"Reverse entry_to_string: entry = %s\n",this->entry_.c_str() ));
return this->entry_.c_str();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -