summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Avseyev <sergey.avseyev@gmail.com>2014-12-10 04:19:55 +0300
committerAnders Broman <a.broman58@gmail.com>2014-12-10 07:23:49 +0000
commitbd8d2f583d295dcf62d8876b0a04baf6eb7c635c (patch)
tree9ada0276dc95bf96a8edcedf6bf5b4311c1284a2
parentc46fa33b418d97e116d0440d2a2375a085a1f227 (diff)
downloadwireshark-bd8d2f583d295dcf62d8876b0a04baf6eb7c635c.tar.gz
packet-couchbase.c: dissect more DCP commands
Change-Id: I0e06c89cdda3c1f8e98412fd20737ff6afd26666 Reviewed-on: https://code.wireshark.org/review/5694 Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com> Reviewed-by: Michael Mann <mmann78@netscape.net> Petri-Dish: Michael Mann <mmann78@netscape.net> Reviewed-by: Anders Broman <a.broman58@gmail.com>
-rw-r--r--epan/dissectors/packet-couchbase.c98
1 files changed, 97 insertions, 1 deletions
diff --git a/epan/dissectors/packet-couchbase.c b/epan/dissectors/packet-couchbase.c
index 7d1d6ef91c..3b468e65f0 100644
--- a/epan/dissectors/packet-couchbase.c
+++ b/epan/dissectors/packet-couchbase.c
@@ -53,7 +53,7 @@
#define PSNAME "Couchbase"
#define PFNAME "couchbase"
-#define COUCHBASE_DEFAULT_PORT "11209,11210"
+#define COUCHBASE_DEFAULT_PORT "11210"
#define COUCHBASE_HEADER_LEN 24
/* Magic Byte */
@@ -276,6 +276,10 @@ static int hf_extras_flags_dcp_connection_type = -1;
static int hf_extras_flags_dcp_add_stream_takeover = -1;
static int hf_extras_flags_dcp_add_stream_diskonly = -1;
static int hf_extras_flags_dcp_add_stream_latest = -1;
+static int hf_extras_flags_dcp_snapshot_marker_memory = -1;
+static int hf_extras_flags_dcp_snapshot_marker_disk = -1;
+static int hf_extras_flags_dcp_snapshot_marker_chk = -1;
+static int hf_extras_flags_dcp_snapshot_marker_ack = -1;
static int hf_extras_seqno = -1;
static int hf_extras_opaque = -1;
static int hf_extras_reserved = -1;
@@ -288,6 +292,11 @@ static int hf_extras_expiration = -1;
static int hf_extras_delta = -1;
static int hf_extras_initial = -1;
static int hf_extras_unknown = -1;
+static int hf_extras_by_seqno = -1;
+static int hf_extras_rev_seqno = -1;
+static int hf_extras_lock_time = -1;
+static int hf_extras_nmeta = -1;
+static int hf_extras_nru = -1;
static int hf_key = -1;
static int hf_value = -1;
static int hf_uint64_response = -1;
@@ -764,6 +773,84 @@ dissect_extras(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
}
break;
+ 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;
+ } else {
+ illegal = TRUE;
+ }
+ } else if (request) {
+ /* Request must have extras */
+ missing = TRUE;
+ }
+ break;
+
+ case PROTOCOL_BINARY_DCP_MUTATION:
+ if (extlen) {
+ if (request) {
+ static const int * extra_flags[] = {
+ NULL
+ };
+
+ proto_tree_add_item(extras_tree, hf_extras_by_seqno, tvb, offset, 8, ENC_BIG_ENDIAN);
+ offset += 8;
+ proto_tree_add_item(extras_tree, hf_extras_rev_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;
+ proto_tree_add_item(extras_tree, hf_extras_expiration, tvb, offset, 4, ENC_BIG_ENDIAN);
+ offset += 4;
+ proto_tree_add_item(extras_tree, hf_extras_lock_time, tvb, offset, 4, ENC_BIG_ENDIAN);
+ offset += 4;
+ proto_tree_add_item(extras_tree, hf_extras_nmeta, tvb, offset, 2, ENC_BIG_ENDIAN);
+ offset += 2;
+ proto_tree_add_item(extras_tree, hf_extras_nru, tvb, offset, 1, ENC_BIG_ENDIAN);
+ offset += 1;
+ } else {
+ illegal = TRUE;
+ }
+ } else if (request) {
+ /* Request must have extras */
+ missing = TRUE;
+ }
+ break;
+
+ case PROTOCOL_BINARY_DCP_DELETION:
+ case PROTOCOL_BINARY_DCP_EXPIRATION:
+ case PROTOCOL_BINARY_DCP_FLUSH:
+ if (extlen) {
+ if (request) {
+ proto_tree_add_item(extras_tree, hf_extras_by_seqno, tvb, offset, 8, ENC_BIG_ENDIAN);
+ offset += 8;
+ proto_tree_add_item(extras_tree, hf_extras_rev_seqno, tvb, offset, 8, ENC_BIG_ENDIAN);
+ offset += 8;
+ proto_tree_add_item(extras_tree, hf_extras_nmeta, tvb, offset, 2, ENC_BIG_ENDIAN);
+ offset += 2;
+ proto_tree_add_item(extras_tree, hf_extras_nru, tvb, offset, 1, ENC_BIG_ENDIAN);
+ offset += 1;
+ } else {
+ illegal = TRUE;
+ }
+ } else if (request) {
+ /* Request must have extras */
+ missing = TRUE;
+ }
+ break;
+
default:
if (extlen) {
/* Decode as unknown extras */
@@ -1205,6 +1292,10 @@ proto_register_couchbase(void)
{ &hf_extras_flags_dcp_add_stream_takeover, {"Take Over", "couchbase.extras.flags.dcp_add_stream_takeover", FT_BOOLEAN, 16, TFS(&tfs_set_notset), 0x01, NULL, HFILL } },
{ &hf_extras_flags_dcp_add_stream_diskonly, {"Disk Only", "couchbase.extras.flags.dcp_add_stream_diskonly", FT_BOOLEAN, 16, TFS(&tfs_set_notset), 0x02, NULL, HFILL } },
{ &hf_extras_flags_dcp_add_stream_latest, {"Latest", "couchbase.extras.flags.dcp_add_stream_latest", FT_BOOLEAN, 16, TFS(&tfs_set_notset), 0x04, NULL, HFILL } },
+ { &hf_extras_flags_dcp_snapshot_marker_memory, {"Memory", "couchbase.extras.flags.dcp_snapshot_marker_memory", FT_BOOLEAN, 16, TFS(&tfs_set_notset), 0x01, NULL, HFILL } },
+ { &hf_extras_flags_dcp_snapshot_marker_disk, {"Disk", "couchbase.extras.flags.dcp_snapshot_marker_disk", FT_BOOLEAN, 16, TFS(&tfs_set_notset), 0x02, NULL, HFILL } },
+ { &hf_extras_flags_dcp_snapshot_marker_chk, {"Chk", "couchbase.extras.flags.dcp_snapshot_marker_chk", FT_BOOLEAN, 16, TFS(&tfs_set_notset), 0x04, NULL, HFILL } },
+ { &hf_extras_flags_dcp_snapshot_marker_ack, {"Ack", "couchbase.extras.flags.dcp_snapshot_marker_ack", FT_BOOLEAN, 16, TFS(&tfs_set_notset), 0x08, NULL, HFILL } },
{ &hf_extras_seqno, { "Sequence number", "couchbase.extras.seqno", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } },
{ &hf_extras_opaque, { "Opaque (vBucket identifier)", "couchbase.extras.opaque", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } },
{ &hf_extras_reserved, { "Reserved", "couchbase.extras.reserved", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } },
@@ -1213,6 +1304,11 @@ proto_register_couchbase(void)
{ &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_HEX, NULL, 0x0, NULL, HFILL } },
{ &hf_extras_snap_end_seqno, { "Snapshot End Sequence Number", "couchbase.extras.snap_start_seqno", FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL } },
+ { &hf_extras_by_seqno, { "by_seqno", "couchbase.extras.by_seqno", FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL } },
+ { &hf_extras_rev_seqno, { "rev_seqno", "couchbase.extras.rev_seqno", FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL } },
+ { &hf_extras_lock_time, { "lock_time", "couchbase.extras.lock_time", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+ { &hf_extras_nmeta, { "nmeta", "couchbase.extras.nmeta", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } },
+ { &hf_extras_nru, { "nru", "couchbase.extras.nru", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } },
{ &hf_failover_log, { "Failover Log", "couchbase.dcp.failover_log", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
{ &hf_failover_log_size, { "Size", "couchbase.dcp.failover_log.size", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },