(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 kumpf 1.40         inParams.append(CIMParamValue("force",
275 kumpf 1.39             CIMValue(Boolean(forceOption))));
276 mike  1.35 
277 kumpf 1.40         inParams.append(CIMParamValue("timeout",
278 kumpf 1.39             CIMValue(Uint32(timeoutValue))));
279 mike  1.35 
280                    CIMValue retValue = client.invokeMethod(
281                        NAMESPACE,
282                        reference,
283                        "shutdown",
284                        inParams,
285                        outParams);
286 kumpf 1.36 
287                    // Put server shutdown message to the logger
288                    Logger::put(Logger::STANDARD_LOG, "CIMServer", Logger::INFORMATION,
289            	    "$0 terminated on port $1.", PEGASUS_NAME, portNumberStr);
290            
291 mike  1.35     }
292                catch(Exception& e)
293                {
294                    PEGASUS_STD(cerr) << "Failed to shutdown server: " << e.getMessage() << PEGASUS_STD(endl);
295                    exit(1);
296                }
297            
298                return;
299 mike  1.32 }
300            
301 mike  1.35 
302 mike  1.33 /////////////////////////////////////////////////////////////////////////
303 mike  1.32 //  MAIN
304            //////////////////////////////////////////////////////////////////////////
305            int main(int argc, char** argv)
306            {
307 mike  1.35     String pegasusHome  = String::EMPTY;
308                Boolean pegasusIOTrace = false;
309                Boolean pegasusIOLog = false;
310                String portOption = String::EMPTY;
311                String logsDirectory = String::EMPTY;
312                Boolean useSLP = false;
313                Boolean useSSL = false;
314                Boolean daemonOption = false;
315                Boolean shutdownOption = false;
316                Boolean forceOption = false;
317                Boolean timeoutOption = false;
318                String  timeoutStr  = String::EMPTY;
319                long timeoutValue  = 0;
320            
321 kumpf 1.38     //
322                // Get environment variables:
323                //
324                const char* tmp = getenv("PEGASUS_HOME");
325            
326                if (tmp)
327                {
328                    pegasusHome = tmp;
329                }
330            
331                FileSystem::translateSlashes(pegasusHome);
332            
333 mike  1.32     // on Windows NT if there are no command-line options, run as a service
334            
335                if (argc == 1 )
336 mike  1.35     {
337                  cim_server_service(argc, argv);
338                }
339                else
340                {
341                    // Get help, version and home options
342            
343                    for (int i = 1; i < argc; )
344                    {
345                        const char* arg = argv[i];
346            
347                        // Check for -option
348                        if (*arg == '-')
349                        {
350                            // Get the option
351                            const char* option = arg + 1;
352            
353                            //
354                            // Check to see if user asked for the version (-v option):
355                            //
356                            if (*option == OPTION_VERSION)
357 mike  1.35                 {
358                                cout << PEGASUS_VERSION << endl;
359                                exit(0);
360                            }
361                            //
362                            // Check to see if user asked for help (-h option):
363                            //
364                            else if (*option == OPTION_HELP)
365                            {
366                                PrintHelp(argv[0]);
367                                exit(0);
368                            }
369                            else if (*option == OPTION_HOME)
370                            {
371                                if (i + 1 < argc) 
372                                {
373                                    pegasusHome.assign(argv[i + 1]);
374                                }
375                                else
376                                {
377                                    cout << "Missing argument for option -" << option << endl;
378 mike  1.35                         exit(0);
379                                }
380            
381                                memmove(&argv[i], &argv[i + 2], (argc-i-1) * sizeof(char*));
382                                argc -= 2;
383                            }
384                            //
385                            // Check to see if user asked for shutdown (-s option):
386                            //
387                            else if (*option == OPTION_SHUTDOWN)
388                            {
389                                //
390                                // Check to see if shutdown has already been specified:
391                                //
392                                if (shutdownOption)
393                                {
394                                    cout << "Duplicate shutdown option specified." << endl;
395                                    exit(0);
396                                }
397                                shutdownOption = true;
398             
399 mike  1.35                     // remove the option from the command line
400                                memmove(&argv[i], &argv[i + 1], (argc-i) * sizeof(char*));
401                                argc--;   
402                            }
403                            else if (*option == OPTION_FORCE)
404                            {
405                                //
406                                // Check to see if shutdown has been specified:
407                                //
408                                if (!shutdownOption)
409                                {
410                                    cout << "Invalid option -" << option << endl;
411                                    exit(0);
412                                }
413            
414                                //
415                                // Check to see if force has already been specified:
416                                //
417                                if (forceOption)
418                                {
419                                    cout << "Duplicate force option specified." << endl;
420 mike  1.35                         exit(0);
421                                }
422            
423                                forceOption = true;
424             
425                                // remove the option from the command line
426                                memmove(&argv[i], &argv[i + 1], (argc-i) * sizeof(char*));
427                                argc--;   
428                            }
429                            else if (*option == OPTION_TIMEOUT)
430                            {
431                                //
432                                // Check to see if shutdown has been specified:
433                                //
434                                if (!shutdownOption)
435                                {
436                                    cout << "Invalid option -" << option << endl;
437                                    exit(0);
438                                }
439            
440                                if (timeoutOption)
441 mike  1.35                     {
442                                    cout << "Duplicate timeout option specified." << endl;
443                                    exit(0);
444                                }
445            
446                                timeoutOption = true;
447            
448                                if (i + 1 < argc)
449                                {
450                                    // get timeout value
451                                    timeoutStr.assign(argv[i + 1]);
452            
453                                    // validate timeout value string
454                                    char* tmp = timeoutStr.allocateCString();
455                                    char* end = 0;
456                                    timeoutValue  = strtol(tmp, &end, 10);
457                                  
458                                    if (!end || *end != '\0')
459                                    {
460                                        cout << "invalid timeout value specified: ";
461                                        cout << timeoutStr << endl;
462 mike  1.35                             delete [] tmp;
463                                        exit(0);
464                                    }
465                                }
466                                else
467                                {
468                                    cout << "Missing argument for option -";
469                                    cout << option << endl;
470                                    exit(0);
471                                }
472            
473                                // remove the option from the command line
474                                memmove(&argv[i], &argv[i + 2], (argc-i-1) * sizeof(char*));
475                                argc -= 2;
476                            }
477                            else
478                                i++;
479                        }
480                        else
481                            i++;
482 mike  1.32         }
483                }
484 mike  1.35 
485 kumpf 1.38     //
486                // Set the value for pegasusHome property
487                //
488                ConfigManager::setPegasusHome(pegasusHome);
489 mike  1.32 
490 mike  1.35     //
491                // Get an instance of the Config Manager.
492                //
493                configManager = ConfigManager::getInstance();
494            
495                //
496 mike  1.32     // Get options (from command line and from configuration file); this
497 mike  1.35     // removes corresponding options and their arguments from the command
498 mike  1.32     // line.
499 mike  1.35     //
500 mike  1.32     try
501                {
502 mike  1.35         GetOptions(configManager, argc, argv, pegasusHome);
503 mike  1.32     }
504                catch (Exception& e)
505                {
506 mike  1.35         cerr << argv[0] << ": " << e.getMessage() << endl;
507                    exit(1);
508 mike  1.32     }
509            
510            
511 mike  1.35     try
512 mike  1.32     {
513 mike  1.35         //
514                    // Check to see if we should (can) install as a NT service
515                    //
516            
517                    if (String::equal(configManager->getCurrentValue("install"), "true"))
518                    {
519                        if( 0 != cimserver_install_nt_service( pegasusHome ))
520                        {
521                            cout << "\nPegasus installed as NT Service";
522                            exit(0);
523                        }
524                    }
525 mike  1.32 
526 mike  1.35         //
527                    // Check to see if we should (can) remove Pegasus as an NT service
528                    //
529            
530                    if (String::equal(configManager->getCurrentValue("remove"), "true"))
531                    {
532                        if( 0 != cimserver_remove_nt_service() )
533                        {
534                            cout << "\nPegasus removed as NT Service";
535                            exit(0);
536                        }
537                    }
538 mike  1.32 
539 mike  1.35         //
540                    // Check to see if we should Pegasus as a daemon
541                    //
542            
543                    if (String::equal(configManager->getCurrentValue("daemon"), "true"))
544                    {
545                        daemonOption = true;
546                    }
547 mike  1.32 
548 mike  1.35         //
549 kumpf 1.36         // Check the log trace options and set global variable
550                    //
551            
552                    if (String::equal(configManager->getCurrentValue("logtrace"), "true"))
553                    {
554                        pegasusIOLog = true;
555                    }
556            
557                    // Get the log file directory definition.
558                    // We put String into Cstring because
559                    // Directory functions only handle Cstring.
560                    // ATTN-KS: create String based directory functions.
561            
562                    logsDirectory = configManager->getCurrentValue("logdir");
563 kumpf 1.38         logsDirectory = 
564            	    ConfigManager::getHomedPath(configManager->getCurrentValue("logdir"));
565 kumpf 1.36 
566                    // Set up the Logger. This does not open the logs
567                    // Might be more logical to clean before set.
568                    // ATTN: Need tool to completely disable logging.
569            
570                    Logger::setHomeDirectory(logsDirectory);
571            
572                    //
573 mike  1.35         // Check to see if we need to shutdown CIMOM 
574                    //
575                    if (shutdownOption)
576                    {
577                        //
578                        // if timeout was specified, validate the timeout value 
579                        //
580                        if (timeoutOption)
581                        {
582                            Boolean valid = configManager->validatePropertyValue(
583                                                         PROPERTY_TIMEOUT,
584                                                         timeoutStr);
585                            if (!valid)
586                            {
587                                cout << "Invalid timeout value specified: " << timeoutValue;
588                                cout << endl;
589                                exit(1);
590                            }
591                        }
592            
593 kumpf 1.36             shutdownCIMOM(forceOption, timeoutValue);
594 mike  1.35             cout << "Pegasus CIM Server terminated." << endl;
595                        exit(0);
596                    }
597 mike  1.32 
598 mike  1.35         //
599                    // Grab the port option:
600                    //
601            
602                    portOption = configManager->getCurrentValue("port");
603            
604                    //
605                    // Check the trace options and set global variable
606                    //
607            
608                    if (String::equal(configManager->getCurrentValue("trace"), "true"))
609                    {
610                        pegasusIOTrace = true;
611                        cout << "Trace Set" << endl;
612                    }
613            
614 kumpf 1.36         // Leave this in until people get familiar with the logs.
615                    cout << "Logs Directory = " << logsDirectory << endl;
616 mike  1.35 
617                    if (String::equal(configManager->getCurrentValue("cleanlogs"), "true"))
618                    {
619                        Logger::clean(logsDirectory);;
620                    }
621 mike  1.32 
622 mike  1.35         if (String::equal(configManager->getCurrentValue("slp"), "true"))
623                    {
624                        useSLP =  true;
625                    }
626 mike  1.32 
627 mike  1.35         if (String::equal(configManager->getCurrentValue("SSL"), "true"))
628                    {
629                        useSSL =  true;
630                    }
631 mike  1.32     }
632 mike  1.35     catch (UnrecognizedConfigProperty e)
633 mike  1.32     {
634 mike  1.35         cout << "Error: " << e.getMessage() << endl;
635 mike  1.32     }
636            
637                char* address = portOption.allocateCString();
638            
639                // Put out startup up message.
640                cout << PEGASUS_NAME << PEGASUS_VERSION <<
641            	 " on port " << address << endl;
642                cout << "Built " << __DATE__ << " " << __TIME__ << endl;
643                cout <<"Started..."
644            	 << (pegasusIOTrace ? " Tracing to Display ": " ") 
645                     << (pegasusIOLog ? " Tracing to Log ": " ")
646            	 << (useSLP ? " SLP reg. " : " No SLP ")
647 mike  1.35          << (useSSL ? " Use SSL " : " No SSL ")
648 mike  1.32 	<< endl;
649            
650                // Put server start message to the logger
651                Logger::put(Logger::STANDARD_LOG, "CIMServer", Logger::INFORMATION,
652 mike  1.35 	"Start $0 $1 port $2 $3 $4 $5",
653 mike  1.32 		PEGASUS_NAME, 
654            		PEGASUS_VERSION,
655            		address,
656            		(pegasusIOTrace ? " Tracing": " "),
657 mike  1.35 		(useSLP ? " SLP on " : " SLP off "),
658                            (useSSL ? " Use SSL " : " No SSL "));
659 mike  1.32 
660 mike  1.35     // do we need to run as a daemon ?
661                if (daemonOption)
662                {
663                    if(-1 == cimserver_fork())
664                      exit(-1);
665                }
666 mike  1.32 
667                // try loop to bind the address, and run the server
668                try
669                {
670 mike  1.35 #ifndef PEGASUS_OS_ZOS
671 mike  1.32       	slp_client *discovery = new slp_client() ;;
672                    String serviceURL;
673            	serviceURL.assign("service:cim.pegasus://");
674            	String host_name = slp_get_host_name();
675            	serviceURL += host_name;
676            	serviceURL += ":";
677            	serviceURL += address;
678            	char *url = serviceURL.allocateCString();
679            	//	free(host_name);
680 mike  1.35 #endif
681 mike  1.32 
682 mike  1.35 	Monitor monitor;
683 kumpf 1.38 	CIMServer server(&monitor, useSSL);
684 kumpf 1.41 
685            	// bind throws an exception if the bind fails
686            #ifdef PEGASUS_LOCAL_DOMAIN_SOCKET
687            	cout << "Binding to domain socket" << endl;
688            #else
689 mike  1.33 	cout << "Binding to " << address << endl;
690 kumpf 1.41 #endif
691 mike  1.35 
692            	char* end = 0;
693            	long portNumber = strtol(address, &end, 10);
694            	assert(end != 0 && *end == '\0');
695            	server.bind(portNumber);
696            
697 mike  1.32 	delete [] address;
698            
699            	time_t last = 0;
700 mike  1.35 
701                    //
702                    // Loop to call CIMServer's runForever() method until CIMServer
703                    // has been shutdown
704                    //
705            	while( !server.terminated() )
706 mike  1.32 	{
707 mike  1.35 #ifndef PEGASUS_OS_ZOS
708 mike  1.32 	  if(useSLP  ) 
709            	  {
710            	    if(  (time(NULL) - last ) > 60 ) 
711            	    {
712            	      if( discovery != NULL && url != NULL )
713            		discovery->srv_reg_all(url,  
714 mike  1.35 				       "(namespace=root/cimv2)",
715 mike  1.32 				       "service:cim.pegasus", 
716            				       "DEFAULT", 
717            				       70) ;
718            	      time(&last);
719            	    }
720            	  
721            	    discovery->service_listener();
722            	  }
723 mike  1.35 #endif
724 mike  1.32 	  server.runForever();
725            	}
726            
727 mike  1.34 	// This statement is unrechable!
728            	//
729            	// Logger::put(Logger::STANDARD_LOG, "CIMServer", Logger::INFORMATION,
730            	//   "Normal Termination");
731 mike  1.32     }
732                catch(Exception& e)
733                {
734            	Logger::put(Logger::STANDARD_LOG, "CIMServer", Logger::INFORMATION,
735            	    "Abnormal Termination $0", e.getMessage());
736            	
737            	PEGASUS_STD(cerr) << "Error: " << e.getMessage() << PEGASUS_STD(endl);
738                }
739            
740                return 0;
741            }

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2