diff options
Diffstat (limited to 'epan/dissectors/packet-scylla.c')
-rw-r--r-- | epan/dissectors/packet-scylla.c | 83 |
1 files changed, 42 insertions, 41 deletions
diff --git a/epan/dissectors/packet-scylla.c b/epan/dissectors/packet-scylla.c index a01551bc59..45c7ca0d97 100644 --- a/epan/dissectors/packet-scylla.c +++ b/epan/dissectors/packet-scylla.c @@ -25,11 +25,13 @@ #include <epan/expert.h> #include <epan/packet.h> #include <epan/prefs.h> -#include <epan/dissectors/packet-tcp.h> +#include "packet-tcp.h" void proto_reg_handoff_scylla(void); void proto_register_scylla(void); +static dissector_handle_t scylla_handle; + #define SCYLLA_PORT 0 /* Not IANA registered, 7000 is the expected value */ #define SCYLLA_HEADER_SIZE 28 @@ -44,47 +46,47 @@ void proto_register_scylla(void); #define SCYLLA_NEGOTIATION_SIZE 12 #define SCYLLA_NEGOTIATION_LEN_OFFSET 8 -static int proto_scylla = -1; - -static int hf_scylla_request = -1; -static int hf_scylla_request_response_frame = -1; -static int hf_scylla_timeout = -1; -static int hf_scylla_verb = -1; -static int hf_scylla_msg_id = -1; -static int hf_scylla_len = -1; -static int hf_scylla_response = -1; -static int hf_scylla_response_size = -1; -static int hf_scylla_response_request_frame = -1; -static int hf_scylla_negotiation_magic = -1; -static int hf_scylla_negotiation_size = -1; -static int hf_scylla_payload = -1; // TODO: dissect everything, so that generic "payload" is not needed +static int proto_scylla; + +static int hf_scylla_request; +static int hf_scylla_request_response_frame; +static int hf_scylla_timeout; +static int hf_scylla_verb; +static int hf_scylla_msg_id; +static int hf_scylla_len; +static int hf_scylla_response; +static int hf_scylla_response_size; +static int hf_scylla_response_request_frame; +static int hf_scylla_negotiation_magic; +static int hf_scylla_negotiation_size; +static int hf_scylla_payload; // TODO: dissect everything, so that generic "payload" is not needed // Mutation -static int hf_scylla_mut_size1 = -1; -static int hf_scylla_mut_size2 = -1; -static int hf_scylla_mut_table_id = -1; -static int hf_scylla_mut_schema_id = -1; -static int hf_scylla_mut_len_pkeys = -1; -static int hf_scylla_mut_num_pkeys = -1; -static int hf_scylla_mut_len_pkey = -1; -static int hf_scylla_mut_pkey = -1; +static int hf_scylla_mut_size1; +static int hf_scylla_mut_size2; +static int hf_scylla_mut_table_id; +static int hf_scylla_mut_schema_id; +static int hf_scylla_mut_len_pkeys; +static int hf_scylla_mut_num_pkeys; +static int hf_scylla_mut_len_pkey; +static int hf_scylla_mut_pkey; // Read data -static int hf_scylla_read_data_timeout = -1; -static int hf_scylla_read_data_table_id = -1; -static int hf_scylla_read_data_schema_version = -1; - -static gint ett_scylla = -1; -static gint ett_scylla_header = -1; -static gint ett_scylla_response = -1; -static gint ett_scylla_negotiation = -1; -static gint ett_scylla_mut = -1; -static gint ett_scylla_mut_pkey = -1; -static gint ett_scylla_read_data = -1; +static int hf_scylla_read_data_timeout; +static int hf_scylla_read_data_table_id; +static int hf_scylla_read_data_schema_version; + +static gint ett_scylla; +static gint ett_scylla_header; +static gint ett_scylla_response; +static gint ett_scylla_negotiation; +static gint ett_scylla_mut; +static gint ett_scylla_mut_pkey; +static gint ett_scylla_read_data; static gboolean scylla_desegment = TRUE; -static expert_field ei_scylla_response_missing = EI_INIT; +static expert_field ei_scylla_response_missing; enum scylla_packets { CLIENT_ID = 0, @@ -229,7 +231,7 @@ dissect_scylla_negotiation_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *sc proto_tree *scylla_negotiation_tree = proto_tree_add_subtree(scylla_tree, tvb, offset, len, ett_scylla_negotiation, NULL, "Protocol negotiation"); - proto_tree_add_item(scylla_negotiation_tree, hf_scylla_negotiation_magic, tvb, offset, 8, ENC_ASCII|ENC_NA); + proto_tree_add_item(scylla_negotiation_tree, hf_scylla_negotiation_magic, tvb, offset, 8, ENC_ASCII); gint negotiation_offset = 8; proto_tree_add_item(scylla_negotiation_tree, hf_scylla_negotiation_size, tvb, offset + negotiation_offset, 4, ENC_LITTLE_ENDIAN); negotiation_offset += 4; @@ -270,7 +272,7 @@ dissect_scylla_response_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *scyll proto_item *req = proto_tree_add_uint(scylla_tree, hf_scylla_response_request_frame, tvb, 0, 0, req_resp->request_frame_num); proto_item_set_generated(req); - proto_item_append_text(response_ti, " (msg_id=%" G_GINT64_MODIFIER "u, %s)", + proto_item_append_text(response_ti, " (msg_id=%" PRIu64 ", %s)", msg_id, val64_to_str(req_resp->verb_type, packettypenames, "Unknown (0x%02x)")); col_clear(pinfo->cinfo, COL_INFO); @@ -305,7 +307,7 @@ dissect_scylla_msg_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *scylla_tre proto_tree_add_item(scylla_header_tree, hf_scylla_len, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; - proto_item_append_text(request_ti, " (msg_id=%" G_GINT64_MODIFIER "u)", msg_id); + proto_item_append_text(request_ti, " (msg_id=%" PRIu64 ")", msg_id); switch (verb_type) { case MUTATION: { @@ -527,14 +529,13 @@ proto_register_scylla(void) proto_register_subtree_array(ett, array_length(ett)); expert_scylla = expert_register_protocol(proto_scylla); expert_register_field_array(expert_scylla, ei, array_length(ei)); + + scylla_handle = register_dissector("scylla", dissect_scylla, proto_scylla); } void proto_reg_handoff_scylla(void) { - static dissector_handle_t scylla_handle; - - scylla_handle = create_dissector_handle(dissect_scylla, proto_scylla); dissector_add_uint_with_preference("tcp.port", SCYLLA_PORT, scylla_handle); } |