mirror of
https://github.com/znc/znc.git
synced 2026-07-05 01:11:53 +02:00
Did some basic documentation on CSocket, probably needs more but this is a good start
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2139 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
@@ -109,23 +109,45 @@ private:
|
||||
protected:
|
||||
};
|
||||
|
||||
/**
|
||||
* @class CSocket
|
||||
* @brief Base Csock implementation to be used by modules
|
||||
*
|
||||
* By all means, this class should be used as a base for sockets originating from modules. It handles removing instances of itself
|
||||
* from the module as it unloads, and simplifies use in general.
|
||||
* - EnableReadLine is default to true in this class
|
||||
* - MaxBuffer for readline is set to 10240, in the event this is reached the socket is closed (@see ReachedMaxBuffer)
|
||||
*/
|
||||
class CSocket : public CZNCSock {
|
||||
public:
|
||||
/**
|
||||
* @brief ctor
|
||||
* @param pModule the module this sock instance is associated to
|
||||
*/
|
||||
CSocket(CModule* pModule);
|
||||
/**
|
||||
* @brief ctor
|
||||
* @param pModule the module this sock instance is associated to
|
||||
* @param sHostname the hostname being connected to
|
||||
* @param uPort the port being connected to
|
||||
* @param iTimeout the timeout period for this specific sock
|
||||
*/
|
||||
CSocket(CModule* pModule, const CString& sHostname, unsigned short uPort, int iTimeout = 60);
|
||||
virtual ~CSocket();
|
||||
|
||||
using Csock::Connect;
|
||||
using Csock::Listen;
|
||||
|
||||
// This defaults to closing the socket, feel free to override
|
||||
//! This defaults to closing the socket, feel free to override
|
||||
virtual void ReachedMaxBuffer();
|
||||
virtual void SockError(int iErrno);
|
||||
// This limits the global connections from this IP to defeat DoS
|
||||
// attacks, feel free to override
|
||||
|
||||
//! This limits the global connections from this IP to defeat DoS attacks, feel free to override. The ACL used is provided by the main interface @see CZNC::AllowConnectionFrom
|
||||
virtual bool ConnectionFrom(const CString& sHost, unsigned short uPort);
|
||||
|
||||
//! Ease of use Connect, assigns to the manager and is subsequently tracked
|
||||
bool Connect(const CString& sHostname, unsigned short uPort, bool bSSL = false, unsigned int uTimeout = 60);
|
||||
//! Ease of use Listen, assigned to the manager and is subsequently tracked
|
||||
bool Listen(unsigned short uPort, bool bSSL, unsigned int uTimeout = 0);
|
||||
|
||||
// Getters
|
||||
@@ -133,7 +155,7 @@ public:
|
||||
// !Getters
|
||||
private:
|
||||
protected:
|
||||
CModule* m_pModule;
|
||||
CModule* m_pModule; //!< pointer to the module that this sock instance belongs to
|
||||
};
|
||||
|
||||
#endif /* SOCKET_H */
|
||||
|
||||
Reference in New Issue
Block a user