Wireshark
2.9.0-477-g68ec514b
The Wireshark network protocol analyzer
|
#include "ws_symbol_export.h"
#include <epan/wmem/wmem.h>
Go to the source code of this file.
Functions | |
const guchar * | find_line_end (const guchar *data, const guchar *dataend, const guchar **eol) |
WS_DLL_PUBLIC int | get_token_len (const guchar *linep, const guchar *lineend, const guchar **next_token) |
WS_DLL_PUBLIC gchar * | format_text (wmem_allocator_t *allocator, const guchar *line, size_t len) |
WS_DLL_PUBLIC gchar * | format_text_wsp (wmem_allocator_t *allocator, const guchar *line, size_t len) |
WS_DLL_PUBLIC gchar * | format_text_chr (wmem_allocator_t *allocator, const guchar *string, const size_t len, const guchar chr) |
WS_DLL_PUBLIC gboolean | hex_str_to_bytes (const char *hex_str, GByteArray *bytes, gboolean force_separators) |
WS_DLL_PUBLIC gboolean | hex_str_to_bytes_encoding (const char *hex_str, GByteArray *bytes, const char **endptr, const guint encoding, const gboolean fail_if_partial) |
WS_DLL_PUBLIC gboolean | uri_str_to_bytes (const char *uri_str, GByteArray *bytes) |
WS_DLL_PUBLIC gchar * | format_uri (wmem_allocator_t *allocator, const GByteArray *bytes, const gchar *reserved_chars) |
WS_DLL_PUBLIC gboolean | rel_oid_str_to_bytes (const char *oid_str, GByteArray *bytes, gboolean is_absolute) |
WS_DLL_PUBLIC gboolean | oid_str_to_bytes (const char *oid_str, GByteArray *bytes) |
WS_DLL_PUBLIC GByteArray * | byte_array_dup (const GByteArray *ba) |
WS_DLL_PUBLIC gboolean | byte_array_equal (GByteArray *ba1, GByteArray *ba2) |
WS_DLL_PUBLIC gchar * | xml_escape (const gchar *unescaped) |
WS_DLL_PUBLIC const guint8 * | epan_memmem (const guint8 *haystack, guint haystack_len, const guint8 *needle, guint needle_len) |
WS_DLL_PUBLIC guint8 * | convert_string_to_hex (const char *string, size_t *nbytes) |
WS_DLL_PUBLIC char * | convert_string_case (const char *string, gboolean case_insensitive) |
WS_DLL_PUBLIC const char * | epan_strcasestr (const char *haystack, const char *needle) |
WS_DLL_PUBLIC const char * | string_or_null (const char *string) |
WS_DLL_PUBLIC int | escape_string_len (const char *string) |
WS_DLL_PUBLIC char * | escape_string (char *dst, const char *string) |
WS_DLL_PUBLIC void | IA5_7BIT_decode (unsigned char *dest, const unsigned char *src, int len) |
WS_DLL_PUBLIC gchar * | ws_strdup_escape_char (const gchar *str, const gchar chr) |
WS_DLL_PUBLIC gchar * | ws_strdup_unescape_char (const gchar *str, const gchar chr) |
WS_DLL_PUBLIC gchar * | string_replace (const gchar *str, const gchar *old_val, const gchar *new_val) |
String handling and conversion utilities.
WS_DLL_PUBLIC GByteArray* byte_array_dup | ( | const GByteArray * | ba | ) |
Create a copy of a GByteArray
ba | The byte array to be copied. |
Create a copy of a GByteArray
ba | The byte array to be copied. |
WS_DLL_PUBLIC gboolean byte_array_equal | ( | GByteArray * | ba1, |
GByteArray * | ba2 | ||
) |
Compare the contents of two GByteArrays
ba1 | A byte array |
ba2 | A byte array |
Compare the contents of two GByteArrays
ba1 | A byte array |
ba2 | A byte array |
XXX - Should this be in strutil.c?
WS_DLL_PUBLIC char* convert_string_case | ( | const char * | string, |
gboolean | case_insensitive | ||
) |
Prep a string for case-sensitive vs case-insensitive searching.
string | The search string |
case_insensitive | TRUE if case-insensitive, FALSE if not |
WS_DLL_PUBLIC guint8* convert_string_to_hex | ( | const char * | string, |
size_t * | nbytes | ||
) |
Scan a string to make sure it's valid hex.
string | The string to validate |
nbytes | The length of the return buffer |
WS_DLL_PUBLIC const guint8* epan_memmem | ( | const guint8 * | haystack, |
guint | haystack_len, | ||
const guint8 * | needle, | ||
guint | needle_len | ||
) |
Return the first occurrence of needle in haystack. Algorithm copied from GNU's glibc 2.3.2 memcmp()
haystack | The data to search |
haystack_len | The length of the search data |
needle | The string to look for |
needle_len | The length of the search string |
WS_DLL_PUBLIC const char* epan_strcasestr | ( | const char * | haystack, |
const char * | needle | ||
) |
Finds the first occurrence of string 'needle' in string 'haystack'. The matching is done in a case insensitive manner.
haystack | The string possibly containing the substring |
needle | The substring to be searched |
const guchar* find_line_end | ( | const guchar * | data, |
const guchar * | dataend, | ||
const guchar ** | eol | ||
) |
Given a pointer into a data buffer, and to the end of the buffer, find the end of the (putative) line at that position in the data buffer.
data | A pointer to the beginning of the data |
dataend | A pointer to the end of the data |
eol | A pointer that will receive the EOL location |
WS_DLL_PUBLIC gchar* format_text | ( | wmem_allocator_t * | allocator, |
const guchar * | line, | ||
size_t | len | ||
) |
Given a string, generate a string from it that shows non-printable characters as C-style escapes, and return a pointer to it.
allocator | The wmem scope |
line | A pointer to the input string |
len | The length of the input string |
WS_DLL_PUBLIC gchar* format_text_chr | ( | wmem_allocator_t * | allocator, |
const guchar * | string, | ||
const size_t | len, | ||
const guchar | chr | ||
) |
Given a string, generate a string from it that shows non-printable characters as the chr parameter passed, except a whitespace character (space, tab, carriage return, new line, vertical tab, or formfeed) which will be replaced by a space, and return a pointer to it.
allocator | The wmem scope |
string | A pointer to the input string |
len | The length of the input string |
chr | The character to use to replace non-printable characters |
WS_DLL_PUBLIC gchar* format_text_wsp | ( | wmem_allocator_t * | allocator, |
const guchar * | line, | ||
size_t | len | ||
) |
Given a string, generate a string from it that shows non-printable characters as C-style escapes except a whitespace character (space, tab, carriage return, new line, vertical tab, or formfeed) which will be replaced by a space, and return a pointer to it.
allocator | The wmem scope |
line | A pointer to the input string |
len | The length of the input string |
WS_DLL_PUBLIC gchar* format_uri | ( | wmem_allocator_t * | allocator, |
const GByteArray * | bytes, | ||
const gchar * | reserved_chars | ||
) |
Turn a byte array into an RFC 3986 percent-encoded string.
allocator | The wmem scope |
bytes | The GByteArray that will receive the bytes. This must be initialized by the caller. |
reserved_chars | Normally the "gen-delims" and "sub-delims" from RFC 3986 (":/?#[]@" and "!$&'()*+,;=" respectively) plus space (hex value 20) are treated as reserved characters. If this variable is non-NULL, its contents will be used instead. |
WS_DLL_PUBLIC int get_token_len | ( | const guchar * | linep, |
const guchar * | lineend, | ||
const guchar ** | next_token | ||
) |
Get the length of the next token in a line, and the beginning of the next token after that (if any).
linep | A pointer to the beginning of the line |
lineend | A pointer to the end of the line |
next_token | Receives the location of the next token |
WS_DLL_PUBLIC gboolean hex_str_to_bytes | ( | const char * | hex_str, |
GByteArray * | bytes, | ||
gboolean | force_separators | ||
) |
Turn a string of hex digits with optional separators (defined by is_byte_sep() into a byte array.
hex_str | The string of hex digits. |
bytes | The GByteArray that will receive the bytes. This must be initialized by the caller. |
force_separators | If set to TRUE, separators MUST exist between bytes. |
WS_DLL_PUBLIC gboolean oid_str_to_bytes | ( | const char * | oid_str, |
GByteArray * | bytes | ||
) |
Turn a OID string representation (dot notation) into a byte array.
oid_str | The OID string (dot notaion). |
bytes | The GByteArray that will receive the bytes. This must be initialized by the caller. |
WS_DLL_PUBLIC gboolean rel_oid_str_to_bytes | ( | const char * | oid_str, |
GByteArray * | bytes, | ||
gboolean | is_absolute | ||
) |
Turn a OID string representation (dot notation) into a byte array.
oid_str | The OID string (dot notaion). |
bytes | The GByteArray that will receive the bytes. This must be initialized by the caller. |
is_absolute | True if this is an absolute OID; false for relative OID. |
WS_DLL_PUBLIC const char* string_or_null | ( | const char * | string | ) |
Guarantee a non-null string.
string | The string to check |
WS_DLL_PUBLIC gchar* string_replace | ( | const gchar * | str, |
const gchar * | old_val, | ||
const gchar * | new_val | ||
) |
Replace values in a string
str | String containing 0 or more values to be replaced. |
old_val | Old value. |
new_val | New value. May be NULL, in which case occurences of old_value will be removed. |
WS_DLL_PUBLIC gboolean uri_str_to_bytes | ( | const char * | uri_str, |
GByteArray * | bytes | ||
) |
Turn an RFC 3986 percent-encoded string into a byte array.
uri_str | The string of hex digits. |
bytes | The GByteArray that will receive the bytes. This must be initialized by the caller. |
WS_DLL_PUBLIC gchar* ws_strdup_escape_char | ( | const gchar * | str, |
const gchar | chr | ||
) |
Copy a string, escaping the 'chr' characters in it
str | The string to be copied |
chr | The character to be escaped |
WS_DLL_PUBLIC gchar* ws_strdup_unescape_char | ( | const gchar * | str, |
const gchar | chr | ||
) |
Copy a string, unescaping the 'chr' characters in it
str | The string to be copied |
chr | The character to be escaped |
WS_DLL_PUBLIC gchar* xml_escape | ( | const gchar * | unescaped | ) |
Return a XML escaped representation of the unescaped string. The returned string must be freed when no longer in use.
unescaped | The unescaped string |