Manages the options for the ACE Name_Server. More...
#include <Naming_Context.h>
Public Member Functions | |
| ACE_Name_Options (void) | |
| ~ACE_Name_Options (void) | |
| void | parse_args (int argc, ACE_TCHAR *argv[]) |
| Parse arguments. | |
| void | nameserver_port (int port) |
| Set the port number. | |
| int | nameserver_port (void) |
| Get the port number. | |
| ACE_Naming_Context::Context_Scope_Type | context (void) |
| Get the context. | |
| void | context (ACE_Naming_Context::Context_Scope_Type) |
| Set the context. | |
| void | nameserver_host (const ACE_TCHAR *host) |
| Set the host name. | |
| const ACE_TCHAR * | nameserver_host (void) |
| Get the host name. | |
| void | namespace_dir (const ACE_TCHAR *dir) |
| Set name space directory. | |
| const ACE_TCHAR * | namespace_dir (void) |
| Get name space directory. | |
| void | process_name (const ACE_TCHAR *dir) |
| Set process name. | |
| const ACE_TCHAR * | process_name (void) |
| Get process name. | |
| void | database (const ACE_TCHAR *) |
| Set database name. | |
| const ACE_TCHAR * | database (void) |
| Get database name. | |
| void | base_address (char *address) |
| Set base address of the underlying allocator. | |
| char * | base_address (void) |
| Get base address of the underlying allocator. | |
| bool | use_registry (void) const |
| Get use of registry in naming. | |
| void | use_registry (bool x) |
| Set use of registry in naming. | |
| bool | debug (void) |
| Return debug status. | |
| bool | verbose (void) |
| Return verbose status. | |
Private Attributes | |
| bool | debugging_ |
| Extra debugging info. | |
| bool | verbosity_ |
| Extra verbose messages. | |
| bool | use_registry_ |
| Use Win32 Registry. | |
| int | nameserver_port_ |
| Port to connect to nameserver process. | |
| const ACE_TCHAR * | nameserver_host_ |
| Hostname of nameserver. | |
| ACE_TCHAR * | namespace_dir_ |
| Directory to hold name_bindings. | |
| const ACE_TCHAR * | process_name_ |
| Name of this process. | |
| const ACE_TCHAR * | database_ |
| Name of the database that stores the name/value/type bindings. | |
| char * | base_address_ |
| Base address of the underlying allocator. | |
| ACE_Naming_Context::Context_Scope_Type | context_ |
| The context in which the naming database will be created. | |
Manages the options for the ACE Name_Server.
Definition at line 280 of file Naming_Context.h.
| ACE_Name_Options::ACE_Name_Options | ( | void | ) |
Definition at line 417 of file Naming_Context.cpp.
: debugging_ (false), verbosity_ (false), use_registry_ (false), nameserver_port_ (ACE_DEFAULT_SERVER_PORT), nameserver_host_ (ACE_OS::strdup (ACE_DEFAULT_SERVER_HOST)), process_name_ (0), database_ (ACE_OS::strdup (ACE_DEFAULT_LOCALNAME)), base_address_ (ACE_DEFAULT_BASE_ADDR) { ACE_TRACE ("ACE_Name_Options::ACE_Name_Options"); #if defined (ACE_DEFAULT_NAMESPACE_DIR) this->namespace_dir_ = ACE_OS::strdup (ACE_DEFAULT_NAMESPACE_DIR); #else /* ACE_DEFAULT_NAMESPACE_DIR */ size_t pathsize = (MAXPATHLEN + 1) * sizeof (ACE_TCHAR); this->namespace_dir_ = static_cast <ACE_TCHAR *> (ACE_OS::malloc (pathsize)); if (ACE::get_temp_dir (this->namespace_dir_, MAXPATHLEN) == -1) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Temporary path too long, ") ACE_TEXT ("defaulting to current directory\n"))); ACE_OS::strcpy (this->namespace_dir_, ACE_TEXT (".")); ACE_OS::strcat (this->namespace_dir_, ACE_DIRECTORY_SEPARATOR_STR); } #endif /* ACE_DEFAULT_NAMESPACE_DIR */ }
| ACE_Name_Options::~ACE_Name_Options | ( | void | ) |
Definition at line 446 of file Naming_Context.cpp.
{
ACE_TRACE ("ACE_Name_Options::~ACE_Name_Options");
ACE_OS::free ((void *) this->nameserver_host_);
ACE_OS::free ((void *) this->namespace_dir_ );
ACE_OS::free ((void *) this->process_name_ );
ACE_OS::free ((void *) this->database_ );
}
| void ACE_Name_Options::base_address | ( | char * | address | ) |
Set base address of the underlying allocator.
Definition at line 525 of file Naming_Context.cpp.
{
ACE_TRACE ("ACE_Name_Options::base_address");
this->base_address_ = base_address;
}
| char * ACE_Name_Options::base_address | ( | void | ) |
Get base address of the underlying allocator.
Definition at line 518 of file Naming_Context.cpp.
{
ACE_TRACE ("ACE_Name_Options::base_address");
return this->base_address_;
}
| void ACE_Name_Options::context | ( | ACE_Naming_Context::Context_Scope_Type | context | ) |
Set the context.
Definition at line 539 of file Naming_Context.cpp.
| ACE_Naming_Context::Context_Scope_Type ACE_Name_Options::context | ( | void | ) |
Get the context.
Definition at line 532 of file Naming_Context.cpp.
| const ACE_TCHAR * ACE_Name_Options::database | ( | void | ) |
Get database name.
Definition at line 503 of file Naming_Context.cpp.
| void ACE_Name_Options::database | ( | const ACE_TCHAR * | db | ) |
Set database name.
Definition at line 510 of file Naming_Context.cpp.
{
ACE_TRACE ("ACE_Name_Options::database");
ACE_OS::free ((void *) this->database_);
this->database_ = ACE_OS::strdup (db);
}
| bool ACE_Name_Options::debug | ( | void | ) | [inline] |
Return debug status.
Definition at line 39 of file Naming_Context.inl.
{
ACE_TRACE ("ACE_Name_Options::debug");
return this->debugging_;
}
| void ACE_Name_Options::nameserver_host | ( | const ACE_TCHAR * | host | ) |
Set the host name.
Definition at line 488 of file Naming_Context.cpp.
{
ACE_TRACE ("ACE_Name_Options::nameserver_host");
ACE_OS::free ((void *) this->nameserver_host_);
this->nameserver_host_ = ACE_OS::strdup (host);
}
| const ACE_TCHAR * ACE_Name_Options::nameserver_host | ( | void | ) |
Get the host name.
Definition at line 496 of file Naming_Context.cpp.
{
ACE_TRACE ("ACE_Name_Options::nameserver_host");
return this->nameserver_host_;
}
| void ACE_Name_Options::nameserver_port | ( | int | port | ) |
Set the port number.
Definition at line 457 of file Naming_Context.cpp.
{
ACE_TRACE ("ACE_Name_Options::nameserver_port");
this->nameserver_port_ = port;
}
| int ACE_Name_Options::nameserver_port | ( | void | ) |
Get the port number.
Definition at line 464 of file Naming_Context.cpp.
{
ACE_TRACE ("ACE_Name_Options::nameserver_port");
return this->nameserver_port_;
}
| const ACE_TCHAR * ACE_Name_Options::namespace_dir | ( | void | ) | [inline] |
Get name space directory.
Definition at line 32 of file Naming_Context.inl.
{
ACE_TRACE ("ACE_Name_Options::namespace_dir");
return this->namespace_dir_;
}
| void ACE_Name_Options::namespace_dir | ( | const ACE_TCHAR * | dir | ) |
Set name space directory.
Definition at line 471 of file Naming_Context.cpp.
{
ACE_TRACE ("ACE_Name_Options::namespace_dir");
ACE_OS::free ((void *) this->namespace_dir_ );
this->namespace_dir_ = ACE_OS::strdup (dir);
}
| void ACE_Name_Options::parse_args | ( | int | argc, | |
| ACE_TCHAR * | argv[] | |||
| ) |
Parse arguments.
Definition at line 546 of file Naming_Context.cpp.
{
ACE_TRACE ("ACE_Name_Options::parse_args");
const ACE_TCHAR* program_name = 0;
// Argc can be 0 on some platforms like VxWorks.
if (argc > 0)
program_name = argv[0];
ACE_LOG_MSG->open (program_name);
this->process_name (program_name);
// Default is to use the PROC_LOCAL context...
this->context (ACE_Naming_Context::PROC_LOCAL);
// Make the database name the same as the process name by default
// (note that this makes a copy of the process_name_ so that we can
// clean it up in the destructor).
this->database (this->process_name ());
ACE_Get_Opt get_opt (argc, argv, ACE_TEXT ("b:c:dh:l:P:p:s:T:vr"));
for (int c; (c = get_opt ()) != -1; )
switch (c)
{
case 'c':
{
if (ACE_OS::strcmp (get_opt.opt_arg (), ACE_TEXT ("PROC_LOCAL")) == 0)
this->context (ACE_Naming_Context::PROC_LOCAL);
else if (ACE_OS::strcmp (get_opt.opt_arg (), ACE_TEXT ("NODE_LOCAL")) == 0)
this->context (ACE_Naming_Context::NODE_LOCAL);
else if (ACE_OS::strcmp (get_opt.opt_arg (), ACE_TEXT ("NET_LOCAL")) == 0)
this->context (ACE_Naming_Context::NET_LOCAL);
}
break;
case 'd':
this->debugging_ = true;
break;
case 'r':
this->use_registry_ = true;
break;
case 'h':
this->nameserver_host (get_opt.opt_arg ());
break;
case 'l':
this->namespace_dir (get_opt.opt_arg ());
break;
case 'P':
this->process_name (get_opt.opt_arg ());
break;
case 'p':
this->nameserver_port (ACE_OS::atoi (get_opt.opt_arg ()));
break;
case 's':
this->database (get_opt.opt_arg ());
break;
case 'b':
this->base_address
(static_cast<char *> (ACE_OS::atop (get_opt.opt_arg ())));
break;
case 'T':
#if defined (ACE_HAS_TRACE)
if (ACE_OS::strcasecmp (get_opt.opt_arg (), ACE_TEXT ("ON")) == 0)
ACE_Trace::start_tracing ();
else if (ACE_OS::strcasecmp (get_opt.opt_arg (), ACE_TEXT ("OFF")) == 0)
ACE_Trace::stop_tracing ();
#endif /* ACE_HAS_TRACE */
break;
case 'v':
this->verbosity_ = true;
break;
default:
ACE_OS::fprintf (stderr, "%s\n"
"\t[-d] (enable debugging)\n"
"\t[-h nameserver host]\n"
"\t[-l namespace directory]\n"
"\t[-P processname]\n"
"\t[-p nameserver port]\n"
"\t[-s database name]\n"
"\t[-b base address]\n"
"\t[-v] (verbose)\n"
"\t[-r] (use Win32 Registry)\n",
argv[0]);
/* NOTREACHED */
break;
}
}
| const ACE_TCHAR * ACE_Name_Options::process_name | ( | void | ) | [inline] |
Get process name.
Definition at line 25 of file Naming_Context.inl.
{
ACE_TRACE ("ACE_Name_Options::process_name");
return this->process_name_;
}
| void ACE_Name_Options::process_name | ( | const ACE_TCHAR * | dir | ) |
Set process name.
Definition at line 479 of file Naming_Context.cpp.
{
ACE_TRACE ("ACE_Name_Options::process_name");
const ACE_TCHAR *t = ACE::basename (pname, ACE_DIRECTORY_SEPARATOR_CHAR);
ACE_OS::free ((void *) this->process_name_ );
this->process_name_ = ACE_OS::strdup (t);
}
| void ACE_Name_Options::use_registry | ( | bool | x | ) | [inline] |
Set use of registry in naming.
Definition at line 11 of file Naming_Context.inl.
{
ACE_TRACE ("ACE_Name_Options::use_registry");
this->use_registry_ = x;
}
| bool ACE_Name_Options::use_registry | ( | void | ) | const [inline] |
Get use of registry in naming.
Definition at line 4 of file Naming_Context.inl.
{
ACE_TRACE ("ACE_Name_Options::use_registry");
return this->use_registry_;
}
| bool ACE_Name_Options::verbose | ( | void | ) | [inline] |
Return verbose status.
Definition at line 18 of file Naming_Context.inl.
{
ACE_TRACE ("ACE_Name_Options::verbose");
return this->verbosity_;
}
char* ACE_Name_Options::base_address_ [private] |
Base address of the underlying allocator.
Definition at line 371 of file Naming_Context.h.
The context in which the naming database will be created.
Definition at line 374 of file Naming_Context.h.
const ACE_TCHAR* ACE_Name_Options::database_ [private] |
Name of the database that stores the name/value/type bindings.
Definition at line 368 of file Naming_Context.h.
bool ACE_Name_Options::debugging_ [private] |
Extra debugging info.
Definition at line 347 of file Naming_Context.h.
const ACE_TCHAR* ACE_Name_Options::nameserver_host_ [private] |
Hostname of nameserver.
Definition at line 359 of file Naming_Context.h.
int ACE_Name_Options::nameserver_port_ [private] |
Port to connect to nameserver process.
Definition at line 356 of file Naming_Context.h.
ACE_TCHAR* ACE_Name_Options::namespace_dir_ [private] |
Directory to hold name_bindings.
Definition at line 362 of file Naming_Context.h.
const ACE_TCHAR* ACE_Name_Options::process_name_ [private] |
Name of this process.
Definition at line 365 of file Naming_Context.h.
bool ACE_Name_Options::use_registry_ [private] |
Use Win32 Registry.
Definition at line 353 of file Naming_Context.h.
bool ACE_Name_Options::verbosity_ [private] |
Extra verbose messages.
Definition at line 350 of file Naming_Context.h.
1.7.0