Tor 0.4.9.3-alpha-dev
Loading...
Searching...
No Matches
util_string.h
Go to the documentation of this file.
1/* Copyright (c) 2003-2004, Roger Dingledine
2 * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
3 * Copyright (c) 2007-2021, The Tor Project, Inc. */
4/* See LICENSE for licensing information */
5
6/**
7 * \file util_string.h
8 * \brief Header for util_string.c
9 **/
10
11#ifndef TOR_UTIL_STRING_H
12#define TOR_UTIL_STRING_H
13
14#include "orconfig.h"
16
17#include <stddef.h>
18
19const void *tor_memmem(const void *haystack, size_t hlen, const void *needle,
20 size_t nlen);
21const void *tor_memstr(const void *haystack, size_t hlen,
22 const char *needle);
23int fast_mem_is_zero(const char *mem, size_t len);
24#define fast_digest_is_zero(d) fast_mem_is_zero((d), DIGEST_LEN)
25#define fast_digetst256_is_zero(d) fast_mem_is_zero((d), DIGEST256_LEN)
26
27int tor_digest_is_zero(const char *digest);
28int tor_digest256_is_zero(const char *digest);
29
30/** Allowable characters in a hexadecimal string. */
31#define HEX_CHARACTERS "0123456789ABCDEFabcdef"
32void tor_strlower(char *s);
33void tor_strupper(char *s);
34void tor_strreplacechar(char *s, char find, char replacement);
35int tor_strisprint(const char *s);
36int tor_strisnonupper(const char *s);
37int tor_strisspace(const char *s);
38int strcmp_opt(const char *s1, const char *s2);
39int strcmpstart(const char *s1, const char *s2);
40int strcasecmpstart(const char *s1, const char *s2);
41int strcmpend(const char *s1, const char *s2);
42int strcasecmpend(const char *s1, const char *s2);
43int fast_memcmpstart(const void *mem, size_t memlen, const char *prefix);
44
45void tor_strstrip(char *s, const char *strip);
46
47const char *eat_whitespace(const char *s);
48const char *eat_whitespace_eos(const char *s, const char *eos);
49const char *eat_whitespace_no_nl(const char *s);
50const char *eat_whitespace_eos_no_nl(const char *s, const char *eos);
51const char *find_whitespace(const char *s);
52const char *find_whitespace_eos(const char *s, const char *eos);
53const char *find_str_at_start_of_line(const char *haystack,
54 const char *needle);
55
56int string_is_C_identifier(const char *string);
57
58int string_is_utf8(const char *str, size_t len);
59int string_is_utf8_no_bom(const char *str, size_t len);
60
61#endif /* !defined(TOR_UTIL_STRING_H) */
Utility macros to handle different features and behavior in different compilers.
int tor_strisspace(const char *s)
const char * find_whitespace_eos(const char *s, const char *eos)
int strcasecmpstart(const char *s1, const char *s2)
void tor_strlower(char *s)
int strcmpstart(const char *s1, const char *s2)
int strcmpend(const char *s1, const char *s2)
const char * find_whitespace(const char *s)
void tor_strupper(char *s)
const char * eat_whitespace_eos(const char *s, const char *eos)
int fast_memcmpstart(const void *mem, size_t memlen, const char *prefix)
int strcasecmpend(const char *s1, const char *s2)
int tor_strisprint(const char *s)
int strcmp_opt(const char *s1, const char *s2)
int string_is_utf8_no_bom(const char *str, size_t len)
int tor_digest256_is_zero(const char *digest)
int fast_mem_is_zero(const char *mem, size_t len)
Definition util_string.c:76
int string_is_C_identifier(const char *string)
void tor_strstrip(char *s, const char *strip)
const char * find_str_at_start_of_line(const char *haystack, const char *needle)
const char * eat_whitespace(const char *s)
const void * tor_memmem(const void *haystack, size_t hlen, const void *needle, size_t nlen)
Definition util_string.c:29
const char * eat_whitespace_eos_no_nl(const char *s, const char *eos)
const char * eat_whitespace_no_nl(const char *s)
int tor_strisnonupper(const char *s)
int string_is_utf8(const char *str, size_t len)
int tor_digest_is_zero(const char *digest)
Definition util_string.c:98
void tor_strreplacechar(char *s, char find, char replacement)