lib/misc/message_header.js
/**
 * convert the messageChunk header to a string
 * @method messageHeaderToString
 * @param messageChunk {BinaryStream}
 * @return {string}
 */
convert the messageChunk header to a string
@method messageHeaderToString
@param messageChunk {BinaryStream}
@return {string}
convert the messageChunk header to a string @method messageHeaderToString @param messageChunk { BinaryStream } @return { string }
function messageHeaderToString(messageChunk) {
    var stream = new BinaryStream(messageChunk);
    var messageHeader = readMessageHeader(stream);
    if (messageHeader.msgType === "ERR" || messageHeader.msgType === "HEL") {
        return messageHeader.msgType + " " + messageHeader.isFinal + " length   = " + messageHeader.length;
    }
    var chooseSecurityHeader = require("lib/services/secure_channel_service").chooseSecurityHeader;
    var SequenceHeader = require("lib/services/secure_channel_service").SequenceHeader;
    var securityHeader = chooseSecurityHeader(messageHeader.msgType);
    var sequenceHeader = new SequenceHeader();
    assert(stream.length === 8);
    var secureChannelId = stream.readUInt32();
    securityHeader.decode(stream);
    sequenceHeader.decode(stream);
    var slice = messageChunk.slice(0, stream.length);
    return messageHeader.msgType + " " +
        messageHeader.isFinal +
        " length   = " + messageHeader.length +
        " channel  = " + secureChannelId +
        " seqNum   = " + sequenceHeader.sequenceNumber +
        " req ID   = " + sequenceHeader.requestId +
        " security   = " + JSON.stringify(securityHeader) +
        "\n\n" + hexDump(slice);
}
function messageHeaderToString ( messageChunk ) { var stream = new BinaryStream ( messageChunk ) ; var messageHeader = readMessageHeader ( stream ) ; if ( messageHeader . msgType === "ERR" || messageHeader . msgType === "HEL" ) { return messageHeader . msgType + " " + messageHeader . isFinal + " length   = " + messageHeader . length ; } var chooseSecurityHeader = require ( "lib/services/secure_channel_service" ) . chooseSecurityHeader ; var SequenceHeader = require ( "lib/services/secure_channel_service" ) . SequenceHeader ; var securityHeader = chooseSecurityHeader ( messageHeader . msgType ) ; var sequenceHeader = new SequenceHeader ( ) ; assert ( stream . length === 8 ) ; var secureChannelId = stream . readUInt32 ( ) ; securityHeader . decode ( stream ) ; sequenceHeader . decode ( stream ) ; var slice = messageChunk . slice ( 0 , stream . length ) ; return messageHeader . msgType + " " + messageHeader . isFinal + " length   = " + messageHeader . length + " channel  = " + secureChannelId + " seqNum   = " + sequenceHeader . sequenceNumber + " req ID   = " + sequenceHeader . requestId + " security   = " + JSON . stringify ( securityHeader ) + "\n\n" + hexDump ( slice ) ; }
convert the messageChunk header to a string
 @method messageHeaderToString
 @param messageChunk {BinaryStream}
 @return {string}
convert the messageChunk header to a string @method messageHeaderToString @param messageChunk { BinaryStream } @return { string }