loaders.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. #ifndef LOADERS_H_INCLUDED
  2. #define LOADERS_H_INCLUDED
  3. /*********************************************************************
  4. *
  5. * File : $Source: /cvsroot/ijbswa/current/loaders.h,v $
  6. *
  7. * Purpose : Functions to load and unload the various
  8. * configuration files. Also contains code to manage
  9. * the list of active loaders, and to automatically
  10. * unload files that are no longer in use.
  11. *
  12. * Copyright : Written by and Copyright (C) 2001-2010 the
  13. * Privoxy team. https://www.privoxy.org/
  14. *
  15. * Based on the Internet Junkbuster originally written
  16. * by and Copyright (C) 1997 Anonymous Coders and
  17. * Junkbusters Corporation. http://www.junkbusters.com
  18. *
  19. * This program is free software; you can redistribute it
  20. * and/or modify it under the terms of the GNU General
  21. * Public License as published by the Free Software
  22. * Foundation; either version 2 of the License, or (at
  23. * your option) any later version.
  24. *
  25. * This program is distributed in the hope that it will
  26. * be useful, but WITHOUT ANY WARRANTY; without even the
  27. * implied warranty of MERCHANTABILITY or FITNESS FOR A
  28. * PARTICULAR PURPOSE. See the GNU General Public
  29. * License for more details.
  30. *
  31. * The GNU General Public License should be included with
  32. * this file. If not, you can view it at
  33. * http://www.gnu.org/copyleft/gpl.html
  34. * or write to the Free Software Foundation, Inc., 59
  35. * Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  36. *
  37. *********************************************************************/
  38. extern unsigned int sweep(void);
  39. extern void free_csp_resources(struct client_state *csp);
  40. extern char *read_config_line(FILE *fp, unsigned long *linenum, char **buf);
  41. extern int check_file_changed(const struct file_list * current,
  42. const char * filename,
  43. struct file_list ** newfl);
  44. extern jb_err edit_read_line(FILE *fp,
  45. char **raw_out,
  46. char **prefix_out,
  47. char **data_out,
  48. int *newline,
  49. unsigned long *line_number);
  50. extern jb_err simple_read_line(FILE *fp, char **dest, int *newline);
  51. /*
  52. * Various types of newlines that a file may contain.
  53. */
  54. #define NEWLINE_UNKNOWN 0 /* Newline convention in file is unknown */
  55. #define NEWLINE_UNIX 1 /* Newline convention in file is '\n' (ASCII 10) */
  56. #define NEWLINE_DOS 2 /* Newline convention in file is '\r\n' (ASCII 13,10) */
  57. #define NEWLINE_MAC 3 /* Newline convention in file is '\r' (ASCII 13) */
  58. /*
  59. * Types of newlines that a file may contain, as strings. If you have an
  60. * extremely weird compiler that does not have '\r' == CR == ASCII 13 and
  61. * '\n' == LF == ASCII 10), then fix CHAR_CR and CHAR_LF in loaders.c as
  62. * well as these definitions.
  63. */
  64. #define NEWLINE(style) ((style)==NEWLINE_DOS ? "\r\n" : \
  65. ((style)==NEWLINE_MAC ? "\r" : "\n"))
  66. extern short int MustReload;
  67. extern int load_action_files(struct client_state *csp);
  68. extern int load_re_filterfiles(struct client_state *csp);
  69. #ifdef FUZZ
  70. extern int load_one_re_filterfile(struct client_state *csp, int fileid);
  71. #endif
  72. #ifdef FEATURE_TRUST
  73. extern int load_trustfile(struct client_state *csp);
  74. #endif /* def FEATURE_TRUST */
  75. #ifdef FEATURE_GRACEFUL_TERMINATION
  76. #ifdef FEATURE_TRUST
  77. void unload_current_trust_file(void);
  78. #endif
  79. void unload_current_re_filterfile(void);
  80. #endif /* FEATURE_GRACEFUL_TERMINATION */
  81. void unload_forward_spec(struct forward_spec *fwd);
  82. extern void add_loader(int (*loader)(struct client_state *),
  83. struct configuration_spec * config);
  84. extern int run_loader(struct client_state *csp);
  85. extern int any_loaded_file_changed(const struct client_state *csp);
  86. #endif /* ndef LOADERS_H_INCLUDED */
  87. /*
  88. Local Variables:
  89. tab-width: 3
  90. end:
  91. */