5#ifndef QXMPPSTREAMMANAGEMENT_P_H
6#define QXMPPSTREAMMANAGEMENT_P_H
8#include "QXmppGlobal.h"
9#include "QXmppSendResult.h"
10#include "QXmppStanza.h"
13#include <QDomDocument>
14#include <QXmlStreamWriter>
18namespace QXmpp::Private {
35namespace QXmpp::Private {
38 static std::optional<SmEnable> fromDom(
const QDomElement &);
39 void toXml(QXmlStreamWriter *w)
const;
46 static std::optional<SmEnabled> fromDom(
const QDomElement &);
47 void toXml(QXmlStreamWriter *w)
const;
56 static std::optional<SmResume> fromDom(
const QDomElement &);
57 void toXml(QXmlStreamWriter *w)
const;
64 static std::optional<SmResumed> fromDom(
const QDomElement &);
65 void toXml(QXmlStreamWriter *w)
const;
72 static std::optional<SmFailed> fromDom(
const QDomElement &);
73 void toXml(QXmlStreamWriter *w)
const;
75 std::optional<QXmppStanza::Error::Condition> error;
79 static std::optional<SmAck> fromDom(
const QDomElement &);
80 void toXml(QXmlStreamWriter *w)
const;
86 static std::optional<SmRequest> fromDom(
const QDomElement &);
87 void toXml(QXmlStreamWriter *w)
const;
97 explicit StreamAckManager(XmppSocket &socket);
99 bool enabled()
const {
return m_enabled; }
100 unsigned int lastIncomingSequenceNumber()
const {
return m_lastIncomingSequenceNumber; }
102 void handlePacketSent(QXmppPacket &packet,
bool sentData);
103 bool handleStanza(
const QDomElement &stanza);
104 void onSessionClosed();
107 void enableStreamManagement(
bool resetSequenceNumber);
108 void setAcknowledgedSequenceNumber(
unsigned int sequenceNumber);
111 bool sendPacketCompat(QXmppPacket &&);
112 std::tuple<bool, QXmppTask<QXmpp::SendResult>> internalSend(QXmppPacket &&);
114 void sendAcknowledgementRequest();
117 void handleAcknowledgement(SmAck ack);
119 void sendAcknowledgement();
121 QXmpp::Private::XmppSocket &socket;
123 bool m_enabled =
false;
124 QMap<unsigned int, QXmppPacket> m_unacknowledgedStanzas;
125 unsigned int m_lastOutgoingSequenceNumber = 0;
126 unsigned int m_lastIncomingSequenceNumber = 0;
Definition: QXmppTask.h:62