summaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-cql.c
diff options
context:
space:
mode:
Diffstat (limited to 'epan/dissectors/packet-cql.c')
-rw-r--r--epan/dissectors/packet-cql.c35
1 files changed, 22 insertions, 13 deletions
diff --git a/epan/dissectors/packet-cql.c b/epan/dissectors/packet-cql.c
index 32b03ec..668ba72 100644
--- a/epan/dissectors/packet-cql.c
+++ b/epan/dissectors/packet-cql.c
@@ -147,6 +147,7 @@ static int ett_cql_protocol = -1;
static int ett_cql_version = -1;
static int ett_cql_message = -1;
static int ett_cql_result_columns = -1;
+static int ett_cql_results_no_metadata = -1;
static int ett_cql_result_map = -1;
static int ett_cql_result_set = -1;
static int ett_cql_result_metadata = -1;
@@ -1430,6 +1431,16 @@ dissect_cql_tcp_pdu(tvbuff_t* raw_tvb, packet_info* pinfo, proto_tree* tree, voi
}
offset += 4;
+ if (result_rows_flags & CQL_RESULT_ROWS_FLAG_HAS_MORE_PAGES) {
+ /* show paging state */
+ proto_tree_add_item_ret_int(metadata_subtree, hf_cql_bytes_length, tvb, offset, 4, ENC_BIG_ENDIAN, &bytes_length);
+ offset += 4;
+ if (bytes_length > 0) {
+ proto_tree_add_item(metadata_subtree, hf_cql_paging_state, tvb, offset, bytes_length, ENC_NA);
+ offset += bytes_length;
+ }
+ }
+
if ((result_rows_flags & (CQL_RESULT_ROWS_FLAG_GLOBAL_TABLES_SPEC | CQL_RESULT_ROWS_FLAG_NO_METADATA)) == CQL_RESULT_ROWS_FLAG_GLOBAL_TABLES_SPEC) {
proto_tree_add_item_ret_uint(metadata_subtree, hf_cql_string_length, tvb, offset, 2, ENC_BIG_ENDIAN, &string_length);
offset += 2;
@@ -1442,16 +1453,6 @@ dissect_cql_tcp_pdu(tvbuff_t* raw_tvb, packet_info* pinfo, proto_tree* tree, voi
offset += string_length;
}
- if (result_rows_flags & CQL_RESULT_ROWS_FLAG_HAS_MORE_PAGES) {
- /* show paging state */
- proto_tree_add_item_ret_int(metadata_subtree, hf_cql_bytes_length, tvb, offset, 4, ENC_BIG_ENDIAN, &bytes_length);
- offset += 4;
- if (bytes_length > 0) {
- proto_tree_add_item(metadata_subtree, hf_cql_paging_state, tvb, offset, bytes_length, ENC_NA);
- offset += bytes_length;
- }
- }
-
if (result_rows_flags & CQL_RESULT_ROWS_FLAG_NO_METADATA) {
/* There will be no col_spec elements. */
} else {
@@ -1504,12 +1505,19 @@ dissect_cql_tcp_pdu(tvbuff_t* raw_tvb, packet_info* pinfo, proto_tree* tree, voi
offset = parse_row(columns_subtree, pinfo, tvb, offset_row_metadata, offset, result_rows_columns_count);
} else {
for (k = 0; k < result_rows_columns_count; ++k) {
- single_column_subtree = proto_tree_add_item_ret_int(columns_subtree, hf_cql_bytes_length, tvb, offset, 4, ENC_BIG_ENDIAN, &bytes_length);
- proto_item_append_text(single_column_subtree, " for column # %" PRId64, k + 1);
- offset += 4;
+ proto_tree_add_item_ret_int(columns_subtree, hf_cql_bytes_length, tvb, offset, 4, ENC_BIG_ENDIAN, &bytes_length);
+ single_column_subtree = proto_tree_add_subtree(columns_subtree, tvb, offset, bytes_length > 0 ? bytes_length : 0, ett_cql_results_no_metadata, &ti, "Column data");
if (bytes_length > 0) {
+ proto_item_append_text(single_column_subtree, " for column # %" PRId64, k + 1);
proto_tree_add_item(single_column_subtree, hf_cql_bytes, tvb, offset, bytes_length, ENC_NA);
offset += bytes_length;
+ } else if (bytes_length == -1) {
+ proto_item_append_text(single_column_subtree, " is NULL for column # %" PRId64, k + 1);
+ } else if (bytes_length == -2) {
+ proto_item_append_text(single_column_subtree, " is not set for column # %" PRId64, k + 1);
+ } else {
+ expert_add_info(pinfo, ti, &ei_cql_unexpected_negative_value);
+ return tvb_reported_length(tvb);
}
}
}
@@ -2503,6 +2511,7 @@ proto_register_cql(void)
&ett_cql_version,
&ett_cql_message,
&ett_cql_result_columns,
+ &ett_cql_results_no_metadata,
&ett_cql_result_map,
&ett_cql_result_set,
&ett_cql_result_metadata,