QXmppIceConnection Class
The QXmppIceConnection class represents a set of UDP sockets capable of performing Interactive Connectivity Establishment (RFC 5245). More...
| Header: | #include <QXmppStun.h> |
| Inherits: | QXmppLoggable |
Public Types
(since QXmpp 0.9.3) enum | GatheringState { NewGatheringState, BusyGatheringState, CompleteGatheringState } |
Properties
(since QXmpp 0.9.3)gatheringState : QXmppIceConnection::GatheringState
Public Functions
| QXmppIceConnection(QObject *parent = nullptr) | |
| void | addComponent(int component) |
| void | addRemoteCandidate(const QXmppJingleCandidate &candidate) |
| bool | bind(const QList<QHostAddress> &addresses) |
| QXmppIceComponent * | component(int component) |
(since QXmpp 0.9.3) QXmppIceConnection::GatheringState | gatheringState() const |
| bool | isConnected() const |
| QList<QXmppJingleCandidate> | localCandidates() const |
| QString | localPassword() const |
| QString | localUser() const |
| void | setIceControlling(bool controlling) |
| void | setRemotePassword(const QString &password) |
| void | setRemoteUser(const QString &user) |
(since QXmpp 1.14) void | setStunServers(const QList<QXmpp::StunServer> &servers) |
(since QXmpp 1.14) void | setTurnServer(const QXmpp::TurnServer &server) |
Public Slots
| void | close() |
| void | connectToHost() |
Signals
| void | connected() |
| void | disconnected() |
(since QXmpp 0.9.3) void | gatheringStateChanged() |
| void | localCandidatesChanged() |
Detailed Description
A typical example is:
QXmppIceConnection *connection = new QXmppIceConnection();
connection->setIceControlling(true);
connection->addComponent(1);
// if needed, set STUN / TURN configuration
// connection->setStunServer(..);
// connection->setTurnServer(..);
// start listening
connection->bind(QXmppIceComponent::discoverAddresses());
// receive remote information: user, password, candidates
// ...
// set remote information and start connecting
connection->setRemoteUser("foo");
connection->setRemoteUser("bar");
connection->addRemoteCandidate(..);
connection->connectToHost();
Member Type Documentation
[since QXmpp 0.9.3] enum QXmppIceConnection::GatheringState
This enum describes the gathering state of the ICE connection.
| Constant | Value |
|---|---|
QXmppIceConnection::NewGatheringState | 0 |
QXmppIceConnection::BusyGatheringState | 1 |
QXmppIceConnection::CompleteGatheringState | 2 |
This enum was introduced in QXmpp 0.9.3.
Property Documentation
[read-only, since QXmpp 0.9.3] gatheringState : QXmppIceConnection::GatheringState
The ICE gathering state, that is the discovery of local candidates
This enumeration was introduced in QXmpp 0.9.3.
Access functions:
| QXmppIceConnection::GatheringState | gatheringState() const |
Notifier signal:
| void | gatheringStateChanged() |
Member Function Documentation
QXmppIceConnection::QXmppIceConnection(QObject *parent = nullptr)
Constructs a new ICE connection with parent.
void QXmppIceConnection::addComponent(int component)
Adds a component to this ICE connection, for instance 1 for RTP or 2 for RTCP.
void QXmppIceConnection::addRemoteCandidate(const QXmppJingleCandidate &candidate)
Adds a candidate for one of the remote components.
bool QXmppIceConnection::bind(const QList<QHostAddress> &addresses)
Binds the local sockets to the specified addresses on which to listen. Returns true on success.
[slot] void QXmppIceConnection::close()
Closes the ICE connection.
QXmppIceComponent *QXmppIceConnection::component(int component)
Returns the given component of this ICE connection.
[slot] void QXmppIceConnection::connectToHost()
Starts ICE connectivity checks.
[signal] void QXmppIceConnection::connected()
This signal is emitted once ICE negotiation succeeds.
[signal] void QXmppIceConnection::disconnected()
This signal is emitted when ICE negotiation fails.
[since QXmpp 0.9.3] QXmppIceConnection::GatheringState QXmppIceConnection::gatheringState() const
Returns the ICE gathering state, that is the discovery of local candidates.
Note: Getter function for property gatheringState.
This function was introduced in QXmpp 0.9.3.
[signal, since QXmpp 0.9.3] void QXmppIceConnection::gatheringStateChanged()
This signal is emitted when the gathering state of local candidates changes.
Note: Notifier signal for property gatheringState.
This function was introduced in QXmpp 0.9.3.
bool QXmppIceConnection::isConnected() const
Returns true if ICE negotiation completed, false otherwise.
QList<QXmppJingleCandidate> QXmppIceConnection::localCandidates() const
Returns the list of local HOST CANDIDATES candidates by iterating over the available network interfaces.
[signal] void QXmppIceConnection::localCandidatesChanged()
This signal is emitted when the list of local candidates changes.
QString QXmppIceConnection::localPassword() const
Returns the local password.
QString QXmppIceConnection::localUser() const
Returns the local user fragment.
void QXmppIceConnection::setIceControlling(bool controlling)
Sets whether the local party has the ICE controlling role.
note This must be called only once, immediately after creating the connection.
controlling.
void QXmppIceConnection::setRemotePassword(const QString &password)
Sets the remote password.
void QXmppIceConnection::setRemoteUser(const QString &user)
Sets the remote user fragment.
[since QXmpp 1.14] void QXmppIceConnection::setStunServers(const QList<QXmpp::StunServer> &servers)
Sets multiple STUN servers to use to determine server-reflexive addresses and ports.
Note: This may only be called prior to calling bind().
This function was introduced in QXmpp 1.14.
[since QXmpp 1.14] void QXmppIceConnection::setTurnServer(const QXmpp::TurnServer &server)
Sets the TURN server to use to relay packets in double-NAT configurations.
Note: This may only be called prior to calling bind().
server.
This function was introduced in QXmpp 1.14.