9 #ifndef overte_WebRTCSocket_h
10 #define overte_WebRTCSocket_h
12 #include <shared/WebRTC.h>
14 #if defined(WEBRTC_DATA_CHANNELS)
16 #include <QAbstractSocket>
20 #include "WebRTCDataChannels.h"
47 void setSocketOption(QAbstractSocket::SocketOption option,
const QVariant& value);
55 QVariant
socketOption(QAbstractSocket::SocketOption option);
65 bool bind(
const QHostAddress& address, quint16 port = 0, QAbstractSocket::BindMode mode
66 = QAbstractSocket::DefaultForPlatform);
72 QAbstractSocket::SocketState
state()
const;
92 qint64
writeDatagram(
const QByteArray& datagram,
const SockAddr& destination);
114 qint64
readDatagram(
char* data, qint64 maxSize, QHostAddress* address =
nullptr, quint16* port =
nullptr);
119 QAbstractSocket::SocketError
error()
const;
153 void setError(QAbstractSocket::SocketError errorType, QString
errorString);
158 bool _isBound {
false };
160 QQueue<QPair<SockAddr, QByteArray>> _receivedQueue;
162 QAbstractSocket::SocketError _lastErrorType { QAbstractSocket::UnknownSocketError };
163 QString _lastErrorString;
Manages WebRTC data channels on the domain server or an assignment client that Interface clients can ...
Definition: WebRTCDataChannels.h:230
Provides a QUdpSocket-style interface for using WebRTCDataChannels.
Definition: WebRTCSocket.h:31
qint64 writeDatagram(const QByteArray &datagram, const SockAddr &destination)
Sends a datagram.
Definition: WebRTCSocket.cpp:81
void onSignalingMessage(const QJsonObject &json)
Emitted when a WebRTC signaling message has been received from the signaling server for this WebRTCSo...
qint64 pendingDatagramSize() const
Gets the size of the first pending datagram.
Definition: WebRTCSocket.cpp:99
QAbstractSocket::SocketState state() const
Gets the state of the socket.
Definition: WebRTCSocket.cpp:72
QAbstractSocket::SocketError error() const
Gets the type of error that last occurred.
Definition: WebRTCSocket.cpp:131
void sendSignalingMessage(const QJsonObject &message)
Emitted when there's a WebRTC signaling message to send via the signaling server.
void setSocketOption(QAbstractSocket::SocketOption option, const QVariant &value)
Nominally sets the value of a socket option.
Definition: WebRTCSocket.cpp:31
QVariant socketOption(QAbstractSocket::SocketOption option)
Nominally gets the value of a socket option.
Definition: WebRTCSocket.cpp:45
WebRTCSocket(QObject *parent)
Constructs a new WebRTCSocket object.
Definition: WebRTCSocket.cpp:19
void abort()
Immediately closes all connections and resets the socket.
Definition: WebRTCSocket.cpp:76
quint16 localPort() const
Nominally gets the host port number. Included for compatibility with the QUdpSocket interface.
Definition: WebRTCSocket.h:80
void stateChanged(QAbstractSocket::SocketState socketState)
Emitted when the state of the socket changes.
QString errorString() const
Gets the description of the error that last occurred.
Definition: WebRTCSocket.cpp:135
qintptr socketDescriptor() const
Nominally gets the socket descriptor. Included for compatibility with the QUdpSocket interface.
Definition: WebRTCSocket.h:85
bool hasPendingDatagrams() const
Gets whether there's a datagram waiting to be read.
Definition: WebRTCSocket.cpp:95
void onDataChannelReceivedMessage(const SockAddr &source, const QByteArray &message)
Handles the WebRTC data channel receiving a message.
Definition: WebRTCSocket.cpp:150
qint64 readDatagram(char *data, qint64 maxSize, QHostAddress *address=nullptr, quint16 *port=nullptr)
Reads the next datagram, up to a maximum number of bytes.
Definition: WebRTCSocket.cpp:106
qint64 bytesToWrite(const SockAddr &destination) const
Gets the number of bytes waiting to be written.
Definition: WebRTCSocket.cpp:90
void readyRead()
Emitted each time new data becomes available for reading.
bool bind(const QHostAddress &address, quint16 port=0, QAbstractSocket::BindMode mode=QAbstractSocket::DefaultForPlatform)
Nominally binds the WebRTC socket to an address and port.
Definition: WebRTCSocket.cpp:62