1 /* Copyright (c) 2003-2004, Roger Dingledine
2 * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
3 * Copyright (c) 2007-2019, The Tor Project, Inc. */
4 /* See LICENSE for licensing information */
8 * \brief Header for util_string.c
11 #ifndef TOR_UTIL_STRING_H
12 #define TOR_UTIL_STRING_H
15 #include "lib/cc/compat_compiler.h"
19 const void *tor_memmem(const void *haystack
, size_t hlen
, const void *needle
,
21 const void *tor_memstr(const void *haystack
, size_t hlen
,
23 int tor_mem_is_zero(const char *mem
, size_t len
);
24 int tor_digest_is_zero(const char *digest
);
25 int tor_digest256_is_zero(const char *digest
);
27 /** Allowable characters in a hexadecimal string. */
28 #define HEX_CHARACTERS "0123456789ABCDEFabcdef"
29 void tor_strlower(char *s
);
30 void tor_strupper(char *s
);
31 int tor_strisprint(const char *s
);
32 int tor_strisnonupper(const char *s
);
33 int tor_strisspace(const char *s
);
34 int strcmp_opt(const char *s1
, const char *s2
);
35 int strcmpstart(const char *s1
, const char *s2
);
36 int strcmp_len(const char *s1
, const char *s2
, size_t len
);
37 int strcasecmpstart(const char *s1
, const char *s2
);
38 int strcmpend(const char *s1
, const char *s2
);
39 int strcasecmpend(const char *s1
, const char *s2
);
40 int fast_memcmpstart(const void *mem
, size_t memlen
, const char *prefix
);
42 void tor_strstrip(char *s
, const char *strip
);
44 const char *eat_whitespace(const char *s
);
45 const char *eat_whitespace_eos(const char *s
, const char *eos
);
46 const char *eat_whitespace_no_nl(const char *s
);
47 const char *eat_whitespace_eos_no_nl(const char *s
, const char *eos
);
48 const char *find_whitespace(const char *s
);
49 const char *find_whitespace_eos(const char *s
, const char *eos
);
50 const char *find_str_at_start_of_line(const char *haystack
,
53 int string_is_C_identifier(const char *string
);
55 int string_is_utf8(const char *str
, size_t len
);
57 #endif /* !defined(TOR_UTIL_STRING_H) */