base
This commit is contained in:
@@ -0,0 +1,136 @@
|
||||
/****************************************************************************
|
||||
|
||||
od_statusd : Application status monitoring daemon for OpenDisk service
|
||||
|
||||
CopyRight(C) 2005 SolutionBox Inc. All Rights reserved.
|
||||
Author : Sean Kim (sean@0x31.com)
|
||||
|
||||
$Id: serv_conf.h,v 1.7 2007/02/20 04:31:12 mirshead Exp $
|
||||
|
||||
Redistribution and use in source and binary forms, with or with out
|
||||
modification, are not permitted in outside of SolutionBox Inc.
|
||||
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
#ifndef __SERV_CONF_H__
|
||||
#define __SERV_CONF_H__
|
||||
|
||||
#include <iostream>
|
||||
#include <list>
|
||||
#include <string>
|
||||
#include <mm.h>
|
||||
|
||||
#include "util.h"
|
||||
#include "rconfig.h"
|
||||
#include "address.h"
|
||||
#include "protocol.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace SDSocket;
|
||||
|
||||
#define NumOfServerType 10
|
||||
#define MaxSizeOfServerName 32
|
||||
#define MaxSizeOfServerAddr 16
|
||||
#define MaxSizeOfServerPort 8
|
||||
#define MaxSizeOfServerType 24
|
||||
|
||||
#define MaxSizeOfRCAcctName 32
|
||||
#define MaxSizeOfRCAcctUser 32
|
||||
#define MaxSizeOfRCAcctPassword 32
|
||||
#define MaxSizeOfRCAcctCert 128
|
||||
#define MaxSizeOfRCAcctAuthkey 128
|
||||
|
||||
#define CONFIG_SERV "SERV"
|
||||
#define CONFIG_RCACCT "RCACCT"
|
||||
|
||||
enum eServType
|
||||
{
|
||||
SERV_WWW = 0,
|
||||
SERV_FHS = 1,
|
||||
SERV_RC = 2,
|
||||
SERV_DB = 3
|
||||
};
|
||||
|
||||
const char a_ServType[NumOfServerType][MaxSizeOfServerType]
|
||||
= {"www", "rts", "rc", "ccdb", "rcts", "gts", "rcdb", "gms", "timed", "stat"};
|
||||
|
||||
#define MAX_IP_STRING 17
|
||||
|
||||
typedef struct _ServInfo_e
|
||||
{
|
||||
char * m_pszServName;
|
||||
|
||||
char m_szIpString[MAX_IP_STRING];
|
||||
short m_sPort;
|
||||
//Address m_Address;
|
||||
time_t m_StatChgTime;
|
||||
unsigned int m_Status;
|
||||
unsigned int m_ServType;
|
||||
unsigned int m_DeadCount;
|
||||
char * m_pszDomainName;
|
||||
struct svr_status ss;
|
||||
|
||||
struct _ServInfo_e *next;
|
||||
} servinfo_t;
|
||||
|
||||
typedef struct _RCAcct_e
|
||||
{
|
||||
char * m_pszServiceName;
|
||||
char * m_pszUserName;
|
||||
char * m_pszPassword;
|
||||
char * m_pszAuthkey;
|
||||
char * m_pszCertLocation;
|
||||
|
||||
struct _RCAcct_e *next;
|
||||
} rcacct_t;
|
||||
|
||||
typedef struct _CellInfo
|
||||
{
|
||||
string m_strCellPhone;
|
||||
} cellinfo_t;
|
||||
|
||||
class CLoadServConfig : public Config
|
||||
{
|
||||
public:
|
||||
enum eStatus
|
||||
{
|
||||
ALIVE = 1,
|
||||
DEAD = 2
|
||||
};
|
||||
CLoadServConfig() throw();
|
||||
virtual int GetValue(const char *pzKey, char *pszValue);
|
||||
int LoadServConfig(const char *pszFileName);
|
||||
void clearLoadCount(void) { m_Counter = 0; }
|
||||
int getServerCount(void) { return m_ServerCounter; }
|
||||
int getRCAcctCount(void) { return m_RCAcctCounter; }
|
||||
int GetServerValue(servinfo_t *pServInfo);
|
||||
int GetRCAcctValue(rcacct_t *pRCAcctInfo);
|
||||
int GetCellphoneValue(cellinfo_t *pCellInfo);
|
||||
servinfo_t *getList(void) throw() { return m_pServerList; }
|
||||
void addServerToList(servinfo_t newServInfo) throw();
|
||||
void addRCToList(rcacct_t newAcctInfo) throw();
|
||||
rcacct_t *RCAcctFind(char *name);
|
||||
void addCellphoneToList(cellinfo_t newCellphoneInfo) throw();
|
||||
void InsertServKeyValue(const char *pszKey, const char *pzValue);
|
||||
int UpdateStatus(unsigned int _ServType, eStatus _Status, char *servname);
|
||||
int IncreaseDeadCount(unsigned int _ServType, char *servname);
|
||||
void DumpStatusString(string &strStatus) throw();
|
||||
void DumpPrintAll(void) throw();
|
||||
|
||||
char *getMemory(int size) throw();
|
||||
void releaseMemory(char *ptr) throw();
|
||||
|
||||
private:
|
||||
unsigned int m_RCAcctCounter;
|
||||
unsigned int m_ServerCounter;
|
||||
unsigned int m_Counter;
|
||||
//std::list<servinfo_t> m_ServerList;
|
||||
servinfo_t *m_pServerList;
|
||||
rcacct_t *m_pRCAcctList;
|
||||
std::list<cellinfo_t> m_CellInfo;
|
||||
static Semaphore threadsLock;
|
||||
MM *m_pShm;
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user