#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. | |
| int | use_registry (void) |
| Get use of registry in naming. | |
| void | use_registry (int) |
| Set use of registry in naming. | |
| int | debug (void) |
| Return debug status. | |
| int | verbose (void) |
| Return verbose status. | |
Private Attributes | |
| int | debugging_ |
| Extra debugging info. | |
| int | verbosity_ |
| Extra verbose messages. | |
| int | 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. | |
Definition at line 280 of file Naming_Context.h.
|
|
Definition at line 411 of file Naming_Context.cpp. References ACE_DEFAULT_BASE_ADDR, ACE_DEFAULT_LOCALNAME, ACE_DEFAULT_SERVER_HOST, ACE_DEFAULT_SERVER_PORT, ACE_DIRECTORY_SEPARATOR_STR, ACE_ERROR, ACE_LIB_TEXT, ACE_TCHAR, ACE_TRACE, ACE::get_temp_dir(), LM_ERROR, ACE_OS::malloc(), MAXPATHLEN, namespace_dir_, ACE_OS::strcat(), ACE_OS::strcpy(), and ACE_OS::strdup().
00412 : debugging_ (0), 00413 verbosity_ (0), 00414 use_registry_ (0), 00415 nameserver_port_ (ACE_DEFAULT_SERVER_PORT), 00416 nameserver_host_ (ACE_OS::strdup (ACE_DEFAULT_SERVER_HOST)), 00417 process_name_ (0), 00418 database_ (ACE_OS::strdup (ACE_DEFAULT_LOCALNAME)), 00419 base_address_ (ACE_DEFAULT_BASE_ADDR) 00420 { 00421 ACE_TRACE ("ACE_Name_Options::ACE_Name_Options"); 00422 00423 #if defined (ACE_DEFAULT_NAMESPACE_DIR) 00424 this->namespace_dir_ = ACE_OS::strdup (ACE_DEFAULT_NAMESPACE_DIR); 00425 #else /* ACE_DEFAULT_NAMESPACE_DIR */ 00426 size_t pathsize = (MAXPATHLEN + 1) * sizeof (ACE_TCHAR); 00427 this->namespace_dir_ = static_cast <ACE_TCHAR *> (ACE_OS::malloc (pathsize)); 00428 00429 if (ACE::get_temp_dir (this->namespace_dir_, MAXPATHLEN) == -1) 00430 { 00431 ACE_ERROR ((LM_ERROR, 00432 ACE_LIB_TEXT ("Temporary path too long, ") 00433 ACE_LIB_TEXT ("defaulting to current directory\n"))); 00434 ACE_OS::strcpy (this->namespace_dir_, ACE_LIB_TEXT (".")); 00435 ACE_OS::strcat (this->namespace_dir_, ACE_DIRECTORY_SEPARATOR_STR); 00436 } 00437 #endif /* ACE_DEFAULT_NAMESPACE_DIR */ 00438 } |
|
|
Definition at line 440 of file Naming_Context.cpp. References ACE_TRACE, and ACE_OS::free().
00441 {
00442 ACE_TRACE ("ACE_Name_Options::~ACE_Name_Options");
00443
00444 ACE_OS::free ((void *) this->nameserver_host_);
00445 ACE_OS::free ((void *) this->namespace_dir_ );
00446 ACE_OS::free ((void *) this->process_name_ );
00447 ACE_OS::free ((void *) this->database_ );
00448 }
|
|
|
Get base address of the underlying allocator.
Definition at line 512 of file Naming_Context.cpp. References ACE_TRACE, and base_address_.
00513 {
00514 ACE_TRACE ("ACE_Name_Options::base_address");
00515 return this->base_address_;
00516 }
|
|
|
Set base address of the underlying allocator.
Definition at line 519 of file Naming_Context.cpp. References ACE_TRACE, and base_address_. Referenced by parse_args().
00520 {
00521 ACE_TRACE ("ACE_Name_Options::base_address");
00522 this->base_address_ = base_address;
00523 }
|
|
|
Set the context.
Definition at line 533 of file Naming_Context.cpp. References ACE_TRACE, and context_.
|
|
|
Get the context.
Definition at line 526 of file Naming_Context.cpp. References ACE_TRACE, and context_. Referenced by parse_args().
|
|
|
Get database name.
Definition at line 497 of file Naming_Context.cpp. References ACE_TRACE, and database_. Referenced by parse_args().
|
|
|
Set database name.
Definition at line 504 of file Naming_Context.cpp. References ACE_TCHAR, ACE_TRACE, database_, ACE_OS::free(), and ACE_OS::strdup(). Referenced by ACE_Local_Name_Space<, ACE_LOCK >::create_manager_i(), and ACE_Registry_Name_Space::open().
00505 {
00506 ACE_TRACE ("ACE_Name_Options::database");
00507 ACE_OS::free ((void *) this->database_);
00508 this->database_ = ACE_OS::strdup (db);
00509 }
|
|
|
Return debug status.
Definition at line 554 of file Naming_Context.cpp. References ACE_TRACE, and debugging_.
00555 {
00556 ACE_TRACE ("ACE_Name_Options::debug");
00557 return this->debugging_;
00558 }
|
|
|
Get the host name.
Definition at line 490 of file Naming_Context.cpp. References ACE_TRACE, and nameserver_host_. Referenced by parse_args().
00491 {
00492 ACE_TRACE ("ACE_Name_Options::nameserver_host");
00493 return this->nameserver_host_;
00494 }
|
|
|
Set the host name.
Definition at line 482 of file Naming_Context.cpp. References ACE_TCHAR, ACE_TRACE, ACE_OS::free(), nameserver_host_, and ACE_OS::strdup(). Referenced by ACE_Registry_Name_Space::open(), and ACE_Naming_Context::open().
00483 {
00484 ACE_TRACE ("ACE_Name_Options::nameserver_host");
00485 ACE_OS::free ((void *) this->nameserver_host_);
00486 this->nameserver_host_ = ACE_OS::strdup (host);
00487 }
|
|
|
Get the port number.
Definition at line 458 of file Naming_Context.cpp. References ACE_TRACE, and nameserver_port_. Referenced by parse_args().
00459 {
00460 ACE_TRACE ("ACE_Name_Options::nameserver_port");
00461 return this->nameserver_port_;
00462 }
|
|
|
Set the port number.
Definition at line 451 of file Naming_Context.cpp. References ACE_TRACE, and nameserver_port_. Referenced by ACE_Naming_Context::open().
00452 {
00453 ACE_TRACE ("ACE_Name_Options::nameserver_port");
00454 this->nameserver_port_ = port;
00455 }
|
|
|
Get name space directory.
Definition at line 547 of file Naming_Context.cpp. References ACE_TRACE, and namespace_dir_. Referenced by parse_args().
00548 {
00549 ACE_TRACE ("ACE_Name_Options::namespace_dir");
00550 return this->namespace_dir_;
00551 }
|
|
|
Set name space directory.
Definition at line 465 of file Naming_Context.cpp. References ACE_TCHAR, ACE_TRACE, ACE_OS::free(), namespace_dir_, and ACE_OS::strdup(). Referenced by ACE_Local_Name_Space<, ACE_LOCK >::create_manager_i(), and ACE_Registry_Name_Space::open().
00466 {
00467 ACE_TRACE ("ACE_Name_Options::namespace_dir");
00468 ACE_OS::free ((void *) this->namespace_dir_ );
00469 this->namespace_dir_ = ACE_OS::strdup (dir);
00470 }
|
|
||||||||||||
|
Parse arguments.
Definition at line 582 of file Naming_Context.cpp. References ACE_LIB_TEXT, ACE_LOG_MSG, ACE_TCHAR, ACE_TRACE, ACE_OS::atop(), base_address(), context(), database(), debugging_, ACE_OS::fprintf(), nameserver_host(), nameserver_port(), namespace_dir(), process_name(), ACE_Trace::start_tracing(), ACE_Trace::stop_tracing(), ACE_OS::strcasecmp(), ACE_OS::strcmp(), use_registry_, and verbosity_. Referenced by ACE_Naming_Context::init().
00583 {
00584 ACE_TRACE ("ACE_Name_Options::parse_args");
00585
00586 const ACE_TCHAR* program_name = 0;
00587
00588 // Argc can be 0 on some platforms like VxWorks.
00589 if (argc > 0)
00590 program_name = argv[0];
00591
00592 ACE_LOG_MSG->open (program_name);
00593 this->process_name (program_name);
00594
00595 // Default is to use the PROC_LOCAL context...
00596 this->context (ACE_Naming_Context::PROC_LOCAL);
00597
00598 // Make the database name the same as the process name by default
00599 // (note that this makes a copy of the process_name_ so that we can
00600 // clean it up in the destructor).
00601 this->database (this->process_name ());
00602
00603 ACE_Get_Opt get_opt (argc, argv, ACE_LIB_TEXT ("b:c:dh:l:P:p:s:T:vr"));
00604
00605 for (int c; (c = get_opt ()) != -1; )
00606 switch (c)
00607 {
00608 case 'c':
00609 {
00610 if (ACE_OS::strcmp (get_opt.opt_arg (), ACE_LIB_TEXT ("PROC_LOCAL")) == 0)
00611 this->context (ACE_Naming_Context::PROC_LOCAL);
00612 else if (ACE_OS::strcmp (get_opt.opt_arg (), ACE_LIB_TEXT ("NODE_LOCAL")) == 0)
00613 this->context (ACE_Naming_Context::NODE_LOCAL);
00614 else if (ACE_OS::strcmp (get_opt.opt_arg (), ACE_LIB_TEXT ("NET_LOCAL")) == 0)
00615 this->context (ACE_Naming_Context::NET_LOCAL);
00616 }
00617 break;
00618 case 'd':
00619 this->debugging_ = 1;
00620 break;
00621 case 'r':
00622 this->use_registry_ = 1;
00623 break;
00624 case 'h':
00625 this->nameserver_host (get_opt.opt_arg ());
00626 break;
00627 case 'l':
00628 this->namespace_dir (get_opt.opt_arg ());
00629 break;
00630 case 'P':
00631 this->process_name (get_opt.opt_arg ());
00632 break;
00633 case 'p':
00634 this->nameserver_port (ACE_OS::atoi (get_opt.opt_arg ()));
00635 break;
00636 case 's':
00637 this->database (get_opt.opt_arg ());
00638 break;
00639 case 'b':
00640 this->base_address
00641 (static_cast<char *> (ACE_OS::atop (get_opt.opt_arg ())));
00642 break;
00643 case 'T':
00644 #if defined (ACE_HAS_TRACE)
00645 if (ACE_OS::strcasecmp (get_opt.opt_arg (), ACE_LIB_TEXT ("ON")) == 0)
00646 ACE_Trace::start_tracing ();
00647 else if (ACE_OS::strcasecmp (get_opt.opt_arg (), ACE_LIB_TEXT ("OFF")) == 0)
00648 ACE_Trace::stop_tracing ();
00649 #endif /* ACE_HAS_TRACE */
00650 break;
00651 case 'v':
00652 this->verbosity_ = 1;
00653 break;
00654 default:
00655 ACE_OS::fprintf (stderr, "%s\n"
00656 "\t[-d] (enable debugging)\n"
00657 "\t[-h nameserver host]\n"
00658 "\t[-l namespace directory]\n"
00659 "\t[-P processname]\n"
00660 "\t[-p nameserver port]\n"
00661 "\t[-s database name]\n"
00662 "\t[-b base address]\n"
00663 "\t[-v] (verbose) \n"
00664 "\t[-r] (use Win32 Registry) \n",
00665 argv[0]);
00666 /* NOTREACHED */
00667 break;
00668 }
00669 }
|
|
|
Get process name.
Definition at line 540 of file Naming_Context.cpp. References ACE_TRACE, and process_name_. Referenced by parse_args().
00541 {
00542 ACE_TRACE ("ACE_Name_Options::process_name");
00543 return this->process_name_;
00544 }
|
|
|
Set process name.
Definition at line 473 of file Naming_Context.cpp. References ACE_DIRECTORY_SEPARATOR_CHAR, ACE_TCHAR, ACE_TRACE, ACE::basename(), ACE_OS::free(), process_name_, and ACE_OS::strdup().
00474 {
00475 ACE_TRACE ("ACE_Name_Options::process_name");
00476 const ACE_TCHAR *t = ACE::basename (pname, ACE_DIRECTORY_SEPARATOR_CHAR);
00477 ACE_OS::free ((void *) this->process_name_ );
00478 this->process_name_ = ACE_OS::strdup (t);
00479 }
|
|
|
Set use of registry in naming.
Definition at line 568 of file Naming_Context.cpp. References ACE_TRACE, and use_registry_.
00569 {
00570 ACE_TRACE ("ACE_Name_Options::use_registry");
00571 this->use_registry_ = x;
00572 }
|
|
|
Get use of registry in naming.
Definition at line 561 of file Naming_Context.cpp. References ACE_TRACE, and use_registry_. Referenced by ACE_Naming_Context::open().
00562 {
00563 ACE_TRACE ("ACE_Name_Options::use_registry");
00564 return this->use_registry_;
00565 }
|
|
|
Return verbose status.
Definition at line 575 of file Naming_Context.cpp. References ACE_TRACE, and verbosity_.
00576 {
00577 ACE_TRACE ("ACE_Name_Options::verbose");
00578 return this->verbosity_;
00579 }
|
|
|
Base address of the underlying allocator.
Definition at line 371 of file Naming_Context.h. Referenced by base_address(). |
|
|
The context in which the naming database will be created.
Definition at line 374 of file Naming_Context.h. Referenced by context(). |
|
|
Name of the database that stores the name/value/type bindings.
Definition at line 368 of file Naming_Context.h. Referenced by database(). |
|
|
Extra debugging info.
Definition at line 347 of file Naming_Context.h. Referenced by debug(), and parse_args(). |
|
|
Hostname of nameserver.
Definition at line 359 of file Naming_Context.h. Referenced by nameserver_host(). |
|
|
Port to connect to nameserver process.
Definition at line 356 of file Naming_Context.h. Referenced by nameserver_port(). |
|
|
Directory to hold name_bindings.
Definition at line 362 of file Naming_Context.h. Referenced by ACE_Name_Options(), and namespace_dir(). |
|
|
Name of this process.
Definition at line 365 of file Naming_Context.h. Referenced by process_name(). |
|
|
Use Win32 Registry.
Definition at line 353 of file Naming_Context.h. Referenced by parse_args(), and use_registry(). |
|
|
Extra verbose messages.
Definition at line 350 of file Naming_Context.h. Referenced by parse_args(), and verbose(). |
1.3.6