Esempio n. 1
0
 * @param tree the parent tree where the dissected data is going to be inserted
 *
 */
static int
dissect_knet_message(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, int messageindex)
{
    int content_length, total_length, messageid;
    int start_offset = offset;

    proto_item *msgblock_ti;
    proto_tree *msgblock_tree;

    msgblock_ti = proto_tree_add_item(tree, hf_knet_message_tree, tvb, offset, -1, ENC_NA);
    msgblock_tree = proto_item_add_subtree(msgblock_ti, ett_knet_message);

    content_length = dissect_content_length(tvb, offset, msgblock_tree); /* Calculates the Content Length of this packet. */

    if(tvb_get_guint8(tvb, offset+1) & UDP_MSG_BLOCK_RELIABLE_FLAG) /* If the reliable flag is 1 then calculate RMN */
        offset += dissect_reliable_message_number(tvb, offset+2, msgblock_tree);

    offset += 2; /* Move the offset the amount of contentlength and flags fields */

    total_length = (offset-start_offset)+content_length;
    proto_item_set_len(msgblock_ti, total_length);

    messageid = dissect_messageid(tvb, &offset, msgblock_tree, pinfo, messageindex != 0);

    dissect_payload(tvb, offset, messageid, msgblock_tree, content_length);

    return total_length;
}
Esempio n. 2
0
 *
 */
static void
dissect_knet_message(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, emem_strbuf_t* info_field)
{
    int offset;
    int content_length;
    int total_length;
    int messageid;

    proto_item *msgblock_ti;
    proto_tree *msgblock_tree;

    offset = 0;

    total_length = dissect_content_length(tvb, offset, NULL) + 2;

    if(tvb_get_bits8(tvb, 11, 1) > 0) /* If reliable flag is 1 */
        total_length += dissect_reliable_message_number(tvb, offset + 2, NULL); /* We add the RMN into the length of the message */

    msgblock_ti = proto_tree_add_item(tree, hf_knet_message_tree, tvb, offset, total_length, ENC_NA);
    msgblock_tree = proto_item_add_subtree(msgblock_ti, ett_knet_message);

    content_length = dissect_content_length(tvb, offset, msgblock_tree); /* Calculates the Content Length of this packet. */

    ep_strbuf_append_printf(info_field, "%d: ", messageindex + 1);

    offset += 2; /* Move the offset the amount of contentlength and flags fields */

    if(tvb_get_bits8(tvb, 11, 1) > 0) /* If the reliable flag is 1 then calculate RMN */
        offset += dissect_reliable_message_number(tvb, offset, msgblock_tree);