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

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.


Member Enumeration Documentation

enum TAO_Forward_FlowSpec_Entry::Position
 

Enumeration values:
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 494 of file FlowSpec_Entry.cpp.

00495 {
00496   // no-op.
00497 }

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 500 of file FlowSpec_Entry.cpp.

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

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 519 of file FlowSpec_Entry.cpp.

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

TAO_Forward_FlowSpec_Entry::~TAO_Forward_FlowSpec_Entry void   )  [virtual]
 

Definition at line 533 of file FlowSpec_Entry.cpp.

00534 {
00535   // no-op.
00536 }


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 635 of file FlowSpec_Entry.cpp.

References ACE_CString, ACE_DEBUG, ACE_NEW_RETURN, LM_DEBUG, ACE_OS::strncasecmp(), and TAO_debug_level.

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

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 539 of file FlowSpec_Entry.cpp.

References ACE_DEBUG, ACE_NEW_RETURN, ACE_INET_Addr::addr_to_string(), LM_DEBUG, TAO_Tokenizer::num_tokens(), TAO_FlowSpec_Entry::parse_address(), TAO_FlowSpec_Entry::parse_flow_protocol_string(), TAO_FlowSpec_Entry::set_direction(), CORBA::string_dup(), TAO_AV_ADDRESS, TAO_AV_DIRECTION, TAO_AV_FLOW_PROTOCOL, TAO_AV_FLOWNAME, TAO_AV_FORMAT, TAO_AV_PEER_ADDR, and TAO_debug_level.

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

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

Implements TAO_FlowSpec_Entry.

Definition at line 616 of file FlowSpec_Entry.cpp.

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


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 13:48:38 2006 for TAO_AV by doxygen 1.3.6