QXmpp: QXmppIceConnection Class Reference

QXmpp Version: 1.14.4

Loading...
Searching...
No Matches
QXmppIceConnection Class Reference

The QXmppIceConnection class represents a set of UDP sockets capable of performing Interactive Connectivity Establishment (RFC 5245). More...

`#include <QXmppStun.h>`

Inheritance diagram for QXmppIceConnection:

## Public Types
enum | GatheringState { NewGatheringState , BusyGatheringState , CompleteGatheringState }

## Public Member Functions
| QXmppIceConnection (QObject *parent=nullptr)
QXmppIceComponent * | component (int component)
void | addComponent (int component)
void | setIceControlling (bool controlling)
QList< QXmppJingleCandidate > | localCandidates () const
QString | localUser () const
QString | localPassword () const
void | addRemoteCandidate (const QXmppJingleCandidate &candidate)
void | setRemoteUser (const QString &user)
void | setRemotePassword (const QString &password)
void | setStunServers (const QList< QXmpp::StunServer > &servers)
void | setTurnServer (const QXmpp::TurnServer &)
void | setStunServers (const QList< QPair< QHostAddress, quint16 > > &servers)
void | setStunServer (const QHostAddress &host, quint16 port=3478)
void | setTurnServer (const QHostAddress &host, quint16 port=3478)
void | setTurnUser (const QString &user)
void | setTurnPassword (const QString &password)
bool | bind (const QList< QHostAddress > &addresses)
bool | isConnected () const
GatheringState | gatheringState () const
Q_SIGNAL void | connected ()
| This signal is emitted once ICE negotiation succeeds.
Q_SIGNAL void | disconnected ()
| This signal is emitted when ICE negotiation fails.
Q_SIGNAL void | gatheringStateChanged ()
| This signal is emitted when the gathering state of local candidates changes.
Q_SIGNAL void | localCandidatesChanged ()
| This signal is emitted when the list of local candidates changes.
Q_SLOT void | close ()
Q_SLOT void | connectToHost ()
Public Member Functions inherited from QXmppLoggable
| QXmppLoggable (QObject *parent=nullptr)
Q_SIGNAL void | setGauge (const QString &gauge, double value)
| Sets the given gauge to value.
Q_SIGNAL void | logMessage (QXmppLogger::MessageType type, const QString &msg)
| This signal is emitted to send logging messages.
Q_SIGNAL void | updateCounter (const QString &counter, qint64 amount=1)
| Updates the given counter by amount.

## Properties
QXmppIceConnection::GatheringState | gatheringState

## Additional Inherited Members
Protected Member Functions inherited from QXmppLoggable
void | debug (const QString &message)
| Logs a debugging message.
void | info (const QString &message)
| Logs an informational message.
void | warning (const QString &message)
| Logs a warning message.
void | logReceived (const QString &message)
| Logs a received packet.
void | logSent (const QString &message)
| Logs a sent packet.

## Detailed Description

The QXmppIceConnection class represents a set of UDP sockets capable of performing Interactive Connectivity Establishment (RFC 5245).

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();
QXmppIceComponent::discoverAddresses
static QList< QHostAddress > discoverAddresses()
Definition QXmppStun.cpp:2387
QXmppIceConnection::addRemoteCandidate
void addRemoteCandidate(const QXmppJingleCandidate &candidate)
Definition QXmppStun.cpp:2594
QXmppIceConnection::connectToHost
Q_SLOT void connectToHost()
Definition QXmppStun.cpp:2643
QXmppIceConnection::bind
bool bind(const QList< QHostAddress > &addresses)
Definition QXmppStun.cpp:2609
QXmppIceConnection::setIceControlling
void setIceControlling(bool controlling)
Definition QXmppStun.cpp:2679
QXmppIceConnection::QXmppIceConnection
QXmppIceConnection(QObject *parent=nullptr)
Definition QXmppStun.cpp:2535
QXmppIceConnection::setRemoteUser
void setRemoteUser(const QString &user)
Definition QXmppStun.cpp:2718
QXmppIceConnection::addComponent
void addComponent(int component)
Definition QXmppStun.cpp:2565

## Member Enumeration Documentation

## ◆ GatheringState

enum QXmppIceConnection::GatheringState

This enum describes the gathering state of the ICE connection.

Since
  QXmpp 0.9.3

## Constructor & Destructor Documentation

## ◆ QXmppIceConnection()

QXmppIceConnection::QXmppIceConnection | ( | QObject * | parent = nullptr | ) |

Constructs a new ICE connection.

Parameters

  parent |

## Member Function Documentation

## ◆ addComponent()

void QXmppIceConnection::addComponent | ( | int | component | ) |

Adds a component to this ICE connection, for instance 1 for RTP or 2 for RTCP.

Parameters

  component |

## ◆ addRemoteCandidate()

void QXmppIceConnection::addRemoteCandidate | ( | const QXmppJingleCandidate & | candidate | ) |

Adds a candidate for one of the remote components.

Parameters

  candidate |

## ◆ bind()

bool QXmppIceConnection::bind | ( | const QList< QHostAddress > & | addresses | ) |

Binds the local sockets to the specified addresses.

Parameters

  addresses | The addresses on which to listen.

## ◆ close()

void QXmppIceConnection::close | ( |  | ) |

Closes the ICE connection.

## ◆ component()

QXmppIceComponent * QXmppIceConnection::component | ( | int | component | ) |

Returns the given component of this ICE connection.

Parameters

  component |

## ◆ connectToHost()

void QXmppIceConnection::connectToHost | ( |  | ) |

Starts ICE connectivity checks.

## ◆ gatheringState()

QXmppIceConnection::GatheringState QXmppIceConnection::gatheringState | ( |  | ) | const

Returns the ICE gathering state, that is the discovery of local candidates.

Since
  QXmpp 0.9.3

## ◆ gatheringStateChanged()

Q_SIGNAL void QXmppIceConnection::gatheringStateChanged | ( |  | ) |

This signal is emitted when the gathering state of local candidates changes.

Since
  QXmpp 0.9.3

## ◆ isConnected()

bool QXmppIceConnection::isConnected | ( |  | ) | const

Returns true if ICE negotiation completed, false otherwise.

## ◆ localCandidates()

QList< QXmppJingleCandidate > QXmppIceConnection::localCandidates | ( |  | ) | const

Returns the list of local HOST CANDIDATES candidates by iterating over the available network interfaces.

## ◆ localPassword()

QString QXmppIceConnection::localPassword | ( |  | ) | const

Returns the local password.

## ◆ localUser()

QString QXmppIceConnection::localUser | ( |  | ) | const

Returns the local user fragment.

## ◆ setIceControlling()

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.

## ◆ setRemotePassword()

void QXmppIceConnection::setRemotePassword | ( | const QString & | password | ) |

Sets the remote password.

Parameters

  password |

## ◆ setRemoteUser()

void QXmppIceConnection::setRemoteUser | ( | const QString & | user | ) |

Sets the remote user fragment.

Parameters

  user |

## ◆ setStunServer()

void QXmppIceConnection::setStunServer | ( | const QHostAddress & | host,
|  | quint16 | port = 3478 )

Sets a single STUN server to use to determine server-reflexive addresses and ports.

Note
  This may only be called prior to calling bind().

Parameters

  host | The address of the STUN server.
  port | The port of the STUN server.

Deprecated
  Use setStunServers(const QList<QXmpp::StunServer> &)

## ◆ setStunServers() [1/2]

void QXmppIceConnection::setStunServers | ( | const QList< QPair< QHostAddress, quint16 > > & | servers | ) |

Sets multiple STUN servers to use to determine server-reflexive addresses and ports.

Note
  This may only be called prior to calling bind().

Parameters

  servers | List of the STUN servers.

Deprecated
  Use setStunServers(const QList<QXmpp::StunServer> &)

Since
  QXmpp 1.3

## ◆ setStunServers() [2/2]

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().

Parameters

  servers | List of the STUN servers.

Since
  QXmpp 1.14

## ◆ setTurnPassword()

void QXmppIceConnection::setTurnPassword | ( | const QString & | password | ) |

Sets the password used for authentication with the TURN server.

Note
  This may only be called prior to calling bind().

Parameters

  password |

Deprecated
  Use setTurnServer(const QXmpp::TurnServer &)

## ◆ setTurnServer() [1/2]

void QXmppIceConnection::setTurnServer | ( | const QHostAddress & | host,
|  | quint16 | port = 3478 )

Sets the TURN server to use to relay packets in double-NAT configurations.

Note
  This may only be called prior to calling bind().

Parameters

  host | The address of the TURN server.
  port | The port of the TURN server.

Deprecated
  Use setTurnServer(const QXmpp::TurnServer &)

## ◆ setTurnServer() [2/2]

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().

Since
  QXmpp 1.14

## ◆ setTurnUser()

void QXmppIceConnection::setTurnUser | ( | const QString & | user | ) |

Sets the user used for authentication with the TURN server.

Note
  This may only be called prior to calling bind().

Deprecated
  Use setTurnServer(const QXmpp::TurnServer &)

## Property Documentation

## ◆ gatheringState

QXmppIceConnection::GatheringState QXmppIceConnection::gatheringState
| read

The ICE gathering state, that is the discovery of local candidates

Since
  QXmpp 0.9.3

The documentation for this class was generated from the following files:

- QXmppStun.h
- QXmppStun.cpp