diff --git a/Client.h b/Client.h index 1bfd4a8d..18fed080 100644 --- a/Client.h +++ b/Client.h @@ -9,7 +9,7 @@ #ifndef _CLIENT_H #define _CLIENT_H -#include "Csocket.h" +#include "Socket.h" #include "Utils.h" #include "main.h" @@ -68,9 +68,9 @@ protected: CClient* m_pClient; }; -class CClient : public Csock { +class CClient : public CZNCSock { public: - CClient(const CString& sHostname, unsigned short uPort, int iTimeout = 60) : Csock(sHostname, uPort, iTimeout) { + CClient(const CString& sHostname, unsigned short uPort, int iTimeout = 60) : CZNCSock(sHostname, uPort, iTimeout) { m_pUser = NULL; m_pTimeout = NULL; m_pIRCSock = NULL; diff --git a/DCCBounce.cpp b/DCCBounce.cpp index 863491d3..e07104a5 100644 --- a/DCCBounce.cpp +++ b/DCCBounce.cpp @@ -17,7 +17,7 @@ const unsigned int CDCCBounce::m_uiMinDCCBuffer = 2 * 1024; CDCCBounce::CDCCBounce(CUser* pUser, unsigned long uLongIP, unsigned short uPort, const CString& sFileName, const CString& sRemoteNick, - const CString& sRemoteIP, CString sLocalIP, bool bIsChat) : Csock() { + const CString& sRemoteIP, CString sLocalIP, bool bIsChat) : CZNCSock() { m_uRemotePort = uPort; m_sConnectIP = CUtils::GetIP(uLongIP); m_sRemoteIP = sRemoteIP; @@ -36,7 +36,7 @@ CDCCBounce::CDCCBounce(CUser* pUser, unsigned long uLongIP, unsigned short uPort CDCCBounce::CDCCBounce(const CString& sHostname, unsigned short uPort, CUser* pUser, const CString& sRemoteNick, const CString& sRemoteIP, const CString& sFileName, - int iTimeout, bool bIsChat) : Csock(sHostname, uPort, iTimeout) { + int iTimeout, bool bIsChat) : CZNCSock(sHostname, uPort, iTimeout) { m_uRemotePort = 0; m_bIsChat = bIsChat; m_pUser = pUser; diff --git a/DCCBounce.h b/DCCBounce.h index ec59e9be..67c0b563 100644 --- a/DCCBounce.h +++ b/DCCBounce.h @@ -9,11 +9,11 @@ #ifndef _DCCBOUNCE_H #define _DCCBOUNCE_H -#include "Csocket.h" +#include "Socket.h" class CUser; -class CDCCBounce : public Csock { +class CDCCBounce : public CZNCSock { public: CDCCBounce(CUser* pUser, unsigned long uLongIP, unsigned short uPort, const CString& sFileName, const CString& sRemoteNick, diff --git a/DCCSock.h b/DCCSock.h index bd9e0b20..0d16763f 100644 --- a/DCCSock.h +++ b/DCCSock.h @@ -15,9 +15,9 @@ class CUser; // !Forward Declarations -class CDCCSock : public Csock { +class CDCCSock : public CZNCSock { public: - CDCCSock(CUser* pUser, const CString& sRemoteNick, const CString& sLocalFile, const CString& sModuleName, unsigned long uFileSize = 0, CFile* pFile = NULL) : Csock() { + CDCCSock(CUser* pUser, const CString& sRemoteNick, const CString& sLocalFile, const CString& sModuleName, unsigned long uFileSize = 0, CFile* pFile = NULL) : CZNCSock() { m_sRemoteNick = sRemoteNick; m_uFileSize = uFileSize; m_uRemotePort = 0; @@ -30,7 +30,7 @@ public: m_bNoDelFile = false; } - CDCCSock(CUser* pUser, const CString& sRemoteNick, const CString& sRemoteIP, unsigned short uRemotePort, const CString& sLocalFile, unsigned long uFileSize, const CString& sModuleName) : Csock() { + CDCCSock(CUser* pUser, const CString& sRemoteNick, const CString& sRemoteIP, unsigned short uRemotePort, const CString& sLocalFile, unsigned long uFileSize, const CString& sModuleName) : CZNCSock() { m_sRemoteNick = sRemoteNick; m_sRemoteIP = sRemoteIP; m_uRemotePort = uRemotePort; diff --git a/FileUtils.h b/FileUtils.h index 321437ba..0e2abf77 100644 --- a/FileUtils.h +++ b/FileUtils.h @@ -9,7 +9,7 @@ #ifndef _FILEUTILS_H #define _FILEUTILS_H -#include "Csocket.h" +#include "Socket.h" #include "ZNCString.h" #include #include @@ -284,9 +284,9 @@ protected: }; //! @author imaginos@imaginos.net -class CExecSock : public Csock { +class CExecSock : public CZNCSock { public: - CExecSock() : Csock() { + CExecSock() : CZNCSock() { m_iPid = -1; } diff --git a/IRCSock.cpp b/IRCSock.cpp index 528978d5..263632d9 100644 --- a/IRCSock.cpp +++ b/IRCSock.cpp @@ -13,7 +13,7 @@ #include "User.h" #include "znc.h" -CIRCSock::CIRCSock(CUser* pUser) : Csock() { +CIRCSock::CIRCSock(CUser* pUser) : CZNCSock() { m_pUser = pUser; m_bISpoofReleased = false; m_bAuthed = false; diff --git a/IRCSock.h b/IRCSock.h index f7a64689..7f881b37 100644 --- a/IRCSock.h +++ b/IRCSock.h @@ -9,7 +9,7 @@ #ifndef _IRCSOCK_H #define _IRCSOCK_H -#include "Csocket.h" +#include "Socket.h" #include "Nick.h" // Forward Declarations @@ -17,7 +17,7 @@ class CChan; class CUser; // !Forward Declarations -class CIRCSock : public Csock { +class CIRCSock : public CZNCSock { public: CIRCSock(CUser* pUser); virtual ~CIRCSock(); diff --git a/Modules.cpp b/Modules.cpp index 5afcf0d2..f81445ce 100644 --- a/Modules.cpp +++ b/Modules.cpp @@ -103,14 +103,14 @@ const CString& CTimer::GetDescription() const { return m_sDescription; } /////////////////// !Timer /////////////////// /////////////////// Socket /////////////////// -CSocket::CSocket(CModule* pModule) : Csock() { +CSocket::CSocket(CModule* pModule) : CZNCSock() { m_pModule = pModule; m_pModule->AddSocket(this); EnableReadLine(); SetMaxBufferThreshold(10240); } -CSocket::CSocket(CModule* pModule, const CString& sHostname, unsigned short uPort, int iTimeout) : Csock(sHostname, uPort, iTimeout) { +CSocket::CSocket(CModule* pModule, const CString& sHostname, unsigned short uPort, int iTimeout) : CZNCSock(sHostname, uPort, iTimeout) { m_pModule = pModule; m_pModule->AddSocket(this); EnableReadLine(); diff --git a/Modules.h b/Modules.h index da84ae6f..dfd2ed2b 100644 --- a/Modules.h +++ b/Modules.h @@ -89,7 +89,6 @@ class CZNC; class CUser; class CNick; class CChan; -class Csock; class CModule; class CFPTimer; class CSockManager; @@ -140,7 +139,7 @@ private: FPTimer_t m_pFBCallback; }; -class CSocket : public Csock { +class CSocket : public CZNCSock { public: CSocket(CModule* pModule); CSocket(CModule* pModule, const CString& sHostname, unsigned short uPort, int iTimeout = 60); diff --git a/Socket.cpp b/Socket.cpp index cc522ff8..9a0a711e 100644 --- a/Socket.cpp +++ b/Socket.cpp @@ -7,3 +7,11 @@ */ #include "Socket.h" + +CSockManager::CSockManager() : TSocketManager() +{ +} + +CSockManager::~CSockManager() +{ +} diff --git a/Socket.h b/Socket.h index 0d99992c..cda94fd2 100644 --- a/Socket.h +++ b/Socket.h @@ -11,12 +11,19 @@ #include "Csocket.h" -class CSockManager : public TSocketManager { +class CZNCSock : public Csock { public: - CSockManager() : TSocketManager() {} - virtual ~CSockManager() {} + CZNCSock(int timeout = 60) : Csock(timeout) {} + CZNCSock(const CString& sHost, u_short port, int timeout = 60) : Csock(sHost, port, timeout) {} + ~CZNCSock() {} +}; - bool ListenHost(u_short iPort, const CString& sSockName, const CString& sBindHost, bool bSSL = false, int iMaxConns = SOMAXCONN, Csock *pcSock = NULL, u_int iTimeout = 0, bool bIsIPv6 = false) { +class CSockManager : public TSocketManager { +public: + CSockManager(); + virtual ~CSockManager(); + + bool ListenHost(u_short iPort, const CString& sSockName, const CString& sBindHost, bool bSSL = false, int iMaxConns = SOMAXCONN, CZNCSock *pcSock = NULL, u_int iTimeout = 0, bool bIsIPv6 = false) { CSListener L(iPort, sBindHost); L.SetSockName(sSockName); @@ -33,11 +40,11 @@ public: return Listen(L, pcSock); } - bool ListenAll(u_short iPort, const CString& sSockName, bool bSSL = false, int iMaxConns = SOMAXCONN, Csock *pcSock = NULL, u_int iTimeout = 0, bool bIsIPv6 = false) { + bool ListenAll(u_short iPort, const CString& sSockName, bool bSSL = false, int iMaxConns = SOMAXCONN, CZNCSock *pcSock = NULL, u_int iTimeout = 0, bool bIsIPv6 = false) { return ListenHost(iPort, sSockName, "", bSSL, iMaxConns, pcSock, iTimeout, bIsIPv6); } - u_short ListenRand(const CString& sSockName, const CString& sBindHost, bool bSSL = false, int iMaxConns = SOMAXCONN, Csock *pcSock = NULL, u_int iTimeout = 0, bool bIsIPv6 = false) { + u_short ListenRand(const CString& sSockName, const CString& sBindHost, bool bSSL = false, int iMaxConns = SOMAXCONN, CZNCSock *pcSock = NULL, u_int iTimeout = 0, bool bIsIPv6 = false) { unsigned short uPort = 0; CSListener L(0, sBindHost); @@ -57,18 +64,18 @@ public: return uPort; } - u_short ListenAllRand(const CString& sSockName, bool bSSL = false, int iMaxConns = SOMAXCONN, Csock *pcSock = NULL, u_int iTimeout = 0, bool bIsIPv6 = false) { + u_short ListenAllRand(const CString& sSockName, bool bSSL = false, int iMaxConns = SOMAXCONN, CZNCSock *pcSock = NULL, u_int iTimeout = 0, bool bIsIPv6 = false) { return(ListenRand(sSockName, "", bSSL, iMaxConns, pcSock, iTimeout, bIsIPv6)); } - bool Connect(const CString& sHostname, u_short iPort , const CString& sSockName, int iTimeout = 60, bool bSSL = false, const CString& sBindHost = "", Csock *pcSock = NULL) { + bool Connect(const CString& sHostname, u_short iPort , const CString& sSockName, int iTimeout = 60, bool bSSL = false, const CString& sBindHost = "", CZNCSock *pcSock = NULL) { CSConnection C(sHostname, iPort, iTimeout); C.SetSockName(sSockName); C.SetIsSSL(bSSL); C.SetBindHost(sBindHost); - return TSocketManager::Connect(C, pcSock); + return TSocketManager::Connect(C, pcSock); } private: protected: diff --git a/modules/modperl.cpp b/modules/modperl.cpp index a8ab4ce8..970e81ea 100644 --- a/modules/modperl.cpp +++ b/modules/modperl.cpp @@ -116,16 +116,16 @@ typedef vector< PString > VPString; class CModPerl; static CModPerl *g_ModPerl = NULL; -class CPerlSock : public Csock +class CPerlSock : public CZNCSock { public: - CPerlSock() : Csock() + CPerlSock() : CZNCSock() { m_iParentFD = -1; SetSockName(ZNCSOCK); } CPerlSock(const CS_STRING & sHost, u_short iPort, int iTimeout = 60) - : Csock(sHost, iPort, iTimeout) + : CZNCSock(sHost, iPort, iTimeout) { m_iParentFD = -1; SetSockName(ZNCSOCK); diff --git a/modules/shell.cpp b/modules/shell.cpp index a5cd7d84..14e709f9 100644 --- a/modules/shell.cpp +++ b/modules/shell.cpp @@ -48,7 +48,7 @@ public: } virtual ~CShellMod() { - vector vSocks = m_pManager->FindSocksByName("SHELL"); + vector vSocks = m_pManager->FindSocksByName("SHELL"); for (unsigned int a = 0; a < vSocks.size(); a++) { m_pManager->DelSockByAddr(vSocks[a]); diff --git a/znc.h b/znc.h index 2fe0d31c..41855af2 100644 --- a/znc.h +++ b/znc.h @@ -163,9 +163,9 @@ protected: CConnectUserTimer *m_pConnectUserTimer; }; -class CRealListener : public Csock { +class CRealListener : public CZNCSock { public: - CRealListener() : Csock() {} + CRealListener() : CZNCSock() {} virtual ~CRealListener() {} virtual bool ConnectionFrom(const CString& sHost, unsigned short uPort) {