Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
strutil.h
Go to the documentation of this file.
1/* strutil.h
2 * String utility definitions
3 *
4 * Wireshark - Network traffic analyzer
5 * By Gerald Combs <gerald@wireshark.org>
6 * Copyright 1998 Gerald Combs
7 *
8 * SPDX-License-Identifier: GPL-2.0-or-later
9 */
10#pragma once
11#include "ws_symbol_export.h"
12
13#include <epan/wmem_scopes.h>
14#include <wsutil/str_util.h>
15
16#ifdef __cplusplus
17extern "C" {
18#endif /* __cplusplus */
19
33WS_DLL_PUBLIC
34const unsigned char *find_line_end(const unsigned char *data, const unsigned char *dataend,
35 const unsigned char **eol);
36
44WS_DLL_PUBLIC
45int get_token_len(const unsigned char *linep, const unsigned char *lineend,
46 const unsigned char **next_token);
47
58WS_DLL_PUBLIC
59bool hex_str_to_bytes(const char *hex_str, GByteArray *bytes,
60 bool force_separators);
61
89WS_DLL_PUBLIC
90bool hex_str_to_bytes_encoding(const char *hex_str, GByteArray *bytes, const char **endptr,
91 const unsigned encoding, const bool fail_if_partial);
92
101WS_DLL_PUBLIC
102bool uri_to_bytes(const char *uri_str, GByteArray *bytes, size_t len);
103
111WS_DLL_PUBLIC
112bool uri_str_to_bytes(const char *uri_str, GByteArray *bytes);
113
122WS_DLL_PUBLIC
123bool rel_oid_str_to_bytes(const char *oid_str, GByteArray *bytes, bool is_absolute);
124
132WS_DLL_PUBLIC
133bool oid_str_to_bytes(const char *oid_str, GByteArray *bytes);
134
143WS_DLL_PUBLIC
144GByteArray *byte_array_dup(const GByteArray *ba);
145
157WS_DLL_PUBLIC
158bool byte_array_equal(GByteArray *ba1, GByteArray *ba2);
159
160
167WS_DLL_PUBLIC
168char* xml_escape(const char *unescaped);
169
177WS_DLL_PUBLIC
178uint8_t * convert_string_to_hex(const char *string, size_t *nbytes);
179
189WS_DLL_PUBLIC
190char * convert_string_case(const char *string, bool case_insensitive);
191
199WS_DLL_PUBLIC
200void IA5_7BIT_decode(unsigned char * dest, const unsigned char* src, int len);
201
202#define FORMAT_LABEL_REPLACE_SPACE (0x1 << 0)
203
218WS_DLL_PUBLIC
219size_t ws_label_strcpy(char *label_str, size_t bufsize, size_t pos, const uint8_t *str, int flags);
220
234WS_DLL_PUBLIC
235size_t ws_label_strcat(char *label_str, size_t bufsize, const uint8_t *str, int flags);
236
246WS_DLL_LOCAL unsigned char
247module_check_valid_name(const char *name, bool lower_only);
248
249#ifdef __cplusplus
250}
251#endif /* __cplusplus */
WS_DLL_PUBLIC GByteArray * byte_array_dup(const GByteArray *ba)
Definition strutil.c:459
WS_DLL_PUBLIC char * xml_escape(const char *unescaped)
Definition strutil.c:566
WS_DLL_PUBLIC uint8_t * convert_string_to_hex(const char *string, size_t *nbytes)
Definition strutil.c:620
WS_DLL_PUBLIC bool oid_str_to_bytes(const char *oid_str, GByteArray *bytes)
Definition strutil.c:473
WS_DLL_PUBLIC bool hex_str_to_bytes(const char *hex_str, GByteArray *bytes, bool force_separators)
Definition strutil.c:140
WS_DLL_PUBLIC char * convert_string_case(const char *string, bool case_insensitive)
Prep a string for case-sensitive vs case-insensitive searching.
Definition strutil.c:696
WS_DLL_PUBLIC bool uri_to_bytes(const char *uri_str, GByteArray *bytes, size_t len)
Definition strutil.c:402
WS_DLL_PUBLIC const unsigned char * find_line_end(const unsigned char *data, const unsigned char *dataend, const unsigned char **eol)
Definition strutil.c:36
WS_DLL_PUBLIC bool byte_array_equal(GByteArray *ba1, GByteArray *ba2)
Definition strutil.c:548
WS_DLL_PUBLIC bool rel_oid_str_to_bytes(const char *oid_str, GByteArray *bytes, bool is_absolute)
Definition strutil.c:478
WS_DLL_LOCAL unsigned char module_check_valid_name(const char *name, bool lower_only)
Check if name is valid.
Definition strutil.c:783
WS_DLL_PUBLIC bool hex_str_to_bytes_encoding(const char *hex_str, GByteArray *bytes, const char **endptr, const unsigned encoding, const bool fail_if_partial)
Turn a string of hex digits with optional separators (defined by encoding)
Definition strutil.c:312
WS_DLL_PUBLIC int get_token_len(const unsigned char *linep, const unsigned char *lineend, const unsigned char **next_token)
Definition strutil.c:100
WS_DLL_PUBLIC bool uri_str_to_bytes(const char *uri_str, GByteArray *bytes)
Definition strutil.c:446
WS_DLL_PUBLIC size_t ws_label_strcat(char *label_str, size_t bufsize, const uint8_t *str, int flags)
Definition strutil.c:959
WS_DLL_PUBLIC size_t ws_label_strcpy(char *label_str, size_t bufsize, size_t pos, const uint8_t *str, int flags)
Definition strutil.c:823
WS_DLL_PUBLIC void IA5_7BIT_decode(unsigned char *dest, const unsigned char *src, int len)
Decodes an IA5-7BIT encoded string into a UTF-8 string.
Definition strutil.c:742