summaryrefslogtreecommitdiff
path: root/apps/Gateway/Gateway
diff options
context:
space:
mode:
Diffstat (limited to 'apps/Gateway/Gateway')
-rw-r--r--apps/Gateway/Gateway/Connection_Handler.cpp8
-rw-r--r--apps/Gateway/Gateway/Connection_Handler_Connector.cpp14
-rw-r--r--apps/Gateway/Gateway/File_Parser.cpp4
-rw-r--r--apps/Gateway/Gateway/File_Parser.h2
-rw-r--r--apps/Gateway/Gateway/Gateway.cpp62
-rw-r--r--apps/Gateway/Gateway/Options.h4
-rw-r--r--apps/Gateway/Gateway/gateway.mpc2
-rw-r--r--apps/Gateway/Gateway/gatewayd.cpp14
-rw-r--r--apps/Gateway/Gateway/svc.conf2
9 files changed, 56 insertions, 56 deletions
diff --git a/apps/Gateway/Gateway/Connection_Handler.cpp b/apps/Gateway/Gateway/Connection_Handler.cpp
index 1e603dc73b7..95212a7b2c7 100644
--- a/apps/Gateway/Gateway/Connection_Handler.cpp
+++ b/apps/Gateway/Gateway/Connection_Handler.cpp
@@ -2,7 +2,6 @@
#define ACE_BUILD_SVC_DLL
-#include "ace/OS_NS_string.h"
#include "Event_Channel.h"
#include "Concrete_Connection_Handlers.h"
@@ -51,7 +50,8 @@ Connection_Handler::Connection_Handler (void)
}
Connection_Handler::Connection_Handler (const Connection_Config_Info &pci)
- : local_addr_ (pci.local_port_),
+ : remote_addr_ (pci.remote_port_, pci.host_[0] == '\0' ? ACE_DEFAULT_SERVER_HOST : pci.host_),
+ local_addr_ (pci.local_port_),
connection_id_ (pci.connection_id_),
total_bytes_ (0),
state_ (Connection_Handler::IDLE),
@@ -59,10 +59,6 @@ Connection_Handler::Connection_Handler (const Connection_Config_Info &pci)
max_timeout_ (pci.max_retry_timeout_),
event_channel_ (pci.event_channel_)
{
- if (ACE_OS::strlen (pci.host_) > 0)
- this->remote_addr_.set (pci.remote_port_, pci.host_);
- else
- this->remote_addr_.set (pci.remote_port_, ACE_DEFAULT_SERVER_HOST);
// Set the priority of the Proxy.
this->priority (int (pci.priority_));
}
diff --git a/apps/Gateway/Gateway/Connection_Handler_Connector.cpp b/apps/Gateway/Gateway/Connection_Handler_Connector.cpp
index 6382ed80220..a91d00f9e38 100644
--- a/apps/Gateway/Gateway/Connection_Handler_Connector.cpp
+++ b/apps/Gateway/Gateway/Connection_Handler_Connector.cpp
@@ -15,7 +15,7 @@ int
Connection_Handler_Connector::initiate_connection (Connection_Handler *connection_handler,
ACE_Synch_Options &synch_options)
{
- ACE_TCHAR addr_buf[MAXHOSTNAMELEN];
+ char addr_buf[MAXHOSTNAMELEN];
// Mark ourselves as idle so that the various iterators will ignore
// us until we are reconnected.
@@ -25,8 +25,8 @@ Connection_Handler_Connector::initiate_connection (Connection_Handler *connectio
// addr_buf.
if (connection_handler->local_addr ().addr_to_string (addr_buf, sizeof addr_buf) == -1
|| connection_handler->remote_addr ().addr_to_string (addr_buf, sizeof addr_buf) == -1)
- ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%t) %p\n"),
- ACE_TEXT ("can't obtain peer's address")), -1);
+ ACE_ERROR_RETURN ((LM_ERROR, "(%t) %p\n",
+ "can't obtain peer's address"), -1);
// Try to connect to the Peer.
if (this->connect (connection_handler,
@@ -37,22 +37,22 @@ Connection_Handler_Connector::initiate_connection (Connection_Handler *connectio
if (errno != EWOULDBLOCK)
{
connection_handler->state (Connection_Handler::FAILED);
- ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) %p on address %s\n"),
- ACE_TEXT ("connect"), addr_buf));
+ ACE_DEBUG ((LM_DEBUG, "(%t) %p on address %s\n",
+ "connect", addr_buf));
return -1;
}
else
{
connection_handler->state (Connection_Handler::CONNECTING);
ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("(%t) in the process of connecting to %s\n"),
+ "(%t) in the process of connecting to %s\n",
addr_buf));
}
}
else
{
connection_handler->state (Connection_Handler::ESTABLISHED);
- ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) connected to %s on %d\n"),
+ ACE_DEBUG ((LM_DEBUG, "(%t) connected to %s on %d\n",
addr_buf, connection_handler->get_handle ()));
}
return 0;
diff --git a/apps/Gateway/Gateway/File_Parser.cpp b/apps/Gateway/Gateway/File_Parser.cpp
index 20e29990ea8..8c065bbbf8a 100644
--- a/apps/Gateway/Gateway/File_Parser.cpp
+++ b/apps/Gateway/Gateway/File_Parser.cpp
@@ -22,9 +22,9 @@ typedef FP::Return_Type FP_RETURN_TYPE;
// File_Parser stuff.
template <class ENTRY> int
-File_Parser<ENTRY>::open (const ACE_TCHAR filename[])
+File_Parser<ENTRY>::open (const char filename[])
{
- this->infile_ = ACE_OS::fopen (filename, ACE_TEXT ("r"));
+ this->infile_ = ACE_OS::fopen (filename, "r");
if (this->infile_ == 0)
return -1;
else
diff --git a/apps/Gateway/Gateway/File_Parser.h b/apps/Gateway/Gateway/File_Parser.h
index 1e8dd264809..8f09352fcd9 100644
--- a/apps/Gateway/Gateway/File_Parser.h
+++ b/apps/Gateway/Gateway/File_Parser.h
@@ -47,7 +47,7 @@ class File_Parser
// <Consumer_Map>.
public:
// = Open and Close the file specified
- int open (const ACE_TCHAR filename[]);
+ int open (const char filename[]);
int close (void);
virtual FP::Return_Type read_entry (ENTRY &entry,
diff --git a/apps/Gateway/Gateway/Gateway.cpp b/apps/Gateway/Gateway/Gateway.cpp
index bbe748a0cd4..f69d03b1f72 100644
--- a/apps/Gateway/Gateway/Gateway.cpp
+++ b/apps/Gateway/Gateway/Gateway.cpp
@@ -23,13 +23,13 @@ class ACE_Svc_Export Gateway : public ACE_Service_Object
// for the <Gateway> routing.
protected:
// = Service configurator hooks.
- virtual int init (int argc, ACE_TCHAR *argv[]);
+ virtual int init (int argc, char *argv[]);
// Perform initialization.
virtual int fini (void);
// Perform termination when unlinked dynamically.
- virtual int info (ACE_TCHAR **, size_t) const;
+ virtual int info (char **, size_t) const;
// Return info about this service.
// = Configuration methods.
@@ -77,7 +77,7 @@ Gateway::handle_input (ACE_HANDLE h)
}
int
-Gateway::init (int argc, ACE_TCHAR *argv[])
+Gateway::init (int argc, char *argv[])
{
// Parse the "command-line" arguments.
Options::instance ()->parse_args (argc, argv);
@@ -92,8 +92,8 @@ Gateway::init (int argc, ACE_TCHAR *argv[])
if (ACE_Reactor::instance ()->register_handler (sig_set,
this) == -1)
ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("(%t) %p\n"),
- ACE_TEXT ("register_handler")),
+ "(%t) %p\n",
+ "register_handler"),
-1);
// Register this handler to receive events on stdin. We use this to
@@ -102,8 +102,8 @@ Gateway::init (int argc, ACE_TCHAR *argv[])
ACE_Reactor::instance (),
ACE_Thread_Manager::instance ()) == -1)
ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("(%t) %p\n"),
- ACE_TEXT ("register_stdin_handler")),
+ "(%t) %p\n",
+ "register_stdin_handler"),
-1);
// If this->performance_window_ > 0 start a timer.
@@ -114,11 +114,11 @@ Gateway::init (int argc, ACE_TCHAR *argv[])
(&this->event_channel_, 0,
Options::instance ()->performance_window ()) == -1)
ACE_ERROR ((LM_ERROR,
- ACE_TEXT ("(%t) %p\n"),
- ACE_TEXT ("schedule_timer")));
+ "(%t) %p\n",
+ "schedule_timer"));
else
ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("starting timer for %d seconds...\n"),
+ "starting timer for %d seconds...\n",
Options::instance ()->performance_window ()));
}
@@ -159,12 +159,12 @@ Gateway::fini (void)
// Returns information on the currently active service.
int
-Gateway::info (ACE_TCHAR **strp, size_t length) const
+Gateway::info (char **strp, size_t length) const
{
- ACE_TCHAR buf[BUFSIZ];
+ char buf[BUFSIZ];
- ACE_OS::strcpy
- (buf, ACE_TEXT ("Gateway daemon\t # Application-level gateway\n"));
+ ACE_OS::sprintf (buf, "%s\t %s", "Gateway daemon",
+ "# Application-level gateway\n");
if (*strp == 0 && (*strp = ACE_OS::strdup (buf)) == 0)
return -1;
@@ -185,7 +185,7 @@ Gateway::parse_connection_config_file (void)
if (connection_file.open (Options::instance ()->connection_config_file ()) == -1)
ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("(%t) %p\n"),
+ "(%t) %p\n",
Options::instance ()->connection_config_file ()),
-1);
@@ -208,12 +208,12 @@ Gateway::parse_connection_config_file (void)
if (pci.connection_id_ != 1)
ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("(%t) warning, the first connection id should be 1 not %d\n"),
+ "(%t) warning, the first connection id should be 1 not %d\n",
pci.connection_id_));
}
else if (previous_connection_id + 1 != pci.connection_id_)
ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("(%t) warning, connection ids should keep increasing by 1 and %d + 1 != %d\n"),
+ "(%t) warning, connection ids should keep increasing by 1 and %d + 1 != %d\n",
previous_connection_id,
pci.connection_id_));
@@ -223,13 +223,13 @@ Gateway::parse_connection_config_file (void)
if (Options::instance ()->enabled (Options::DEBUG))
ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("(%t) conn id = %d, ")
- ACE_TEXT ("host = %s, ")
- ACE_TEXT ("remote port = %d, ")
- ACE_TEXT ("proxy role = %c, ")
- ACE_TEXT ("max retry timeout = %d, ")
- ACE_TEXT ("local port = %d, ")
- ACE_TEXT ("priority = %d\n"),
+ "(%t) conn id = %d, "
+ "host = %s, "
+ "remote port = %d, "
+ "proxy role = %c, "
+ "max retry timeout = %d, "
+ "local port = %d, "
+ "priority = %d\n",
pci.connection_id_,
pci.host_,
pci.remote_port_,
@@ -257,7 +257,7 @@ Gateway::parse_connection_config_file (void)
if (file_empty)
ACE_ERROR ((LM_WARNING,
- ACE_TEXT ("warning: connection connection_handler configuration file was empty\n")));
+ "warning: connection connection_handler configuration file was empty\n"));
return 0;
}
@@ -271,7 +271,7 @@ Gateway::parse_consumer_config_file (void)
if (consumer_file.open (Options::instance ()->consumer_config_file ()) == -1)
ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("(%t) %p\n"),
+ "(%t) %p\n",
Options::instance ()->consumer_config_file ()),
-1);
@@ -285,15 +285,15 @@ Gateway::parse_consumer_config_file (void)
if (Options::instance ()->enabled (Options::DEBUG))
{
ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("(%t) connection id = %d, payload = %d, ")
- ACE_TEXT ("number of consumers = %d\n"),
+ "(%t) connection id = %d, payload = %d, "
+ "number of consumers = %d\n",
cci_entry.connection_id_,
cci_entry.type_,
cci_entry.total_consumers_));
for (int i = 0; i < cci_entry.total_consumers_; i++)
ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("(%t) destination[%d] = %d\n"),
+ "(%t) destination[%d] = %d\n",
i,
cci_entry.consumers_[i]));
}
@@ -318,7 +318,7 @@ Gateway::parse_consumer_config_file (void)
dispatch_set->insert (connection_handler);
else
ACE_ERROR ((LM_ERROR,
- ACE_TEXT ("(%t) not found: destination[%d] = %d\n"),
+ "(%t) not found: destination[%d] = %d\n",
i,
cci_entry.consumers_[i]));
}
@@ -328,7 +328,7 @@ Gateway::parse_consumer_config_file (void)
if (file_empty)
ACE_ERROR ((LM_WARNING,
- ACE_TEXT ("warning: consumer map configuration file was empty\n")));
+ "warning: consumer map configuration file was empty\n"));
return 0;
}
diff --git a/apps/Gateway/Gateway/Options.h b/apps/Gateway/Gateway/Options.h
index b5971b35c88..ba39d2f1034 100644
--- a/apps/Gateway/Gateway/Options.h
+++ b/apps/Gateway/Gateway/Options.h
@@ -106,6 +106,10 @@ public:
// The connector port number, i.e., the one that we use to actively
// establish connections with a gatewayd and create a Consumer.
+ const char *connector_host (void) const;
+ // Our connector port host, i.e., the host running the gatewayd
+ // process.
+
const ACE_TCHAR *connection_config_file (void) const;
// Name of the connection configuration file.
diff --git a/apps/Gateway/Gateway/gateway.mpc b/apps/Gateway/Gateway/gateway.mpc
index 9403ba858b1..64e5ec6288b 100644
--- a/apps/Gateway/Gateway/gateway.mpc
+++ b/apps/Gateway/Gateway/gateway.mpc
@@ -18,7 +18,7 @@ project(Gateway) : acelib {
}
project(gatewayd) : aceexe {
- exename = gatewayd
+
after += Gateway
libs += Gateway
diff --git a/apps/Gateway/Gateway/gatewayd.cpp b/apps/Gateway/Gateway/gatewayd.cpp
index bda60fe7d3f..8c698f4414b 100644
--- a/apps/Gateway/Gateway/gatewayd.cpp
+++ b/apps/Gateway/Gateway/gatewayd.cpp
@@ -29,7 +29,7 @@ ACE_RCSID (Gateway,
"$Id$")
int
-ACE_TMAIN (int argc, ACE_TCHAR *argv[])
+main (int argc, char *argv[])
{
if (ACE_OS::access (ACE_DEFAULT_SVC_CONF, F_OK) != 0)
{
@@ -38,14 +38,14 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[])
if (sp->init (argc - 1, argv + 1) == -1)
ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("%p\n"),
- ACE_TEXT ("init")),
+ "%p\n",
+ "init"),
1);
// Run forever, performing the configured services until we
// are shut down by a SIGINT/SIGQUIT signal.
- ACE_Reactor::instance ()->run_reactor_event_loop ();
+ ACE_Reactor::run_event_loop ();
// Destructor of <ACE_Service_Object_Ptr> automagically call
// <fini>.
@@ -54,15 +54,15 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
if (ACE_Service_Config::open (argc, argv) == -1)
ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("%p\n"),
- ACE_TEXT ("open")),
+ "%p\n",
+ "open"),
1);
else // Use dynamic linking.
// Run forever, performing the configured services until we are
// shut down by a signal (e.g., SIGINT or SIGQUIT).
- ACE_Reactor::instance ()->run_reactor_event_loop ();
+ ACE_Reactor::run_event_loop ();
}
return 0;
}
diff --git a/apps/Gateway/Gateway/svc.conf b/apps/Gateway/Gateway/svc.conf
index 3698b0e3e13..9b35a7dcbd6 100644
--- a/apps/Gateway/Gateway/svc.conf
+++ b/apps/Gateway/Gateway/svc.conf
@@ -1,3 +1,3 @@
#static Svc_Manager "-d -p 2913"
-dynamic Gateway Service_Object * Gateway:_make_Gateway() active "-b -d -c C|S -a C|S -P connection_config -C consumer_config"
+dynamic Gateway Service_Object * ./Gateway:_make_Gateway() active "-b -d -c C|S -a C|S -P connection_config -C consumer_config"