jcc.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. #ifndef JCC_H_INCLUDED
  2. #define JCC_H_INCLUDED
  3. /*********************************************************************
  4. *
  5. * File : $Source: /cvsroot/ijbswa/current/jcc.h,v $
  6. *
  7. * Purpose : Main file. Contains main() method, main loop, and
  8. * the main connection-handling function.
  9. *
  10. * Copyright : Written by and Copyright (C) 2001-2014 the
  11. * Privoxy team. https://www.privoxy.org/
  12. *
  13. * Based on the Internet Junkbuster originally written
  14. * by and Copyright (C) 1997 Anonymous Coders and
  15. * Junkbusters Corporation. http://www.junkbusters.com
  16. *
  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.
  22. *
  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.
  28. *
  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.
  34. *
  35. *********************************************************************/
  36. struct client_state;
  37. struct file_list;
  38. /* Global variables */
  39. #ifdef FEATURE_STATISTICS
  40. extern int urls_read;
  41. extern int urls_rejected;
  42. #endif /*def FEATURE_STATISTICS*/
  43. extern struct client_states clients[1];
  44. extern struct file_list files[1];
  45. #ifdef unix
  46. extern const char *pidfile;
  47. #endif
  48. extern int daemon_mode;
  49. #ifdef FEATURE_GRACEFUL_TERMINATION
  50. extern int g_terminate;
  51. #endif
  52. #if defined(FEATURE_PTHREAD) || defined(_WIN32)
  53. #define MUTEX_LOCKS_AVAILABLE
  54. #ifdef FEATURE_PTHREAD
  55. #include <pthread.h>
  56. typedef pthread_mutex_t privoxy_mutex_t;
  57. #else
  58. typedef CRITICAL_SECTION privoxy_mutex_t;
  59. #endif
  60. extern void privoxy_mutex_lock(privoxy_mutex_t *mutex);
  61. extern void privoxy_mutex_unlock(privoxy_mutex_t *mutex);
  62. extern privoxy_mutex_t log_mutex;
  63. extern privoxy_mutex_t log_init_mutex;
  64. extern privoxy_mutex_t connection_reuse_mutex;
  65. #ifdef FEATURE_EXTERNAL_FILTERS
  66. extern privoxy_mutex_t external_filter_mutex;
  67. #endif
  68. #ifdef FEATURE_CLIENT_TAGS
  69. extern privoxy_mutex_t client_tags_mutex;
  70. #endif
  71. #ifdef FEATURE_EXTENDED_STATISTICS
  72. extern privoxy_mutex_t filter_statistics_mutex;
  73. extern privoxy_mutex_t block_statistics_mutex;
  74. #endif
  75. #ifndef HAVE_GMTIME_R
  76. extern privoxy_mutex_t gmtime_mutex;
  77. #endif /* ndef HAVE_GMTIME_R */
  78. #ifndef HAVE_LOCALTIME_R
  79. extern privoxy_mutex_t localtime_mutex;
  80. #endif /* ndef HAVE_GMTIME_R */
  81. #if !defined(HAVE_GETHOSTBYADDR_R) || !defined(HAVE_GETHOSTBYNAME_R)
  82. extern privoxy_mutex_t resolver_mutex;
  83. #endif /* !defined(HAVE_GETHOSTBYADDR_R) || !defined(HAVE_GETHOSTBYNAME_R) */
  84. #ifndef HAVE_RANDOM
  85. extern privoxy_mutex_t rand_mutex;
  86. #endif /* ndef HAVE_RANDOM */
  87. #ifdef FEATURE_HTTPS_INSPECTION
  88. extern privoxy_mutex_t certificate_mutex;
  89. extern privoxy_mutex_t ssl_init_mutex;
  90. #endif
  91. #endif /* FEATURE_PTHREAD */
  92. /* Functions */
  93. #ifdef __MINGW32__
  94. int real_main(int argc, char **argv);
  95. #else
  96. int main(int argc, char **argv);
  97. #endif
  98. #ifdef FUZZ
  99. extern int fuzz_client_request(struct client_state *csp, char *fuzz_input_file);
  100. extern int fuzz_server_response(struct client_state *csp, char *fuzz_input_file);
  101. extern int fuzz_chunked_transfer_encoding(struct client_state *csp, char *fuzz_input_file);
  102. #endif
  103. #endif /* ndef JCC_H_INCLUDED */
  104. /*
  105. Local Variables:
  106. tab-width: 3
  107. end:
  108. */