source: psi/trunk/iris/jabber/xmpp_jidlink.h@ 44

Last change on this file since 44 was 2, checked in by dmik, 19 years ago

Imported original Psi 0.10 sources from Affinix

File size: 2.5 KB
Line 
1/*
2 * jidlink.h - establish a link between Jabber IDs
3 * Copyright (C) 2001, 2002 Justin Karneges
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 *
19 */
20
21/*
22 NOTE: this is not to be confused with JEP-0041
23*/
24
25#ifndef JABBER_JIDLINK_H
26#define JABBER_JIDLINK_H
27
28#include<qobject.h>
29#include<qstring.h>
30#include"xmpp.h"
31
32class ByteStream;
33
34namespace XMPP
35{
36 class Client;
37
38 class JidLink : public QObject
39 {
40 Q_OBJECT
41 public:
42 enum { None, DTCP, IBB };
43 enum { Idle, Connecting, WaitingForAccept, Active };
44 enum { ErrConnect, ErrStream };
45 enum { StatDTCPRequesting, StatDTCPAccepted, StatDTCPConnected, StatIBBRequesting, StatIBBConnected };
46 JidLink(Client *client);
47 ~JidLink();
48
49 void connectToJid(const Jid &jid, int type, const QDomElement &comment);
50 void accept();
51
52 int type() const;
53 Jid peer() const;
54 int state() const;
55
56 bool isOpen() const;
57 void close();
58 void write(const QByteArray &);
59 QByteArray read(int bytes=0);
60 int bytesAvailable() const;
61 int bytesToWrite() const;
62
63 signals:
64 void connected();
65 void connectionClosed();
66 void readyRead();
67 void bytesWritten(int);
68 void error(int);
69 void status(int);
70
71 private slots:
72 void dtcp_connected();
73 void dtcp_accepted();
74 void ibb_connected();
75
76 void bs_connectionClosed();
77 void bs_error(int);
78 void bs_readyRead();
79 void bs_bytesWritten(int);
80
81 void doRealAccept();
82
83 private:
84 class Private;
85 Private *d;
86
87 void reset(bool clear=false);
88
89 void link();
90 void unlink();
91
92 friend class JidLinkManager;
93 bool setStream(ByteStream *);
94 };
95
96 // the job of JidLinkManager is to keep track of streams and properly shut them down
97 class JidLinkManager : public QObject
98 {
99 Q_OBJECT
100 public:
101 JidLinkManager(Client *);
102 ~JidLinkManager();
103
104 JidLink *takeIncoming();
105
106 void insertStream(ByteStream *);
107
108 private:
109 class Private;
110 Private *d;
111 };
112}
113
114#endif
Note: See TracBrowser for help on using the repository browser.