#include "UDPProtocol.h"
#include <QDataStream>

CUDPProtocol::CUDPProtocol()
{
}


unsigned int CUDPProtocol::AnalyseNewData(QByteArray Data)
{

    return RET_OK;
}

QByteArray CUDPProtocol::GetInitUDPConnectionPacket()
{
    QByteArray packet;
    packet.clear();
    QDataStream stream(&packet,QIODevice::WriteOnly);
    stream.device()->seek(0);

    quint32 Request = (quint32)UDP_INIT_CONNECTION_REQUEST;

    stream << UDP_PROTOCOL_HEADER << Request;

    return packet;
}

QByteArray CUDPProtocol::GetCloseUDPConnectionPacket()
{
    QByteArray packet;
    packet.clear();
    QDataStream stream(&packet,QIODevice::WriteOnly);
    stream.device()->seek(0);

    quint32 Request = (quint32)UDP_CLOSE_CONNECTION_REQUEST;

    stream << UDP_PROTOCOL_HEADER << Request;

    return packet;
}
