2
* Copyright (C) 2009 Barracuda Networks, Inc.
4
* This library is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU Lesser General Public
6
* License as published by the Free Software Foundation; either
7
* version 2.1 of the License, or (at your option) any later version.
9
* This library is distributed in the hope that it will be useful,
10
* but WITHANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
* Lesser General Public License for more details.
14
* You should have received a copy of the GNU Lesser General Public
15
* License along with this library; if not, write to the Free Software
16
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21
#ifndef ICELOCALTRANSPORT_H
22
#define ICELOCALTRANSPORT_H
35
// this class manages a single port on a single interface, including the
36
// relationship with an associated STUN/TURN server. if TURN is used, this
37
// class offers two UDP channels (direct or relayed), otherwise it offers
38
// just one UDP channel (direct).
39
class IceLocalTransport : public QObject
61
IceLocalTransport(QObject *parent = 0);
64
void start(const QHostAddress &addr, int port = -1);
67
void setStunService(StunServiceType type, const QHostAddress &addr, int port);
68
void setStunUsername(const QString &user);
69
void setStunPassword(const QCA::SecureArray &pass);
71
// obtain relay / reflexive
74
QHostAddress localAddress() const;
75
int localPort() const;
77
QHostAddress serverReflexiveAddress() const;
78
int serverReflexivePort() const;
80
QHostAddress relayedAddress() const;
81
int relayedPort() const;
83
bool hasPendingDatagrams(TransmitPath path) const;
84
QByteArray readDatagram(TransmitPath path, QHostAddress *addr, int *port);
85
void writeDatagram(TransmitPath path, const QByteArray &buf, const QHostAddress &addr, int port);
91
void error(XMPP::IceLocalTransport::Error e);
93
void readyRead(XMPP::IceLocalTransport::TransmitPath path);
94
void datagramsWritten(XMPP::IceLocalTransport::TransmitPath path, int count);