diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-09-19 04:14:26 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-09-19 04:14:26 +0000 |
commit | c4e8a3222648fcf22ca207f1815ebbf7cd144eeb (patch) | |
tree | 93d5c6aa93d9987680dd1adad5685e2ad698f223 /epan/dissectors/packet-irc.c | |
parent | Adding upstream version 4.2.6. (diff) | |
download | wireshark-c4e8a3222648fcf22ca207f1815ebbf7cd144eeb.tar.xz wireshark-c4e8a3222648fcf22ca207f1815ebbf7cd144eeb.zip |
Adding upstream version 4.4.0.upstream/4.4.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'epan/dissectors/packet-irc.c')
-rw-r--r-- | epan/dissectors/packet-irc.c | 184 |
1 files changed, 92 insertions, 92 deletions
diff --git a/epan/dissectors/packet-irc.c b/epan/dissectors/packet-irc.c index ad4a8872..6b6b954b 100644 --- a/epan/dissectors/packet-irc.c +++ b/epan/dissectors/packet-irc.c @@ -33,39 +33,39 @@ void proto_register_irc(void); void proto_reg_handoff_irc(void); -static int proto_irc = -1; -static int proto_irc_ctcp = -1; -static int hf_irc_request = -1; -static int hf_irc_request_prefix = -1; -static int hf_irc_request_command = -1; -static int hf_irc_request_command_param = -1; -static int hf_irc_request_trailer = -1; -static int hf_irc_response = -1; -static int hf_irc_response_prefix = -1; -static int hf_irc_response_command = -1; -static int hf_irc_response_num_command = -1; -static int hf_irc_response_command_param = -1; -static int hf_irc_response_trailer = -1; -static int hf_irc_ctcp = -1; -static int hf_irc_ctcp_command = -1; -static int hf_irc_ctcp_params = -1; - -static gint ett_irc = -1; -static gint ett_irc_request = -1; -static gint ett_irc_request_command = -1; -static gint ett_irc_response = -1; -static gint ett_irc_response_command = -1; - -static expert_field ei_irc_missing_end_delimiter = EI_INIT; -static expert_field ei_irc_numeric_request_command = EI_INIT; -static expert_field ei_irc_response_command = EI_INIT; -static expert_field ei_irc_prefix_missing_ending_space = EI_INIT; -static expert_field ei_irc_request_command = EI_INIT; -static expert_field ei_irc_tag_data_invalid = EI_INIT; +static int proto_irc; +static int proto_irc_ctcp; +static int hf_irc_request; +static int hf_irc_request_prefix; +static int hf_irc_request_command; +static int hf_irc_request_command_param; +static int hf_irc_request_trailer; +static int hf_irc_response; +static int hf_irc_response_prefix; +static int hf_irc_response_command; +static int hf_irc_response_num_command; +static int hf_irc_response_command_param; +static int hf_irc_response_trailer; +static int hf_irc_ctcp; +static int hf_irc_ctcp_command; +static int hf_irc_ctcp_params; + +static int ett_irc; +static int ett_irc_request; +static int ett_irc_request_command; +static int ett_irc_response; +static int ett_irc_response_command; + +static expert_field ei_irc_missing_end_delimiter; +static expert_field ei_irc_numeric_request_command; +static expert_field ei_irc_response_command; +static expert_field ei_irc_prefix_missing_ending_space; +static expert_field ei_irc_request_command; +static expert_field ei_irc_tag_data_invalid; /* This must be a null-terminated string */ -static const guint8 TAG_DELIMITER[] = {0x01, 0x00}; -/* patterns used for tvb_ws_mempbrk_pattern_guint8 */ +static const uint8_t TAG_DELIMITER[] = {0x01, 0x00}; +/* patterns used for tvb_ws_mempbrk_pattern_uint8 */ static ws_mempbrk_pattern pbrk_tag_delimiter; static dissector_handle_t ctcp_handle; @@ -77,13 +77,13 @@ dissect_irc_ctcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data { proto_tree *ctcp_tree; proto_item *ti; - const guint8 *str_command, *str_params; - gint space_offset = -1; + const uint8_t *str_command, *str_params; + int space_offset = -1; ti = proto_tree_add_item(tree, hf_irc_ctcp, tvb, 0, -1, ENC_ASCII|ENC_NA); ctcp_tree = proto_item_add_subtree(ti, ett_irc); - space_offset = tvb_find_guint8(tvb, 1, -1, ' '); + space_offset = tvb_find_uint8(tvb, 1, -1, ' '); if (space_offset == -1) { proto_tree_add_item_ret_string(ctcp_tree, hf_irc_ctcp_command, tvb, 0, tvb_reported_length(tvb), ENC_ASCII|ENC_NA, pinfo->pool, &str_command); } @@ -96,21 +96,21 @@ dissect_irc_ctcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data } static void -dissect_irc_tag_data(proto_tree *tree, proto_item *item, tvbuff_t *tvb, int offset, int datalen, packet_info *pinfo, const guint8* command) +dissect_irc_tag_data(proto_tree *tree, proto_item *item, tvbuff_t *tvb, int offset, int datalen, packet_info *pinfo, const uint8_t* command) { - guchar found_start_needle = 0, + unsigned char found_start_needle = 0, found_end_needle = 0; - gint tag_start_offset, tag_end_offset; + int tag_start_offset, tag_end_offset; tvbuff_t *next_tvb; - tag_start_offset = tvb_ws_mempbrk_pattern_guint8(tvb, offset, datalen, &pbrk_tag_delimiter, &found_start_needle); + tag_start_offset = tvb_ws_mempbrk_pattern_uint8(tvb, offset, datalen, &pbrk_tag_delimiter, &found_start_needle); if (tag_start_offset == -1) { /* no tag data */ return; } - tag_end_offset = tvb_ws_mempbrk_pattern_guint8(tvb, tag_start_offset+1, datalen, &pbrk_tag_delimiter, &found_end_needle); + tag_end_offset = tvb_ws_mempbrk_pattern_uint8(tvb, tag_start_offset+1, datalen, &pbrk_tag_delimiter, &found_end_needle); if (tag_end_offset == -1) { expert_add_info(pinfo, item, &ei_irc_missing_end_delimiter); @@ -137,13 +137,13 @@ dissect_irc_request(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int off proto_item *request_item; int start_offset = offset; int end_offset = start_offset+linelen; - gint eop_offset = -1, + int eop_offset = -1, eoc_offset = -1, eocp_offset, tag_start_offset, tag_end_offset; - const guint8 *str_command; - guchar found_tag_needle = 0; - gboolean first_command_param = TRUE; + const uint8_t *str_command; + unsigned char found_tag_needle = 0; + bool first_command_param = true; request_item = proto_tree_add_item(tree, hf_irc_request, tvb, offset, linelen, ENC_ASCII); if (linelen <= 0) @@ -152,10 +152,10 @@ dissect_irc_request(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int off request_tree = proto_item_add_subtree(request_item, ett_irc_request ); /* Check if message has a prefix */ - if (tvb_get_guint8(tvb, offset) == ':') + if (tvb_get_uint8(tvb, offset) == ':') { /* find the end of the prefix */ - eop_offset = tvb_find_guint8(tvb, offset+1, linelen-1, ' '); + eop_offset = tvb_find_uint8(tvb, offset+1, linelen-1, ' '); if (eop_offset == -1) { expert_add_info(pinfo, request_item, &ei_irc_prefix_missing_ending_space); @@ -167,7 +167,7 @@ dissect_irc_request(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int off } /* clear out any whitespace before command */ - while(offset < end_offset && tvb_get_guint8(tvb, offset) == ' ') + while(offset < end_offset && tvb_get_uint8(tvb, offset) == ' ') { offset++; } @@ -177,18 +177,18 @@ dissect_irc_request(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int off return; } - eoc_offset = tvb_find_guint8(tvb, offset, end_offset-offset, ' '); + eoc_offset = tvb_find_uint8(tvb, offset, end_offset-offset, ' '); if (eoc_offset == -1) { - const guint8* col_str; + const uint8_t* col_str; proto_tree_add_item_ret_string(request_tree, hf_irc_request_command, tvb, offset, end_offset-offset, ENC_ASCII|ENC_NA, pinfo->pool, &col_str); col_append_fstr( pinfo->cinfo, COL_INFO, " (%s)", col_str); /* Warn if there is a "numeric" command */ if ((end_offset-offset == 3) && - (g_ascii_isdigit(tvb_get_guint8(tvb, offset))) && - (g_ascii_isdigit(tvb_get_guint8(tvb, offset+1))) && - (g_ascii_isdigit(tvb_get_guint8(tvb, offset+2)))) + (g_ascii_isdigit(tvb_get_uint8(tvb, offset))) && + (g_ascii_isdigit(tvb_get_uint8(tvb, offset+1))) && + (g_ascii_isdigit(tvb_get_uint8(tvb, offset+2)))) { expert_add_info(pinfo, request_item, &ei_irc_numeric_request_command); } @@ -200,9 +200,9 @@ dissect_irc_request(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int off /* Warn if there is a "numeric" command */ if ((eoc_offset-offset == 3) && - (g_ascii_isdigit(tvb_get_guint8(tvb, offset))) && - (g_ascii_isdigit(tvb_get_guint8(tvb, offset+1))) && - (g_ascii_isdigit(tvb_get_guint8(tvb, offset+2)))) + (g_ascii_isdigit(tvb_get_uint8(tvb, offset))) && + (g_ascii_isdigit(tvb_get_uint8(tvb, offset+1))) && + (g_ascii_isdigit(tvb_get_uint8(tvb, offset+2)))) { expert_add_info(pinfo, request_item, &ei_irc_numeric_request_command); } @@ -210,7 +210,7 @@ dissect_irc_request(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int off offset = eoc_offset+1; /* clear out any whitespace before command parameter */ - while(offset < end_offset && tvb_get_guint8(tvb, offset) == ' ') + while(offset < end_offset && tvb_get_uint8(tvb, offset) == ' ') { offset++; } @@ -221,7 +221,7 @@ dissect_irc_request(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int off } /* Check if message has a trailer */ - if (tvb_get_guint8(tvb, offset) == ':') + if (tvb_get_uint8(tvb, offset) == ':') { proto_tree_add_item(request_tree, hf_irc_request_trailer, tvb, offset+1, end_offset-offset-1, ENC_ASCII); dissect_irc_tag_data(request_tree, request_item, tvb, offset+1, end_offset-offset-1, pinfo, str_command); @@ -230,15 +230,15 @@ dissect_irc_request(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int off while(offset < end_offset) { - eocp_offset = tvb_find_guint8(tvb, offset, end_offset-offset, ' '); - tag_start_offset = tvb_ws_mempbrk_pattern_guint8(tvb, offset, end_offset-offset, &pbrk_tag_delimiter, &found_tag_needle); + eocp_offset = tvb_find_uint8(tvb, offset, end_offset-offset, ' '); + tag_start_offset = tvb_ws_mempbrk_pattern_uint8(tvb, offset, end_offset-offset, &pbrk_tag_delimiter, &found_tag_needle); /* Create subtree when the first parameter is found */ if (first_command_param) { command_tree = proto_tree_add_subtree(request_tree, tvb, offset, end_offset-offset, ett_irc_request_command, NULL, "Command parameters"); - first_command_param = FALSE; + first_command_param = false; } if (((eocp_offset == -1) && (tag_start_offset == -1)) || @@ -257,7 +257,7 @@ dissect_irc_request(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int off offset = eocp_offset+1; /* clear out any whitespace before next command parameter */ - while(offset < end_offset && tvb_get_guint8(tvb, offset) == ' ') + while(offset < end_offset && tvb_get_uint8(tvb, offset) == ' ') { offset++; } @@ -267,7 +267,7 @@ dissect_irc_request(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int off } /* Check if message has a trailer */ - if (tvb_get_guint8(tvb, offset) == ':') + if (tvb_get_uint8(tvb, offset) == ':') { proto_tree_add_item(request_tree, hf_irc_request_trailer, tvb, offset+1, end_offset-offset-1, ENC_ASCII); dissect_irc_tag_data(request_tree, request_item, tvb, offset+1, end_offset-offset-1, pinfo, str_command); @@ -280,7 +280,7 @@ dissect_irc_request(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int off /* tag data dissected */ found_tag_needle = 0; - tag_end_offset = tvb_ws_mempbrk_pattern_guint8(tvb, tag_start_offset+1, end_offset-tag_start_offset-1, &pbrk_tag_delimiter, &found_tag_needle); + tag_end_offset = tvb_ws_mempbrk_pattern_uint8(tvb, tag_start_offset+1, end_offset-tag_start_offset-1, &pbrk_tag_delimiter, &found_tag_needle); if (tag_end_offset == -1) { expert_add_info(pinfo, request_item, &ei_irc_missing_end_delimiter); @@ -300,14 +300,14 @@ dissect_irc_response(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int of proto_item *response_item, *hidden_item; int start_offset = offset; int end_offset = start_offset+linelen; - gint eop_offset = -1, + int eop_offset = -1, eoc_offset = -1, eocp_offset, tag_start_offset, tag_end_offset; - const guint8* str_command; - guint16 num_command; - guchar found_tag_needle = 0; - gboolean first_command_param = TRUE; + const uint8_t* str_command; + uint16_t num_command; + unsigned char found_tag_needle = 0; + bool first_command_param = true; response_item = proto_tree_add_item(tree, hf_irc_response, tvb, offset, linelen, ENC_ASCII); if (linelen <= 0) @@ -316,10 +316,10 @@ dissect_irc_response(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int of response_tree = proto_item_add_subtree(response_item, ett_irc_response ); /* Check if message has a prefix */ - if (tvb_get_guint8(tvb, offset) == ':') + if (tvb_get_uint8(tvb, offset) == ':') { /* find the end of the prefix */ - eop_offset = tvb_find_guint8(tvb, offset+1, linelen-1, ' '); + eop_offset = tvb_find_uint8(tvb, offset+1, linelen-1, ' '); if (eop_offset == -1) { expert_add_info(pinfo, response_item, &ei_irc_prefix_missing_ending_space); @@ -331,7 +331,7 @@ dissect_irc_response(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int of } /* clear out any whitespace before command */ - while(offset < end_offset && tvb_get_guint8(tvb, offset) == ' ') + while(offset < end_offset && tvb_get_uint8(tvb, offset) == ' ') { offset++; } @@ -341,20 +341,20 @@ dissect_irc_response(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int of return; } - eoc_offset = tvb_find_guint8(tvb, offset, end_offset-offset, ' '); + eoc_offset = tvb_find_uint8(tvb, offset, end_offset-offset, ' '); if (eoc_offset == -1) { - const guint8* col_str; + const uint8_t* col_str; proto_tree_add_item_ret_string(response_tree, hf_irc_response_command, tvb, offset, end_offset-offset, ENC_ASCII|ENC_NA, pinfo->pool, &col_str); col_append_fstr( pinfo->cinfo, COL_INFO, " (%s)", col_str); /* if response command is numeric, allow it to be filtered as an integer */ if ((end_offset-offset == 3) && - (g_ascii_isdigit(tvb_get_guint8(tvb, offset))) && - (g_ascii_isdigit(tvb_get_guint8(tvb, offset+1))) && - (g_ascii_isdigit(tvb_get_guint8(tvb, offset+2)))) + (g_ascii_isdigit(tvb_get_uint8(tvb, offset))) && + (g_ascii_isdigit(tvb_get_uint8(tvb, offset+1))) && + (g_ascii_isdigit(tvb_get_uint8(tvb, offset+2)))) { - num_command = ((tvb_get_guint8(tvb, offset)-0x30)*100) + ((tvb_get_guint8(tvb, offset+1)-0x30)*10) + (tvb_get_guint8(tvb, offset+2)-0x30); + num_command = ((tvb_get_uint8(tvb, offset)-0x30)*100) + ((tvb_get_uint8(tvb, offset+1)-0x30)*10) + (tvb_get_uint8(tvb, offset+2)-0x30); hidden_item = proto_tree_add_uint(response_tree, hf_irc_response_num_command, tvb, offset, end_offset-offset, num_command); proto_item_set_hidden(hidden_item); } @@ -366,11 +366,11 @@ dissect_irc_response(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int of /* if response command is numeric, allow it to be filtered as an integer */ if ((eoc_offset-offset == 3) && - (g_ascii_isdigit(tvb_get_guint8(tvb, offset))) && - (g_ascii_isdigit(tvb_get_guint8(tvb, offset+1))) && - (g_ascii_isdigit(tvb_get_guint8(tvb, offset+2)))) + (g_ascii_isdigit(tvb_get_uint8(tvb, offset))) && + (g_ascii_isdigit(tvb_get_uint8(tvb, offset+1))) && + (g_ascii_isdigit(tvb_get_uint8(tvb, offset+2)))) { - num_command = ((tvb_get_guint8(tvb, offset)-0x30)*100) + ((tvb_get_guint8(tvb, offset+1)-0x30)*10) + (tvb_get_guint8(tvb, offset+2)-0x30); + num_command = ((tvb_get_uint8(tvb, offset)-0x30)*100) + ((tvb_get_uint8(tvb, offset+1)-0x30)*10) + (tvb_get_uint8(tvb, offset+2)-0x30); hidden_item = proto_tree_add_uint(response_tree, hf_irc_response_num_command, tvb, offset, eoc_offset-offset, num_command); proto_item_set_hidden(hidden_item); } @@ -378,7 +378,7 @@ dissect_irc_response(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int of offset = eoc_offset+1; /* clear out any whitespace before command parameter */ - while(offset < end_offset && tvb_get_guint8(tvb, offset) == ' ') + while(offset < end_offset && tvb_get_uint8(tvb, offset) == ' ') { offset++; } @@ -389,7 +389,7 @@ dissect_irc_response(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int of } /* Check if message has a trailer */ - if (tvb_get_guint8(tvb, offset) == ':') + if (tvb_get_uint8(tvb, offset) == ':') { proto_tree_add_item(response_tree, hf_irc_response_trailer, tvb, offset+1, end_offset-offset-1, ENC_ASCII); dissect_irc_tag_data(response_tree, response_item, tvb, offset+1, end_offset-offset-1, pinfo, str_command); @@ -398,15 +398,15 @@ dissect_irc_response(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int of while(offset < end_offset) { - eocp_offset = tvb_find_guint8(tvb, offset, end_offset-offset, ' '); - tag_start_offset = tvb_ws_mempbrk_pattern_guint8(tvb, offset, end_offset-offset, &pbrk_tag_delimiter, &found_tag_needle); + eocp_offset = tvb_find_uint8(tvb, offset, end_offset-offset, ' '); + tag_start_offset = tvb_ws_mempbrk_pattern_uint8(tvb, offset, end_offset-offset, &pbrk_tag_delimiter, &found_tag_needle); /* Create subtree when the first parameter is found */ if (first_command_param) { command_tree = proto_tree_add_subtree(response_tree, tvb, offset, end_offset-offset, ett_irc_response_command , NULL, "Command parameters"); - first_command_param = FALSE; + first_command_param = false; } if ((tag_start_offset == -1) || (eocp_offset < tag_start_offset)) @@ -423,7 +423,7 @@ dissect_irc_response(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int of offset = eocp_offset+1; /* clear out any whitespace before next command parameter */ - while(offset < end_offset && tvb_get_guint8(tvb, offset) == ' ') + while(offset < end_offset && tvb_get_uint8(tvb, offset) == ' ') { offset++; } @@ -433,7 +433,7 @@ dissect_irc_response(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int of } /* Check if message has a trailer */ - if (tvb_get_guint8(tvb, offset) == ':') + if (tvb_get_uint8(tvb, offset) == ':') { proto_tree_add_item(response_tree, hf_irc_response_trailer, tvb, offset+1, end_offset-offset-1, ENC_ASCII); dissect_irc_tag_data(response_tree, response_item, tvb, offset+1, end_offset-offset-1, pinfo, str_command); @@ -445,7 +445,7 @@ dissect_irc_response(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int of /* tag data dissected */ found_tag_needle = 0; - tag_end_offset = tvb_ws_mempbrk_pattern_guint8(tvb, tag_start_offset+1, end_offset-tag_start_offset-1, &pbrk_tag_delimiter, &found_tag_needle); + tag_end_offset = tvb_ws_mempbrk_pattern_uint8(tvb, tag_start_offset+1, end_offset-tag_start_offset-1, &pbrk_tag_delimiter, &found_tag_needle); if (tag_end_offset == -1) { expert_add_info(pinfo, response_item, &ei_irc_missing_end_delimiter); @@ -462,8 +462,8 @@ static int dissect_irc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_tree *irc_tree, *ti; - gint offset = 0; - gint next_offset; + int offset = 0; + int next_offset; int linelen; col_set_str(pinfo->cinfo, COL_PROTOCOL, "IRC"); @@ -482,7 +482,7 @@ dissect_irc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) /* * Find the end of the line. */ - linelen = tvb_find_line_end(tvb, offset, -1, &next_offset, FALSE); + linelen = tvb_find_line_end(tvb, offset, -1, &next_offset, false); if (next_offset == offset) { /* * XXX - we really want the "show data a @@ -558,7 +558,7 @@ proto_register_irc(void) NULL, 0x0, "CTCP parameters", HFILL }}, }; - static gint *ett[] = { + static int *ett[] = { &ett_irc, &ett_irc_request, &ett_irc_request_command, |