Logo Search packages:      
Sourcecode: znc version File versions

CExecSock Class Reference

#include <FileUtils.h>

Inheritance diagram for CExecSock:

Csock

List of all members.


Detailed Description

Author:
imaginos@imaginos.net

Definition at line 361 of file FileUtils.h.


Public Types

enum  { TMO_READ = 1, TMO_WRITE = 2, TMO_ACCEPT = 4, TMO_ALL = TMO_READ|TMO_WRITE|TMO_ACCEPT }
enum  ECloseType { CLT_DONT = 0, CLT_NOW = 1, CLT_AFTERWRITE = 2 }
enum  ECONState {
  CST_START = 0, CST_DNS = CST_START, CST_VHOSTDNS = 1, CST_BINDVHOST = 2,
  CST_CONNECT = 3, CST_OK = 4
}
enum  EDNSLType { DNS_VHOST, DNS_DEST }
enum  EFRead {
  READ_EOF = 0, READ_ERR = -1, READ_EAGAIN = -2, READ_CONNREFUSED = -3,
  READ_TIMEDOUT = -4
}
enum  EFSelect { SEL_OK = 0, SEL_TIMEOUT = -1, SEL_EAGAIN = -2, SEL_ERR = -3 }
enum  ESSLMethod { SSL23 = 0, SSL2 = 2, SSL3 = 3 }
enum  ETConn { OUTBOUND = 0, LISTENER = 1, INBOUND = 2 }

Public Member Functions

virtual int Accept (CS_STRING &sHost, u_short &iRPort)
 Accept an inbound connection, this is used internally.
virtual bool AcceptSSL ()
 Accept an inbound SSL connection, this is used internally and called after Accept.
virtual void AddCron (CCron *pcCron)
 insert a newly created cron
bool AllowWrite (unsigned long long &iNOW) const
 returns true if this socket can write its data, primarily used with rate shaping, initialize iNOW to 0 and it sets it on the first call
void BlockIO (bool bBLOCK)
 Set rather to NON Blocking IO on this socket, default is true.
 CExecSock (const CString &sExec)
virtual bool CheckTimeout ()
 returns true if the socket has timed out
void ClearWriteBuffer ()
void Close (ECloseType eCloseType=CLT_NOW)
 just mark us as closed, the parent can pick it up
void close2 (int iPid, int iReadFD, int iWriteFD)
virtual bool Connect (const CS_STRING &sBindHost="", bool bSkipSetup=false)
virtual void Connected ()
bool ConnectFD (int iReadFD, int iWriteFD, const CS_STRING &sName, bool bIsSSL=false, ETConn eDirection=INBOUND)
 Tie this guy to an existing real file descriptor.
bool ConnectInetd (bool bIsSSL=false, const CS_STRING &sHostname="")
 Use this to bind this socket to inetd.
virtual bool ConnectionFrom (const CS_STRING &sHost, u_short iPort)
virtual void ConnectionRefused ()
virtual bool ConnectSSL (const CS_STRING &sBindhost="")
bool CreateSocksFD ()
 grabs fd's for the sockets
virtual void Cron ()
 This has a garbage collecter, and is used internall to call the jobs.
virtual void DelCron (u_int iPos)
 delete cron by idx
virtual void DelCron (const CS_STRING &sName, bool bDeleteAll=true, bool bCaseSensitive=true)
 delete cron(s) by name
virtual void DelCronByAddr (CCron *pcCron)
 delete cron by address
void DisableReadLine ()
virtual void Disconnected ()
int DNSLookup (EDNSLType eDNSLType)
void EnableReadLine ()
 set the value of m_bEnableReadLine to true, we don't want to store a buffer for ReadLine, unless we want it
int Execute (const CString &sExec)
bool FullSSLAccept ()
 is SSL_accept finished ?
double GetAvgRead (unsigned long long iSample=1000)
 Get Avg Read Speed in sample milliseconds (default is 1000 milliseconds or 1 second).
double GetAvgWrite (unsigned long long iSample=1000)
 Get Avg Write Speed in sample milliseconds (default is 1000 milliseconds or 1 second).
const CS_STRING & GetBindHost () const
unsigned long long GetBytesRead () const
 Gets the amount of data read during the existence of the socket.
unsigned long long GetBytesWritten () const
 Gets the amount of data written during the existence of the socket.
ECloseType GetCloseType ()
 returns int of type to close
ECONState GetConState () const
 returns the current connection state
const CS_STRING & GetHostName ()
 Returns a reference to the host name.
CS_STRING & GetInternalBuffer ()
bool GetIPv6 () const
CS_STRING GetLocalIP ()
u_short GetLocalPort ()
 Returns the local port.
u_int GetMaxBufferThreshold ()
const CS_STRING & GetParentSockName ()
virtual int GetPending ()
 return the data imediatly ready for read
u_short GetPort ()
 Returns the port.
u_int GetRateBytes ()
unsigned long long GetRateTime ()
CS_STRING GetRemoteIP ()
u_short GetRemotePort ()
 Returns the remote port.
int & GetRSock ()
 returns a reference to the sock
int & GetSock ()
const CS_STRING & GetSockName ()
 Returns a reference to the socket name.
virtual CsockGetSockObj (const CS_STRING &sHostname, u_short iPort)
 override this for accept sockets
bool GetSSL ()
 if this connection type is ssl or not
unsigned long long GetStartTime () const
 Gets the starting time of this socket.
int GetTimeout () const
u_int GetTimeoutType () const
int GetTimeSinceLastWrite ()
 return how long it has been (in seconds) since the last write
int GetType ()
 Returns the connection type from enum eConnType.
const CS_STRING & GetWriteBuffer ()
 Get the send buffer.
int & GetWSock ()
bool HasReadLine () const
 returns the value of m_bEnableReadLine, if ReadLine is enabled
bool IsClosed ()
virtual bool IsConnected ()
 Tells you if the socket is connected.
bool IsReadPaused ()
void Kill (int iSignal)
virtual bool Listen (u_short iPort, int iMaxConns=SOMAXCONN, const CS_STRING &sBindHost="", u_int iTimeout=0)
void NonBlockingIO ()
 Use this to change your fd's to blocking or none blocking.
Csockoperator<< (double i)
Csockoperator<< (float i)
Csockoperator<< (unsigned long long i)
Csockoperator<< (unsigned long i)
Csockoperator<< (long i)
Csockoperator<< (unsigned int i)
Csockoperator<< (int i)
Csockoperator<< (std::ostream &(*io)(std::ostream &))
Csockoperator<< (const CS_STRING &s)
void PauseRead ()
 will pause/unpause reading on this socket
int popen2 (int &iReadFD, int &iWriteFD, const CString &sCommand)
virtual void PushBuff (const char *data, int len, bool bStartAtZero=false)
virtual void ReachedMaxBuffer ()
virtual int Read (char *data, int len)
virtual void ReadData (const char *data, int len)
virtual void ReadLine (const CS_STRING &sLine)
virtual void ReadPaused ()
virtual int ReadSelect ()
void ResetBytesRead ()
void ResetBytesWritten ()
void ResetStartTime ()
 Resets the start time.
void ResetTimer ()
 resets the time counter
void SetAFRequire (CSSockAddr::EAFRequire iAFRequire)
void SetBindHost (const CS_STRING &sBindHost)
void SetConState (ECONState eState)
 sets the connection state to eState
void SetHostName (const CS_STRING &sHostname)
void SetIPv6 (bool b)
virtual void SetIsConnected (bool b)
 Sets the sock, telling it its connected (internal use only).
void SetMaxBufferThreshold (u_int iThreshold)
 sets the max buffered threshold when EnableReadLine() is enabled
virtual void SetParentSockName (const CS_STRING &sParentName)
 Get the peer's X509 cert.
void SetPort (u_short iPort)
virtual void SetRate (u_int iBytes, unsigned long long iMilliseconds)
void SetRSock (int iSock)
void SetSock (int iSock)
void SetSockName (const CS_STRING &sName)
void SetSSL (bool b)
void SetTimeout (int iTimeout, u_int iTimeoutType=TMO_ALL)
void SetTimeoutType (u_int iTimeoutType)
void SetType (int iType)
bool SetupVHost ()
 this is only used on outbound connections, listeners bind in a different spot
void SetWSock (int iSock)
virtual void SockError (int iErrno)
virtual bool SSLClientSetup ()
 This sets up the SSL Client, this is used internally.
bool SslIsEstablished ()
 is the ssl properly finished (from write no error)
virtual bool SSLServerSetup ()
 This sets up the SSL Server, this is used internally.
virtual void Timeout ()
void UnPauseRead ()
virtual bool Write (const CS_STRING &sData)
virtual bool Write (const char *data, int len)
virtual int WriteSelect ()

Private Attributes

int m_iPid

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

Generated by  Doxygen 1.6.0   Back to index