Tue, 06 Jan 2015 21:39:09 +0100
Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.
1 /**
2 util.h
5 Copyright (C) 2001-2003, Network Resonance, Inc.
6 Copyright (C) 2006, Network Resonance, Inc.
7 All Rights Reserved
9 Redistribution and use in source and binary forms, with or without
10 modification, are permitted provided that the following conditions
11 are met:
13 1. Redistributions of source code must retain the above copyright
14 notice, this list of conditions and the following disclaimer.
15 2. Redistributions in binary form must reproduce the above copyright
16 notice, this list of conditions and the following disclaimer in the
17 documentation and/or other materials provided with the distribution.
18 3. Neither the name of Network Resonance, Inc. nor the name of any
19 contributors to this software may be used to endorse or promote
20 products derived from this software without specific prior written
21 permission.
23 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
24 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
27 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 POSSIBILITY OF SUCH DAMAGE.
36 ekr@rtfm.com Wed Dec 26 17:20:23 2001
37 */
40 #ifndef _util_h
41 #define _util_h
43 #include "registry.h"
45 int nr_get_filename(char *base,char *name, char **namep);
46 #if 0
47 #include <openssl/ssl.h>
49 int read_RSA_private_key(char *base, char *name,RSA **keyp);
50 #endif
51 void nr_errprintf_log(const char *fmt,...);
52 void nr_errprintf_log2(void *ignore, const char *fmt,...);
53 extern int nr_util_default_log_facility;
55 int nr_read_data(int fd,char *buf,int len);
56 int nr_drop_privileges(char *username);
57 int nr_hex_ascii_dump(Data *data);
58 int nr_fwrite_all(FILE *fp,UCHAR *buf,int len);
59 int nr_sha1_file(char *filename,UCHAR *out);
60 int nr_bin2hex(UCHAR *in,int len,UCHAR *out);
61 int nr_rm_tree(char *path);
62 int nr_write_pid_file(char *pid_filename);
64 int nr_reg_uint4_fetch_and_check(NR_registry key, UINT4 min, UINT4 max, int log_fac, int die, UINT4 *val);
65 int nr_reg_uint8_fetch_and_check(NR_registry key, UINT8 min, UINT8 max, int log_fac, int die, UINT8 *val);
67 #ifdef WIN32
68 int snprintf(char *buffer, size_t n, const char *format, ...);
69 const char *inet_ntop(int af, const void *src, char *dst, size_t size);
70 #endif
72 #endif