diff options
author | Jim Walker <jim@couchbase.com> | 2019-11-28 13:39:26 +0000 |
---|---|---|
committer | Jaap Keuter <jaap.keuter@xs4all.nl> | 2019-11-30 04:21:47 +0000 |
commit | d4ca6cc550e98f4a4f2f879a3572ea56792caf45 (patch) | |
tree | 11926ba50e6cad0d55e76a1286e1bf1a6a9fb02a /epan/dissectors/packet-couchbase.c | |
parent | 3c10d7308bded2b49d17726870c83bfefc5e34c8 (diff) |
couchbase: Update dissector for latest 6.5.0 DCP snapshot marker
Decode the v1/v2.0 formats which are relevant for the upcoming
6.5.0 release.
Change-Id: Ie726f1ebd2457f6a36b096a0cd0bed9c94f713df
Reviewed-on: https://code.wireshark.org/review/35251
Reviewed-by: Ben Huddleston <ben.huddleston@couchbase.com>
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Jaap Keuter <jaap.keuter@xs4all.nl>
Diffstat (limited to 'epan/dissectors/packet-couchbase.c')
-rw-r--r-- | epan/dissectors/packet-couchbase.c | 57 |
1 files changed, 40 insertions, 17 deletions
diff --git a/epan/dissectors/packet-couchbase.c b/epan/dissectors/packet-couchbase.c index 680126b1e5..e5d09a801b 100644 --- a/epan/dissectors/packet-couchbase.c +++ b/epan/dissectors/packet-couchbase.c @@ -392,6 +392,8 @@ static int hf_extras_reserved = -1; static int hf_extras_start_seqno = -1; static int hf_extras_end_seqno = -1; static int hf_extras_high_completed_seqno = -1; +static int hf_extras_max_visible_seqno = -1; +static int hf_extras_marker_version = -1; static int hf_extras_vbucket_uuid = -1; static int hf_extras_snap_start_seqno = -1; static int hf_extras_snap_end_seqno = -1; @@ -929,6 +931,14 @@ static const value_string dcp_system_event_id_vals [] = { {0, NULL} }; +static const int * snapshot_marker_flags [] = { + &hf_extras_flags_dcp_snapshot_marker_memory, + &hf_extras_flags_dcp_snapshot_marker_disk, + &hf_extras_flags_dcp_snapshot_marker_chk, + &hf_extras_flags_dcp_snapshot_marker_ack, + NULL +}; + static dissector_handle_t couchbase_handle; static dissector_handle_t json_handle; @@ -1331,23 +1341,19 @@ dissect_extras(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, case PROTOCOL_BINARY_DCP_SNAPSHOT_MARKER: if (extlen) { if (request) { - static const int * extra_flags[] = { - &hf_extras_flags_dcp_snapshot_marker_memory, - &hf_extras_flags_dcp_snapshot_marker_disk, - &hf_extras_flags_dcp_snapshot_marker_chk, - &hf_extras_flags_dcp_snapshot_marker_ack, - NULL - }; - - proto_tree_add_item(extras_tree, hf_extras_start_seqno, tvb, offset, 8, ENC_BIG_ENDIAN); - offset += 8; - proto_tree_add_item(extras_tree, hf_extras_end_seqno, tvb, offset, 8, ENC_BIG_ENDIAN); - offset += 8; - proto_tree_add_bitmask(extras_tree, tvb, offset, hf_extras_flags, ett_extras_flags, extra_flags, ENC_BIG_ENDIAN); - offset += 4; - if (extlen == 28) { - proto_tree_add_item(extras_tree, hf_extras_high_completed_seqno, tvb, offset, 8, ENC_BIG_ENDIAN); + // Two formats exist and the extlen allows us to know which is which + if (extlen == 1) { + proto_tree_add_item(extras_tree, hf_extras_marker_version, tvb, offset, 1, ENC_BIG_ENDIAN); + offset += 1; + } else if (extlen == 20){ + proto_tree_add_item(extras_tree, hf_extras_start_seqno, tvb, offset, 8, ENC_BIG_ENDIAN); offset += 8; + proto_tree_add_item(extras_tree, hf_extras_end_seqno, tvb, offset, 8, ENC_BIG_ENDIAN); + offset += 8; + proto_tree_add_bitmask(extras_tree, tvb, offset, hf_extras_flags, ett_extras_flags, snapshot_marker_flags, ENC_BIG_ENDIAN); + offset += 4; + } else { + illegal = TRUE; } } else { illegal = TRUE; @@ -2269,6 +2275,22 @@ dissect_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } else { ti = proto_tree_add_item(tree, hf_get_errmap_version, tvb, offset, value_len, ENC_BIG_ENDIAN); } + } else if (request && opcode == PROTOCOL_BINARY_DCP_SNAPSHOT_MARKER) { + if (value_len != 36) { + expert_add_info_format(pinfo, ti, &ef_warn_illegal_value_length, "Illegal Value length, should be 36"); + ti = proto_tree_add_item(tree, hf_value, tvb, offset, value_len, ENC_ASCII | ENC_NA); + } else { + proto_tree_add_item(tree, hf_extras_start_seqno, tvb, offset, 8, ENC_BIG_ENDIAN); + offset += 8; + proto_tree_add_item(tree, hf_extras_end_seqno, tvb, offset, 8, ENC_BIG_ENDIAN); + offset += 8; + proto_tree_add_bitmask(tree, tvb, offset, hf_extras_flags, ett_extras_flags, snapshot_marker_flags, ENC_BIG_ENDIAN); + offset += 4; + proto_tree_add_item(tree, hf_extras_max_visible_seqno, tvb, offset, 8, ENC_BIG_ENDIAN); + offset += 8; + proto_tree_add_item(tree, hf_extras_high_completed_seqno, tvb, offset, 8, ENC_BIG_ENDIAN); + offset += 8; + } } else { ti = proto_tree_add_item(tree, hf_value, tvb, offset, value_len, ENC_ASCII | ENC_NA); #ifdef HAVE_SNAPPY @@ -2321,7 +2343,6 @@ dissect_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, case PROTOCOL_BINARY_DCP_CLOSE_STREAM: case PROTOCOL_BINARY_DCP_FAILOVER_LOG_REQUEST: case PROTOCOL_BINARY_DCP_STREAM_END: - case PROTOCOL_BINARY_DCP_SNAPSHOT_MARKER: case PROTOCOL_BINARY_DCP_DELETION: case PROTOCOL_BINARY_DCP_EXPIRATION: case PROTOCOL_BINARY_DCP_FLUSH: @@ -2902,6 +2923,8 @@ proto_register_couchbase(void) { &hf_extras_start_seqno, { "Start Sequence Number", "couchbase.extras.start_seqno", FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_extras_end_seqno, { "End Sequence Number", "couchbase.extras.end_seqno", FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_extras_high_completed_seqno, { "High Completed Sequence Number", "couchbase.extras.high_completed_seqno", FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { &hf_extras_max_visible_seqno, { "Max Visible Seqno", "couchbase.extras.max_visible_seqno", FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { &hf_extras_marker_version, { "Snapshot Marker Version", "couchbase.extras.marker_version", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_extras_vbucket_uuid, { "VBucket UUID", "couchbase.extras.vbucket_uuid", FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_extras_snap_start_seqno, { "Snapshot Start Sequence Number", "couchbase.extras.snap_start_seqno", FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_extras_snap_end_seqno, { "Snapshot End Sequence Number", "couchbase.extras.snap_start_seqno", FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL } }, |