diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-09-19 04:14:53 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-09-19 04:14:53 +0000 |
commit | a86c5f7cae7ec9a3398300555a0b644689d946a1 (patch) | |
tree | 39fe4b107c71174fd1e8a8ceb9a4d2aa14116248 /epan/dissectors/packet-nasdaq-itch.c | |
parent | Releasing progress-linux version 4.2.6-1~progress7.99u1. (diff) | |
download | wireshark-a86c5f7cae7ec9a3398300555a0b644689d946a1.tar.xz wireshark-a86c5f7cae7ec9a3398300555a0b644689d946a1.zip |
Merging upstream version 4.4.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'epan/dissectors/packet-nasdaq-itch.c')
-rw-r--r-- | epan/dissectors/packet-nasdaq-itch.c | 116 |
1 files changed, 58 insertions, 58 deletions
diff --git a/epan/dissectors/packet-nasdaq-itch.c b/epan/dissectors/packet-nasdaq-itch.c index 3b7005fd..673c7dd6 100644 --- a/epan/dissectors/packet-nasdaq-itch.c +++ b/epan/dissectors/packet-nasdaq-itch.c @@ -33,7 +33,7 @@ void proto_reg_handoff_nasdaq_itch(void); static dissector_handle_t nasdaq_itch_handle; /* Chi-X version */ -static gboolean nasdaq_itch_chi_x = TRUE; +static bool nasdaq_itch_chi_x = true; static const value_string message_types_val[] = { { 'A', "Add Order " }, @@ -100,47 +100,47 @@ static const value_string round_lots_only_val[] = { }; /* Initialize the protocol and registered fields */ -static int proto_nasdaq_itch = -1; +static int proto_nasdaq_itch; /* Initialize the subtree pointers */ -static gint ett_nasdaq_itch = -1; - -static int hf_nasdaq_itch_version = -1; - -static int hf_nasdaq_itch_message_type = -1; -static int hf_nasdaq_itch_market_category = -1; -static int hf_nasdaq_itch_financial_status = -1; -static int hf_nasdaq_itch_stock = -1; -static int hf_nasdaq_itch_round_lot_size = -1; -static int hf_nasdaq_itch_round_lots_only = -1; - -static int hf_nasdaq_itch_system_event = -1; -static int hf_nasdaq_itch_second = -1; -static int hf_nasdaq_itch_millisecond = -1; - -static int hf_nasdaq_itch_message = -1; - -static int hf_nasdaq_itch_trading_state = -1; -static int hf_nasdaq_itch_reserved = -1; -static int hf_nasdaq_itch_reason = -1; -static int hf_nasdaq_itch_order_reference = -1; -static int hf_nasdaq_itch_buy_sell = -1; -static int hf_nasdaq_itch_shares = -1; -static int hf_nasdaq_itch_price = -1; -static int hf_nasdaq_itch_attribution = -1; -static int hf_nasdaq_itch_executed = -1; -static int hf_nasdaq_itch_match = -1; -static int hf_nasdaq_itch_printable = -1; -static int hf_nasdaq_itch_execution_price = -1; -static int hf_nasdaq_itch_canceled = -1; -static int hf_nasdaq_itch_cross = -1; +static int ett_nasdaq_itch; + +static int hf_nasdaq_itch_version; + +static int hf_nasdaq_itch_message_type; +static int hf_nasdaq_itch_market_category; +static int hf_nasdaq_itch_financial_status; +static int hf_nasdaq_itch_stock; +static int hf_nasdaq_itch_round_lot_size; +static int hf_nasdaq_itch_round_lots_only; + +static int hf_nasdaq_itch_system_event; +static int hf_nasdaq_itch_second; +static int hf_nasdaq_itch_millisecond; + +static int hf_nasdaq_itch_message; + +static int hf_nasdaq_itch_trading_state; +static int hf_nasdaq_itch_reserved; +static int hf_nasdaq_itch_reason; +static int hf_nasdaq_itch_order_reference; +static int hf_nasdaq_itch_buy_sell; +static int hf_nasdaq_itch_shares; +static int hf_nasdaq_itch_price; +static int hf_nasdaq_itch_attribution; +static int hf_nasdaq_itch_executed; +static int hf_nasdaq_itch_match; +static int hf_nasdaq_itch_printable; +static int hf_nasdaq_itch_execution_price; +static int hf_nasdaq_itch_canceled; +static int hf_nasdaq_itch_cross; /* ---------------------- */ static int order_ref_number(tvbuff_t *tvb, packet_info *pinfo, proto_tree *nasdaq_itch_tree, int offset) { - const char *str_value = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, 9, ENC_ASCII); - guint32 value = (guint32)strtoul(str_value, NULL, 10); + const char *str_value = tvb_get_string_enc(pinfo->pool, tvb, offset, 9, ENC_ASCII); + uint32_t value = (uint32_t)strtoul(str_value, NULL, 10); proto_tree_add_uint(nasdaq_itch_tree, hf_nasdaq_itch_order_reference, tvb, offset, 9, value); col_append_fstr(pinfo->cinfo, COL_INFO, "%u ", value); @@ -150,24 +150,24 @@ order_ref_number(tvbuff_t *tvb, packet_info *pinfo, proto_tree *nasdaq_itch_tree /* -------------------------- */ static int -time_stamp(tvbuff_t *tvb, proto_tree *nasdaq_itch_tree, int id, int offset, int size) +time_stamp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *nasdaq_itch_tree, int id, int offset, int size) { if (nasdaq_itch_tree) { - guint32 ms, val; + uint32_t ms, val; const char *display = ""; - const char *str_value = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, size, ENC_ASCII); + const char *str_value = tvb_get_string_enc(pinfo->pool, tvb, offset, size, ENC_ASCII); - ms = val = (guint32)strtoul(str_value, NULL, 10); + ms = val = (uint32_t)strtoul(str_value, NULL, 10); switch (size) { case 3: - display = wmem_strdup_printf(wmem_packet_scope(), " %03u" , val); + display = wmem_strdup_printf(pinfo->pool, " %03u" , val); break; case 5: ms = val *1000; /* Fall Through */ case 8: /* 0 86 400 000 */ - display = wmem_strdup_printf(wmem_packet_scope(), " %u (%02u:%02u:%02u.%03u)", val, + display = wmem_strdup_printf(pinfo->pool, " %u (%02u:%02u:%02u.%03u)", val, ms/3600000, (ms % 3600000)/60000, (ms % 60000)/1000, ms %1000); break; } @@ -180,10 +180,10 @@ time_stamp(tvbuff_t *tvb, proto_tree *nasdaq_itch_tree, int id, int offset, int static int number_of_shares(tvbuff_t *tvb, packet_info *pinfo, proto_tree *nasdaq_itch_tree, int id, int offset, int big) { - gint size = (big) ? 10 : 6; - const char *str_value = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, size, ENC_ASCII); + int size = (big) ? 10 : 6; + const char *str_value = tvb_get_string_enc(pinfo->pool, tvb, offset, size, ENC_ASCII); - guint32 value = (guint32)strtoul(str_value, NULL, 10); + uint32_t value = (uint32_t)strtoul(str_value, NULL, 10); proto_tree_add_uint(nasdaq_itch_tree, id, tvb, offset, size, value); col_append_fstr(pinfo->cinfo, COL_INFO, "qty %u ", value); @@ -195,10 +195,10 @@ number_of_shares(tvbuff_t *tvb, packet_info *pinfo, proto_tree *nasdaq_itch_tree static int price(tvbuff_t *tvb, packet_info *pinfo, proto_tree *nasdaq_itch_tree, int id, int offset, int big) { - gint size = (big) ? 19 : 10; + int size = (big) ? 19 : 10; - const char *str_value = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, size, ENC_ASCII); - gdouble value = guint64_to_gdouble(g_ascii_strtoull(str_value, NULL, 10))/((big)?1000000.0:10000.0); + const char *str_value = tvb_get_string_enc(pinfo->pool, tvb, offset, size, ENC_ASCII); + double value = uint64_to_double(g_ascii_strtoull(str_value, NULL, 10))/((big)?1000000.0:10000.0); proto_tree_add_double(nasdaq_itch_tree, id, tvb, offset, size, value); col_append_fstr(pinfo->cinfo, COL_INFO, "price %g ", value); @@ -210,7 +210,7 @@ price(tvbuff_t *tvb, packet_info *pinfo, proto_tree *nasdaq_itch_tree, int id, i static int stock(tvbuff_t *tvb, packet_info *pinfo, proto_tree *nasdaq_itch_tree, int offset) { - char *stock_p = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, 6, ENC_ASCII); + char *stock_p = tvb_get_string_enc(pinfo->pool, tvb, offset, 6, ENC_ASCII); proto_tree_add_item(nasdaq_itch_tree, hf_nasdaq_itch_stock, tvb, offset, 6, ENC_ASCII); col_append_fstr(pinfo->cinfo, COL_INFO, "<%s> ", stock_p); @@ -222,11 +222,11 @@ stock(tvbuff_t *tvb, packet_info *pinfo, proto_tree *nasdaq_itch_tree, int offse static int order(tvbuff_t *tvb, packet_info *pinfo, proto_tree *nasdaq_itch_tree, int offset, int big) { - guint8 value; + uint8_t value; offset = order_ref_number(tvb, pinfo, nasdaq_itch_tree, offset); - value = tvb_get_guint8(tvb, offset); + value = tvb_get_uint8(tvb, offset); col_append_fstr(pinfo->cinfo, COL_INFO, "%c ", value); proto_tree_add_item(nasdaq_itch_tree, hf_nasdaq_itch_buy_sell, tvb, offset, 1, ENC_ASCII); @@ -259,18 +259,18 @@ dissect_nasdaq_itch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* d { proto_item *ti; proto_tree *nasdaq_itch_tree = NULL; - guint8 nasdaq_itch_type; + uint8_t nasdaq_itch_type; int offset = 0; int version = 3; int big = 0; - const gchar *rep; + const char *rep; col_set_str(pinfo->cinfo, COL_PROTOCOL, "Nasdaq-ITCH"); - nasdaq_itch_type = tvb_get_guint8(tvb, offset); + nasdaq_itch_type = tvb_get_uint8(tvb, offset); if (nasdaq_itch_type >= '0' && nasdaq_itch_type <= '9') { version = 2; - nasdaq_itch_type = tvb_get_guint8(tvb, offset +8); + nasdaq_itch_type = tvb_get_uint8(tvb, offset +8); } if ((!nasdaq_itch_chi_x || version == 3) && strchr(chix_msg, nasdaq_itch_type)) { @@ -293,7 +293,7 @@ dissect_nasdaq_itch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* d } if (version == 2) { - offset = time_stamp (tvb, nasdaq_itch_tree, hf_nasdaq_itch_millisecond, offset, 8); + offset = time_stamp (tvb, pinfo, nasdaq_itch_tree, hf_nasdaq_itch_millisecond, offset, 8); } proto_tree_add_item(nasdaq_itch_tree, hf_nasdaq_itch_message_type, tvb, offset, 1, ENC_ASCII|ENC_NA); @@ -302,11 +302,11 @@ dissect_nasdaq_itch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* d if (version == 3) { switch (nasdaq_itch_type) { case 'T': /* seconds */ - /*offset =*/ time_stamp (tvb, nasdaq_itch_tree, hf_nasdaq_itch_second, offset, 5); + /*offset =*/ time_stamp (tvb, pinfo, nasdaq_itch_tree, hf_nasdaq_itch_second, offset, 5); return tvb_captured_length(tvb); case 'M': /* milliseconds */ - /*offset =*/ time_stamp (tvb, nasdaq_itch_tree, hf_nasdaq_itch_millisecond, offset, 3); + /*offset =*/ time_stamp (tvb, pinfo, nasdaq_itch_tree, hf_nasdaq_itch_millisecond, offset, 3); return tvb_captured_length(tvb); } } @@ -563,7 +563,7 @@ proto_register_nasdaq_itch(void) }; /* Setup protocol subtree array */ - static gint *ett[] = { + static int *ett[] = { &ett_nasdaq_itch }; |