diff options
author | Guy Harris <guy@alum.mit.edu> | 2015-02-21 12:39:00 -0800 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2015-02-21 20:39:25 +0000 |
commit | bfb432729156378d2f8fc8b666fda7e7b23e9749 (patch) | |
tree | 4c3e85ba30ff41319e48563ee0063c7b6e990f6c | |
parent | f3a68f00a1a9b7a3f28c6986713febaa81b92ba0 (diff) |
Remove tvb_ from the names of wsutil mempbrk routines.
Routines that don't take a tvbuff as an argument shouldn't have tvb_ in
the name.
Change-Id: I3550256551e30b3f329cbbfca71ef27c727d29c0
Reviewed-on: https://code.wireshark.org/review/7302
Reviewed-by: Guy Harris <guy@alum.mit.edu>
-rw-r--r-- | epan/dissectors/packet-cups.c | 8 | ||||
-rw-r--r-- | epan/dissectors/packet-irc.c | 18 | ||||
-rw-r--r-- | epan/dissectors/packet-megaco.c | 14 | ||||
-rw-r--r-- | epan/dissectors/packet-sdp.c | 14 | ||||
-rw-r--r-- | epan/dissectors/packet-sip.c | 60 | ||||
-rw-r--r-- | epan/tvbuff-int.h | 2 | ||||
-rw-r--r-- | epan/tvbuff.c | 28 | ||||
-rw-r--r-- | epan/tvbuff.h | 6 | ||||
-rw-r--r-- | epan/tvbuff_subset.c | 4 | ||||
-rw-r--r-- | frame_tvbuff.c | 4 | ||||
-rw-r--r-- | wsutil/ws_mempbrk.c | 6 | ||||
-rw-r--r-- | wsutil/ws_mempbrk.h | 12 | ||||
-rw-r--r-- | wsutil/ws_mempbrk_int.h | 6 | ||||
-rw-r--r-- | wsutil/ws_mempbrk_sse42.c | 4 |
14 files changed, 94 insertions, 92 deletions
diff --git a/epan/dissectors/packet-cups.c b/epan/dissectors/packet-cups.c index 42359bb741..ad6ab5892f 100644 --- a/epan/dissectors/packet-cups.c +++ b/epan/dissectors/packet-cups.c @@ -103,8 +103,8 @@ static int hf_cups_make_model = -1; static gint ett_cups = -1; static gint ett_cups_ptype = -1; -/* patterns used for tvb_pbrk_pattern_guint8 */ -static tvb_pbrk_pattern pbrk_whitespace; +/* patterns used for tvb_ws_mempbrk_pattern_guint8 */ +static ws_mempbrk_pattern pbrk_whitespace; /* This protocol is heavily related to IPP, but it is CUPS-specific and non-standard. */ @@ -289,7 +289,7 @@ get_unquoted_string(tvbuff_t *tvb, gint offset, gint *next_offset, guint *len) guint l = 0; gint o; - o = tvb_pbrk_pattern_guint8(tvb, offset, -1, &pbrk_whitespace, NULL); + o = tvb_ws_mempbrk_pattern_guint8(tvb, offset, -1, &pbrk_whitespace, NULL); if (o != -1) { l = o - offset; s = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, l, ENC_ASCII); @@ -394,7 +394,7 @@ proto_register_cups(void) proto_register_subtree_array(ett, array_length(ett)); /* compile patterns */ - tvb_pbrk_compile(&pbrk_whitespace, " \t\r\n"); + ws_mempbrk_compile(&pbrk_whitespace, " \t\r\n"); } void diff --git a/epan/dissectors/packet-irc.c b/epan/dissectors/packet-irc.c index 2d0b66f479..d9eee7867f 100644 --- a/epan/dissectors/packet-irc.c +++ b/epan/dissectors/packet-irc.c @@ -75,8 +75,8 @@ static expert_field ei_irc_tag_data_invalid = EI_INIT; /* This must be a null-terminated string */ static const guint8 TAG_DELIMITER[] = {0x01, 0x00}; -/* patterns used for tvb_pbrk_pattern_guint8 */ -static tvb_pbrk_pattern pbrk_tag_delimiter; +/* patterns used for tvb_ws_mempbrk_pattern_guint8 */ +static ws_mempbrk_pattern pbrk_tag_delimiter; #define TCP_PORT_IRC 6667 @@ -90,14 +90,14 @@ dissect_irc_tag_data(proto_tree *tree, proto_item *item, tvbuff_t *tvb, int offs found_end_needle = 0; gint tag_start_offset, tag_end_offset; - tag_start_offset = tvb_pbrk_pattern_guint8(tvb, offset, datalen, &pbrk_tag_delimiter, &found_start_needle); + tag_start_offset = tvb_ws_mempbrk_pattern_guint8(tvb, offset, datalen, &pbrk_tag_delimiter, &found_start_needle); if (tag_start_offset == -1) { /* no tag data */ return; } - tag_end_offset = tvb_pbrk_pattern_guint8(tvb, offset, datalen-offset, &pbrk_tag_delimiter, &found_end_needle); + tag_end_offset = tvb_ws_mempbrk_pattern_guint8(tvb, offset, datalen-offset, &pbrk_tag_delimiter, &found_end_needle); if (tag_end_offset == -1) { expert_add_info(pinfo, item, &ei_irc_missing_end_delimiter); @@ -216,7 +216,7 @@ 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_pbrk_pattern_guint8(tvb, offset, end_offset-offset, &pbrk_tag_delimiter, &found_tag_needle); + tag_start_offset = tvb_ws_mempbrk_pattern_guint8(tvb, offset, end_offset-offset, &pbrk_tag_delimiter, &found_tag_needle); /* Create subtree when the first parameter is found */ if (first_command_param) @@ -265,7 +265,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_pbrk_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_guint8(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); @@ -385,7 +385,7 @@ 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_pbrk_pattern_guint8(tvb, offset, end_offset-offset, &pbrk_tag_delimiter, &found_tag_needle); + tag_start_offset = tvb_ws_mempbrk_pattern_guint8(tvb, offset, end_offset-offset, &pbrk_tag_delimiter, &found_tag_needle); /* Create subtree when the first parameter is found */ if (first_command_param) @@ -431,7 +431,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_pbrk_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_guint8(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); @@ -563,7 +563,7 @@ proto_register_irc(void) expert_register_field_array(expert_irc, ei, array_length(ei)); /* compile patterns */ - tvb_pbrk_compile(&pbrk_tag_delimiter, TAG_DELIMITER); + ws_mempbrk_compile(&pbrk_tag_delimiter, TAG_DELIMITER); } void diff --git a/epan/dissectors/packet-megaco.c b/epan/dissectors/packet-megaco.c index 91af614297..4f3f144273 100644 --- a/epan/dissectors/packet-megaco.c +++ b/epan/dissectors/packet-megaco.c @@ -139,9 +139,9 @@ static dissector_handle_t megaco_text_handle; static int megaco_tap = -1; -/* patterns used for tvb_pbrk_pattern_guint8 */ -static tvb_pbrk_pattern pbrk_whitespace; -static tvb_pbrk_pattern pbrk_braces; +/* patterns used for tvb_ws_mempbrk_pattern_guint8 */ +static ws_mempbrk_pattern pbrk_whitespace; +static ws_mempbrk_pattern pbrk_braces; /* @@ -456,7 +456,7 @@ dissect_megaco_text(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) * pathNAME = ["*"] NAME *("/" / "*"/ ALPHA / DIGIT /"_" / "$" )["@" pathDomainName ] */ - tvb_current_offset = tvb_pbrk_pattern_guint8(tvb, tvb_current_offset, -1, &pbrk_whitespace, &needle); + tvb_current_offset = tvb_ws_mempbrk_pattern_guint8(tvb, tvb_current_offset, -1, &pbrk_whitespace, &needle); if (tvb_current_offset == -1) { expert_add_info_format(pinfo, ti, &ei_megaco_parse_error, "[ Parse error: no body in MEGACO message (missing SEP after mId) ]"); @@ -3289,7 +3289,7 @@ static gint megaco_tvb_find_token(tvbuff_t* tvb, gint offset, gint maxlength){ guchar needle; do { - pos = tvb_pbrk_pattern_guint8(tvb, pos + 1, maxlength, &pbrk_braces, &needle); + pos = tvb_ws_mempbrk_pattern_guint8(tvb, pos + 1, maxlength, &pbrk_braces, &needle); if(pos == -1) return -1; switch(needle){ @@ -3570,8 +3570,8 @@ proto_register_megaco(void) megaco_tap = register_tap("megaco"); /* compile patterns */ - tvb_pbrk_compile(&pbrk_whitespace, " \t\r\n"); - tvb_pbrk_compile(&pbrk_braces, "{}"); + ws_mempbrk_compile(&pbrk_whitespace, " \t\r\n"); + ws_mempbrk_compile(&pbrk_braces, "{}"); } diff --git a/epan/dissectors/packet-sdp.c b/epan/dissectors/packet-sdp.c index 166b8c30a1..3d3aed08bd 100644 --- a/epan/dissectors/packet-sdp.c +++ b/epan/dissectors/packet-sdp.c @@ -197,9 +197,9 @@ static expert_field ei_sdp_invalid_line_fields = EI_INIT; static expert_field ei_sdp_invalid_line_space = EI_INIT; static expert_field ei_sdp_invalid_conversion = EI_INIT; -/* patterns used for tvb_pbrk_pattern_guint8 */ -static tvb_pbrk_pattern pbrk_digits; -static tvb_pbrk_pattern pbrk_alpha; +/* patterns used for tvb_ws_mempbrk_pattern_guint8 */ +static ws_mempbrk_pattern pbrk_digits; +static ws_mempbrk_pattern pbrk_alpha; #define SDP_RTP_PROTO 0x00000001 #define SDP_SRTP_PROTO 0x00000002 @@ -825,7 +825,7 @@ static void dissect_sdp_session_attribute(tvbuff_t *tvb, packet_info * pinfo, pr offset = next_offset + 1; if (strcmp((char*)field_name, "ipbcp") == 0) { - offset = tvb_pbrk_pattern_guint8(tvb, offset, -1,&pbrk_digits, NULL); + offset = tvb_ws_mempbrk_pattern_guint8(tvb, offset, -1,&pbrk_digits, NULL); if (offset == -1) return; @@ -836,7 +836,7 @@ static void dissect_sdp_session_attribute(tvbuff_t *tvb, packet_info * pinfo, pr proto_tree_add_item(sdp_session_attribute_tree, hf_ipbcp_version, tvb, offset, tokenlen, ENC_UTF_8|ENC_NA); - offset = tvb_pbrk_pattern_guint8(tvb, offset, -1,&pbrk_alpha, NULL); + offset = tvb_ws_mempbrk_pattern_guint8(tvb, offset, -1,&pbrk_alpha, NULL); if (offset == -1) return; @@ -3092,8 +3092,8 @@ proto_register_sdp(void) sdp_tap = register_tap("sdp"); /* compile patterns */ - tvb_pbrk_compile(&pbrk_digits, "0123456789"); - tvb_pbrk_compile(&pbrk_alpha, "ABCDEFGHIJKLMNOPQRSTUVWXYZ"); + ws_mempbrk_compile(&pbrk_digits, "0123456789"); + ws_mempbrk_compile(&pbrk_alpha, "ABCDEFGHIJKLMNOPQRSTUVWXYZ"); } void diff --git a/epan/dissectors/packet-sip.c b/epan/dissectors/packet-sip.c index 9fa6932045..bee70cb32a 100644 --- a/epan/dissectors/packet-sip.c +++ b/epan/dissectors/packet-sip.c @@ -237,16 +237,16 @@ static expert_field ei_sip_header_not_terminated = EI_INIT; static expert_field ei_sip_odd_register_response = EI_INIT; static expert_field ei_sip_sipsec_malformed = EI_INIT; -/* patterns used for tvb_pbrk_pattern_guint8 */ -static tvb_pbrk_pattern pbrk_comma_semi; -static tvb_pbrk_pattern pbrk_whitespace; -static tvb_pbrk_pattern pbrk_param_end; -static tvb_pbrk_pattern pbrk_param_end_colon_brackets; -static tvb_pbrk_pattern pbrk_header_end_dquote; -static tvb_pbrk_pattern pbrk_quotes; -static tvb_pbrk_pattern pbrk_tab_sp_fslash; -static tvb_pbrk_pattern pbrk_addr_end; -static tvb_pbrk_pattern pbrk_via_param_end; +/* patterns used for tvb_ws_mempbrk_pattern_guint8 */ +static ws_mempbrk_pattern pbrk_comma_semi; +static ws_mempbrk_pattern pbrk_whitespace; +static ws_mempbrk_pattern pbrk_param_end; +static ws_mempbrk_pattern pbrk_param_end_colon_brackets; +static ws_mempbrk_pattern pbrk_header_end_dquote; +static ws_mempbrk_pattern pbrk_quotes; +static ws_mempbrk_pattern pbrk_tab_sp_fslash; +static ws_mempbrk_pattern pbrk_addr_end; +static ws_mempbrk_pattern pbrk_via_param_end; /* PUBLISH method added as per http://www.ietf.org/internet-drafts/draft-ietf-sip-publish-01.txt */ @@ -1122,7 +1122,7 @@ dissect_sip_uri(tvbuff_t *tvb, packet_info *pinfo _U_, gint start_offset, */ int end_offset; - end_offset = tvb_pbrk_pattern_guint8(tvb, current_offset, line_end_offset - current_offset, &pbrk_comma_semi, NULL); + end_offset = tvb_ws_mempbrk_pattern_guint8(tvb, current_offset, line_end_offset - current_offset, &pbrk_comma_semi, NULL); if (end_offset != -1) { @@ -1162,7 +1162,7 @@ dissect_sip_uri(tvbuff_t *tvb, packet_info *pinfo _U_, gint start_offset, while (parameter_end_offset < line_end_offset) { parameter_end_offset++; - parameter_end_offset = tvb_pbrk_pattern_guint8(tvb, parameter_end_offset, line_end_offset - parameter_end_offset, &pbrk_param_end_colon_brackets, &c); + parameter_end_offset = tvb_ws_mempbrk_pattern_guint8(tvb, parameter_end_offset, line_end_offset - parameter_end_offset, &pbrk_param_end_colon_brackets, &c); if (parameter_end_offset == -1) { parameter_end_offset = line_end_offset; @@ -1208,7 +1208,7 @@ uri_host_end_found: while (parameter_end_offset < line_end_offset) { parameter_end_offset++; - parameter_end_offset = tvb_pbrk_pattern_guint8(tvb, parameter_end_offset, line_end_offset - parameter_end_offset, &pbrk_param_end, &c); + parameter_end_offset = tvb_ws_mempbrk_pattern_guint8(tvb, parameter_end_offset, line_end_offset - parameter_end_offset, &pbrk_param_end, &c); if (parameter_end_offset == -1) { parameter_end_offset = line_end_offset; @@ -1580,7 +1580,7 @@ display_sip_uri (tvbuff_t *tvb, proto_tree *sip_element_tree, packet_info *pinfo /* Put the contact parameters in the tree */ while (current_offset < uri_offsets->name_addr_end) { - queried_offset = tvb_pbrk_pattern_guint8(tvb, current_offset, uri_offsets->name_addr_end - current_offset, &pbrk_comma_semi, &c); + queried_offset = tvb_ws_mempbrk_pattern_guint8(tvb, current_offset, uri_offsets->name_addr_end - current_offset, &pbrk_comma_semi, &c); if (queried_offset == -1) { /* Reached line end */ @@ -1681,7 +1681,7 @@ dissect_sip_contact_item(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gi while(current_offset< line_end_offset){ c = '\0'; queried_offset++; - queried_offset = (queried_offset < line_end_offset) ? tvb_pbrk_pattern_guint8(tvb, queried_offset, line_end_offset - queried_offset, &pbrk_header_end_dquote, &c) : -1; + queried_offset = (queried_offset < line_end_offset) ? tvb_ws_mempbrk_pattern_guint8(tvb, queried_offset, line_end_offset - queried_offset, &pbrk_header_end_dquote, &c) : -1; if (queried_offset != -1) { switch (c) { @@ -1710,7 +1710,7 @@ dissect_sip_contact_item(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gi /* We have an opening quote but no closing quote. */ current_offset = line_end_offset; } else { - current_offset = tvb_pbrk_pattern_guint8(tvb, queried_offset+1, line_end_offset - queried_offset, &pbrk_comma_semi, &c); + current_offset = tvb_ws_mempbrk_pattern_guint8(tvb, queried_offset+1, line_end_offset - queried_offset, &pbrk_comma_semi, &c); if(current_offset==-1){ /* Last parameter, line end */ current_offset = line_end_offset; @@ -1809,7 +1809,7 @@ dissect_sip_authorization_item(tvbuff_t *tvb, proto_tree *tree, gint start_offse name = tvb_get_string_enc(wmem_packet_scope(), tvb, start_offset, par_name_end_offset-start_offset, ENC_UTF_8|ENC_NA); /* Find end of parameter, it can be a quoted string so check for quoutes too */ - queried_offset = tvb_pbrk_pattern_guint8(tvb, par_name_end_offset, line_end_offset - par_name_end_offset, &pbrk_quotes, &c); + queried_offset = tvb_ws_mempbrk_pattern_guint8(tvb, par_name_end_offset, line_end_offset - par_name_end_offset, &pbrk_quotes, &c); if (queried_offset == -1) { /* Last parameter, line end */ current_offset = line_end_offset; @@ -2178,7 +2178,7 @@ static void dissect_sip_via_header(tvbuff_t *tvb, proto_tree *tree, gint start_o { int transport_start_offset = current_offset; - current_offset = tvb_pbrk_pattern_guint8(tvb, current_offset, line_end_offset - current_offset, &pbrk_tab_sp_fslash, &c); + current_offset = tvb_ws_mempbrk_pattern_guint8(tvb, current_offset, line_end_offset - current_offset, &pbrk_tab_sp_fslash, &c); if (current_offset != -1){ proto_tree_add_item(tree, hf_sip_via_transport, tvb, transport_start_offset, current_offset - transport_start_offset, ENC_UTF_8|ENC_NA); @@ -2207,7 +2207,7 @@ static void dissect_sip_via_header(tvbuff_t *tvb, proto_tree *tree, gint start_o address_start_offset = current_offset; while (current_offset < line_end_offset) { - current_offset = tvb_pbrk_pattern_guint8(tvb, current_offset, line_end_offset - current_offset, &pbrk_addr_end, &c); + current_offset = tvb_ws_mempbrk_pattern_guint8(tvb, current_offset, line_end_offset - current_offset, &pbrk_addr_end, &c); if (current_offset == -1) { current_offset = line_end_offset; @@ -2342,7 +2342,7 @@ static void dissect_sip_via_header(tvbuff_t *tvb, proto_tree *tree, gint start_o parameter_name_end = current_offset; /* Read until end of parameter value */ - current_offset = tvb_pbrk_pattern_guint8(tvb, current_offset, line_end_offset - current_offset, &pbrk_via_param_end, NULL); + current_offset = tvb_ws_mempbrk_pattern_guint8(tvb, current_offset, line_end_offset - current_offset, &pbrk_via_param_end, NULL); if (current_offset == -1) current_offset = line_end_offset; @@ -3419,7 +3419,7 @@ dissect_sip_common(tvbuff_t *tvb, int offset, int remaining_length, packet_info if (hf_index != POS_AUTHENTICATION_INFO) { /* The first time comma_offset is "start of parameters" */ - comma_offset = tvb_pbrk_pattern_guint8(tvb, value_offset, line_end_offset - value_offset, &pbrk_whitespace, NULL); + comma_offset = tvb_ws_mempbrk_pattern_guint8(tvb, value_offset, line_end_offset - value_offset, &pbrk_whitespace, NULL); proto_tree_add_item(sip_element_tree, hf_sip_auth_scheme, tvb, value_offset, comma_offset - value_offset, ENC_UTF_8|ENC_NA); @@ -5959,15 +5959,15 @@ void proto_register_sip(void) ext_hdr_subdissector_table = register_dissector_table("sip.hdr", "SIP Extension header", FT_STRING, BASE_NONE); /* compile patterns */ - tvb_pbrk_compile(&pbrk_comma_semi, ",;"); - tvb_pbrk_compile(&pbrk_whitespace, " \t\r\n"); - tvb_pbrk_compile(&pbrk_param_end, ">,;? \r"); - tvb_pbrk_compile(&pbrk_param_end_colon_brackets, ">,;? \r:[]"); - tvb_pbrk_compile(&pbrk_header_end_dquote, "\r\n,;\""); - tvb_pbrk_compile(&pbrk_quotes, "'\""); - tvb_pbrk_compile(&pbrk_tab_sp_fslash, "\t /"); - tvb_pbrk_compile(&pbrk_addr_end, "[] \t:;"); - tvb_pbrk_compile(&pbrk_via_param_end, "\t;, "); + ws_mempbrk_compile(&pbrk_comma_semi, ",;"); + ws_mempbrk_compile(&pbrk_whitespace, " \t\r\n"); + ws_mempbrk_compile(&pbrk_param_end, ">,;? \r"); + ws_mempbrk_compile(&pbrk_param_end_colon_brackets, ">,;? \r:[]"); + ws_mempbrk_compile(&pbrk_header_end_dquote, "\r\n,;\""); + ws_mempbrk_compile(&pbrk_quotes, "'\""); + ws_mempbrk_compile(&pbrk_tab_sp_fslash, "\t /"); + ws_mempbrk_compile(&pbrk_addr_end, "[] \t:;"); + ws_mempbrk_compile(&pbrk_via_param_end, "\t;, "); } diff --git a/epan/tvbuff-int.h b/epan/tvbuff-int.h index c925863e88..7996bbda30 100644 --- a/epan/tvbuff-int.h +++ b/epan/tvbuff-int.h @@ -34,7 +34,7 @@ struct tvb_ops { void *(*tvb_memcpy)(struct tvbuff *tvb, void *target, guint offset, guint length); gint (*tvb_find_guint8)(tvbuff_t *tvb, guint abs_offset, guint limit, guint8 needle); - gint (*tvb_pbrk_pattern_guint8)(tvbuff_t *tvb, guint abs_offset, guint limit, const tvb_pbrk_pattern* pattern, guchar *found_needle); + gint (*tvb_ws_mempbrk_pattern_guint8)(tvbuff_t *tvb, guint abs_offset, guint limit, const ws_mempbrk_pattern* pattern, guchar *found_needle); tvbuff_t *(*tvb_clone)(tvbuff_t *tvb, guint abs_offset, guint abs_length); }; diff --git a/epan/tvbuff.c b/epan/tvbuff.c index 4be4f1a1fa..e608339679 100644 --- a/epan/tvbuff.c +++ b/epan/tvbuff.c @@ -1894,14 +1894,14 @@ tvb_find_guint8(tvbuff_t *tvb, const gint offset, const gint maxlength, const gu } static inline gint -tvb_pbrk_guint8_generic(tvbuff_t *tvb, guint abs_offset, guint limit, const tvb_pbrk_pattern* pattern, guchar *found_needle) +tvb_ws_mempbrk_guint8_generic(tvbuff_t *tvb, guint abs_offset, guint limit, const ws_mempbrk_pattern* pattern, guchar *found_needle) { const guint8 *ptr; const guint8 *result; ptr = ensure_contiguous(tvb, abs_offset, limit); /* tvb_get_ptr */ - result = tvb_pbrk_exec(ptr, limit, pattern, found_needle); + result = ws_mempbrk_exec(ptr, limit, pattern, found_needle); if (!result) return -1; @@ -1917,8 +1917,8 @@ tvb_pbrk_guint8_generic(tvbuff_t *tvb, guint abs_offset, guint limit, const tvb_ * in that case, -1 will be returned if the boundary is reached before * finding needle. */ gint -tvb_pbrk_pattern_guint8(tvbuff_t *tvb, const gint offset, const gint maxlength, - const tvb_pbrk_pattern* pattern, guchar *found_needle) +tvb_ws_mempbrk_pattern_guint8(tvbuff_t *tvb, const gint offset, const gint maxlength, + const ws_mempbrk_pattern* pattern, guchar *found_needle) { const guint8 *result; guint abs_offset; @@ -1940,7 +1940,7 @@ tvb_pbrk_pattern_guint8(tvbuff_t *tvb, const gint offset, const gint maxlength, /* If we have real data, perform our search now. */ if (tvb->real_data) { - result = tvb_pbrk_exec(tvb->real_data + abs_offset, limit, pattern, found_needle); + result = ws_mempbrk_exec(tvb->real_data + abs_offset, limit, pattern, found_needle); if (result == NULL) { return -1; } @@ -1949,10 +1949,10 @@ tvb_pbrk_pattern_guint8(tvbuff_t *tvb, const gint offset, const gint maxlength, } } - if (tvb->ops->tvb_pbrk_pattern_guint8) - return tvb->ops->tvb_pbrk_pattern_guint8(tvb, abs_offset, limit, pattern, found_needle); + if (tvb->ops->tvb_ws_mempbrk_pattern_guint8) + return tvb->ops->tvb_ws_mempbrk_pattern_guint8(tvb, abs_offset, limit, pattern, found_needle); - return tvb_pbrk_guint8_generic(tvb, abs_offset, limit, pattern, found_needle); + return tvb_ws_mempbrk_guint8_generic(tvb, abs_offset, limit, pattern, found_needle); } /* Find size of stringz (NUL-terminated string) by looking for terminating @@ -3039,7 +3039,7 @@ tvb_get_nstringz0(tvbuff_t *tvb, const gint offset, const guint bufsize, guint8* } -static tvb_pbrk_pattern pbrk_crlf; +static ws_mempbrk_pattern pbrk_crlf; /* * Given a tvbuff, an offset into the tvbuff, and a length that starts * at that offset (which may be -1 for "all the way to the end of the @@ -3079,14 +3079,14 @@ tvb_find_line_end(tvbuff_t *tvb, const gint offset, int len, gint *next_offset, eob_offset = offset + len; if (!compiled) { - tvb_pbrk_compile(&pbrk_crlf, "\r\n"); + ws_mempbrk_compile(&pbrk_crlf, "\r\n"); compiled = TRUE; } /* * Look either for a CR or an LF. */ - eol_offset = tvb_pbrk_pattern_guint8(tvb, offset, len, &pbrk_crlf, &found_needle); + eol_offset = tvb_ws_mempbrk_pattern_guint8(tvb, offset, len, &pbrk_crlf, &found_needle); if (eol_offset == -1) { /* * No CR or LF - line is presumably continued in next packet. @@ -3164,7 +3164,7 @@ tvb_find_line_end(tvbuff_t *tvb, const gint offset, int len, gint *next_offset, return linelen; } -static tvb_pbrk_pattern pbrk_crlf_dquote; +static ws_mempbrk_pattern pbrk_crlf_dquote; /* * Given a tvbuff, an offset into the tvbuff, and a length that starts * at that offset (which may be -1 for "all the way to the end of the @@ -3199,7 +3199,7 @@ tvb_find_line_end_unquoted(tvbuff_t *tvb, const gint offset, int len, gint *next len = _tvb_captured_length_remaining(tvb, offset); if (!compiled) { - tvb_pbrk_compile(&pbrk_crlf_dquote, "\r\n\""); + ws_mempbrk_compile(&pbrk_crlf_dquote, "\r\n\""); compiled = TRUE; } @@ -3225,7 +3225,7 @@ tvb_find_line_end_unquoted(tvbuff_t *tvb, const gint offset, int len, gint *next /* * Look either for a CR, an LF, or a '"'. */ - char_offset = tvb_pbrk_pattern_guint8(tvb, cur_offset, len, &pbrk_crlf_dquote, &c); + char_offset = tvb_ws_mempbrk_pattern_guint8(tvb, cur_offset, len, &pbrk_crlf_dquote, &c); } if (char_offset == -1) { /* diff --git a/epan/tvbuff.h b/epan/tvbuff.h index c5936020f2..cb931d0362 100644 --- a/epan/tvbuff.h +++ b/epan/tvbuff.h @@ -509,14 +509,14 @@ WS_DLL_PUBLIC gint tvb_find_guint8(tvbuff_t *tvb, const gint offset, /** Find first occurrence of any of the needles of the pre-compiled pattern in * tvbuff, starting at offset. The passed in pattern must have been "compiled" - * before-hand, using tvb_pbrk_compile() above. + * before-hand, using ws_mempbrk_compile(). * Searches at most maxlength number of bytes. Returns the offset of the * found needle, or -1 if not found and the found needle. * Will not throw an exception, even if * maxlength exceeds boundary of tvbuff; in that case, -1 will be returned if * the boundary is reached before finding needle. */ -WS_DLL_PUBLIC gint tvb_pbrk_pattern_guint8(tvbuff_t *tvb, const gint offset, - const gint maxlength, const tvb_pbrk_pattern* pattern, guchar *found_needle); +WS_DLL_PUBLIC gint tvb_ws_mempbrk_pattern_guint8(tvbuff_t *tvb, const gint offset, + const gint maxlength, const ws_mempbrk_pattern* pattern, guchar *found_needle); /** Find size of stringz (NUL-terminated string) by looking for terminating diff --git a/epan/tvbuff_subset.c b/epan/tvbuff_subset.c index 8db4c0f510..3bb6e8fd18 100644 --- a/epan/tvbuff_subset.c +++ b/epan/tvbuff_subset.c @@ -79,11 +79,11 @@ subset_find_guint8(tvbuff_t *tvb, guint abs_offset, guint limit, guint8 needle) } static gint -subset_pbrk_guint8(tvbuff_t *tvb, guint abs_offset, guint limit, const tvb_pbrk_pattern* pattern, guchar *found_needle) +subset_pbrk_guint8(tvbuff_t *tvb, guint abs_offset, guint limit, const ws_mempbrk_pattern* pattern, guchar *found_needle) { struct tvb_subset *subset_tvb = (struct tvb_subset *) tvb; - return tvb_pbrk_pattern_guint8(subset_tvb->subset.tvb, subset_tvb->subset.offset + abs_offset, limit, pattern, found_needle); + return tvb_ws_mempbrk_pattern_guint8(subset_tvb->subset.tvb, subset_tvb->subset.offset + abs_offset, limit, pattern, found_needle); } static tvbuff_t * diff --git a/frame_tvbuff.c b/frame_tvbuff.c index d70b053cae..89c8ab68f0 100644 --- a/frame_tvbuff.c +++ b/frame_tvbuff.c @@ -139,13 +139,13 @@ frame_find_guint8(tvbuff_t *tvb, guint abs_offset, guint limit, guint8 needle) } static gint -frame_pbrk_guint8(tvbuff_t *tvb, guint abs_offset, guint limit, const tvb_pbrk_pattern* pattern, guchar *found_needle) +frame_pbrk_guint8(tvbuff_t *tvb, guint abs_offset, guint limit, const ws_mempbrk_pattern* pattern, guchar *found_needle) { struct tvb_frame *frame_tvb = (struct tvb_frame *) tvb; frame_cache(frame_tvb); - return tvb_pbrk_pattern_guint8(tvb, abs_offset, limit, pattern, found_needle); + return tvb_ws_mempbrk_pattern_guint8(tvb, abs_offset, limit, pattern, found_needle); } static guint diff --git a/wsutil/ws_mempbrk.c b/wsutil/ws_mempbrk.c index 28f6a61f7b..11b19e39ff 100644 --- a/wsutil/ws_mempbrk.c +++ b/wsutil/ws_mempbrk.c @@ -40,7 +40,7 @@ #include "ws_mempbrk_int.h" void -tvb_pbrk_compile(tvb_pbrk_pattern* pattern, const gchar *needles) +ws_mempbrk_compile(ws_mempbrk_pattern* pattern, const gchar *needles) { const gchar *n = needles; while (*n) { @@ -55,7 +55,7 @@ tvb_pbrk_compile(tvb_pbrk_pattern* pattern, const gchar *needles) const guint8 * -ws_mempbrk_portable_exec(const guint8* haystack, size_t haystacklen, const tvb_pbrk_pattern* pattern, guchar *found_needle) +ws_mempbrk_portable_exec(const guint8* haystack, size_t haystacklen, const ws_mempbrk_pattern* pattern, guchar *found_needle) { const guint8 *haystack_end = haystack + haystacklen; @@ -73,7 +73,7 @@ ws_mempbrk_portable_exec(const guint8* haystack, size_t haystacklen, const tvb_p WS_DLL_PUBLIC const guint8 * -tvb_pbrk_exec(const guint8* haystack, size_t haystacklen, const tvb_pbrk_pattern* pattern, guchar *found_needle) +ws_mempbrk_exec(const guint8* haystack, size_t haystacklen, const ws_mempbrk_pattern* pattern, guchar *found_needle) { #ifdef HAVE_SSE4_2 if (haystacklen >= 16 && pattern->use_sse42) diff --git a/wsutil/ws_mempbrk.h b/wsutil/ws_mempbrk.h index 6138ec3ccd..74129c3195 100644 --- a/wsutil/ws_mempbrk.h +++ b/wsutil/ws_mempbrk.h @@ -28,7 +28,7 @@ #include <emmintrin.h> #endif -/** The pattern object used for tvb_pbrk_pattern_guint8(). +/** The pattern object used for ws_mempbrk_exec(). */ typedef struct { gchar patt[256]; @@ -36,12 +36,14 @@ typedef struct { gboolean use_sse42; __m128i mask; #endif -} tvb_pbrk_pattern; +} ws_mempbrk_pattern; -/** Compile the pattern for the needles to find using tvb_pbrk_pattern_guint8(). +/** Compile the pattern for the needles to find using ws_mempbrk_exec(). */ -WS_DLL_PUBLIC void tvb_pbrk_compile(tvb_pbrk_pattern* pattern, const gchar *needles); +WS_DLL_PUBLIC void ws_mempbrk_compile(ws_mempbrk_pattern* pattern, const gchar *needles); -WS_DLL_PUBLIC const guint8 *tvb_pbrk_exec(const guint8* haystack, size_t haystacklen, const tvb_pbrk_pattern* pattern, guchar *found_needle); +/** Scan for the needles specified by the compiled pattern. + */ +WS_DLL_PUBLIC const guint8 *ws_mempbrk_exec(const guint8* haystack, size_t haystacklen, const ws_mempbrk_pattern* pattern, guchar *found_needle); #endif /* __WS_MEMPBRK_H__ */ diff --git a/wsutil/ws_mempbrk_int.h b/wsutil/ws_mempbrk_int.h index 53f5a46617..83c06e24ef 100644 --- a/wsutil/ws_mempbrk_int.h +++ b/wsutil/ws_mempbrk_int.h @@ -22,11 +22,11 @@ #ifndef __WS_MEMPBRK_INT_H__ #define __WS_MEMPBRK_INT_H__ -const guint8 *ws_mempbrk_portable_exec(const guint8* haystack, size_t haystacklen, const tvb_pbrk_pattern* pattern, guchar *found_needle); +const guint8 *ws_mempbrk_portable_exec(const guint8* haystack, size_t haystacklen, const ws_mempbrk_pattern* pattern, guchar *found_needle); #ifdef HAVE_SSE4_2 -void ws_mempbrk_sse42_compile(tvb_pbrk_pattern* pattern, const gchar *needles); -const char *ws_mempbrk_sse42_exec(const char* haystack, size_t haystacklen, const tvb_pbrk_pattern* pattern, guchar *found_needle); +void ws_mempbrk_sse42_compile(ws_mempbrk_pattern* pattern, const gchar *needles); +const char *ws_mempbrk_sse42_exec(const char* haystack, size_t haystacklen, const ws_mempbrk_pattern* pattern, guchar *found_needle); #endif #endif /* __WS_MEMPBRK_INT_H__ */ diff --git a/wsutil/ws_mempbrk_sse42.c b/wsutil/ws_mempbrk_sse42.c index 66b92c4417..80bf53d25f 100644 --- a/wsutil/ws_mempbrk_sse42.c +++ b/wsutil/ws_mempbrk_sse42.c @@ -62,7 +62,7 @@ __m128i_shift_right (__m128i value, unsigned long int offset) void -ws_mempbrk_sse42_compile(tvb_pbrk_pattern* pattern, const gchar *needles) +ws_mempbrk_sse42_compile(ws_mempbrk_pattern* pattern, const gchar *needles) { size_t length = strlen(needles); @@ -107,7 +107,7 @@ ws_mempbrk_sse42_compile(tvb_pbrk_pattern* pattern, const gchar *needles) X for case 1. */ const char * -ws_mempbrk_sse42_exec(const char *s, size_t slen, const tvb_pbrk_pattern* pattern, guchar *found_needle) +ws_mempbrk_sse42_exec(const char *s, size_t slen, const ws_mempbrk_pattern* pattern, guchar *found_needle) { const char *aligned; int offset; |