#include <Naming_Context.h>
Public Methods | |
| ACE_Name_Options (void) | |
| ~ACE_Name_Options (void) | |
| void | parse_args (int argc, ACE_TCHAR *argv[]) |
| Parse arguments. More... | |
| void | nameserver_port (int port) |
| Set the port number. More... | |
| int | nameserver_port (void) |
| Get the port number. More... | |
| ACE_Naming_Context::Context_Scope_Type | context (void) |
| Get the context. More... | |
| void | context (ACE_Naming_Context::Context_Scope_Type) |
| Set the context. More... | |
| void | nameserver_host (const ACE_TCHAR *host) |
| Set the host name. More... | |
| const ACE_TCHAR * | nameserver_host (void) |
| Get the host name. More... | |
| void | namespace_dir (const ACE_TCHAR *dir) |
| Set name space directory. More... | |
| const ACE_TCHAR * | namespace_dir (void) |
| Get name space directory. More... | |
| void | process_name (const ACE_TCHAR *dir) |
| Set process name. More... | |
| const ACE_TCHAR * | process_name (void) |
| Get process name. More... | |
| void | database (const ACE_TCHAR *) |
| Set database name. More... | |
| const ACE_TCHAR * | database (void) |
| Get database name. More... | |
| void | base_address (char *address) |
| Set base address of the underlying allocator. More... | |
| char * | base_address (void) |
| Get base address of the underlying allocator. More... | |
| int | use_registry (void) |
| Get use of registry in naming. More... | |
| void | use_registry (int) |
| Set use of registry in naming. More... | |
| int | debug (void) |
| Return debug status. More... | |
| int | verbose (void) |
| Return verbose status. More... | |
Private Attributes | |
| int | debugging_ |
| Extra debugging info. More... | |
| int | verbosity_ |
| Extra verbose messages. More... | |
| int | use_registry_ |
| Use Win32 Registry. More... | |
| int | nameserver_port_ |
| Port to connect to nameserver process. More... | |
| const ACE_TCHAR * | nameserver_host_ |
| Hostname of nameserver. More... | |
| ACE_TCHAR * | namespace_dir_ |
| Directory to hold name_bindings. More... | |
| const ACE_TCHAR * | process_name_ |
| Name of this process. More... | |
| const ACE_TCHAR * | database_ |
| Name of the database that stores the name/value/type bindings. More... | |
| char * | base_address_ |
| Base address of the underlying allocator. More... | |
| ACE_Naming_Context::Context_Scope_Type | context_ |
| The context in which the naming database will be created. More... | |
Definition at line 279 of file Naming_Context.h.
|
|
Definition at line 415 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_Lib_Find::get_temp_dir, LM_ERROR, ACE_OS_Memory::malloc, MAXPATHLEN, namespace_dir_, ACE_OS_String::strcat, and ACE_OS_String::strdup.
00416 : debugging_ (0), 00417 verbosity_ (0), 00418 use_registry_ (0), 00419 nameserver_port_ (ACE_DEFAULT_SERVER_PORT), 00420 nameserver_host_ (ACE_OS::strdup (ACE_DEFAULT_SERVER_HOST)), 00421 process_name_ (0), 00422 database_ (ACE_OS::strdup (ACE_DEFAULT_LOCALNAME)), 00423 base_address_ (ACE_DEFAULT_BASE_ADDR) 00424 { 00425 ACE_TRACE ("ACE_Name_Options::ACE_Name_Options"); 00426 00427 #if defined (ACE_DEFAULT_NAMESPACE_DIR) 00428 this->namespace_dir_ = ACE_OS::strdup (ACE_DEFAULT_NAMESPACE_DIR); 00429 #else /* ACE_DEFAULT_NAMESPACE_DIR */ 00430 size_t pathsize = (MAXPATHLEN + 1) * sizeof (ACE_TCHAR); 00431 this->namespace_dir_ = ACE_static_cast (ACE_TCHAR *, ACE_OS::malloc (pathsize)); 00432 00433 if (ACE_Lib_Find::get_temp_dir (this->namespace_dir_, MAXPATHLEN) == -1) 00434 { 00435 ACE_ERROR ((LM_ERROR, 00436 ACE_LIB_TEXT ("Temporary path too long, ") 00437 ACE_LIB_TEXT ("defaulting to current directory\n"))); 00438 ACE_OS::strcat (this->namespace_dir_, ACE_LIB_TEXT (".")); 00439 ACE_OS::strcat (this->namespace_dir_, ACE_DIRECTORY_SEPARATOR_STR); 00440 } 00441 #endif /* ACE_DEFAULT_NAMESPACE_DIR */ 00442 } |
|
|
Definition at line 444 of file Naming_Context.cpp. References ACE_TRACE, and ACE_OS_Memory::free.
00445 {
00446 ACE_TRACE ("ACE_Name_Options::~ACE_Name_Options");
00447
00448 ACE_OS::free ((void *) this->nameserver_host_);
00449 ACE_OS::free ((void *) this->namespace_dir_ );
00450 ACE_OS::free ((void *) this->process_name_ );
00451 ACE_OS::free ((void *) this->database_ );
00452 }
|
|
|
Get base address of the underlying allocator.
Definition at line 516 of file Naming_Context.cpp. References ACE_TRACE, and base_address_.
00517 {
00518 ACE_TRACE ("ACE_Name_Options::base_address");
00519 return this->base_address_;
00520 }
|
|
|
Set base address of the underlying allocator.
Definition at line 523 of file Naming_Context.cpp. References ACE_TRACE, base_address, and base_address_. Referenced by base_address, and parse_args.
00524 {
00525 ACE_TRACE ("ACE_Name_Options::base_address");
00526 // HP-UX 11, aC++ has a bug with 64-bit pointer initialization from
00527 // a literal. To work around it, assign the literal to a long, then
00528 // to the pointer. This is allegedly fixed in aC++ A.03.10.
00529 #if defined (__hpux) && defined(__LP64__)
00530 long temp = ACE_DEFAULT_BASE_ADDRL;
00531 base_address = (char *) temp;
00532 #endif /* defined (__hpux) && defined(__LP64__) */
00533 this->base_address_ = base_address;
00534 }
|
|
|
Set the context.
Definition at line 544 of file Naming_Context.cpp. References ACE_TRACE, context, context_, and ACE_Naming_Context::Context_Scope_Type.
|
|
|
Get the context.
Definition at line 537 of file Naming_Context.cpp. References ACE_TRACE, and context_. Referenced by context, and parse_args.
|
|
|
Get database name.
Definition at line 501 of file Naming_Context.cpp. References ACE_TRACE, and database_. Referenced by parse_args.
|
|
|
Set database name.
Definition at line 508 of file Naming_Context.cpp. References ACE_TCHAR, ACE_TRACE, database_, ACE_OS_Memory::free, and ACE_OS_String::strdup. Referenced by ACE_Local_Name_Space::create_manager_i, and ACE_Registry_Name_Space::open.
00509 {
00510 ACE_TRACE ("ACE_Name_Options::database");
00511 ACE_OS::free ((void *) this->database_);
00512 this->database_ = ACE_OS::strdup (db);
00513 }
|
|
|
Return debug status.
Definition at line 565 of file Naming_Context.cpp. References ACE_TRACE, and debugging_.
00566 {
00567 ACE_TRACE ("ACE_Name_Options::debug");
00568 return this->debugging_;
00569 }
|
|
|
Get the host name.
Definition at line 494 of file Naming_Context.cpp. References ACE_TRACE, and nameserver_host_. Referenced by parse_args.
00495 {
00496 ACE_TRACE ("ACE_Name_Options::nameserver_host");
00497 return this->nameserver_host_;
00498 }
|
|
|
Set the host name.
Definition at line 486 of file Naming_Context.cpp. References ACE_TCHAR, ACE_TRACE, ACE_OS_Memory::free, nameserver_host_, and ACE_OS_String::strdup. Referenced by ACE_Registry_Name_Space::open, and ACE_Naming_Context::open.
00487 {
00488 ACE_TRACE ("ACE_Name_Options::nameserver_host");
00489 ACE_OS::free ((void *) this->nameserver_host_);
00490 this->nameserver_host_ = ACE_OS::strdup (host);
00491 }
|
|
|
Get the port number.
Definition at line 462 of file Naming_Context.cpp. References ACE_TRACE, and nameserver_port_. Referenced by parse_args.
00463 {
00464 ACE_TRACE ("ACE_Name_Options::nameserver_port");
00465 return this->nameserver_port_;
00466 }
|
|
|
Set the port number.
Definition at line 455 of file Naming_Context.cpp. References ACE_TRACE, and nameserver_port_. Referenced by ACE_Naming_Context::open.
00456 {
00457 ACE_TRACE ("ACE_Name_Options::nameserver_port");
00458 this->nameserver_port_ = port;
00459 }
|
|
|
Get name space directory.
Definition at line 558 of file Naming_Context.cpp. References ACE_TRACE, and namespace_dir_. Referenced by parse_args.
00559 {
00560 ACE_TRACE ("ACE_Name_Options::namespace_dir");
00561 return this->namespace_dir_;
00562 }
|
|
|
Set name space directory.
Definition at line 469 of file Naming_Context.cpp. References ACE_TCHAR, ACE_TRACE, ACE_OS_Memory::free, namespace_dir_, and ACE_OS_String::strdup. Referenced by ACE_Local_Name_Space::create_manager_i, and ACE_Registry_Name_Space::open.
00470 {
00471 ACE_TRACE ("ACE_Name_Options::namespace_dir");
00472 ACE_OS::free ((void *) this->namespace_dir_ );
00473 this->namespace_dir_ = ACE_OS::strdup (dir);
00474 }
|
|
||||||||||||
|
Parse arguments.
Definition at line 593 of file Naming_Context.cpp. References ACE_LIB_TEXT, ACE_LOG_MSG, ACE_TCHAR, ACE_TRACE, ACE_OS::atoi, ACE_OS::atop, base_address, context, database, debugging_, ACE_OS::fprintf, nameserver_host, nameserver_port, namespace_dir, ACE_Naming_Context::NET_LOCAL, ACE_Naming_Context::NODE_LOCAL, ACE_Get_Opt::opt_arg, ACE_Naming_Context::PROC_LOCAL, process_name, ACE_Trace::start_tracing, ACE_Trace::stop_tracing, ACE_OS_String::strcasecmp, ACE_OS_String::strcmp, use_registry_, and verbosity_. Referenced by ACE_Naming_Context::init.
00594 {
00595 ACE_TRACE ("ACE_Name_Options::parse_args");
00596 ACE_LOG_MSG->open (argv[0]);
00597 this->process_name (argv[0]);
00598
00599 // Default is to use the PROC_LOCAL context...
00600 this->context (ACE_Naming_Context::PROC_LOCAL);
00601
00602 // Make the database name the same as the process name by default
00603 // (note that this makes a copy of the process_name_ so that we can
00604 // clean it up in the destructor).
00605 this->database (this->process_name ());
00606
00607 ACE_Get_Opt get_opt (argc, argv, ACE_LIB_TEXT ("b:c:dh:l:P:p:s:T:vr"));
00608
00609 for (int c; (c = get_opt ()) != -1; )
00610 switch (c)
00611 {
00612 case 'c':
00613 {
00614 if (ACE_OS::strcmp (get_opt.opt_arg (), ACE_LIB_TEXT ("PROC_LOCAL")) == 0)
00615 this->context (ACE_Naming_Context::PROC_LOCAL);
00616 else if (ACE_OS::strcmp (get_opt.opt_arg (), ACE_LIB_TEXT ("NODE_LOCAL")) == 0)
00617 this->context (ACE_Naming_Context::NODE_LOCAL);
00618 else if (ACE_OS::strcmp (get_opt.opt_arg (), ACE_LIB_TEXT ("NET_LOCAL")) == 0)
00619 this->context (ACE_Naming_Context::NET_LOCAL);
00620 }
00621 break;
00622 case 'd':
00623 this->debugging_ = 1;
00624 break;
00625 case 'r':
00626 this->use_registry_ = 1;
00627 break;
00628 case 'h':
00629 this->nameserver_host (get_opt.opt_arg ());
00630 break;
00631 case 'l':
00632 this->namespace_dir (get_opt.opt_arg ());
00633 break;
00634 case 'P':
00635 this->process_name (get_opt.opt_arg ());
00636 break;
00637 case 'p':
00638 this->nameserver_port (ACE_OS::atoi (get_opt.opt_arg ()));
00639 break;
00640 case 's':
00641 this->database (get_opt.opt_arg ());
00642 break;
00643 case 'b':
00644 this->base_address
00645 (ACE_static_cast (char *, ACE_OS::atop (get_opt.opt_arg ())));
00646 break;
00647 case 'T':
00648 if (ACE_OS::strcasecmp (get_opt.opt_arg (), ACE_LIB_TEXT ("ON")) == 0)
00649 ACE_Trace::start_tracing ();
00650 else if (ACE_OS::strcasecmp (get_opt.opt_arg (), ACE_LIB_TEXT ("OFF")) == 0)
00651 ACE_Trace::stop_tracing ();
00652 break;
00653 case 'v':
00654 this->verbosity_ = 1;
00655 break;
00656 default:
00657 ACE_OS::fprintf (stderr, "%s\n"
00658 "\t[-d] (enable debugging)\n"
00659 "\t[-h nameserver host]\n"
00660 "\t[-l namespace directory]\n"
00661 "\t[-P processname]\n"
00662 "\t[-p nameserver port]\n"
00663 "\t[-s database name]\n"
00664 "\t[-b base address]\n"
00665 "\t[-v] (verbose) \n"
00666 "\t[-r] (use Win32 Registry) \n",
00667 argv[0]);
00668 /* NOTREACHED */
00669 break;
00670 }
00671 }
|
|
|
Get process name.
Definition at line 551 of file Naming_Context.cpp. References ACE_TRACE, and process_name_. Referenced by parse_args.
00552 {
00553 ACE_TRACE ("ACE_Name_Options::process_name");
00554 return this->process_name_;
00555 }
|
|
|
Set process name.
Definition at line 477 of file Naming_Context.cpp. References ACE_DIRECTORY_SEPARATOR_CHAR, ACE_TCHAR, ACE_TRACE, ACE::basename, ACE_OS_Memory::free, process_name_, and ACE_OS_String::strdup.
00478 {
00479 ACE_TRACE ("ACE_Name_Options::process_name");
00480 const ACE_TCHAR *t = ACE::basename (pname, ACE_DIRECTORY_SEPARATOR_CHAR);
00481 ACE_OS::free ((void *) this->process_name_ );
00482 this->process_name_ = ACE_OS::strdup (t);
00483 }
|
|
|
Set use of registry in naming.
Definition at line 579 of file Naming_Context.cpp. References ACE_TRACE, and use_registry_.
00580 {
00581 ACE_TRACE ("ACE_Name_Options::use_registry");
00582 this->use_registry_ = x;
00583 }
|
|
|
Get use of registry in naming.
Definition at line 572 of file Naming_Context.cpp. References ACE_TRACE, and use_registry_. Referenced by ACE_Naming_Context::open.
00573 {
00574 ACE_TRACE ("ACE_Name_Options::use_registry");
00575 return this->use_registry_;
00576 }
|
|
|
Return verbose status.
Definition at line 586 of file Naming_Context.cpp. References ACE_TRACE, and verbosity_.
00587 {
00588 ACE_TRACE ("ACE_Name_Options::verbose");
00589 return this->verbosity_;
00590 }
|
|
|
Base address of the underlying allocator.
Definition at line 370 of file Naming_Context.h. Referenced by base_address. |
|
|
The context in which the naming database will be created.
Definition at line 373 of file Naming_Context.h. Referenced by context. |
|
|
Name of the database that stores the name/value/type bindings.
Definition at line 367 of file Naming_Context.h. Referenced by database. |
|
|
Extra debugging info.
Definition at line 346 of file Naming_Context.h. Referenced by debug, and parse_args. |
|
|
Hostname of nameserver.
Definition at line 358 of file Naming_Context.h. Referenced by nameserver_host. |
|
|
Port to connect to nameserver process.
Definition at line 355 of file Naming_Context.h. Referenced by nameserver_port. |
|
|
Directory to hold name_bindings.
Definition at line 361 of file Naming_Context.h. Referenced by ACE_Name_Options, and namespace_dir. |
|
|
Name of this process.
Definition at line 364 of file Naming_Context.h. Referenced by process_name. |
|
|
Use Win32 Registry.
Definition at line 352 of file Naming_Context.h. Referenced by parse_args, and use_registry. |
|
|
Extra verbose messages.
Definition at line 349 of file Naming_Context.h. Referenced by parse_args, and verbose. |
1.2.14 written by Dimitri van Heesch,
© 1997-2002