xwords/relay/configs.h
ehouse c10a3a7340 Start adding ability to listen on multiple sockets and to dynamically
change the set listened on.  There's still some debugging to do but
nothing that worked before is broken.  Also begin to accept unique
prefixes (e.g. g for get) for commands and attributes on the control
port.  Note that relay-related code in comms seems broken now, but is
without this checkin.
2007-12-01 15:00:30 +00:00

65 lines
2 KiB
C

/* -*-mode: C; fill-column: 78; c-basic-offset: 4; -*- */
/*
* Copyright 2005 by Eric House (xwords@eehouse.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_
#include <string>
#include <vector>
#include "xwrelay_priv.h"
using namespace std;
class RelayConfigs {
public:
static void InitConfigs( const char* confFile );
static RelayConfigs* GetConfigs();
~RelayConfigs() {}
void GetPorts( vector<int>::const_iterator* iter, vector<int>::const_iterator* end);
int GetCtrlPort() { return m_ctrlport; }
int GetNWorkerThreads() { return m_nWorkerThreads; }
time_t GetAllConnectedInterval() { return m_allConnInterval; }
time_t GetHeartbeatInterval() { return m_heartbeatInterval; }
const char* GetServerName() { return m_serverName.c_str(); }
const char* GetIdFileName() { return m_idFileName.c_str(); }
int GetLogLevel(void) { return m_logLevel; }
void SetLogLevel(int ll) { m_logLevel = ll; }
private:
RelayConfigs( const char* cfile );
void parse( const char* fname );
time_t m_allConnInterval;
time_t m_heartbeatInterval;
int m_ctrlport;
vector<int> m_ports;
int m_logLevel;
int m_nWorkerThreads;
string m_serverName;
string m_idFileName;
static RelayConfigs* instance;
};
#endif