Ejemplo n.º 1
0
//TODO: remove return int, make bool
int BinTreeNodeReader::readStreamStart()
{
    bool result = getOneToplevelStream();
    //TODO: count real bytes;
    int bytes = getOneToplevelStreamSize();

    if (decodedStream.bytesAvailable() < 3) {
        //TODO: make bool result. remove int.
        //return false;
        return bytes;
    }

    quint8 tag = 0, size;
    //TODO: check for bool result
    readInt8(tag);
    readInt8(size);
    readInt8(tag);
    if (tag != 1) {
        throw ProtocolException("Expecting STREAM_START in readStreamStart.");
    }

    int attribCount = (size - 2 + size % 2) / 2;

    AttributeList attribs;
    if (!readAttributes(attribs,attribCount)) {
        //TODO: make bool result. remove int.
        //return false;
        qDebug() << "readStreamStart: failed to read attributes" << attribCount;
        return bytes;
    }

    //TODO: make bool result. remove int.
    return bytes;
}
Ejemplo n.º 2
0
bool BinTreeNodeReader::nextTree(ProtocolTreeNode& node)
{
    bool result;

    node.setSize(getOneToplevelStream());
    QDataStream in(readBuffer);

    result = nextTreeInternal(node, in);
    qDebug() << "read" << node.toString();
    return result;
}
Ejemplo n.º 3
0
bool BinTreeNodeReader::nextTree(ProtocolTreeNode& node)
{
    bool result;

    node.setSize(getOneToplevelStream());
    QDataStream in(readBuffer);

    result = nextTreeInternal(node, in);
    Utilities::logData(QDateTime::currentDateTime().toString());
    Utilities::logData(node.toString());
    return result;
}
Ejemplo n.º 4
0
bool BinTreeNodeReader::nextTree(ProtocolTreeNode& node)
{
    bool result;

    if (!getOneToplevelStream()) {
        return false;
    }

    node.setSize(getOneToplevelStreamSize());

    result = nextTreeInternal(node);
    Utilities::logData("INCOMING:\n" + node.toString());
    return result;
}
Ejemplo n.º 5
0
int BinTreeNodeReader::readStreamStart()
{
    int bytes = getOneToplevelStream();
    QDataStream in(readBuffer);

    quint8 tag, size;
    in >> tag;
    in >> size;
    in >> tag;
    if (tag != 1)
        throw ProtocolException("Expecting STREAM_START in readStreamStart.");

    int attribCount = (size - 2 + size % 2) / 2;

    AttributeList attribs;

    readAttributes(attribs,attribCount,in);

    return bytes;
}
Ejemplo n.º 6
0
int BinTreeNodeReader::readStreamStart()
{
    int bytes = getOneToplevelStream();
    QDataStream in(readBuffer);

    quint8 tag, size;
    in >> tag;
    in >> size;
    in >> tag;
    if (tag != 1) {
        qDebug() << "Expecting STREAM_START in readStreamStart.";
        //socket->disconnectFromHost();
        Q_EMIT socketBroken();
    }

    int attribCount = (size - 2 + size % 2) / 2;

    AttributeList attribs;

    readAttributes(attribs,attribCount,in);

    return bytes;
}