/**************************************************************************** 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 #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__ */