summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryamuna <yamuna@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2003-04-24 03:41:06 +0000
committeryamuna <yamuna@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2003-04-24 03:41:06 +0000
commitcf91c47b3c68b89a5a8da4de622a3ad7074f75be (patch)
tree882540517a441a41c6e4d5c3fc994264fe8fc53b
parenta04189d2dde49d091804fea3157f8368a72fb07a (diff)
downloadATCD-cf91c47b3c68b89a5a8da4de622a3ad7074f75be.tar.gz
*** empty log message ***
-rw-r--r--TAO/orbsvcs/tests/AVStreams/Asynch_Three_Stage/Connection_Manager.cpp87
-rw-r--r--TAO/orbsvcs/tests/AVStreams/Asynch_Three_Stage/Connection_Manager.h26
2 files changed, 108 insertions, 5 deletions
diff --git a/TAO/orbsvcs/tests/AVStreams/Asynch_Three_Stage/Connection_Manager.cpp b/TAO/orbsvcs/tests/AVStreams/Asynch_Three_Stage/Connection_Manager.cpp
index e7188d0b2d2..e7ebc01b795 100644
--- a/TAO/orbsvcs/tests/AVStreams/Asynch_Three_Stage/Connection_Manager.cpp
+++ b/TAO/orbsvcs/tests/AVStreams/Asynch_Three_Stage/Connection_Manager.cpp
@@ -10,6 +10,70 @@ Connection_Manager::~Connection_Manager (void)
{
}
+void
+Connection_Manager::load_ep_addr (char* file_name)
+{
+ FILE* addr_file = ACE_OS::fopen (file_name, "r");
+
+ if (addr_file == 0)
+ ACE_ERROR_RETURN ((LM_DEBUG,
+ "Cannot open addr file %s\n",
+ file_name),
+ -1);
+ else
+ ACE_DEBUG ((LM_DEBUG,
+ "Addr file opened successfully\n"));
+
+ while (1)
+ {
+ char buf [BUFSIZ];
+ // Read from the file into a buffer
+ int n = ACE_OS::fread (buf,
+ 1,
+ BUFSIZ,
+ addr_file);
+
+ if (n < 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Sender::pace_data fread failed\n"),
+ -1);
+
+ if (n == 0)
+ {
+ // At end of file break the loop and end the sender.
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,"End of Addr file\n"));
+ break;
+ }
+
+ Endpoint_Addresses* addr;
+ ACE_NEW (addr,
+ Endpoint_Addresses);
+
+ TAO_Tokenizer addr_tokenizer (address,'/');
+
+ ACE_CString flowname;
+
+ if (addr_tokenizer [0] == 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Corresponding flow name not specified for endpoint addresses\n"),
+ -1);
+ else
+ flowname += addr_tokenizer [0];
+
+ if (addr_tokenizer [1] != 0)
+ addr->sender_addr += addr_tokenizer [1];
+
+ if (addr_tokenizer [2] != 0)
+ addr->receiver_addr += addr_tokenizer [2];
+
+ ep_addr_.bind (flowname,
+ addr);
+
+ }
+
+}
+
int
Connection_Manager::init (CORBA::ORB_ptr orb)
{
@@ -200,13 +264,22 @@ Connection_Manager::connect_to_receivers (AVStreams::MMDevice_ptr sender
ACE_CString flowname =
(*iterator).ext_id_;
+ Endpoint_Addresses* addr;
+ ep_addr_.find (floname,
+ addr);
+
+ ACE_INET_Addr sender_addr (addr->sender_addr.c_str ());
+ ACE_INET_Addr receiver_addr (addr->receiver_addr);
+
// Create the forward flow specification to describe the flow.
TAO_Forward_FlowSpec_Entry sender_entry (flowname.c_str (),
"IN",
"USER_DEFINED",
"",
"UDP",
- 0);
+ &sender_addr);
+
+ sender_entry.set_peer_addr (&receiver_addr);
// Set the flow specification for the stream between receiver
// and distributer
@@ -373,13 +446,23 @@ Connection_Manager::connect_to_sender (ACE_ENV_SINGLE_ARG_DECL)
"_" +
this->receiver_name_;
+ Endpoint_Addresses* addr;
+ ep_addr_.find (floname,
+ addr);
+
+ ACE_INET_Addr sender_addr (addr->sender_addr.c_str ());
+ ACE_INET_Addr receiver_addr (addr->receiver_addr.c_str ());
+
+
// Create the forward flow specification to describe the flow.
TAO_Forward_FlowSpec_Entry sender_entry (flowname.c_str (),
"IN",
"USER_DEFINED",
"",
"UDP",
- 0);
+ &local_addr);
+
+ sender_entry.set_peer_addr (&receiver_addr);
// Set the flow specification for the stream between sender and
// receiver.
diff --git a/TAO/orbsvcs/tests/AVStreams/Asynch_Three_Stage/Connection_Manager.h b/TAO/orbsvcs/tests/AVStreams/Asynch_Three_Stage/Connection_Manager.h
index 742fd06918e..1d79d1e6e3d 100644
--- a/TAO/orbsvcs/tests/AVStreams/Asynch_Three_Stage/Connection_Manager.h
+++ b/TAO/orbsvcs/tests/AVStreams/Asynch_Three_Stage/Connection_Manager.h
@@ -23,6 +23,13 @@
#include "orbsvcs/AV/Protocol_Factory.h"
#include "tao/PortableServer/PortableServer.h"
+class Endpoint_Addresses
+{
+ public:
+ ACE_CString sender_addr;
+ ACE_CString receiver_addr;
+};
+
class Connection_Manager
{
// = TITLE
@@ -76,9 +83,9 @@ public:
// Map of receivers.
typedef ACE_Hash_Map_Manager<ACE_CString,
- AVStreams::MMDevice_var,
- ACE_Null_Mutex>
- Receivers;
+ AVStreams::MMDevice_var,
+ ACE_Null_Mutex>
+ Receivers;
// Map of protocol objects.
typedef ACE_Hash_Map_Manager<ACE_CString,
@@ -86,19 +93,31 @@ public:
ACE_Null_Mutex>
Protocol_Objects;
+
+
// Map of streamctrl.
typedef ACE_Hash_Map_Manager<ACE_CString,
AVStreams::StreamCtrl_var,
ACE_Null_Mutex>
StreamCtrls;
+ // Map of flownames and corresponding endpoint addresses
+ typedef ACE_Hash_Map_Manager<ACE_CString,
+ Endpoint_Addresses*,
+ ACE_Null_Mutex>
+ EP_Addr;
+
// Map accessors.
Receivers &receivers (void);
Protocol_Objects &protocol_objects (void);
StreamCtrls &streamctrls (void);
+ void load_ep_addr (char* file_name);
+
protected:
+
+
void find_receivers (ACE_ENV_SINGLE_ARG_DECL);
void add_to_receivers (CosNaming::BindingList &binding_list
@@ -111,6 +130,7 @@ protected:
Receivers receivers_;
Protocol_Objects protocol_objects_;
StreamCtrls streamctrls_;
+ EP_Addr ep_addr_;
// Sender name.
ACE_CString sender_name_;