KVIrc 5.2.6
Developer APIs
DccMarshal.h
Go to the documentation of this file.
1#ifndef _MARSHAL_H_
2#define _MARSHAL_H_
3//=============================================================================
4//
5// File : DccMarshal.h
6// Creation date : Sun Sep 17 2000 10:44:20 by Szymon Stefanek
7//
8// This file is part of the KVIrc IRC client distribution
9// Copyright (C) 2000-2010 Szymon Stefanek (pragma at kvirc dot net)
10//
11// This program is FREE software. You can redistribute it and/or
12// modify it under the terms of the GNU General Public License
13// as published by the Free Software Foundation; either version 2
14// of the License, or (at your option) any later version.
15//
16// This program is distributed in the HOPE that it will be USEFUL,
17// but WITHOUT ANY WARRANTY; without even the implied warranty of
18// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19// See the GNU General Public License for more details.
20//
21// You should have received a copy of the GNU General Public License
22// along with this program. If not, write to the Free Software Foundation,
23// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24//
25//=============================================================================
26
27#include "KviCString.h"
28#include "KviError.h"
29#include "kvi_sockettype.h"
30#include "kvi_inttypes.h"
31
32#include <QObject>
33#include <QSocketNotifier>
34#include <QTimer>
35
36class KviWindow;
37class DccMarshal;
38
39#ifdef COMPILE_SSL_SUPPORT
40#include "KviSSLMaster.h"
41#endif
42
44{
45 friend class DccMarshal;
46
47public:
50
51protected:
53 virtual const char * dccMarshalOutputContextString() = 0;
54};
55
56class DccMarshal : public QObject
57{
58 Q_OBJECT
59public:
62
63protected:
64 // DCC DESCRIPTOR
65 QString m_szIp; // Dcc initiator ip address (the one that listens)
66 QString m_szPort; // Dcc initiator port (the one that listens)
67 // other info
68 bool m_bIPv6; // Dcc mode
69 kvi_u32_t m_uPort; // Dcc initiator port
70 bool m_bOutgoing; // true if WE have connected to the remote host (so m_szIp is the remote host ip)
71 QString m_szSecondaryIp; // Ip of the client that has connected to the remote host
72 QString m_szSecondaryPort; // Port of the client that has connected to the remote host
73 // internals
74 kvi_socket_t m_fd; // socket
75 QSocketNotifier * m_pSn;
78#ifdef COMPILE_SSL_SUPPORT
79 KviSSL * m_pSSL;
80 bool m_bUseSSL;
81#endif
83
84public:
85 const QString & dccIp() const { return m_szIp; };
86 const QString & dccPort() const { return m_szPort; };
87 const QString & localIp() const { return m_bOutgoing ? m_szSecondaryIp : m_szIp; };
88 const QString & localPort() const { return m_bOutgoing ? m_szSecondaryPort : m_szPort; };
89 const QString & remoteIp() const { return m_bOutgoing ? m_szIp : m_szSecondaryIp; };
90 const QString & remotePort() const { return m_bOutgoing ? m_szPort : m_szSecondaryPort; };
91 KviError::Code dccListen(const QString & ip, const QString & port, bool bUseTimeout, bool bUseSSL = false);
92 KviError::Code dccConnect(const char * ip, const char * port, bool bUseTimeout, bool bUseSSL = false);
94#ifdef COMPILE_SSL_SUPPORT
95 KviSSL * releaseSSL();
96#endif
97 void abort();
98
99private:
100 void reset();
101 //#ifdef COMPILE_SSL_SUPPORT
102 // bool trySSLCertificate();
103 //#endif
104private slots:
105 void doSSLHandshake(int);
106 // void doListenSSLHandshake();
107 void snActivated(int);
108 void connectionTimedOut();
109 void doListen();
110 void doConnect();
111signals:
113 void sslError(const char * msg);
114 void connected();
117};
118
119#endif //_MARSHAL_H_
Error List.
Definition DccMarshal.h:44
virtual KviWindow * dccMarshalOutputWindow()=0
virtual const char * dccMarshalOutputContextString()=0
virtual ~DccMarshalOutputContext()
Definition DccMarshal.h:49
DccMarshalOutputContext()
Definition DccMarshal.h:48
Definition DccMarshal.h:57
void reset()
Definition DccMarshal.cpp:78
bool m_bUseTimeout
Definition DccMarshal.h:76
void connectionTimedOut()
Definition DccMarshal.cpp:674
void doListen()
Definition DccMarshal.cpp:136
QString m_szIp
Definition DccMarshal.h:65
void inProgress()
QSocketNotifier * m_pSn
Definition DccMarshal.h:75
kvi_u32_t m_uPort
Definition DccMarshal.h:69
void abort()
Definition DccMarshal.cpp:669
const QString & remotePort() const
Definition DccMarshal.h:90
~DccMarshal()
Definition DccMarshal.cpp:57
QString m_szSecondaryIp
Definition DccMarshal.h:71
KviError::Code dccConnect(const char *ip, const char *port, bool bUseTimeout, bool bUseSSL=false)
Definition DccMarshal.cpp:306
QString m_szSecondaryPort
Definition DccMarshal.h:72
const QString & localIp() const
Definition DccMarshal.h:87
void doConnect()
Definition DccMarshal.cpp:327
QTimer * m_pTimeoutTimer
Definition DccMarshal.h:77
bool m_bOutgoing
Definition DccMarshal.h:70
DccMarshalOutputContext * m_pOutputContext
Definition DccMarshal.h:82
const QString & localPort() const
Definition DccMarshal.h:88
void connected()
QString m_szPort
Definition DccMarshal.h:66
const QString & dccPort() const
Definition DccMarshal.h:86
KviError::Code dccListen(const QString &ip, const QString &port, bool bUseTimeout, bool bUseSSL=false)
Definition DccMarshal.cpp:107
void startingSSLHandshake()
void error(KviError::Code)
void snActivated(int)
Definition DccMarshal.cpp:451
const QString & remoteIp() const
Definition DccMarshal.h:89
DccMarshal(DccMarshalOutputContext *ctx)
Definition DccMarshal.cpp:39
bool m_bIPv6
Definition DccMarshal.h:68
void doSSLHandshake(int)
Definition DccMarshal.cpp:587
kvi_socket_t m_fd
Definition DccMarshal.h:74
void sslError(const char *msg)
const QString & dccIp() const
Definition DccMarshal.h:85
kvi_socket_t releaseSocket()
Definition DccMarshal.cpp:62
Base class for all windows in KVIrc.
Definition KviWindow.h:75
int kvi_socket_t
Definition kvi_sockettype.h:40
Code
Contains all error codes.
Definition KviError.h:48