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-pingpongprotocol.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-pingpongprotocol.c')
-rw-r--r-- | epan/dissectors/packet-pingpongprotocol.c | 63 |
1 files changed, 32 insertions, 31 deletions
diff --git a/epan/dissectors/packet-pingpongprotocol.c b/epan/dissectors/packet-pingpongprotocol.c index 5a6d5c78..a5c1e2c0 100644 --- a/epan/dissectors/packet-pingpongprotocol.c +++ b/epan/dissectors/packet-pingpongprotocol.c @@ -20,6 +20,7 @@ #include <epan/sctpppids.h> #include <epan/stat_tap_ui.h> +#include <wsutil/array.h> #define PINGPONGPROTOCOL_PAYLOAD_PROTOCOL_ID_LEGACY 0x29097602 @@ -29,20 +30,20 @@ void proto_reg_handoff_pingpongprotocol(void); static dissector_handle_t pingpongprotocol_handle; /* Initialize the protocol and registered fields */ -static int proto_pingpongprotocol = -1; +static int proto_pingpongprotocol; static int tap_pingpongprotocol = -1; -static int ett_pingpongprotocol = -1; -static int hf_message_type = -1; -static int hf_message_flags = -1; -static int hf_message_length = -1; -static int hf_ping_messageno = -1; -static int hf_ping_data = -1; -static int hf_pong_messageno = -1; -static int hf_pong_replyno = -1; -static int hf_pong_data = -1; - -static guint64 pingpongprotocol_total_msgs = 0; -static guint64 pingpongprotocol_total_bytes = 0; +static int ett_pingpongprotocol; +static int hf_message_type; +static int hf_message_flags; +static int hf_message_length; +static int hf_ping_messageno; +static int hf_ping_data; +static int hf_pong_messageno; +static int hf_pong_replyno; +static int hf_pong_data; + +static uint64_t pingpongprotocol_total_msgs; +static uint64_t pingpongprotocol_total_bytes; /* Dissectors for messages. This is specific to PingPongProtocol */ #define MESSAGE_TYPE_LENGTH 1 @@ -81,8 +82,8 @@ static const value_string message_type_values[] = { typedef struct _tap_pingpongprotocol_rec_t { - guint8 type; - guint16 size; + uint8_t type; + uint16_t size; const char* type_string; } tap_pingpongprotocol_rec_t; @@ -90,7 +91,7 @@ typedef struct _tap_pingpongprotocol_rec_t { static void dissect_pingpongprotocol_ping_message(tvbuff_t *message_tvb, proto_tree *message_tree) { - guint16 ping_data_length; + uint16_t ping_data_length; proto_tree_add_item(message_tree, hf_ping_messageno, message_tvb, PING_MESSAGENO_OFFSET, PING_MESSAGENO_LENGTH, ENC_BIG_ENDIAN); @@ -102,7 +103,7 @@ dissect_pingpongprotocol_ping_message(tvbuff_t *message_tvb, proto_tree *message static void dissect_pingpongprotocol_pong_message(tvbuff_t *message_tvb, proto_tree *message_tree) { - guint16 pong_data_length; + uint16_t pong_data_length; proto_tree_add_item(message_tree, hf_pong_messageno, message_tvb, PONG_MESSAGENO_OFFSET, PONG_MESSAGENO_LENGTH, ENC_BIG_ENDIAN); proto_tree_add_item(message_tree, hf_pong_replyno, message_tvb, PONG_REPLYNO_OFFSET, PONG_REPLYNO_LENGTH, ENC_BIG_ENDIAN); @@ -118,7 +119,7 @@ static void dissect_pingpongprotocol_message(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *pingpongprotocol_tree) { tap_pingpongprotocol_rec_t* tap_rec = wmem_new0(pinfo->pool, tap_pingpongprotocol_rec_t); - tap_rec->type = tvb_get_guint8(message_tvb, MESSAGE_TYPE_OFFSET); + tap_rec->type = tvb_get_uint8(message_tvb, MESSAGE_TYPE_OFFSET); tap_rec->size = tvb_get_ntohs(message_tvb, MESSAGE_LENGTH_OFFSET); tap_rec->type_string = val_to_str_const(tap_rec->type, message_type_values, "Unknown PingPongProtocol message type"); tap_queue_packet(tap_pingpongprotocol, pinfo, tap_rec); @@ -157,7 +158,7 @@ dissect_pingpongprotocol(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree * }; /* dissect the message */ dissect_pingpongprotocol_message(message_tvb, pinfo, pingpongprotocol_tree); - return(TRUE); + return true; } @@ -192,10 +193,10 @@ static stat_tap_table_item pingpongprotocol_stat_fields[] = { static void pingpongprotocol_stat_init(stat_tap_table_ui* new_stat) { const char *table_name = "PingPongProtocol Statistics"; - int num_fields = sizeof(pingpongprotocol_stat_fields)/sizeof(stat_tap_table_item); + int num_fields = array_length(pingpongprotocol_stat_fields); stat_tap_table *table; int i = 0; - stat_tap_table_item_type items[sizeof(pingpongprotocol_stat_fields)/sizeof(stat_tap_table_item)]; + stat_tap_table_item_type items[array_length(pingpongprotocol_stat_fields)]; table = stat_tap_find_table(new_stat, table_name); if (table) { @@ -243,9 +244,9 @@ pingpongprotocol_stat_packet(void* tapdata, packet_info* pinfo _U_, epan_dissect const tap_pingpongprotocol_rec_t* tap_rec = (const tap_pingpongprotocol_rec_t*)data; stat_tap_table* table; stat_tap_table_item_type* msg_data; - gint idx; - guint64 messages; - guint64 bytes; + int idx; + uint64_t messages; + uint64_t bytes; int i = 0; double firstSeen = -1.0; double lastSeen = -1.0; @@ -273,9 +274,9 @@ pingpongprotocol_stat_packet(void* tapdata, packet_info* pinfo _U_, epan_dissect /* Update messages and bytes share */ while (message_type_values[i].strptr) { msg_data = stat_tap_get_field_data(table, i, MESSAGES_COLUMN); - const guint m = msg_data->value.uint_value; + const unsigned m = msg_data->value.uint_value; msg_data = stat_tap_get_field_data(table, i, BYTES_COLUMN); - const guint b = msg_data->value.uint_value; + const unsigned b = msg_data->value.uint_value; msg_data = stat_tap_get_field_data(table, i, MESSAGES_SHARE_COLUMN); msg_data->type = TABLE_ITEM_FLOAT; @@ -333,7 +334,7 @@ pingpongprotocol_stat_packet(void* tapdata, packet_info* pinfo _U_, epan_dissect static void pingpongprotocol_stat_reset(stat_tap_table* table) { - guint element; + unsigned element; stat_tap_table_item_type* item_data; for (element = 0; element < table->num_elements; element++) { @@ -403,12 +404,12 @@ proto_register_pingpongprotocol(void) }; /* Setup protocol subtree array */ - static gint *ett[] = { + static int *ett[] = { &ett_pingpongprotocol }; static tap_param pingpongprotocol_stat_params[] = { - { PARAM_FILTER, "filter", "Filter", NULL, TRUE } + { PARAM_FILTER, "filter", "Filter", NULL, true } }; static stat_tap_table_ui pingpongprotocol_stat_table = { @@ -421,8 +422,8 @@ proto_register_pingpongprotocol(void) pingpongprotocol_stat_reset, NULL, NULL, - sizeof(pingpongprotocol_stat_fields)/sizeof(stat_tap_table_item), pingpongprotocol_stat_fields, - sizeof(pingpongprotocol_stat_params)/sizeof(tap_param), pingpongprotocol_stat_params, + array_length(pingpongprotocol_stat_fields), pingpongprotocol_stat_fields, + array_length(pingpongprotocol_stat_params), pingpongprotocol_stat_params, NULL, 0 }; |