xwords/relay/configs.h

60 lines
1.8 KiB
C
Raw Normal View History

2005-09-02 08:35:25 +02:00
/* -*-mode: C; fill-column: 78; c-basic-offset: 4; -*- */
/*
* Copyright 2005 by Eric House (fixin@peak.org). All rights reserved.
*
* This program 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 2
* of the License, or (at your option) any later version.
*
* This program 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 this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef _CONFIGS_H_
#define _CONFIGS_H_
2005-10-01 18:09:57 +02:00
#include <string>
2005-09-02 08:35:25 +02:00
#include "xwrelay_priv.h"
class RelayConfigs {
public:
static void InitConfigs( const char* confFile );
static RelayConfigs* GetConfigs();
~RelayConfigs() {}
2005-09-02 08:35:25 +02:00
int GetPort() { return m_port; }
int GetCtrlPort() { return m_ctrlport; }
int GetNWorkerThreads() { return m_nWorkerThreads; }
time_t GetAllConnectedInterval() { return m_allConnInterval; }
time_t GetHeartbeatInterval() { return m_heartbeatInterval; }
2005-10-01 18:09:57 +02:00
const char* GetServerName() { return m_serverName.c_str(); }
const char* GetIdFileName() { return m_idFileName.c_str(); }
2005-09-02 08:35:25 +02:00
private:
RelayConfigs( const char* cfile );
void parse( const char* fname );
2005-09-02 08:35:25 +02:00
time_t m_allConnInterval;
time_t m_heartbeatInterval;
int m_ctrlport;
int m_port;
int m_nWorkerThreads;
2005-10-01 18:09:57 +02:00
std::string m_serverName;
std::string m_idFileName;
2005-09-02 08:35:25 +02:00
static RelayConfigs* instance;
};
#endif