/* * * ProLinga-UI * * Copyright (C) 2002-2008 Xobas Software. * All rights reserved. * * This file is part of ProLinga-UI. * * ProLinga-UI is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * ProLinga-UI is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with ProLinga-UI. If not, see . * * More information is available at the following addresses: * * Website : http://www.prolinga.org * * Email : prolinga-list@prolinga.org * * */ #include "UICommon.h" #include #include #include #include #include "UIConfig.hpp" #include "UIMain.hpp" /* Global Settings */ PlUIPtr uiPtr; //pthread_t mainThreadId = pthread_self(); void ResetUIService(int signo) { /* Close UI */ uiPtr->uiClose(); /* Open UI */ uiPtr->uiOpen(NULL, -1, NULL); } void StopUIService(int signo) { /* Close UI */ uiPtr->uiClose(); /* Exit */ exit(0); } int main(int argc, char *argv[]) { pid_t pid; char *serverHost, *logFile; int serverPort, numThreads = 0, compLevel = 0, logLevel = 0, i=0; PlSoapService sservice; ConfigUIPtr confUIPtr; /* Process command line arguments */ for (i=1;igetStringValue("LogFile", DEF_LOG_FILE); confUIPtr->writeConfig(logFile); /* Get Service parameters */ serverHost = confUIPtr->getStringValue("ServerHost", DEF_SERVER_HOST); serverPort = confUIPtr->getNumberValue("ServerPort", DEF_SERVER_PORT); numThreads = confUIPtr->getNumberValue("NumberOfThreads", DEF_NUMBER_THREADS); compLevel = confUIPtr->getNumberValue("ServerCompressionLevel", DEF_SERVER_COMP_LEVEL); logFile = confUIPtr->getStringValue("LogFile", DEF_LOG_FILE); logLevel = confUIPtr->getNumberValue("LogLevel", DEF_LOG_LEVEL); /* Open UI */ uiPtr->uiOpen(NULL, argc, argv); /*Start the UI Service */ sservice.soapServiceStart(serverHost, serverPort, numThreads, compLevel, logFile, logLevel); /* Close UI */ uiPtr->uiClose(); /* Clean up */ delete confUIPtr; /* Return */ return 0; /* Fork Process */ pid = fork(); if (pid < 0) { printf("Error creating server process\n"); exit(-1); } else if (pid != 0) { /* Parent Process */ exit(0); } else { /* Child Process */ setsid(); umask(0); chdir("/"); /* Get Service parameters */ serverHost = confUIPtr->getStringValue("ServerHost", DEF_SERVER_HOST); serverPort = confUIPtr->getNumberValue("ServerPort", DEF_SERVER_PORT); numThreads = confUIPtr->getNumberValue("NumberOfThreads", DEF_NUMBER_THREADS); compLevel = confUIPtr->getNumberValue("ServerCompressionLevel", DEF_SERVER_COMP_LEVEL); logFile = confUIPtr->getStringValue("LogFile", DEF_LOG_FILE); logLevel = confUIPtr->getNumberValue("LogLevel", DEF_LOG_LEVEL); /* Open UI */ uiPtr->uiOpen(NULL, argc, argv); /*Start the UI Service */ sservice.soapServiceStart(serverHost, serverPort, numThreads, compLevel, logFile, logLevel); /* Close UI */ uiPtr->uiClose(); /* Clean up */ delete confUIPtr; /* Return */ return 0; } }