3 /*********************************************************************
5 * File : $Source: /cvsroot/ijbswa/current/jcc.h,v $
7 * Purpose : Main file. Contains main() method, main loop, and
8 * the main connection-handling function.
10 * Copyright : Written by and Copyright (C) 2001-2014 the
11 * Privoxy team. https://www.privoxy.org/
13 * Based on the Internet Junkbuster originally written
14 * by and Copyright (C) 1997 Anonymous Coders and
15 * Junkbusters Corporation. http://www.junkbusters.com
17 * This program is free software; you can redistribute it
18 * and/or modify it under the terms of the GNU General
19 * Public License as published by the Free Software
20 * Foundation; either version 2 of the License, or (at
21 * your option) any later version.
23 * This program is distributed in the hope that it will
24 * be useful, but WITHOUT ANY WARRANTY; without even the
25 * implied warranty of MERCHANTABILITY or FITNESS FOR A
26 * PARTICULAR PURPOSE. See the GNU General Public
27 * License for more details.
29 * The GNU General Public License should be included with
30 * this file. If not, you can view it at
31 * http://www.gnu.org/copyleft/gpl.html
32 * or write to the Free Software Foundation, Inc., 59
33 * Temple Place - Suite 330, Boston, MA 02111-1307, USA.
35 *********************************************************************/
41 /* Global variables */
43 #ifdef FEATURE_STATISTICS
44 #if defined(FEATURE_PTHREAD) || defined(_WIN32)
45 extern unsigned long long number_of_requests_received;
46 extern unsigned long long number_of_requests_blocked;
49 extern int urls_rejected;
51 #endif /*def FEATURE_STATISTICS*/
53 extern struct client_states clients[1];
54 extern struct file_list files[1];
57 extern const char *pidfile;
59 extern int daemon_mode;
61 #ifdef FEATURE_GRACEFUL_TERMINATION
62 extern int g_terminate;
65 #if defined(FEATURE_PTHREAD) || defined(_WIN32)
66 #define MUTEX_LOCKS_AVAILABLE
68 #ifdef FEATURE_PTHREAD
71 typedef pthread_mutex_t privoxy_mutex_t;
75 typedef CRITICAL_SECTION privoxy_mutex_t;
79 extern void privoxy_mutex_lock(privoxy_mutex_t *mutex);
80 extern void privoxy_mutex_unlock(privoxy_mutex_t *mutex);
82 extern privoxy_mutex_t log_mutex;
83 extern privoxy_mutex_t log_init_mutex;
84 extern privoxy_mutex_t connection_reuse_mutex;
86 #ifdef FEATURE_EXTERNAL_FILTERS
87 extern privoxy_mutex_t external_filter_mutex;
90 #ifdef FEATURE_CLIENT_TAGS
91 extern privoxy_mutex_t client_tags_mutex;
94 #ifdef FEATURE_STATISTICS
95 extern privoxy_mutex_t block_statistics_mutex;
97 #ifdef FEATURE_EXTENDED_STATISTICS
98 extern privoxy_mutex_t filter_statistics_mutex;
99 extern privoxy_mutex_t block_reason_statistics_mutex;
102 #ifndef HAVE_GMTIME_R
103 extern privoxy_mutex_t gmtime_mutex;
104 #endif /* ndef HAVE_GMTIME_R */
106 #ifndef HAVE_LOCALTIME_R
107 extern privoxy_mutex_t localtime_mutex;
108 #endif /* ndef HAVE_GMTIME_R */
110 #if !defined(HAVE_GETHOSTBYADDR_R) || !defined(HAVE_GETHOSTBYNAME_R)
111 extern privoxy_mutex_t resolver_mutex;
112 #endif /* !defined(HAVE_GETHOSTBYADDR_R) || !defined(HAVE_GETHOSTBYNAME_R) */
115 extern privoxy_mutex_t rand_mutex;
116 #endif /* ndef HAVE_RANDOM */
118 #ifdef FEATURE_HTTPS_INSPECTION
119 extern privoxy_mutex_t certificate_mutex;
120 extern privoxy_mutex_t ssl_init_mutex;
123 #endif /* FEATURE_PTHREAD */
128 int real_main(int argc, char **argv);
130 int main(int argc, char **argv);
134 extern int fuzz_client_request(struct client_state *csp, char *fuzz_input_file);
135 extern int fuzz_server_response(struct client_state *csp, char *fuzz_input_file);
136 extern int fuzz_chunked_transfer_encoding(struct client_state *csp, char *fuzz_input_file);
139 #endif /* ndef JCC_H_INCLUDED */