ZNC  trunk
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
CZNC Class Reference

#include <znc.h>

+ Collaboration diagram for CZNC:

Public Types

enum  ConfigState {
  ECONFIG_NOTHING, ECONFIG_NEED_REHASH, ECONFIG_NEED_WRITE, ECONFIG_NEED_VERBOSE_WRITE,
  ECONFIG_DELAYED_WRITE, ECONFIG_NEED_QUIT
}
 
typedef std::pair< unsigned
long long, unsigned long long > 
TrafficStatsPair
 
typedef std::map< CString,
TrafficStatsPair
TrafficStatsMap
 

Public Member Functions

 CZNC ()
 
 ~CZNC ()
 
 CZNC (const CZNC &)=delete
 
CZNCoperator= (const CZNC &)=delete
 
void DeleteUsers ()
 
void Loop ()
 
bool WritePidFile (int iPid)
 
bool DeletePidFile ()
 
bool WaitForChildLock ()
 
bool IsHostAllowed (const CString &sHostMask) const
 
bool AllowConnectionFrom (const CString &sIP) const
 
void InitDirs (const CString &sArgvPath, const CString &sDataDir)
 
bool OnBoot ()
 
CString ExpandConfigPath (const CString &sConfigFile, bool bAllowMkDir=true)
 
bool WriteNewConfig (const CString &sConfigFile)
 
bool WriteConfig ()
 
bool ParseConfig (const CString &sConfig, CString &sError)
 
bool RehashConfig (CString &sError)
 
void BackupConfigOnce (const CString &sSuffix)
 
CString GetUptime () const
 
void ClearBindHosts ()
 
bool AddBindHost (const CString &sHost)
 
bool RemBindHost (const CString &sHost)
 
void ClearTrustedProxies ()
 
bool AddTrustedProxy (const CString &sHost)
 
bool RemTrustedProxy (const CString &sHost)
 
void Broadcast (const CString &sMessage, bool bAdminOnly=false, CUser *pSkipUser=nullptr, CClient *pSkipClient=nullptr)
 
void AddBytesRead (unsigned long long u)
 
void AddBytesWritten (unsigned long long u)
 
unsigned long long BytesRead () const
 
unsigned long long BytesWritten () const
 
TrafficStatsMap GetTrafficStats (TrafficStatsPair &Users, TrafficStatsPair &ZNC, TrafficStatsPair &Total)
 
TrafficStatsMap GetNetworkTrafficStats (const CString &sUsername, TrafficStatsPair &Total)
 
void AuthUser (std::shared_ptr< CAuthBase > AuthClass)
 
void SetConfigState (enum ConfigState e)
 
void SetSkinName (const CString &s)
 
void SetStatusPrefix (const CString &s)
 
void SetMaxBufferSize (unsigned int i)
 
void SetAnonIPLimit (unsigned int i)
 
void SetServerThrottle (unsigned int i)
 
void SetProtectWebSessions (bool b)
 
void SetHideVersion (bool b)
 
void SetAuthOnlyViaModule (bool b)
 
void SetConnectDelay (unsigned int i)
 
void SetSSLCiphers (const CString &sCiphers)
 
bool SetSSLProtocols (const CString &sProtocols)
 
void SetSSLCertFile (const CString &sFile)
 
void SetConfigWriteDelay (unsigned int i)
 
enum ConfigState GetConfigState ()
 
CSockManagerGetManager ()
 
const CSockManagerGetManager () const
 
CModulesGetModules ()
 
CString GetSkinName () const
 
const CStringGetStatusPrefix () const
 
const CStringGetCurPath () const
 
const CStringGetHomePath () const
 
const CStringGetZNCPath () const
 
CString GetConfPath (bool bAllowMkDir=true) const
 
CString GetUserPath () const
 
CString GetModPath () const
 
CString GetPemLocation () const
 
CString GetKeyLocation () const
 
CString GetDHParamLocation () const
 
const CStringGetConfigFile () const
 
bool WritePemFile ()
 
const VCStringGetBindHosts () const
 
const VCStringGetTrustedProxies () const
 
const std::vector< CListener * > & GetListeners () const
 
time_t TimeStarted () const
 
unsigned int GetMaxBufferSize () const
 
unsigned int GetAnonIPLimit () const
 
unsigned int GetServerThrottle () const
 
unsigned int GetConnectDelay () const
 
bool GetProtectWebSessions () const
 
bool GetHideVersion () const
 
bool GetAuthOnlyViaModule () const
 
CString GetSSLCiphers () const
 
CString GetSSLProtocols () const
 
Csock::EDisableProtocol GetDisabledSSLProtocols () const
 
CString GetSSLCertFile () const
 
unsigned int GetConfigWriteDelay () const
 
CUserFindUser (const CString &sUsername)
 
CModuleFindModule (const CString &sModName, const CString &sUsername)
 
CModuleFindModule (const CString &sModName, CUser *pUser)
 
bool UpdateModule (const CString &sModule)
 Reload a module everywhere. More...
 
bool DeleteUser (const CString &sUsername)
 
bool AddUser (CUser *pUser, CString &sErrorRet, bool bStartup=false)
 
const std::map< CString, CUser * > & GetUserMap () const
 
CListenerFindListener (u_short uPort, const CString &BindHost, EAddrType eAddr)
 
bool AddListener (CListener *)
 
bool AddListener (unsigned short uPort, const CString &sBindHost, const CString &sURIPrefix, bool bSSL, EAddrType eAddr, CListener::EAcceptType eAccept, CString &sError)
 
bool DelListener (CListener *)
 
void SetMotd (const CString &sMessage)
 
void AddMotd (const CString &sMessage)
 
void ClearMotd ()
 
const VCStringGetMotd () const
 
void AddServerThrottle (CString sName)
 
bool GetServerThrottle (CString sName)
 
void AddNetworkToQueue (CIRCNetwork *pNetwork)
 
std::list< CIRCNetwork * > & GetConnectionQueue ()
 
void EnableConnectQueue ()
 
void DisableConnectQueue ()
 
void PauseConnectQueue ()
 
void ResumeConnectQueue ()
 
void ForceEncoding ()
 
void UnforceEncoding ()
 
bool IsForcingEncoding () const
 
CString FixupEncoding (const CString &sEncoding) const
 
void LeakConnectQueueTimer (CConnectQueueTimer *pTimer)
 
void DisableConfigTimer ()
 

Static Public Member Functions

static CString GetVersion ()
 
static CString GetTag (bool bIncludeVersion=true, bool bHTML=false)
 
static CString GetCompileOptionsString ()
 
static VCString GetAvailableSSLProtocols ()
 
static void CreateInstance ()
 
static CZNCGet ()
 
static void DestroyInstance ()
 
static void DumpConfig (const CConfig *Config)
 

Protected Attributes

time_t m_TimeStarted
 
enum ConfigState m_eConfigState
 
std::mutex m_mutexConfigState
 
std::vector< CListener * > m_vpListeners
 
std::map< CString, CUser * > m_msUsers
 
std::map< CString, CUser * > m_msDelUsers
 
CSockManager m_Manager
 
CString m_sCurPath
 
CString m_sZNCPath
 
CString m_sConfigFile
 
CString m_sSkinName
 
CString m_sStatusPrefix
 
CString m_sPidFile
 
CString m_sSSLCertFile
 
CString m_sSSLKeyFile
 
CString m_sSSLDHParamFile
 
CString m_sSSLCiphers
 
CString m_sSSLProtocols
 
VCString m_vsBindHosts
 
VCString m_vsTrustedProxies
 
VCString m_vsMotd
 
CFilem_pLockFile
 
unsigned int m_uiConnectDelay
 
unsigned int m_uiAnonIPLimit
 
unsigned int m_uiMaxBufferSize
 
unsigned int m_uDisabledSSLProtocols
 
CModulesm_pModules
 
unsigned long long m_uBytesRead
 
unsigned long long m_uBytesWritten
 
std::list< CIRCNetwork * > m_lpConnectQueue
 
CConnectQueueTimer * m_pConnectQueueTimer
 
unsigned int m_uiConnectPaused
 
unsigned int m_uiForceEncoding
 
TCacheMap< CStringm_sConnectThrottle
 
bool m_bProtectWebSessions
 
bool m_bHideVersion
 
bool m_bAuthOnlyViaModule
 
CTranslationDomainRefHolder m_Translation
 
unsigned int m_uiConfigWriteDelay
 
CConfigWriteTimer * m_pConfigTimer
 

Member Typedef Documentation

typedef std::pair<unsigned long long, unsigned long long> CZNC::TrafficStatsPair

Member Enumeration Documentation

Enumerator
ECONFIG_NOTHING 
ECONFIG_NEED_REHASH 
ECONFIG_NEED_WRITE 
ECONFIG_NEED_VERBOSE_WRITE 
ECONFIG_DELAYED_WRITE 
ECONFIG_NEED_QUIT 

Constructor & Destructor Documentation

CZNC::CZNC ( )
CZNC::~CZNC ( )
CZNC::CZNC ( const CZNC )
delete

Member Function Documentation

bool CZNC::AddBindHost ( const CString sHost)
inline
Deprecated:
Since 1.7.0. List of allowed bind hosts was a flawed design.
void CZNC::AddBytesRead ( unsigned long long  u)
inline

References m_uBytesRead.

void CZNC::AddBytesWritten ( unsigned long long  u)
inline

References m_uBytesWritten.

bool CZNC::AddListener ( CListener )
bool CZNC::AddListener ( unsigned short  uPort,
const CString sBindHost,
const CString sURIPrefix,
bool  bSSL,
EAddrType  eAddr,
CListener::EAcceptType  eAccept,
CString sError 
)
void CZNC::AddMotd ( const CString sMessage)
inline

References m_vsMotd.

Referenced by SetMotd().

void CZNC::AddNetworkToQueue ( CIRCNetwork pNetwork)
void CZNC::AddServerThrottle ( CString  sName)
inline
bool CZNC::AddTrustedProxy ( const CString sHost)
bool CZNC::AddUser ( CUser pUser,
CString sErrorRet,
bool  bStartup = false 
)
bool CZNC::AllowConnectionFrom ( const CString sIP) const
void CZNC::AuthUser ( std::shared_ptr< CAuthBase AuthClass)
void CZNC::BackupConfigOnce ( const CString sSuffix)
void CZNC::Broadcast ( const CString sMessage,
bool  bAdminOnly = false,
CUser pSkipUser = nullptr,
CClient pSkipClient = nullptr 
)
unsigned long long CZNC::BytesRead ( ) const
inline

References m_uBytesRead.

unsigned long long CZNC::BytesWritten ( ) const
inline

References m_uBytesWritten.

void CZNC::ClearBindHosts ( )
inline
Deprecated:
Since 1.7.0. List of allowed bind hosts was a flawed design.
void CZNC::ClearMotd ( )
inline

References m_vsMotd.

Referenced by SetMotd().

void CZNC::ClearTrustedProxies ( )
static void CZNC::CreateInstance ( )
static
bool CZNC::DeletePidFile ( )
bool CZNC::DeleteUser ( const CString sUsername)
void CZNC::DeleteUsers ( )
bool CZNC::DelListener ( CListener )
static void CZNC::DestroyInstance ( )
static
void CZNC::DisableConfigTimer ( )
void CZNC::DisableConnectQueue ( )
static void CZNC::DumpConfig ( const CConfig Config)
static
void CZNC::EnableConnectQueue ( )
CString CZNC::ExpandConfigPath ( const CString sConfigFile,
bool  bAllowMkDir = true 
)
CListener* CZNC::FindListener ( u_short  uPort,
const CString BindHost,
EAddrType  eAddr 
)
CModule* CZNC::FindModule ( const CString sModName,
const CString sUsername 
)
CModule* CZNC::FindModule ( const CString sModName,
CUser pUser 
)
CUser* CZNC::FindUser ( const CString sUsername)
CString CZNC::FixupEncoding ( const CString sEncoding) const
void CZNC::ForceEncoding ( )
static CZNC& CZNC::Get ( )
static
unsigned int CZNC::GetAnonIPLimit ( ) const
inline

References m_uiAnonIPLimit.

bool CZNC::GetAuthOnlyViaModule ( ) const
inline

References m_bAuthOnlyViaModule.

static VCString CZNC::GetAvailableSSLProtocols ( )
static
const VCString& CZNC::GetBindHosts ( ) const
inline
Deprecated:
Since 1.7.0. List of allowed bind hosts was a flawed design.

References m_vsBindHosts.

static CString CZNC::GetCompileOptionsString ( )
static
const CString& CZNC::GetConfigFile ( ) const
inline

References m_sConfigFile.

enum ConfigState CZNC::GetConfigState ( )
inline
unsigned int CZNC::GetConfigWriteDelay ( ) const
inline

References m_uiConfigWriteDelay.

CString CZNC::GetConfPath ( bool  bAllowMkDir = true) const
unsigned int CZNC::GetConnectDelay ( ) const
inline

References m_uiConnectDelay.

std::list<CIRCNetwork*>& CZNC::GetConnectionQueue ( )
inline

References m_lpConnectQueue.

const CString& CZNC::GetCurPath ( ) const
CString CZNC::GetDHParamLocation ( ) const
Csock::EDisableProtocol CZNC::GetDisabledSSLProtocols ( ) const
inline
bool CZNC::GetHideVersion ( ) const
inline

References m_bHideVersion.

const CString& CZNC::GetHomePath ( ) const
CString CZNC::GetKeyLocation ( ) const
const std::vector<CListener*>& CZNC::GetListeners ( ) const
inline

References m_vpListeners.

CSockManager& CZNC::GetManager ( )
inline

References m_Manager.

const CSockManager& CZNC::GetManager ( ) const
inline

References m_Manager.

unsigned int CZNC::GetMaxBufferSize ( ) const
inline

References m_uiMaxBufferSize.

CString CZNC::GetModPath ( ) const
CModules& CZNC::GetModules ( )
inline

References m_pModules.

const VCString& CZNC::GetMotd ( ) const
inline

References m_vsMotd.

TrafficStatsMap CZNC::GetNetworkTrafficStats ( const CString sUsername,
TrafficStatsPair Total 
)
CString CZNC::GetPemLocation ( ) const
bool CZNC::GetProtectWebSessions ( ) const
inline

References m_bProtectWebSessions.

unsigned int CZNC::GetServerThrottle ( ) const
inline
bool CZNC::GetServerThrottle ( CString  sName)
inline
CString CZNC::GetSkinName ( ) const
inline

References m_sSkinName.

CString CZNC::GetSSLCertFile ( ) const
inline

References m_sSSLCertFile.

CString CZNC::GetSSLCiphers ( ) const
inline

References m_sSSLCiphers.

CString CZNC::GetSSLProtocols ( ) const
inline

References m_sSSLProtocols.

const CString& CZNC::GetStatusPrefix ( ) const
inline

References m_sStatusPrefix.

static CString CZNC::GetTag ( bool  bIncludeVersion = true,
bool  bHTML = false 
)
static
TrafficStatsMap CZNC::GetTrafficStats ( TrafficStatsPair Users,
TrafficStatsPair ZNC,
TrafficStatsPair Total 
)
const VCString& CZNC::GetTrustedProxies ( ) const
inline

References m_vsTrustedProxies.

CString CZNC::GetUptime ( ) const
const std::map<CString, CUser*>& CZNC::GetUserMap ( ) const
inline

References m_msUsers.

CString CZNC::GetUserPath ( ) const
static CString CZNC::GetVersion ( )
static
const CString& CZNC::GetZNCPath ( ) const
void CZNC::InitDirs ( const CString sArgvPath,
const CString sDataDir 
)
bool CZNC::IsForcingEncoding ( ) const
bool CZNC::IsHostAllowed ( const CString sHostMask) const
void CZNC::LeakConnectQueueTimer ( CConnectQueueTimer *  pTimer)
void CZNC::Loop ( )
bool CZNC::OnBoot ( )
CZNC& CZNC::operator= ( const CZNC )
delete
bool CZNC::ParseConfig ( const CString sConfig,
CString sError 
)
void CZNC::PauseConnectQueue ( )
bool CZNC::RehashConfig ( CString sError)
bool CZNC::RemBindHost ( const CString sHost)
inline
Deprecated:
Since 1.7.0. List of allowed bind hosts was a flawed design.
bool CZNC::RemTrustedProxy ( const CString sHost)
void CZNC::ResumeConnectQueue ( )
void CZNC::SetAnonIPLimit ( unsigned int  i)
inline

References m_uiAnonIPLimit.

void CZNC::SetAuthOnlyViaModule ( bool  b)
inline

References m_bAuthOnlyViaModule.

void CZNC::SetConfigState ( enum ConfigState  e)
inline
void CZNC::SetConfigWriteDelay ( unsigned int  i)
inline

References m_uiConfigWriteDelay.

void CZNC::SetConnectDelay ( unsigned int  i)
void CZNC::SetHideVersion ( bool  b)
inline

References m_bHideVersion.

void CZNC::SetMaxBufferSize ( unsigned int  i)
inline

References m_uiMaxBufferSize.

void CZNC::SetMotd ( const CString sMessage)
inline

References AddMotd(), and ClearMotd().

void CZNC::SetProtectWebSessions ( bool  b)
inline

References m_bProtectWebSessions.

void CZNC::SetServerThrottle ( unsigned int  i)
inline
void CZNC::SetSkinName ( const CString s)
inline

References m_sSkinName.

void CZNC::SetSSLCertFile ( const CString sFile)
inline

References m_sSSLCertFile.

void CZNC::SetSSLCiphers ( const CString sCiphers)
inline

References m_sSSLCiphers.

bool CZNC::SetSSLProtocols ( const CString sProtocols)
void CZNC::SetStatusPrefix ( const CString s)
inline

References m_sStatusPrefix.

time_t CZNC::TimeStarted ( ) const
inline

References m_TimeStarted.

void CZNC::UnforceEncoding ( )
bool CZNC::UpdateModule ( const CString sModule)

Reload a module everywhere.

This method will unload a module globally, for a user and for each network. It will then reload them all again.

Parameters
sModuleThe name of the module to reload
bool CZNC::WaitForChildLock ( )
bool CZNC::WriteConfig ( )
bool CZNC::WriteNewConfig ( const CString sConfigFile)
bool CZNC::WritePemFile ( )
bool CZNC::WritePidFile ( int  iPid)

Member Data Documentation

bool CZNC::m_bAuthOnlyViaModule
protected
bool CZNC::m_bHideVersion
protected

Referenced by GetHideVersion(), and SetHideVersion().

bool CZNC::m_bProtectWebSessions
protected
enum ConfigState CZNC::m_eConfigState
protected

Referenced by GetConfigState(), and SetConfigState().

std::list<CIRCNetwork*> CZNC::m_lpConnectQueue
protected

Referenced by GetConnectionQueue().

CSockManager CZNC::m_Manager
protected

Referenced by GetManager().

std::map<CString, CUser*> CZNC::m_msDelUsers
protected
std::map<CString, CUser*> CZNC::m_msUsers
protected

Referenced by GetUserMap().

std::mutex CZNC::m_mutexConfigState
protected

Referenced by GetConfigState(), and SetConfigState().

CConfigWriteTimer* CZNC::m_pConfigTimer
protected
CConnectQueueTimer* CZNC::m_pConnectQueueTimer
protected
CFile* CZNC::m_pLockFile
protected
CModules* CZNC::m_pModules
protected

Referenced by GetModules().

CString CZNC::m_sConfigFile
protected

Referenced by GetConfigFile().

TCacheMap<CString> CZNC::m_sConnectThrottle
protected
CString CZNC::m_sCurPath
protected
CString CZNC::m_sPidFile
protected
CString CZNC::m_sSkinName
protected

Referenced by GetSkinName(), and SetSkinName().

CString CZNC::m_sSSLCertFile
protected

Referenced by GetSSLCertFile(), and SetSSLCertFile().

CString CZNC::m_sSSLCiphers
protected

Referenced by GetSSLCiphers(), and SetSSLCiphers().

CString CZNC::m_sSSLDHParamFile
protected
CString CZNC::m_sSSLKeyFile
protected
CString CZNC::m_sSSLProtocols
protected

Referenced by GetSSLProtocols().

CString CZNC::m_sStatusPrefix
protected

Referenced by GetStatusPrefix(), and SetStatusPrefix().

CString CZNC::m_sZNCPath
protected
time_t CZNC::m_TimeStarted
protected

Referenced by TimeStarted().

CTranslationDomainRefHolder CZNC::m_Translation
protected
unsigned long long CZNC::m_uBytesRead
protected

Referenced by AddBytesRead(), and BytesRead().

unsigned long long CZNC::m_uBytesWritten
protected

Referenced by AddBytesWritten(), and BytesWritten().

unsigned int CZNC::m_uDisabledSSLProtocols
protected

Referenced by GetDisabledSSLProtocols().

unsigned int CZNC::m_uiAnonIPLimit
protected

Referenced by GetAnonIPLimit(), and SetAnonIPLimit().

unsigned int CZNC::m_uiConfigWriteDelay
protected
unsigned int CZNC::m_uiConnectDelay
protected

Referenced by GetConnectDelay().

unsigned int CZNC::m_uiConnectPaused
protected
unsigned int CZNC::m_uiForceEncoding
protected
unsigned int CZNC::m_uiMaxBufferSize
protected
std::vector<CListener*> CZNC::m_vpListeners
protected

Referenced by GetListeners().

VCString CZNC::m_vsBindHosts
protected

Referenced by GetBindHosts().

VCString CZNC::m_vsMotd
protected

Referenced by AddMotd(), ClearMotd(), and GetMotd().

VCString CZNC::m_vsTrustedProxies
protected

Referenced by GetTrustedProxies().


The documentation for this class was generated from the following file: