(file) Return to cimserver.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Server

  1 mike  1.32 //%/////////////////////////////////////////////////////////////////////////////
  2            //
  3            // Copyright (c) 2000, 2001 The Open group, BMC Software, Tivoli Systems, IBM
  4            //
  5            // Permission is hereby granted, free of charge, to any person obtaining a copy
  6            // of this software and associated documentation files (the "Software"), to 
  7            // deal in the Software without restriction, including without limitation the 
  8            // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 
  9            // sell copies of the Software, and to permit persons to whom the Software is
 10            // furnished to do so, subject to the following conditions:
 11            // 
 12            // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN 
 13            // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
 14            // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
 15            // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 
 16            // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 
 17            // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 
 18            // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 19            // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 20            //
 21            //==============================================================================
 22 mike  1.32 //
 23            // Author: Mike Brasher (mbrasher@bmc.com)
 24            //
 25            // Modified By: Mike Day (mdday@us.ibm.com) 
 26 mike  1.33 //
 27 mike  1.32 // Modified By:	Karl Schopmeyer (k.schopmeyer@opengroup.org)
 28            //
 29 mike  1.35 // Modified By: Nag Boranna (nagaraja_boranna@hp.com)
 30            //
 31            // Modified By: Jenny Yu (jenny_yu@hp.com)
 32            //
 33 kumpf 1.38 // Modified By: Sushma Fernandes (sushma_fernandes@hp.com)
 34            //
 35 mike  1.32 //%/////////////////////////////////////////////////////////////////////////////
 36            
 37            
 38            //////////////////////////////////////////////////////////////////////
 39            //
 40            // Notes on deamon operation (Unix) and service operation (Win 32):
 41            //
 42            // To run pegasus as a daemon on Unix platforms, use the -d option:
 43            //
 44            // cimserver -d
 45            //
 46            // The -d option has no effect on windows operation. 
 47            //
 48 mike  1.35 // To shutdown pegasus, use the -s option:
 49            // 
 50            // cimserver -s [-f] [-T timeout_value]
 51            //
 52 mike  1.32 // To run pegasus as an NT service, there are FOUR  different possibilities:
 53            //
 54            // To INSTALL the Pegasus service, 
 55            //
 56            // cimserver -install
 57            //
 58            // To REMOVE the Pegasus service, 
 59            //
 60            // cimserver -remove
 61            //
 62            // To START the Pegasus service, 
 63            //
 64            // net start cimserver
 65            //
 66            // To STOP the Pegasus service, 
 67            //
 68            // net stop cimserver
 69            //
 70            // Alternatively, you can use the windows service manager. Pegasus shows up 
 71            // in the service database as "Pegasus CIM Object Manager"
 72            //
 73 mike  1.32 // Mike Day, mdday@us.ibm.com
 74            // 
 75            //////////////////////////////////////////////////////////////////////
 76            
 77            
 78 mike  1.35 #include <Pegasus/Common/Config.h>
 79 mike  1.32 #include <iostream>
 80 mike  1.35 #include <cassert>
 81 mike  1.32 #include <cstdlib>
 82            #include <Pegasus/Common/FileSystem.h>
 83 mike  1.35 #include <Pegasus/Common/Monitor.h>
 84 mike  1.32 #include <Pegasus/Server/CIMServer.h>
 85            #include <Pegasus/Common/PegasusVersion.h>
 86            #include <Pegasus/Common/Logger.h>
 87            #include <Pegasus/Common/System.h>
 88 mike  1.35 #include <Pegasus/Common/Tracer.h>
 89            #include <Pegasus/Config/ConfigManager.h>
 90            #include <Pegasus/Client/CIMClient.h>
 91            #include <Pegasus/Common/HTTPConnector.h>
 92            #include <Pegasus/Server/ShutdownService.h>
 93 kumpf 1.38 #include <Pegasus/Common/Destroyer.h>
 94 mike  1.35 #ifndef PEGASUS_OS_ZOS
 95 mike  1.32 #include <slp/slp.h>
 96 mike  1.35 #endif
 97 mike  1.32 
 98            
 99            #if defined(PEGASUS_OS_TYPE_WINDOWS)
100            # include "cimserver_windows.cpp"
101            #elif defined(PEGASUS_OS_TYPE_UNIX)
102            # include "cimserver_unix.cpp"
103            #else
104            # error "Unsupported platform"
105            #endif
106            
107            PEGASUS_USING_PEGASUS;
108            PEGASUS_USING_STD;
109            
110 mike  1.35 //
111            //  The command name.
112            //
113            static const char COMMAND_NAME []    = "cimserver";
114            
115            //
116            //  The constant defining usage string.
117            //
118            static const char USAGE []           = "Usage: ";
119            
120            /**
121            Constants representing the command line options.
122            */
123            static const char OPTION_VERSION     = 'v';
124            
125            static const char OPTION_HELP        = 'h';
126            
127            static const char OPTION_HOME        = 'D';
128            
129            static const char OPTION_SHUTDOWN    = 's';
130            
131 mike  1.35 static const char OPTION_FORCE       = 'f';
132            
133            static const char OPTION_TIMEOUT     = 'T';
134            
135            static const String NAMESPACE = "root/cimv2";
136            static const String CLASSNAME_SHUTDOWNSERVICE = "PG_ShutdownService";
137 kumpf 1.36 static const String PROPERTY_TIMEOUT = "operationTimeout";
138 mike  1.35 
139            ConfigManager*    configManager;
140            
141 mike  1.32 /** GetOptions function - This function defines the Options Table
142 mike  1.35     and sets up the options from that table using the config manager.
143 mike  1.32 */
144            void GetOptions(
145 mike  1.35     ConfigManager* cm,
146 mike  1.32     int& argc,
147                char** argv,
148                const String& pegasusHome)
149            {
150 mike  1.35     try
151 mike  1.32     {
152 kumpf 1.38         cm->mergeConfigFiles();
153 mike  1.33 
154 mike  1.35         cm->mergeCommandLine(argc, argv);
155                }
156                catch (NoSuchFile nsf)
157                {
158                    throw nsf;
159                }
160                catch (FileNotReadable fnr)
161                {
162                    throw fnr;
163                }
164                catch (CannotRenameFile ftrf)
165                {
166                    throw ftrf;
167                }
168                catch (ConfigFileSyntaxError cfse)
169                {
170                    throw cfse;
171                }
172                catch(UnrecognizedConfigProperty ucp)
173                {
174                    throw ucp;
175 mike  1.35     }
176                catch(InvalidPropertyValue ipv)
177                {
178                    throw ipv;
179                }
180 mike  1.32 }
181            
182            /* PrintHelp - This is temporary until we expand the options manager to allow
183               options help to be defined with the OptionRow entries and presented from
184               those entries.
185            */
186            void PrintHelp(const char* arg0)
187            {
188 mike  1.35     /**
189                    Build the usage string for the config command.
190                */
191                String usage = String (USAGE);
192                usage.append (COMMAND_NAME);
193                usage.append (" [ [ options ] | [ configProperty=value, ... ] ]\n");
194                usage.append ("  options\n");
195                usage.append ("    -v          - displays pegasus version number\n");
196                usage.append ("    -h          - prints this help message\n");
197                usage.append ("    -D [home]   - sets pegasus home directory\n");
198                usage.append ("    -t          - turns tracing on\n");
199                usage.append ("    -t          - turns on trace of client IO to console\n");
200                usage.append ("    -l          - turns on trace of client IO to trace file\n");
201                usage.append ("    -d          - runs pegasus as a daemon\n");
202                usage.append ("    -s [-f] [-T timeout] \n");
203                usage.append ("                - shuts down pegasus\n");
204                usage.append ("    -cleanlogs  - clears the log files at startup\n");
205                usage.append ("    -install    - installs pegasus as a Windows NT Service\n");
206                usage.append ("    -remove     - removes pegasus as a Windows NT Service\n");
207                usage.append ("    -slp        - registers pegasus as a service with SLP\n\n");
208                usage.append ("    -SSL        - uses SSL\n\n");
209 mike  1.35 
210                usage.append ("  configProperty=value\n");
211                usage.append ("    port=nnnn            - sets port number to listen on\n");
212                usage.append ("    logdir=/pegasus/logs - directory for log files\n");
213            
214                cout << endl;
215 mike  1.32     cout << PEGASUS_NAME << PEGASUS_VERSION << endl;
216                cout << endl;
217 mike  1.35     cout << usage << endl;
218            }
219            
220 kumpf 1.36 void shutdownCIMOM(Boolean forceOption, Uint32 timeoutValue)
221 mike  1.35 {
222                //
223                // Create CIMClient object
224                //
225                Monitor* monitor = new Monitor;
226                HTTPConnector* httpConnector = new HTTPConnector(monitor);
227                CIMClient client(monitor, httpConnector);
228            
229                //
230                // Get the port number
231                //
232                String portNumberStr = configManager->getCurrentValue("port");
233            
234                String hostStr = System::getHostName();
235                hostStr.append(":");
236                hostStr.append(portNumberStr);
237            
238 kumpf 1.36     // Put server shutdown message to the logger
239                Logger::put(Logger::STANDARD_LOG, "CIMServer", Logger::INFORMATION,
240            	"Shutdown $0 on port $1.", PEGASUS_NAME, portNumberStr);
241            
242 mike  1.35     //
243                // open connection to CIMOM 
244                //
245                try
246                {
247                    client.connect(hostStr.allocateCString());
248                }
249                catch(Exception& e)
250                {
251 kumpf 1.36         Logger::put(Logger::STANDARD_LOG, "CIMServer", Logger::INFORMATION,
252                        "Failed to connect to $0 $1.", PEGASUS_NAME, e.getMessage());
253            
254 mike  1.35         PEGASUS_STD(cerr) << "Failed to connect to server: " << e.getMessage() << PEGASUS_STD(endl);
255                    exit(1);
256                }
257            
258                try
259                {
260                    //
261                    // construct CIMReference 
262                    //
263                    String referenceStr = "//";
264                    referenceStr.append(hostStr);
265                    referenceStr.append("/root/cimv2:PG_ShutdownService");
266                    CIMReference reference(referenceStr);
267            
268                    //
269                    // issue the invokeMethod request on the shutdown method
270                    //
271                    Array<CIMParamValue> inParams;
272                    Array<CIMParamValue> outParams;
273            
274                    if (forceOption)
275 mike  1.35         {
276                        inParams.append(CIMParamValue(
277                            CIMParameter("force", CIMType::STRING),
278                            CIMValue("TRUE")));
279                    }
280                    else
281                    {
282                        inParams.append(CIMParamValue(
283                            CIMParameter("force", CIMType::STRING),
284                            CIMValue("FALSE")));
285                    }
286            
287                    inParams.append(CIMParamValue(
288 kumpf 1.36             CIMParameter("timeout", CIMType::UINT32),
289                        CIMValue(timeoutValue)));
290 mike  1.35 
291                    CIMValue retValue = client.invokeMethod(
292                        NAMESPACE,
293                        reference,
294                        "shutdown",
295                        inParams,
296                        outParams);
297 kumpf 1.36 
298                    // Put server shutdown message to the logger
299                    Logger::put(Logger::STANDARD_LOG, "CIMServer", Logger::INFORMATION,
300            	    "$0 terminated on port $1.", PEGASUS_NAME, portNumberStr);
301            
302 mike  1.35     }
303                catch(Exception& e)
304                {
305                    PEGASUS_STD(cerr) << "Failed to shutdown server: " << e.getMessage() << PEGASUS_STD(endl);
306                    exit(1);
307                }
308            
309                return;
310 mike  1.32 }
311            
312 mike  1.35 
313 mike  1.33 /////////////////////////////////////////////////////////////////////////
314 mike  1.32 //  MAIN
315            //////////////////////////////////////////////////////////////////////////
316            int main(int argc, char** argv)
317            {
318 mike  1.35     String pegasusHome  = String::EMPTY;
319                Boolean pegasusIOTrace = false;
320                Boolean pegasusIOLog = false;
321                String portOption = String::EMPTY;
322                String logsDirectory = String::EMPTY;
323                Boolean useSLP = false;
324                Boolean useSSL = false;
325                Boolean daemonOption = false;
326                Boolean shutdownOption = false;
327                Boolean forceOption = false;
328                Boolean timeoutOption = false;
329                String  timeoutStr  = String::EMPTY;
330                long timeoutValue  = 0;
331            
332 kumpf 1.38     //
333                // Get environment variables:
334                //
335                const char* tmp = getenv("PEGASUS_HOME");
336            
337                if (tmp)
338                {
339                    pegasusHome = tmp;
340                }
341            
342                FileSystem::translateSlashes(pegasusHome);
343            
344 mike  1.32     // on Windows NT if there are no command-line options, run as a service
345            
346                if (argc == 1 )
347 mike  1.35     {
348                  cim_server_service(argc, argv);
349                }
350                else
351                {
352                    // Get help, version and home options
353            
354                    for (int i = 1; i < argc; )
355                    {
356                        const char* arg = argv[i];
357            
358                        // Check for -option
359                        if (*arg == '-')
360                        {
361                            // Get the option
362                            const char* option = arg + 1;
363            
364                            //
365                            // Check to see if user asked for the version (-v option):
366                            //
367                            if (*option == OPTION_VERSION)
368 mike  1.35                 {
369                                cout << PEGASUS_VERSION << endl;
370                                exit(0);
371                            }
372                            //
373                            // Check to see if user asked for help (-h option):
374                            //
375                            else if (*option == OPTION_HELP)
376                            {
377                                PrintHelp(argv[0]);
378                                exit(0);
379                            }
380                            else if (*option == OPTION_HOME)
381                            {
382                                if (i + 1 < argc) 
383                                {
384                                    pegasusHome.assign(argv[i + 1]);
385                                }
386                                else
387                                {
388                                    cout << "Missing argument for option -" << option << endl;
389 mike  1.35                         exit(0);
390                                }
391            
392                                memmove(&argv[i], &argv[i + 2], (argc-i-1) * sizeof(char*));
393                                argc -= 2;
394                            }
395                            //
396                            // Check to see if user asked for shutdown (-s option):
397                            //
398                            else if (*option == OPTION_SHUTDOWN)
399                            {
400                                //
401                                // Check to see if shutdown has already been specified:
402                                //
403                                if (shutdownOption)
404                                {
405                                    cout << "Duplicate shutdown option specified." << endl;
406                                    exit(0);
407                                }
408                                shutdownOption = true;
409             
410 mike  1.35                     // remove the option from the command line
411                                memmove(&argv[i], &argv[i + 1], (argc-i) * sizeof(char*));
412                                argc--;   
413                            }
414                            else if (*option == OPTION_FORCE)
415                            {
416                                //
417                                // Check to see if shutdown has been specified:
418                                //
419                                if (!shutdownOption)
420                                {
421                                    cout << "Invalid option -" << option << endl;
422                                    exit(0);
423                                }
424            
425                                //
426                                // Check to see if force has already been specified:
427                                //
428                                if (forceOption)
429                                {
430                                    cout << "Duplicate force option specified." << endl;
431 mike  1.35                         exit(0);
432                                }
433            
434                                forceOption = true;
435             
436                                // remove the option from the command line
437                                memmove(&argv[i], &argv[i + 1], (argc-i) * sizeof(char*));
438                                argc--;   
439                            }
440                            else if (*option == OPTION_TIMEOUT)
441                            {
442                                //
443                                // Check to see if shutdown has been specified:
444                                //
445                                if (!shutdownOption)
446                                {
447                                    cout << "Invalid option -" << option << endl;
448                                    exit(0);
449                                }
450            
451                                if (timeoutOption)
452 mike  1.35                     {
453                                    cout << "Duplicate timeout option specified." << endl;
454                                    exit(0);
455                                }
456            
457                                timeoutOption = true;
458            
459                                if (i + 1 < argc)
460                                {
461                                    // get timeout value
462                                    timeoutStr.assign(argv[i + 1]);
463            
464                                    // validate timeout value string
465                                    char* tmp = timeoutStr.allocateCString();
466                                    char* end = 0;
467                                    timeoutValue  = strtol(tmp, &end, 10);
468                                  
469                                    if (!end || *end != '\0')
470                                    {
471                                        cout << "invalid timeout value specified: ";
472                                        cout << timeoutStr << endl;
473 mike  1.35                             delete [] tmp;
474                                        exit(0);
475                                    }
476                                }
477                                else
478                                {
479                                    cout << "Missing argument for option -";
480                                    cout << option << endl;
481                                    exit(0);
482                                }
483            
484                                // remove the option from the command line
485                                memmove(&argv[i], &argv[i + 2], (argc-i-1) * sizeof(char*));
486                                argc -= 2;
487                            }
488                            else
489                                i++;
490                        }
491                        else
492                            i++;
493 mike  1.32         }
494                }
495 mike  1.35 
496 kumpf 1.38     //
497                // Set the value for pegasusHome property
498                //
499                ConfigManager::setPegasusHome(pegasusHome);
500 mike  1.32 
501 mike  1.35     //
502                // Get an instance of the Config Manager.
503                //
504                configManager = ConfigManager::getInstance();
505            
506                //
507 mike  1.32     // Get options (from command line and from configuration file); this
508 mike  1.35     // removes corresponding options and their arguments from the command
509 mike  1.32     // line.
510 mike  1.35     //
511 mike  1.32     try
512                {
513 mike  1.35         GetOptions(configManager, argc, argv, pegasusHome);
514 mike  1.32     }
515                catch (Exception& e)
516                {
517 mike  1.35         cerr << argv[0] << ": " << e.getMessage() << endl;
518                    exit(1);
519 mike  1.32     }
520            
521            
522 mike  1.35     try
523 mike  1.32     {
524 mike  1.35         //
525                    // Check to see if we should (can) install as a NT service
526                    //
527            
528                    if (String::equal(configManager->getCurrentValue("install"), "true"))
529                    {
530                        if( 0 != cimserver_install_nt_service( pegasusHome ))
531                        {
532                            cout << "\nPegasus installed as NT Service";
533                            exit(0);
534                        }
535                    }
536 mike  1.32 
537 mike  1.35         //
538                    // Check to see if we should (can) remove Pegasus as an NT service
539                    //
540            
541                    if (String::equal(configManager->getCurrentValue("remove"), "true"))
542                    {
543                        if( 0 != cimserver_remove_nt_service() )
544                        {
545                            cout << "\nPegasus removed as NT Service";
546                            exit(0);
547                        }
548                    }
549 mike  1.32 
550 mike  1.35         //
551                    // Check to see if we should Pegasus as a daemon
552                    //
553            
554                    if (String::equal(configManager->getCurrentValue("daemon"), "true"))
555                    {
556                        daemonOption = true;
557                    }
558 mike  1.32 
559 mike  1.35         //
560 kumpf 1.36         // Check the log trace options and set global variable
561                    //
562            
563                    if (String::equal(configManager->getCurrentValue("logtrace"), "true"))
564                    {
565                        pegasusIOLog = true;
566                    }
567            
568                    // Get the log file directory definition.
569                    // We put String into Cstring because
570                    // Directory functions only handle Cstring.
571                    // ATTN-KS: create String based directory functions.
572            
573                    logsDirectory = configManager->getCurrentValue("logdir");
574 kumpf 1.38         logsDirectory = 
575            	    ConfigManager::getHomedPath(configManager->getCurrentValue("logdir"));
576 kumpf 1.36 
577                    // Set up the Logger. This does not open the logs
578                    // Might be more logical to clean before set.
579                    // ATTN: Need tool to completely disable logging.
580            
581                    Logger::setHomeDirectory(logsDirectory);
582            
583                    //
584 mike  1.35         // Check to see if we need to shutdown CIMOM 
585                    //
586                    if (shutdownOption)
587                    {
588                        //
589                        // if timeout was specified, validate the timeout value 
590                        //
591                        if (timeoutOption)
592                        {
593                            Boolean valid = configManager->validatePropertyValue(
594                                                         PROPERTY_TIMEOUT,
595                                                         timeoutStr);
596                            if (!valid)
597                            {
598                                cout << "Invalid timeout value specified: " << timeoutValue;
599                                cout << endl;
600                                exit(1);
601                            }
602                        }
603            
604 kumpf 1.36             shutdownCIMOM(forceOption, timeoutValue);
605 mike  1.35             cout << "Pegasus CIM Server terminated." << endl;
606                        exit(0);
607                    }
608 mike  1.32 
609 mike  1.35         //
610                    // Grab the port option:
611                    //
612            
613                    portOption = configManager->getCurrentValue("port");
614            
615                    //
616                    // Check the trace options and set global variable
617                    //
618            
619                    if (String::equal(configManager->getCurrentValue("trace"), "true"))
620                    {
621                        pegasusIOTrace = true;
622                        cout << "Trace Set" << endl;
623                    }
624            
625 kumpf 1.36         // Leave this in until people get familiar with the logs.
626                    cout << "Logs Directory = " << logsDirectory << endl;
627 mike  1.35 
628                    if (String::equal(configManager->getCurrentValue("cleanlogs"), "true"))
629                    {
630                        Logger::clean(logsDirectory);;
631                    }
632 mike  1.32 
633 mike  1.35         if (String::equal(configManager->getCurrentValue("slp"), "true"))
634                    {
635                        useSLP =  true;
636                    }
637 mike  1.32 
638 mike  1.35         if (String::equal(configManager->getCurrentValue("SSL"), "true"))
639                    {
640                        useSSL =  true;
641                    }
642 mike  1.32     }
643 mike  1.35     catch (UnrecognizedConfigProperty e)
644 mike  1.32     {
645 mike  1.35         cout << "Error: " << e.getMessage() << endl;
646 mike  1.32     }
647            
648                char* address = portOption.allocateCString();
649            
650                // Put out startup up message.
651                cout << PEGASUS_NAME << PEGASUS_VERSION <<
652            	 " on port " << address << endl;
653                cout << "Built " << __DATE__ << " " << __TIME__ << endl;
654                cout <<"Started..."
655            	 << (pegasusIOTrace ? " Tracing to Display ": " ") 
656                     << (pegasusIOLog ? " Tracing to Log ": " ")
657            	 << (useSLP ? " SLP reg. " : " No SLP ")
658 mike  1.35          << (useSSL ? " Use SSL " : " No SSL ")
659 mike  1.32 	<< endl;
660            
661                // Put server start message to the logger
662                Logger::put(Logger::STANDARD_LOG, "CIMServer", Logger::INFORMATION,
663 mike  1.35 	"Start $0 $1 port $2 $3 $4 $5",
664 mike  1.32 		PEGASUS_NAME, 
665            		PEGASUS_VERSION,
666            		address,
667            		(pegasusIOTrace ? " Tracing": " "),
668 mike  1.35 		(useSLP ? " SLP on " : " SLP off "),
669                            (useSSL ? " Use SSL " : " No SSL "));
670 mike  1.32 
671 mike  1.35     // do we need to run as a daemon ?
672                if (daemonOption)
673                {
674                    if(-1 == cimserver_fork())
675                      exit(-1);
676                }
677 mike  1.32 
678                // try loop to bind the address, and run the server
679                try
680                {
681 mike  1.35 #ifndef PEGASUS_OS_ZOS
682 mike  1.32       	slp_client *discovery = new slp_client() ;;
683                    String serviceURL;
684            	serviceURL.assign("service:cim.pegasus://");
685            	String host_name = slp_get_host_name();
686            	serviceURL += host_name;
687            	serviceURL += ":";
688            	serviceURL += address;
689            	char *url = serviceURL.allocateCString();
690            	//	free(host_name);
691 mike  1.35 #endif
692 mike  1.32 
693 mike  1.35 	Monitor monitor;
694 kumpf 1.38 	CIMServer server(&monitor, useSSL);
695 mike  1.35 		
696 mike  1.32 	// bind throws an exception of the bind fails
697 mike  1.33 	cout << "Binding to " << address << endl;
698 mike  1.35 
699            	char* end = 0;
700            	long portNumber = strtol(address, &end, 10);
701            	assert(end != 0 && *end == '\0');
702            	server.bind(portNumber);
703            
704 mike  1.32 	delete [] address;
705            
706            	time_t last = 0;
707 mike  1.35 
708                    //
709                    // Loop to call CIMServer's runForever() method until CIMServer
710                    // has been shutdown
711                    //
712            	while( !server.terminated() )
713 mike  1.32 	{
714 mike  1.35 #ifndef PEGASUS_OS_ZOS
715 mike  1.32 	  if(useSLP  ) 
716            	  {
717            	    if(  (time(NULL) - last ) > 60 ) 
718            	    {
719            	      if( discovery != NULL && url != NULL )
720            		discovery->srv_reg_all(url,  
721 mike  1.35 				       "(namespace=root/cimv2)",
722 mike  1.32 				       "service:cim.pegasus", 
723            				       "DEFAULT", 
724            				       70) ;
725            	      time(&last);
726            	    }
727            	  
728            	    discovery->service_listener();
729            	  }
730 mike  1.35 #endif
731 mike  1.32 	  server.runForever();
732            	}
733            
734 mike  1.34 	// This statement is unrechable!
735            	//
736            	// Logger::put(Logger::STANDARD_LOG, "CIMServer", Logger::INFORMATION,
737            	//   "Normal Termination");
738 mike  1.32     }
739                catch(Exception& e)
740                {
741            	Logger::put(Logger::STANDARD_LOG, "CIMServer", Logger::INFORMATION,
742            	    "Abnormal Termination $0", e.getMessage());
743            	
744            	PEGASUS_STD(cerr) << "Error: " << e.getMessage() << PEGASUS_STD(endl);
745                }
746            
747                return 0;
748            }

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2