This commit is contained in:
biosvos
2026-08-07 17:38:18 +09:00
commit 873193a243
9613 changed files with 2755992 additions and 0 deletions
+146
View File
@@ -0,0 +1,146 @@
/****************************************************************************
rc_mond config processing module
-----------------------------------------
begin : 2015/06/03
copyright : (C) 2005 Solbox Inc.
author : Dev Storage team
email : huibong@solbox.com
version : 3.5
CopyRight(C) 2005 Solbox Inc. All Rights reserved.
Redistribution and use in source and binary forms, with or with out
modification, are not permitted in outside of Solbox Inc.
*****************************************************************************/
#ifndef __PROCESS_CONFIG_H__
#define __PROCESS_CONFIG_H__
#include <string>
#include "Config.h"
// 본 모듈은 conf 파일의 정보를 read 하여... 본 프로세스 관련 설정 정보를 저장한다.
// 본 모듈은 singleton 으로 동작시켜 Main 프로세스 및 Worker 프로세스에서도 접근이 가능토록 한다.
// conf 파일에 대한 파싱 및 설정 정보 추출은 lib 하위의 Config 클래스를 이용한다.
// 본 객체는 singleton 객체이므로 상속받아 사용하지 않도록 한다. ( 상속받아 사용할 수 없도록 private 처리함 )
class CProcessConfig
{
private:
// sigleton 객체 생성을 위해 생성자를 public 으로 처리하지 않음.
CProcessConfig();
// 소멸자
virtual ~CProcessConfig();
static CProcessConfig * m_pInstance;
public:
// 객체 초기화 처리용 Function.
// 본 함수 호출시 Instance 생성 후 입력 받은 Config 파일 load.
// 따라서 본 함수를 호출하지 않을 경우.. GetInstance() 함수는 NULL 을 반환
// 본 함수를 객체가 생성된 상태에서 재 호출할 경우
// - 주어진 Conf 파일 정보가 정확하다면.. conf 정보를 다시 load 함.
// - 주어진 conf 파일 정보가 부정확하다면... 이전 conf 를 계속 사용함.
static bool Init( const std::string strProgramName, const std::string & strConfFileName, std::string & strErrorMessage );
// Singleton 객체 접근 메소드
static CProcessConfig * GetInstance();
private:
// 전달받은 conf 파일에서 해당 config 정보를 로드하여 멤버 변수에 저장한다.
// 만약 반환값이 false 인 경우 해당 오류 관련 내역은 strErrorMessage 변수에 저장된다.
bool Load( const std::string & strProgramName, const std::string & strConfFileName, std::string & strErrorMessage );
// Config 객체로 부터 지정된 strKey 정보를 가져와 유효성 여부를 판단.
// 반환값이 false 인 경우 strErrorMessage 상에 오류 내역이 저장된다.
bool GetConfigValue( Config & conf, const std::string & strProgramName, const std::string strKey, std::string & strValue, std::string & strErrorMessage );
private:
// 객체 초기화시 전달받은 정보
std::string m_strConfigFileName; // 설정 파일 정보
std::string m_strProgramName; // 프로그램 명 (conf 상에서 해당 프로그램의 설정 정보를 가져올 때 사용)
// 기본 설정 정보.
std::string m_strLogPath; // 로그 저장 Path (/user/service/logs)
int m_nLogLevel; // 로그 기록 Level
std::string m_strRcId; // RC ID
std::string m_strRcdbIp; // RCDB IP
unsigned int m_nRcdbPort; // RCDB Port
std::string m_strRcdbName; // RCDB DB Name
std::string m_strRcdbAcct; // RCDB 접근 계정
std::string m_strRcdbAcctPw; // RCDB 접근 Password.
// FHS 의 vmasd 에서 Broadcasting 하는 UDP Data 수신을 위한 UDP Port = 13201
// 0 일 경우.. Broadcasting recv 기능을 사용하지 않는 것으로 판단한다.
unsigned int m_nFhsBroadcastRecvPort;
// 프로세스 설정 정보
// FHS csagentd 가 전송하는 FHS system 상태 정보 수신을 위한 TCP port = 14003
unsigned int m_nTcpListenPortSystemStat;
// FHS csagentd 가 전송하는 FHS service check 상태 정보 수신을 위한 TCP port = 14004
unsigned int m_nTcpListenPortCheckStat;
// fimngd 등의 Client 요청에 대해 Alive FHS 목록 등의 결과 전달을 위한 listen 할 TCP port = 14005
unsigned int m_nTcpListenPortSendInfo;
std::string m_strGmsServer; // GMS new_sh_statusd server domain
unsigned int m_nGmsPortStat; // GMS new_sh_statusd server tcp port
// 업로드 방지 처리 관련 Storage 최대 사용량 설정값. (%)
int m_nStorageMaxUsageToDisable;
// 2018-01-11 NEW huibong 메모리 사용량 초과시 report 기능 추가 (#31360, #31679)
// - FHS memory 사용량(%) check 를 위한 설정값 (%)
int m_nReportMemoryMaxUsage;
public: // 멤버 변수에 대한 Get 함수 선언 및 정의
const char * GetConfigFileName() { return m_strConfigFileName.c_str(); }
const char * GetProgramName() { return m_strProgramName.c_str(); }
const char * GetLogPath() { return m_strLogPath.c_str(); }
int GetLogLevel() { return m_nLogLevel; }
const char * GetRcId() { return m_strRcId.c_str(); }
const char * GetRcdbIp() { return m_strRcdbIp.c_str(); }
unsigned int GetRcdbPort() { return m_nRcdbPort; }
const char * GetRcdbName() { return m_strRcdbName.c_str(); }
const char * GetRcdbAcct() { return m_strRcdbAcct.c_str(); }
const char * GetRcdbAcctPw() { return m_strRcdbAcctPw.c_str(); }
unsigned int GetFhsBroadcastRecvPort() { return m_nFhsBroadcastRecvPort; }
unsigned int GetPortRecvSystem() { return m_nTcpListenPortSystemStat; }
unsigned int GetPortRecvCheck() { return m_nTcpListenPortCheckStat; }
unsigned int GetPortSendInfo() { return m_nTcpListenPortSendInfo; }
const char * GetGmsServer() { return m_strGmsServer.c_str(); }
unsigned int GetGmsPortStat() { return m_nGmsPortStat; }
int GetStorageMaxUsageToDisable() { return m_nStorageMaxUsageToDisable; }
int GetReportMemoryMaxUsage() { return m_nReportMemoryMaxUsage; }
};
#endif /* __PROCESS_CONFIG_H__ */