#include <FlowSpec_Entry.h>
Public Types | |
enum | Position { TAO_AV_FLOWNAME = 0, TAO_AV_DIRECTION = 1, TAO_AV_FORMAT = 2, TAO_AV_FLOW_PROTOCOL = 3, TAO_AV_ADDRESS = 4, TAO_AV_PEER_ADDR = 5 } |
Public Member Functions | |
TAO_Forward_FlowSpec_Entry (void) | |
default constructor. | |
TAO_Forward_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=0) | |
constructor to construct an entry from the arguments. | |
TAO_Forward_FlowSpec_Entry (const char *flowname, const char *direction, const char *format_name, const char *flow_protocol, const char *address) | |
virtual | ~TAO_Forward_FlowSpec_Entry (void) |
virtual const char * | entry_to_string (void) |
converts the entry to a string. | |
virtual Role | role (void) |
virtual int | parse (const char *flowSpec_entry) |
construct the entry from a string specified by the flowSpec grammar. |
Definition at line 266 of file FlowSpec_Entry.h.
TAO_AV_FLOWNAME | |
TAO_AV_DIRECTION | |
TAO_AV_FORMAT | |
TAO_AV_FLOW_PROTOCOL | |
TAO_AV_ADDRESS | |
TAO_AV_PEER_ADDR |
Definition at line 270 of file FlowSpec_Entry.h.
{TAO_AV_FLOWNAME = 0, TAO_AV_DIRECTION = 1, TAO_AV_FORMAT = 2, TAO_AV_FLOW_PROTOCOL = 3, TAO_AV_ADDRESS = 4, TAO_AV_PEER_ADDR = 5};
TAO_Forward_FlowSpec_Entry::TAO_Forward_FlowSpec_Entry | ( | void | ) |
TAO_Forward_FlowSpec_Entry::TAO_Forward_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 = 0 | |||
) |
constructor to construct an entry from the arguments.
Definition at line 498 of file FlowSpec_Entry.cpp.
:TAO_FlowSpec_Entry (flowname, direction, format_name, flow_protocol, carrier_protocol, address, control_address) { // no-op. }
TAO_Forward_FlowSpec_Entry::TAO_Forward_FlowSpec_Entry | ( | const char * | flowname, | |
const char * | direction, | |||
const char * | format_name, | |||
const char * | flow_protocol, | |||
const char * | address | |||
) |
Definition at line 517 of file FlowSpec_Entry.cpp.
:TAO_FlowSpec_Entry (flowname, direction, format_name, flow_protocol, address) { // no-op. }
TAO_Forward_FlowSpec_Entry::~TAO_Forward_FlowSpec_Entry | ( | void | ) | [virtual] |
Definition at line 531 of file FlowSpec_Entry.cpp.
{
// no-op.
}
const char * TAO_Forward_FlowSpec_Entry::entry_to_string | ( | void | ) | [virtual] |
converts the entry to a string.
Implements TAO_FlowSpec_Entry.
Definition at line 633 of file FlowSpec_Entry.cpp.
{ if (this->flowname_.length() == 0) return ""; ACE_TCHAR address [BUFSIZ]; ACE_CString address_str; ACE_CString peer_address_str; if (this->address_ != 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 = dynamic_cast<ACE_INET_Addr*> (this->address_); inet_addr->addr_to_string (address,BUFSIZ); } break; default: break; } ACE_CString cstring (ACE_TEXT_ALWAYS_CHAR(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 = 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 = 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 = 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 (ACE_TEXT_ALWAYS_CHAR(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 = dynamic_cast<ACE_INET_Addr*> (this->control_address_); control_port = inet_addr->get_port_number(); } break; default: break; } address_str += ";"; char port_str[10]; ACE_OS::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(); }
int TAO_Forward_FlowSpec_Entry::parse | ( | const char * | flowSpec_entry | ) | [virtual] |
construct the entry from a string specified by the flowSpec grammar.
Implements TAO_FlowSpec_Entry.
Definition at line 537 of file FlowSpec_Entry.cpp.
{ TAO_Tokenizer tokenizer (flowSpec_entry,'\\'); this->flowname_ = tokenizer [TAO_AV_FLOWNAME]; if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "TAO_Forward_FlowSpec_Entry::parse [%s]\n", flowSpec_entry)); 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]; 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_PEER_ADDR] != 0) { ACE_INET_Addr *addr = 0; if (this->protocol_ == TAO_AV_Core::TAO_AV_SCTP_SEQ) { TAO_Tokenizer addr_token (tokenizer [TAO_AV_PEER_ADDR], ';'); ACE_DEBUG ((LM_DEBUG, "Number of peer sec addresses = %d\n", addr_token.num_tokens () - 1)); if (addr_token.num_tokens () != 0) { ACE_NEW_RETURN (addr, ACE_INET_Addr (addr_token [0]), 0); ACE_NEW_RETURN (peer_sec_addr_, char* [addr_token.num_tokens () - 1],-1); for (int j = 1; j <= addr_token.num_tokens () - 1; j++) { ACE_DEBUG ((LM_DEBUG, "adding addresses to sequence %s\n", addr_token [j])); peer_sec_addr_ [j-1] = CORBA::string_dup (addr_token [j]); } num_peer_sec_addrs_ = addr_token.num_tokens () - 1; } } else { ACE_NEW_RETURN (addr, ACE_INET_Addr (tokenizer [TAO_AV_PEER_ADDR]), 0); } this->delete_peer_addr_ = true; this->peer_addr_ = addr; ACE_TCHAR buf [BUFSIZ]; addr->addr_to_string (buf, BUFSIZ); ACE_DEBUG ((LM_DEBUG, "Peer Address %s\n", buf)); } if (tokenizer [TAO_AV_FLOW_PROTOCOL] != 0) if (this->parse_flow_protocol_string (tokenizer [TAO_AV_FLOW_PROTOCOL]) < 0) return -1; return 0; }
TAO_FlowSpec_Entry::Role TAO_Forward_FlowSpec_Entry::role | ( | void | ) | [virtual] |
Implements TAO_FlowSpec_Entry.
Definition at line 614 of file FlowSpec_Entry.cpp.
{ 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_PRODUCER; case TAO_AV_DIR_OUT: // Forward out means we're the sink. return TAO_AV_CONSUMER; default: return TAO_AV_INVALID_ROLE; } }