Пример #1
0
static guint64
tvb_get_guintX(tvbuff_t *tvb, const gint offset, const gint size, const guint encoding) {
    switch (size) {
        case 1:
            return tvb_get_guint8(tvb, offset);
        case 2:
            return tvb_get_guint16(tvb, offset, encoding);
        case 3:
            return tvb_get_guint24(tvb, offset, encoding);
        case 4:
            return tvb_get_guint32(tvb, offset, encoding);
        case 5:
            return tvb_get_guint40(tvb, offset, encoding);
        case 6:
            return tvb_get_guint48(tvb, offset, encoding);
        case 7:
            return tvb_get_guint56(tvb, offset, encoding);
        case 8:
            return tvb_get_guint64(tvb, offset, encoding);
    }

    return 0;
}
Пример #2
0
	return offset;
}

static int
dissect_cbsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
	int len_ind, offset = 0;
	proto_item *ti;
	proto_tree *cbsp_tree = NULL;
	guint8 msg_type;
	const char *str;


	//len = tvb_reported_length(tvb);
	msg_type = tvb_get_guint8(tvb, offset + 0);
	len_ind = tvb_get_guint24(tvb, offset + 1, ENC_BIG_ENDIAN);

	col_set_str(pinfo->cinfo, COL_PROTOCOL, "CBSP");

	col_clear(pinfo->cinfo, COL_INFO);
	str = val_to_str(msg_type, cbsp_msg_type_names, "Unknown CBSP Message Type 0x%02x");
	col_append_fstr(pinfo->cinfo, COL_INFO, "%s ", str);

	if (tree) {
		ti = proto_tree_add_protocol_format(tree, proto_cbsp, tvb, 0, len_ind+4, "CBSP %s", str);
		cbsp_tree = proto_item_add_subtree(ti, ett_cbsp);

		proto_tree_add_item(cbsp_tree, hf_cbsp_msg_type,
				    tvb, offset, 1, ENC_BIG_ENDIAN);
		offset++;