(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/Server/ShutdownService.h>
 92 kumpf 1.38 #include <Pegasus/Common/Destroyer.h>
 93 mike  1.35 #ifndef PEGASUS_OS_ZOS
 94 mike  1.32 #include <slp/slp.h>
 95 mike  1.35 #endif
 96 mike  1.32 
 97            
 98            #if defined(PEGASUS_OS_TYPE_WINDOWS)
 99            # include "cimserver_windows.cpp"
100            #elif defined(PEGASUS_OS_TYPE_UNIX)
101            # include "cimserver_unix.cpp"
102            #else
103            # error "Unsupported platform"
104            #endif
105            
106            PEGASUS_USING_PEGASUS;
107            PEGASUS_USING_STD;
108            
109 mike  1.35 //
110            //  The command name.
111            //
112            static const char COMMAND_NAME []    = "cimserver";
113            
114            //
115            //  The constant defining usage string.
116            //
117            static const char USAGE []           = "Usage: ";
118            
119            /**
120            Constants representing the command line options.
121            */
122            static const char OPTION_VERSION     = 'v';
123            
124            static const char OPTION_HELP        = 'h';
125            
126            static const char OPTION_HOME        = 'D';
127            
128            static const char OPTION_SHUTDOWN    = 's';
129            
130 mike  1.35 static const char OPTION_FORCE       = 'f';
131            
132            static const char OPTION_TIMEOUT     = 'T';
133            
134            static const String NAMESPACE = "root/cimv2";
135            static const String CLASSNAME_SHUTDOWNSERVICE = "PG_ShutdownService";
136 kumpf 1.36 static const String PROPERTY_TIMEOUT = "operationTimeout";
137 mike  1.35 
138            ConfigManager*    configManager;
139            
140 mike  1.32 /** GetOptions function - This function defines the Options Table
141 mike  1.35     and sets up the options from that table using the config manager.
142 mike  1.32 */
143            void GetOptions(
144 mike  1.35     ConfigManager* cm,
145 mike  1.32     int& argc,
146                char** argv,
147                const String& pegasusHome)
148            {
149 mike  1.35     try
150 mike  1.32     {
151 kumpf 1.38         cm->mergeConfigFiles();
152 mike  1.33 
153 mike  1.35         cm->mergeCommandLine(argc, argv);
154                }
155                catch (NoSuchFile nsf)
156                {
157                    throw nsf;
158                }
159                catch (FileNotReadable fnr)
160                {
161                    throw fnr;
162                }
163                catch (CannotRenameFile ftrf)
164                {
165                    throw ftrf;
166                }
167                catch (ConfigFileSyntaxError cfse)
168                {
169                    throw cfse;
170                }
171                catch(UnrecognizedConfigProperty ucp)
172                {
173                    throw ucp;
174 mike  1.35     }
175                catch(InvalidPropertyValue ipv)
176                {
177                    throw ipv;
178                }
179 mike  1.32 }
180            
181            /* PrintHelp - This is temporary until we expand the options manager to allow
182               options help to be defined with the OptionRow entries and presented from
183               those entries.
184            */
185            void PrintHelp(const char* arg0)
186            {
187 mike  1.35     /**
188                    Build the usage string for the config command.
189                */
190                String usage = String (USAGE);
191                usage.append (COMMAND_NAME);
192                usage.append (" [ [ options ] | [ configProperty=value, ... ] ]\n");
193                usage.append ("  options\n");
194                usage.append ("    -v          - displays pegasus version number\n");
195                usage.append ("    -h          - prints this help message\n");
196                usage.append ("    -D [home]   - sets pegasus home directory\n");
197                usage.append ("    -t          - turns tracing on\n");
198                usage.append ("    -t          - turns on trace of client IO to console\n");
199                usage.append ("    -l          - turns on trace of client IO to trace file\n");
200                usage.append ("    -d          - runs pegasus as a daemon\n");
201                usage.append ("    -s [-f] [-T timeout] \n");
202                usage.append ("                - shuts down pegasus\n");
203                usage.append ("    -cleanlogs  - clears the log files at startup\n");
204                usage.append ("    -install    - installs pegasus as a Windows NT Service\n");
205                usage.append ("    -remove     - removes pegasus as a Windows NT Service\n");
206                usage.append ("    -slp        - registers pegasus as a service with SLP\n\n");
207                usage.append ("    -SSL        - uses SSL\n\n");
208 mike  1.35 
209                usage.append ("  configProperty=value\n");
210                usage.append ("    port=nnnn            - sets port number to listen on\n");
211                usage.append ("    logdir=/pegasus/logs - directory for log files\n");
212            
213                cout << endl;
214 mike  1.32     cout << PEGASUS_NAME << PEGASUS_VERSION << endl;
215                cout << endl;
216 mike  1.35     cout << usage << endl;
217            }
218            
219 kumpf 1.36 void shutdownCIMOM(Boolean forceOption, Uint32 timeoutValue)
220 mike  1.35 {
221                //
222                // Create CIMClient object
223                //
224 kumpf 1.42     CIMClient client;
225 mike  1.35 
226                //
227                // Get the port number
228                //
229                String portNumberStr = configManager->getCurrentValue("port");
230            
231                String hostStr = System::getHostName();
232                hostStr.append(":");
233                hostStr.append(portNumberStr);
234            
235 kumpf 1.36     // Put server shutdown message to the logger
236                Logger::put(Logger::STANDARD_LOG, "CIMServer", Logger::INFORMATION,
237            	"Shutdown $0 on port $1.", PEGASUS_NAME, portNumberStr);
238            
239 mike  1.35     //
240                // open connection to CIMOM 
241                //
242                try
243                {
244                    client.connect(hostStr.allocateCString());
245                }
246                catch(Exception& e)
247                {
248 kumpf 1.36         Logger::put(Logger::STANDARD_LOG, "CIMServer", Logger::INFORMATION,
249                        "Failed to connect to $0 $1.", PEGASUS_NAME, e.getMessage());
250            
251 mike  1.35         PEGASUS_STD(cerr) << "Failed to connect to server: " << e.getMessage() << PEGASUS_STD(endl);
252                    exit(1);
253                }
254            
255                try
256                {
257                    //
258                    // construct CIMReference 
259                    //
260                    String referenceStr = "//";
261                    referenceStr.append(hostStr);
262                    referenceStr.append("/root/cimv2:PG_ShutdownService");
263                    CIMReference reference(referenceStr);
264            
265                    //
266                    // issue the invokeMethod request on the shutdown method
267                    //
268                    Array<CIMParamValue> inParams;
269                    Array<CIMParamValue> outParams;
270            
271 kumpf 1.40         inParams.append(CIMParamValue("force",
272 kumpf 1.39             CIMValue(Boolean(forceOption))));
273 mike  1.35 
274 kumpf 1.40         inParams.append(CIMParamValue("timeout",
275 kumpf 1.39             CIMValue(Uint32(timeoutValue))));
276 mike  1.35 
277                    CIMValue retValue = client.invokeMethod(
278                        NAMESPACE,
279                        reference,
280                        "shutdown",
281                        inParams,
282                        outParams);
283 kumpf 1.36 
284                    // Put server shutdown message to the logger
285                    Logger::put(Logger::STANDARD_LOG, "CIMServer", Logger::INFORMATION,
286            	    "$0 terminated on port $1.", PEGASUS_NAME, portNumberStr);
287            
288 mike  1.35     }
289                catch(Exception& e)
290                {
291                    PEGASUS_STD(cerr) << "Failed to shutdown server: " << e.getMessage() << PEGASUS_STD(endl);
292                    exit(1);
293                }
294            
295                return;
296 mike  1.32 }
297            
298 mike  1.35 
299 mike  1.33 /////////////////////////////////////////////////////////////////////////
300 mike  1.32 //  MAIN
301            //////////////////////////////////////////////////////////////////////////
302            int main(int argc, char** argv)
303            {
304 mike  1.35     String pegasusHome  = String::EMPTY;
305                Boolean pegasusIOTrace = false;
306                Boolean pegasusIOLog = false;
307                String portOption = String::EMPTY;
308                String logsDirectory = String::EMPTY;
309                Boolean useSLP = false;
310                Boolean useSSL = false;
311                Boolean daemonOption = false;
312                Boolean shutdownOption = false;
313                Boolean forceOption = false;
314                Boolean timeoutOption = false;
315                String  timeoutStr  = String::EMPTY;
316                long timeoutValue  = 0;
317            
318 kumpf 1.38     //
319                // Get environment variables:
320                //
321                const char* tmp = getenv("PEGASUS_HOME");
322            
323                if (tmp)
324                {
325                    pegasusHome = tmp;
326                }
327            
328                FileSystem::translateSlashes(pegasusHome);
329            
330 mike  1.32     // on Windows NT if there are no command-line options, run as a service
331            
332                if (argc == 1 )
333 mike  1.35     {
334                  cim_server_service(argc, argv);
335                }
336                else
337                {
338                    // Get help, version and home options
339            
340                    for (int i = 1; i < argc; )
341                    {
342                        const char* arg = argv[i];
343            
344                        // Check for -option
345                        if (*arg == '-')
346                        {
347                            // Get the option
348                            const char* option = arg + 1;
349            
350                            //
351                            // Check to see if user asked for the version (-v option):
352                            //
353                            if (*option == OPTION_VERSION)
354 mike  1.35                 {
355                                cout << PEGASUS_VERSION << endl;
356                                exit(0);
357                            }
358                            //
359                            // Check to see if user asked for help (-h option):
360                            //
361                            else if (*option == OPTION_HELP)
362                            {
363                                PrintHelp(argv[0]);
364                                exit(0);
365                            }
366                            else if (*option == OPTION_HOME)
367                            {
368                                if (i + 1 < argc) 
369                                {
370                                    pegasusHome.assign(argv[i + 1]);
371                                }
372                                else
373                                {
374                                    cout << "Missing argument for option -" << option << endl;
375 mike  1.35                         exit(0);
376                                }
377            
378                                memmove(&argv[i], &argv[i + 2], (argc-i-1) * sizeof(char*));
379                                argc -= 2;
380                            }
381                            //
382                            // Check to see if user asked for shutdown (-s option):
383                            //
384                            else if (*option == OPTION_SHUTDOWN)
385                            {
386                                //
387                                // Check to see if shutdown has already been specified:
388                                //
389                                if (shutdownOption)
390                                {
391                                    cout << "Duplicate shutdown option specified." << endl;
392                                    exit(0);
393                                }
394                                shutdownOption = true;
395             
396 mike  1.35                     // remove the option from the command line
397                                memmove(&argv[i], &argv[i + 1], (argc-i) * sizeof(char*));
398                                argc--;   
399                            }
400                            else if (*option == OPTION_FORCE)
401                            {
402                                //
403                                // Check to see if shutdown has been specified:
404                                //
405                                if (!shutdownOption)
406                                {
407                                    cout << "Invalid option -" << option << endl;
408                                    exit(0);
409                                }
410            
411                                //
412                                // Check to see if force has already been specified:
413                                //
414                                if (forceOption)
415                                {
416                                    cout << "Duplicate force option specified." << endl;
417 mike  1.35                         exit(0);
418                                }
419            
420                                forceOption = true;
421             
422                                // remove the option from the command line
423                                memmove(&argv[i], &argv[i + 1], (argc-i) * sizeof(char*));
424                                argc--;   
425                            }
426                            else if (*option == OPTION_TIMEOUT)
427                            {
428                                //
429                                // Check to see if shutdown has been specified:
430                                //
431                                if (!shutdownOption)
432                                {
433                                    cout << "Invalid option -" << option << endl;
434                                    exit(0);
435                                }
436            
437                                if (timeoutOption)
438 mike  1.35                     {
439                                    cout << "Duplicate timeout option specified." << endl;
440                                    exit(0);
441                                }
442            
443                                timeoutOption = true;
444            
445                                if (i + 1 < argc)
446                                {
447                                    // get timeout value
448                                    timeoutStr.assign(argv[i + 1]);
449            
450                                    // validate timeout value string
451                                    char* tmp = timeoutStr.allocateCString();
452                                    char* end = 0;
453                                    timeoutValue  = strtol(tmp, &end, 10);
454                                  
455                                    if (!end || *end != '\0')
456                                    {
457                                        cout << "invalid timeout value specified: ";
458                                        cout << timeoutStr << endl;
459 mike  1.35                             delete [] tmp;
460                                        exit(0);
461                                    }
462                                }
463                                else
464                                {
465                                    cout << "Missing argument for option -";
466                                    cout << option << endl;
467                                    exit(0);
468                                }
469            
470                                // remove the option from the command line
471                                memmove(&argv[i], &argv[i + 2], (argc-i-1) * sizeof(char*));
472                                argc -= 2;
473                            }
474                            else
475                                i++;
476                        }
477                        else
478                            i++;
479 mike  1.32         }
480                }
481 mike  1.35 
482 kumpf 1.38     //
483                // Set the value for pegasusHome property
484                //
485                ConfigManager::setPegasusHome(pegasusHome);
486 mike  1.32 
487 mike  1.35     //
488                // Get an instance of the Config Manager.
489                //
490                configManager = ConfigManager::getInstance();
491            
492                //
493 mike  1.32     // Get options (from command line and from configuration file); this
494 mike  1.35     // removes corresponding options and their arguments from the command
495 mike  1.32     // line.
496 mike  1.35     //
497 mike  1.32     try
498                {
499 mike  1.35         GetOptions(configManager, argc, argv, pegasusHome);
500 mike  1.32     }
501                catch (Exception& e)
502                {
503 mike  1.35         cerr << argv[0] << ": " << e.getMessage() << endl;
504                    exit(1);
505 mike  1.32     }
506            
507            
508 mike  1.35     try
509 mike  1.32     {
510 mike  1.35         //
511                    // Check to see if we should (can) install as a NT service
512                    //
513            
514                    if (String::equal(configManager->getCurrentValue("install"), "true"))
515                    {
516                        if( 0 != cimserver_install_nt_service( pegasusHome ))
517                        {
518                            cout << "\nPegasus installed as NT Service";
519                            exit(0);
520                        }
521                    }
522 mike  1.32 
523 mike  1.35         //
524                    // Check to see if we should (can) remove Pegasus as an NT service
525                    //
526            
527                    if (String::equal(configManager->getCurrentValue("remove"), "true"))
528                    {
529                        if( 0 != cimserver_remove_nt_service() )
530                        {
531                            cout << "\nPegasus removed as NT Service";
532                            exit(0);
533                        }
534                    }
535 mike  1.32 
536 mike  1.35         //
537                    // Check to see if we should Pegasus as a daemon
538                    //
539            
540                    if (String::equal(configManager->getCurrentValue("daemon"), "true"))
541                    {
542                        daemonOption = true;
543                    }
544 mike  1.32 
545 mike  1.35         //
546 kumpf 1.36         // Check the log trace options and set global variable
547                    //
548            
549                    if (String::equal(configManager->getCurrentValue("logtrace"), "true"))
550                    {
551                        pegasusIOLog = true;
552                    }
553            
554                    // Get the log file directory definition.
555                    // We put String into Cstring because
556                    // Directory functions only handle Cstring.
557                    // ATTN-KS: create String based directory functions.
558            
559                    logsDirectory = configManager->getCurrentValue("logdir");
560 kumpf 1.38         logsDirectory = 
561            	    ConfigManager::getHomedPath(configManager->getCurrentValue("logdir"));
562 kumpf 1.36 
563                    // Set up the Logger. This does not open the logs
564                    // Might be more logical to clean before set.
565                    // ATTN: Need tool to completely disable logging.
566            
567                    Logger::setHomeDirectory(logsDirectory);
568            
569                    //
570 mike  1.35         // Check to see if we need to shutdown CIMOM 
571                    //
572                    if (shutdownOption)
573                    {
574                        //
575                        // if timeout was specified, validate the timeout value 
576                        //
577                        if (timeoutOption)
578                        {
579                            Boolean valid = configManager->validatePropertyValue(
580                                                         PROPERTY_TIMEOUT,
581                                                         timeoutStr);
582                            if (!valid)
583                            {
584                                cout << "Invalid timeout value specified: " << timeoutValue;
585                                cout << endl;
586                                exit(1);
587                            }
588                        }
589            
590 kumpf 1.36             shutdownCIMOM(forceOption, timeoutValue);
591 mike  1.35             cout << "Pegasus CIM Server terminated." << endl;
592                        exit(0);
593                    }
594 mike  1.32 
595 mike  1.35         //
596                    // Grab the port option:
597                    //
598            
599                    portOption = configManager->getCurrentValue("port");
600            
601                    //
602                    // Check the trace options and set global variable
603                    //
604            
605                    if (String::equal(configManager->getCurrentValue("trace"), "true"))
606                    {
607                        pegasusIOTrace = true;
608                        cout << "Trace Set" << endl;
609                    }
610            
611 kumpf 1.36         // Leave this in until people get familiar with the logs.
612                    cout << "Logs Directory = " << logsDirectory << endl;
613 mike  1.35 
614                    if (String::equal(configManager->getCurrentValue("cleanlogs"), "true"))
615                    {
616                        Logger::clean(logsDirectory);;
617                    }
618 mike  1.32 
619 mike  1.35         if (String::equal(configManager->getCurrentValue("slp"), "true"))
620                    {
621                        useSLP =  true;
622                    }
623 mike  1.32 
624 mike  1.35         if (String::equal(configManager->getCurrentValue("SSL"), "true"))
625                    {
626                        useSSL =  true;
627                    }
628 mike  1.32     }
629 mike  1.35     catch (UnrecognizedConfigProperty e)
630 mike  1.32     {
631 mike  1.35         cout << "Error: " << e.getMessage() << endl;
632 mike  1.32     }
633            
634                char* address = portOption.allocateCString();
635            
636                // Put out startup up message.
637                cout << PEGASUS_NAME << PEGASUS_VERSION <<
638            	 " on port " << address << endl;
639                cout << "Built " << __DATE__ << " " << __TIME__ << endl;
640                cout <<"Started..."
641            	 << (pegasusIOTrace ? " Tracing to Display ": " ") 
642                     << (pegasusIOLog ? " Tracing to Log ": " ")
643            	 << (useSLP ? " SLP reg. " : " No SLP ")
644 mike  1.35          << (useSSL ? " Use SSL " : " No SSL ")
645 mike  1.32 	<< endl;
646            
647                // Put server start message to the logger
648                Logger::put(Logger::STANDARD_LOG, "CIMServer", Logger::INFORMATION,
649 mike  1.35 	"Start $0 $1 port $2 $3 $4 $5",
650 mike  1.32 		PEGASUS_NAME, 
651            		PEGASUS_VERSION,
652            		address,
653            		(pegasusIOTrace ? " Tracing": " "),
654 mike  1.35 		(useSLP ? " SLP on " : " SLP off "),
655                            (useSSL ? " Use SSL " : " No SSL "));
656 mike  1.32 
657 mike  1.35     // do we need to run as a daemon ?
658                if (daemonOption)
659                {
660                    if(-1 == cimserver_fork())
661                      exit(-1);
662                }
663 mike  1.32 
664                // try loop to bind the address, and run the server
665                try
666                {
667 mike  1.35 #ifndef PEGASUS_OS_ZOS
668 mike  1.32       	slp_client *discovery = new slp_client() ;;
669                    String serviceURL;
670            	serviceURL.assign("service:cim.pegasus://");
671            	String host_name = slp_get_host_name();
672            	serviceURL += host_name;
673            	serviceURL += ":";
674            	serviceURL += address;
675            	char *url = serviceURL.allocateCString();
676            	//	free(host_name);
677 mike  1.35 #endif
678 mike  1.32 
679 mike  1.35 	Monitor monitor;
680 kumpf 1.38 	CIMServer server(&monitor, useSSL);
681 kumpf 1.41 
682            	// bind throws an exception if the bind fails
683            #ifdef PEGASUS_LOCAL_DOMAIN_SOCKET
684            	cout << "Binding to domain socket" << endl;
685            #else
686 mike  1.33 	cout << "Binding to " << address << endl;
687 kumpf 1.41 #endif
688 mike  1.35 
689            	char* end = 0;
690            	long portNumber = strtol(address, &end, 10);
691            	assert(end != 0 && *end == '\0');
692            	server.bind(portNumber);
693            
694 mike  1.32 	delete [] address;
695            
696            	time_t last = 0;
697 mike  1.35 
698                    //
699                    // Loop to call CIMServer's runForever() method until CIMServer
700                    // has been shutdown
701                    //
702            	while( !server.terminated() )
703 mike  1.32 	{
704 mike  1.35 #ifndef PEGASUS_OS_ZOS
705 mike  1.32 	  if(useSLP  ) 
706            	  {
707            	    if(  (time(NULL) - last ) > 60 ) 
708            	    {
709            	      if( discovery != NULL && url != NULL )
710            		discovery->srv_reg_all(url,  
711 mike  1.35 				       "(namespace=root/cimv2)",
712 mike  1.32 				       "service:cim.pegasus", 
713            				       "DEFAULT", 
714            				       70) ;
715            	      time(&last);
716            	    }
717            	  
718            	    discovery->service_listener();
719            	  }
720 mike  1.35 #endif
721 mike  1.32 	  server.runForever();
722            	}
723            
724 mike  1.34 	// This statement is unrechable!
725            	//
726            	// Logger::put(Logger::STANDARD_LOG, "CIMServer", Logger::INFORMATION,
727            	//   "Normal Termination");
728 mike  1.32     }
729                catch(Exception& e)
730                {
731            	Logger::put(Logger::STANDARD_LOG, "CIMServer", Logger::INFORMATION,
732            	    "Abnormal Termination $0", e.getMessage());
733            	
734            	PEGASUS_STD(cerr) << "Error: " << e.getMessage() << PEGASUS_STD(endl);
735                }
736            
737                return 0;
738            }

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2