int run_main (int, ACE_TCHAR *argv[]) { ACE_START_TEST (ACE_TEXT ("Service_Config_Stream_Test")); ACE_STATIC_SVC_REGISTER (Decrypter); // If you want to try the static module in the stream test (comments at // the top of this file) it needs the -y in the argv list which enables // static services. Otherwise it's not really needed. Same with the // 'false' 4th arg to open() below - it allows static services. ACE_TCHAR *_argv[5] = { argv[0], const_cast<ACE_TCHAR*> (ACE_TEXT ("-d")), const_cast<ACE_TCHAR*> (ACE_TEXT ("-y")), const_cast<ACE_TCHAR*> (ACE_TEXT ("-f")), const_cast<ACE_TCHAR*> (ACE_TEXT ("Service_Config_Stream_Test.conf")) }; int status; if ((status = ACE_Service_Config::open (5, _argv, ACE_DEFAULT_LOGGER_KEY, false, true /*ignore def svc.conf*/)) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("open"), 1)); ACE_END_TEST; return status; }
int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { ACE_STATIC_SVC_REGISTER (Reporter_Descriptor); ACE_Service_Config::open (argc, argv, ACE_DEFAULT_LOGGER_KEY, 0); ACE_Reactor::instance ()->run_reactor_event_loop (); return 0; }
int ACE_TMAIN (int, ACE_TCHAR *[]) { int i; ACE_STATIC_SVC_REGISTER(ACE_Naming_Context); ACE_Naming_Context *ns_ptr; ACE_NEW_RETURN (ns_ptr, ACE_Naming_Context, 1); ACE_Name_Options *name_options = ns_ptr->name_options (); const ACE_TCHAR *m_argv[] = { ACE_TEXT("MyName"), ACE_TEXT("-cNODE_LOCAL") , #if defined (ACE_WIN32) ACE_TEXT("-lC:\\temp\\non_existent"), #else ACE_TEXT("-l/tmp/foobar.mine"), #endif /* ACE_WIN32 */ 0 }; int m_argc = sizeof (m_argv) / sizeof (ACE_TCHAR *) -1; name_options->parse_args (m_argc, (ACE_TCHAR**)m_argv); i = ns_ptr->open (ACE_Naming_Context::NODE_LOCAL); ACE_DEBUG ((LM_DEBUG, "(%P) opened with %d\n", i)); if (i != 0) return -1; i = ns_ptr->bind ("Key_Value", "Val_Value", "-"); ACE_DEBUG ((LM_DEBUG, "(%P) bound with %d\n", i)); return 0; }
int ACE_TMAIN (int, ACE_TCHAR *[]) { static u_long ACE_DEFAULT_BASE_ADDR_1 = (1 * 64 * 1024 * 1024); static u_long ACE_DEFAULT_BASE_ADDR_2 = (2 * 64 * 1024 * 1024); int i; ACE_STATIC_SVC_REGISTER(ACE_Naming_Context); ACE_Naming_Context *ns_ptr; ACE_NEW_RETURN (ns_ptr, ACE_Naming_Context, 1); ACE_Name_Options *name_options = ns_ptr->name_options (); ACE_Naming_Context *ns_ptr1; ACE_NEW_RETURN (ns_ptr1, ACE_Naming_Context, 1); ACE_Name_Options *name_options1 = ns_ptr1->name_options (); ACE_TCHAR address_arg1[BUFSIZ]; ACE_TCHAR address_arg2[BUFSIZ]; ACE_OS::sprintf (address_arg1, ACE_TEXT("-b%ld"), ACE_DEFAULT_BASE_ADDR_1); const ACE_TCHAR *m_argv[] = { ACE_TEXT("MyName1"), ACE_TEXT("-cNODE_LOCAL"), address_arg1, NULL }; int m_argc = sizeof (m_argv) / sizeof (ACE_TCHAR *) -1; ACE_OS::sprintf (address_arg2, ACE_TEXT("-b%ld"), ACE_DEFAULT_BASE_ADDR_2); const ACE_TCHAR *n_argv[] = { ACE_TEXT("MyName2"), ACE_TEXT("-cNODE_LOCAL"), address_arg2, NULL }; int n_argc = sizeof (n_argv) / sizeof (ACE_TCHAR *) -1; name_options->parse_args (m_argc, (ACE_TCHAR **) m_argv); i = ns_ptr->open (ACE_Naming_Context::NODE_LOCAL); ACE_DEBUG ((LM_DEBUG, "(%P) opened with %d\n", i)); if (i != 0) return -1; name_options1->parse_args (n_argc, (ACE_TCHAR **) n_argv); i = ns_ptr1->open (ACE_Naming_Context::NODE_LOCAL); ACE_DEBUG ((LM_DEBUG, "(%P) 1 opened with %d\n", i)); if (i != 0) return -1; return 0; }
int ACE_TMAIN (int, ACE_TCHAR *[]) { int i; ACE_STATIC_SVC_REGISTER(ACE_Naming_Context); ACE_Naming_Context *ns_ptr; ACE_NEW_RETURN (ns_ptr, ACE_Naming_Context, 1); ACE_Name_Options *name_options = ns_ptr->name_options (); const ACE_TCHAR *m_argv[] = { ACE_TEXT("MyName"), ACE_TEXT("-cNODE_LOCAL"), 0 }; int m_argc = sizeof (m_argv) / sizeof (ACE_TCHAR *) -1; name_options->parse_args (m_argc, (ACE_TCHAR **) m_argv); i = ns_ptr->open (ACE_Naming_Context::NODE_LOCAL); ACE_DEBUG ((LM_DEBUG, "(%P) opened with %d\n", i)); if (i != 0) return -1; else { char key[128]; char val[32]; char type[2]; type[0] = '-'; type[1] = '\0'; int i = 0; for (int l = 1; l <= 1000 ; l++) { ACE_OS::sprintf (key, "K_%05d_%05d", (int) ACE_OS::getpid (), l); ACE_OS::sprintf (val, "Val%05d", l); i = ns_ptr->bind (key, val, type); ACE_DEBUG ((LM_DEBUG, "%d: bind of %s: %d\n", ACE_OS::getpid (), key, i)); if (i != 0) return -1; } } return 0; }
int main (int argc, char **argv) { const char *host = argc > 1 ? argv[1] : "-hlocalhost"; const char *port = argc > 2 ? argv[2] : "-p20012"; ACE_STATIC_SVC_REGISTER(ACE_Naming_Context); ACE_Naming_Context ns; ACE_Name_Options *name_options = ns.name_options (); const char *m_argv[] = { "MyName", "-cNET_LOCAL", host, port, NULL }; int m_argc = sizeof (m_argv) / sizeof (char *) -1; name_options->parse_args (m_argc, (char **) m_argv); int result = ns.open (ACE_Naming_Context::NET_LOCAL); ACE_DEBUG ((LM_DEBUG, "ACE_Naming_Context::open returned %d\n", result)); if (result != 0) return result; else { char key[128]; char val[32]; char type[2]; type[0] = '-'; type[1] = '\0'; int i = 0; for (int l = 1; l <= 1000 ; l++) { ACE_OS::sprintf (key, "K_%05d_%05d", (int) ACE_OS::getpid (), l); ACE_OS::sprintf (val, "Val%05d", l); i = ns.bind (key, val, type); ACE_DEBUG ((LM_DEBUG, "%d: bind of %s: %d\n", ACE_OS::getpid (), key, i)); if (i != 0) return -1; } result = ns.close (); ACE_DEBUG ((LM_DEBUG, "ACE_Naming_Context::close returned %d\n", result)); } return result; }