TAO_Forward_FlowSpec_Entry Class Reference

#include <FlowSpec_Entry.h>

Inheritance diagram for TAO_Forward_FlowSpec_Entry:

Inheritance graph
[legend]
Collaboration diagram for TAO_Forward_FlowSpec_Entry:

Collaboration graph
[legend]
List of all members.

Public Types

 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
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.

Detailed Description

Definition at line 266 of file FlowSpec_Entry.h.


Member Enumeration Documentation

enum TAO_Forward_FlowSpec_Entry::Position

Enumerator:
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.

00270                 {TAO_AV_FLOWNAME = 0,
00271                  TAO_AV_DIRECTION = 1,
00272                  TAO_AV_FORMAT = 2,
00273                  TAO_AV_FLOW_PROTOCOL = 3,
00274                  TAO_AV_ADDRESS = 4,
00275                  TAO_AV_PEER_ADDR = 5};


Constructor & Destructor Documentation

TAO_Forward_FlowSpec_Entry::TAO_Forward_FlowSpec_Entry ( void   ) 

default constructor.

Definition at line 492 of file FlowSpec_Entry.cpp.

00493 {
00494   // no-op.
00495 }

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.

00505   :TAO_FlowSpec_Entry (flowname,
00506                        direction,
00507                        format_name,
00508                        flow_protocol,
00509                        carrier_protocol,
00510                        address,
00511                        control_address)
00512 {
00513   // no-op.
00514 }

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.

00522   :TAO_FlowSpec_Entry (flowname,
00523                        direction,
00524                        format_name,
00525                        flow_protocol,
00526                        address)
00527 {
00528   // no-op.
00529 }

TAO_Forward_FlowSpec_Entry::~TAO_Forward_FlowSpec_Entry ( void   )  [virtual]

Definition at line 531 of file FlowSpec_Entry.cpp.

00532 {
00533   // no-op.
00534 }


Member Function Documentation

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.

References ACE_NEW_RETURN, TAO_FlowSpec_Entry::address(), TAO_FlowSpec_Entry::address_, TAO_FlowSpec_Entry::address_str(), TAO_FlowSpec_Entry::carrier_protocol_, TAO_FlowSpec_Entry::control_address_, inet_addr(), TAO_FlowSpec_Entry::local_sec_addr_, TAO_FlowSpec_Entry::num_local_sec_addrs_, TAO_FlowSpec_Entry::num_peer_sec_addrs_, TAO_FlowSpec_Entry::peer_addr_, TAO_FlowSpec_Entry::peer_sec_addr_, ACE_OS::strncasecmp(), TAO_AV_Core::TAO_AV_QOS_UDP, TAO_AV_Core::TAO_AV_RTP_UDP, TAO_AV_Core::TAO_AV_RTP_UDP_MCAST, TAO_AV_Core::TAO_AV_SCTP_SEQ, TAO_AV_Core::TAO_AV_SFP_UDP, TAO_AV_Core::TAO_AV_SFP_UDP_MCAST, TAO_AV_Core::TAO_AV_TCP, TAO_AV_Core::TAO_AV_UDP, TAO_AV_Core::TAO_AV_UDP_MCAST, TAO_AV_Core::TAO_AV_USERDEFINED_UDP, and TAO_AV_Core::TAO_AV_USERDEFINED_UDP_MCAST.

Referenced by TAO_StreamEndPoint_A::multiconnect().

00634 {
00635   if (this->flowname_.length() == 0)
00636     return "";
00637 
00638   char address [BUFSIZ];
00639   ACE_CString address_str;
00640   ACE_CString peer_address_str;
00641 
00642   if (this->address_ != 0)
00643     {
00644       switch (this->protocol_)
00645         {
00646         case TAO_AV_Core::TAO_AV_SFP_UDP:
00647         case TAO_AV_Core::TAO_AV_SFP_UDP_MCAST:
00648         case TAO_AV_Core::TAO_AV_USERDEFINED_UDP:
00649         case TAO_AV_Core::TAO_AV_USERDEFINED_UDP_MCAST:
00650         case TAO_AV_Core::TAO_AV_RTP_UDP:
00651         case TAO_AV_Core::TAO_AV_RTP_UDP_MCAST:
00652         case TAO_AV_Core::TAO_AV_UDP:
00653         case TAO_AV_Core::TAO_AV_QOS_UDP:
00654         case TAO_AV_Core::TAO_AV_UDP_MCAST:
00655         case TAO_AV_Core::TAO_AV_TCP:
00656         case TAO_AV_Core::TAO_AV_SCTP_SEQ:
00657           {
00658             ACE_INET_Addr *inet_addr = dynamic_cast<ACE_INET_Addr*> (this->address_);
00659             inet_addr->addr_to_string (address,BUFSIZ);
00660           }
00661           break;
00662         default:
00663           break;
00664         }
00665       ACE_CString cstring (address);
00666 
00667       address_str = this->carrier_protocol_;
00668       address_str += "=";
00669       address_str += cstring;
00670 
00671       if (this->protocol_ == TAO_AV_Core::TAO_AV_SCTP_SEQ)
00672         {
00673           for (int i = 0; i < this->num_local_sec_addrs_; i++)
00674             {
00675               address_str += ";";
00676               address_str += this->local_sec_addr_ [i];
00677             }
00678         }
00679 
00680     }
00681   else
00682     {
00683       address_str = this->carrier_protocol_;
00684     }
00685 
00686 
00687   if ( (this->address_ != 0) &&
00688        (this->control_address_ == 0) &&
00689        (ACE_OS::strncasecmp (this->flow_protocol_.c_str(), "RTP", 3) == 0))
00690     {
00691       u_short control_port;
00692 
00693       switch (this->protocol_)
00694         {
00695         case TAO_AV_Core::TAO_AV_SFP_UDP:
00696         case TAO_AV_Core::TAO_AV_SFP_UDP_MCAST:
00697         case TAO_AV_Core::TAO_AV_USERDEFINED_UDP:
00698         case TAO_AV_Core::TAO_AV_USERDEFINED_UDP_MCAST:
00699         case TAO_AV_Core::TAO_AV_RTP_UDP:
00700         case TAO_AV_Core::TAO_AV_RTP_UDP_MCAST:
00701         case TAO_AV_Core::TAO_AV_UDP:
00702         case TAO_AV_Core::TAO_AV_QOS_UDP:
00703         case TAO_AV_Core::TAO_AV_UDP_MCAST:
00704         case TAO_AV_Core::TAO_AV_TCP:
00705         case TAO_AV_Core::TAO_AV_SCTP_SEQ:
00706           {
00707             ACE_INET_Addr *inet_addr = dynamic_cast<ACE_INET_Addr*> (this->address_);
00708             control_port = inet_addr->get_port_number() + 1;
00709             ACE_INET_Addr *inet_control_addr;
00710             ACE_NEW_RETURN (inet_control_addr,
00711                             ACE_INET_Addr (control_port, inet_addr->get_host_addr ()),
00712                             "");
00713             this->control_address_ = inet_control_addr;
00714           }
00715           break;
00716         default:
00717           break;
00718         }
00719     }
00720 
00721 
00722   if (this->peer_addr_ != 0)
00723     {
00724       switch (this->protocol_)
00725         {
00726         case TAO_AV_Core::TAO_AV_SFP_UDP:
00727         case TAO_AV_Core::TAO_AV_SFP_UDP_MCAST:
00728         case TAO_AV_Core::TAO_AV_USERDEFINED_UDP:
00729         case TAO_AV_Core::TAO_AV_USERDEFINED_UDP_MCAST:
00730         case TAO_AV_Core::TAO_AV_RTP_UDP:
00731         case TAO_AV_Core::TAO_AV_RTP_UDP_MCAST:
00732         case TAO_AV_Core::TAO_AV_UDP:
00733         case TAO_AV_Core::TAO_AV_QOS_UDP:
00734         case TAO_AV_Core::TAO_AV_UDP_MCAST:
00735         case TAO_AV_Core::TAO_AV_TCP:
00736         case TAO_AV_Core::TAO_AV_SCTP_SEQ:
00737           {
00738             ACE_INET_Addr *inet_addr = dynamic_cast<ACE_INET_Addr*> (this->peer_addr_);
00739             inet_addr->addr_to_string (address,BUFSIZ);
00740             //inet_addr->get_host_name (address, BUFSIZ);
00741 
00742             //cstring += ACE_OS::itoa (address, BUFSIZ, inet_addr->get_port_number ());
00743 
00744           }
00745           break;
00746         default:
00747           break;
00748         }
00749 
00750           ACE_CString cstring (address);
00751 
00752           //peer_address_str = this->carrier_protocol_;
00753           //peer_address_str += "=";
00754           peer_address_str += cstring;
00755 
00756           if (this->protocol_ == TAO_AV_Core::TAO_AV_SCTP_SEQ)
00757             {
00758               for (int i = 0; i < this->num_peer_sec_addrs_; i++)
00759                 {
00760                   peer_address_str += ";";
00761                   peer_address_str += this->peer_sec_addr_ [i];
00762                 }
00763             }
00764 
00765     }
00766 
00767   if (this->control_address_ != 0)
00768     {
00769       u_short control_port = 0;
00770 
00771       switch (this->protocol_)
00772         {
00773         case TAO_AV_Core::TAO_AV_SFP_UDP:
00774         case TAO_AV_Core::TAO_AV_SFP_UDP_MCAST:
00775         case TAO_AV_Core::TAO_AV_USERDEFINED_UDP:
00776         case TAO_AV_Core::TAO_AV_USERDEFINED_UDP_MCAST:
00777         case TAO_AV_Core::TAO_AV_RTP_UDP:
00778         case TAO_AV_Core::TAO_AV_RTP_UDP_MCAST:
00779         case TAO_AV_Core::TAO_AV_UDP:
00780         case TAO_AV_Core::TAO_AV_QOS_UDP:
00781         case TAO_AV_Core::TAO_AV_UDP_MCAST:
00782         case TAO_AV_Core::TAO_AV_TCP:
00783         case TAO_AV_Core::TAO_AV_SCTP_SEQ:
00784           {
00785             ACE_INET_Addr *inet_addr = dynamic_cast<ACE_INET_Addr*> (this->control_address_);
00786             control_port = inet_addr->get_port_number();
00787           }
00788           break;
00789         default:
00790           break;
00791         }
00792 
00793       address_str += ";";
00794       char port_str[10];
00795       ACE_OS::sprintf(port_str, "%u", control_port);
00796       address_str += port_str;
00797     }
00798 
00799   this->entry_  = this->flowname_;
00800   this->entry_ += "\\";
00801   this->entry_ += this->direction_str_;
00802   this->entry_ += "\\";
00803   this->entry_ += this->format_;
00804   this->entry_ += "\\";
00805   this->entry_ += this->flow_protocol_;
00806   this->entry_ += "\\";
00807   this->entry_ += address_str;
00808 
00809   if (this->peer_addr_ != 0)
00810     {
00811       this->entry_ += "\\";
00812       this->entry_ += peer_address_str;
00813     }
00814   else ACE_DEBUG ((LM_DEBUG,
00815                    "No peer address specified\n"));
00816 
00817   if (TAO_debug_level > 0)
00818     ACE_DEBUG ((LM_DEBUG,"Forward entry_to_string: entry = %s\n",this->entry_.c_str()));
00819 
00820   return this->entry_.c_str();
00821 }

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.

References ACE_DEBUG, ACE_NEW_RETURN, ACE_INET_Addr::addr_to_string(), TAO_FlowSpec_Entry::delete_peer_addr_, TAO_FlowSpec_Entry::flowname_, TAO_FlowSpec_Entry::format_, LM_DEBUG, TAO_FlowSpec_Entry::num_peer_sec_addrs_, TAO_Tokenizer::num_tokens(), TAO_FlowSpec_Entry::peer_addr_, TAO_FlowSpec_Entry::peer_sec_addr_, TAO_FlowSpec_Entry::set_direction(), CORBA::string_dup(), TAO_AV_ADDRESS, TAO_AV_Core::TAO_AV_BOTH, TAO_AV_DIRECTION, TAO_AV_FLOW_PROTOCOL, TAO_AV_FLOWNAME, TAO_AV_FORMAT, TAO_AV_PEER_ADDR, TAO_AV_Core::TAO_AV_SCTP_SEQ, and TAO_debug_level.

00538 {
00539   TAO_Tokenizer tokenizer (flowSpec_entry,'\\');
00540 
00541   this->flowname_ = tokenizer [TAO_AV_FLOWNAME];
00542 
00543   if (TAO_debug_level > 0)
00544       ACE_DEBUG ((LM_DEBUG,
00545                   "TAO_Forward_FlowSpec_Entry::parse [%s]\n",
00546                   flowSpec_entry));
00547 
00548   if (tokenizer [TAO_AV_DIRECTION] != 0)
00549     this->set_direction (tokenizer [TAO_AV_DIRECTION]);
00550 
00551   if (tokenizer [TAO_AV_FORMAT] != 0)
00552     this->format_ = tokenizer [TAO_AV_FORMAT];
00553 
00554   if (tokenizer [TAO_AV_ADDRESS] != 0)
00555     if (this->parse_address (tokenizer [TAO_AV_ADDRESS], TAO_AV_Core::TAO_AV_BOTH) < 0)
00556       return -1;
00557 
00558   if (tokenizer [TAO_AV_PEER_ADDR] != 0)
00559     {
00560       ACE_INET_Addr *addr = 0;
00561 
00562 
00563       if (this->protocol_ == TAO_AV_Core::TAO_AV_SCTP_SEQ)
00564         {
00565           TAO_Tokenizer addr_token (tokenizer [TAO_AV_PEER_ADDR], ';');
00566 
00567           ACE_DEBUG ((LM_DEBUG,
00568                       "Number of peer sec addresses = %d\n",
00569                       addr_token.num_tokens () - 1));
00570 
00571           if (addr_token.num_tokens () != 0)
00572             {
00573               ACE_NEW_RETURN (addr,
00574                               ACE_INET_Addr (addr_token [0]),
00575                               0);
00576 
00577               ACE_NEW_RETURN (peer_sec_addr_, char* [addr_token.num_tokens () - 1],-1);
00578               for (int j = 1; j <= addr_token.num_tokens () - 1; j++)
00579                 {
00580                   ACE_DEBUG ((LM_DEBUG,
00581                               "adding addresses to sequence %s\n",
00582                               addr_token [j]));
00583 
00584                   peer_sec_addr_ [j-1] =  CORBA::string_dup (addr_token [j]);
00585                 }
00586               num_peer_sec_addrs_ = addr_token.num_tokens () - 1;
00587             }
00588         }
00589       else
00590         {
00591           ACE_NEW_RETURN (addr,
00592                           ACE_INET_Addr (tokenizer [TAO_AV_PEER_ADDR]),
00593                           0);
00594         }
00595       this->delete_peer_addr_ = true;
00596       this->peer_addr_ = addr;
00597 
00598       char buf [BUFSIZ];
00599       addr->addr_to_string (buf, BUFSIZ);
00600       ACE_DEBUG ((LM_DEBUG,
00601                   "Peer Address %s \n",
00602                   buf));
00603 
00604     }
00605 
00606   if (tokenizer [TAO_AV_FLOW_PROTOCOL] != 0)
00607     if (this->parse_flow_protocol_string (tokenizer [TAO_AV_FLOW_PROTOCOL]) < 0)
00608       return -1;
00609 
00610   return 0;
00611 }

TAO_FlowSpec_Entry::Role TAO_Forward_FlowSpec_Entry::role ( void   )  [virtual]

Implements TAO_FlowSpec_Entry.

Definition at line 614 of file FlowSpec_Entry.cpp.

References TAO_FlowSpec_Entry::role_, TAO_FlowSpec_Entry::TAO_AV_CONSUMER, TAO_FlowSpec_Entry::TAO_AV_DIR_IN, TAO_FlowSpec_Entry::TAO_AV_DIR_OUT, TAO_FlowSpec_Entry::TAO_AV_INVALID_ROLE, and TAO_FlowSpec_Entry::TAO_AV_PRODUCER.

00615 {
00616   if (this->role_ != TAO_AV_INVALID_ROLE)
00617     return this->role_;
00618 
00619   switch (this->direction_)
00620     {
00621     case TAO_AV_DIR_IN:
00622       // Forward IN means we're the Source.
00623       return TAO_AV_PRODUCER;
00624     case TAO_AV_DIR_OUT:
00625       // Forward out means we're the sink.
00626       return TAO_AV_CONSUMER;
00627     default:
00628       return TAO_AV_INVALID_ROLE;
00629     }
00630 }


The documentation for this class was generated from the following files:
Generated on Tue Feb 2 17:48:10 2010 for TAO_AV by  doxygen 1.4.7