2
* Copyright (C) 2004-2011 See the AUTHORS file for details.
4
* This program is free software; you can redistribute it and/or modify it
5
* under the terms of the GNU General Public License version 2 as published
6
* by the Free Software Foundation.
12
#include "zncconfig.h"
15
// Forward Declarations
17
// !Forward Declarations
27
CListener(unsigned short uPort, const CString& sBindHost, bool bSSL, EAddrType eAddr, EAcceptType eAccept) {
29
m_sBindHost = sBindHost;
33
m_eAcceptType = eAccept;
39
bool IsSSL() const { return m_bSSL; }
40
EAddrType GetAddrType() const { return m_eAddr; }
41
unsigned short GetPort() const { return m_uPort; }
42
const CString& GetBindHost() const { return m_sBindHost; }
43
CRealListener* GetRealListener() const { return m_pListener; }
44
EAcceptType GetAcceptType() const { return m_eAcceptType; }
47
// It doesn't make sense to change any of the settings after Listen()
48
// except this one, so don't add other setters!
49
void SetAcceptType(EAcceptType eType) { m_eAcceptType = eType; }
52
void ResetRealListener();
58
unsigned short m_uPort;
60
CRealListener* m_pListener;
61
EAcceptType m_eAcceptType;
64
class CRealListener : public CZNCSock {
66
CRealListener(CListener *pParent) : CZNCSock(), m_pParent(pParent) {}
67
virtual ~CRealListener();
69
virtual bool ConnectionFrom(const CString& sHost, unsigned short uPort);
70
virtual Csock* GetSockObj(const CString& sHost, unsigned short uPort);
71
virtual void SockError(int iErrno);
77
class CIncomingConnection : public CZNCSock {
79
CIncomingConnection(const CString& sHostname, unsigned short uPort, CListener::EAcceptType eAcceptType);
80
virtual ~CIncomingConnection() {}
81
virtual void ReadLine(const CString& sData);
82
virtual void ReachedMaxBuffer();
85
CListener::EAcceptType m_eAcceptType;
88
#endif // !_LISTENER_H