cgi.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. #ifndef CGI_H_INCLUDED
  2. #define CGI_H_INCLUDED
  3. /*********************************************************************
  4. *
  5. * File : $Source: /cvsroot/ijbswa/current/cgi.h,v $
  6. *
  7. * Purpose : Declares functions to intercept request, generate
  8. * html or gif answers, and to compose HTTP responses.
  9. *
  10. * Functions declared include:
  11. *
  12. *
  13. * Copyright : Written by and Copyright (C) 2001-2009 the
  14. * Privoxy team. https://www.privoxy.org/
  15. *
  16. * Based on the Internet Junkbuster originally written
  17. * by and Copyright (C) 1997 Anonymous Coders and
  18. * Junkbusters Corporation. http://www.junkbusters.com
  19. *
  20. * This program is free software; you can redistribute it
  21. * and/or modify it under the terms of the GNU General
  22. * Public License as published by the Free Software
  23. * Foundation; either version 2 of the License, or (at
  24. * your option) any later version.
  25. *
  26. * This program is distributed in the hope that it will
  27. * be useful, but WITHOUT ANY WARRANTY; without even the
  28. * implied warranty of MERCHANTABILITY or FITNESS FOR A
  29. * PARTICULAR PURPOSE. See the GNU General Public
  30. * License for more details.
  31. *
  32. * The GNU General Public License should be included with
  33. * this file. If not, you can view it at
  34. * http://www.gnu.org/copyleft/gpl.html
  35. * or write to the Free Software Foundation, Inc., 59
  36. * Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  37. *
  38. **********************************************************************/
  39. #include "project.h"
  40. /*
  41. * Main dispatch function
  42. */
  43. extern struct http_response *dispatch_cgi(struct client_state *csp);
  44. /* Not exactly a CGI */
  45. extern struct http_response *error_response(struct client_state *csp,
  46. const char *templatename);
  47. /*
  48. * CGI support functions
  49. */
  50. extern struct http_response * alloc_http_response(void);
  51. extern void free_http_response(struct http_response *rsp);
  52. extern struct http_response *finish_http_response(struct client_state *csp,
  53. struct http_response *rsp);
  54. extern struct map * default_exports(const struct client_state *csp, const char *caller);
  55. extern jb_err map_block_killer (struct map *exports, const char *name);
  56. extern jb_err map_block_keep (struct map *exports, const char *name);
  57. extern jb_err map_conditional (struct map *exports, const char *name, int choose_first);
  58. extern jb_err template_load(const struct client_state *csp, char ** template_ptr,
  59. const char *templatename, int recursive);
  60. extern jb_err template_fill(char ** template_ptr, const struct map *exports);
  61. extern jb_err template_fill_for_cgi(const struct client_state *csp,
  62. const char *templatename,
  63. struct map *exports,
  64. struct http_response *rsp);
  65. extern void cgi_init_error_messages(void);
  66. extern struct http_response *cgi_error_memory(void);
  67. extern jb_err cgi_redirect (struct http_response * rsp, const char *target);
  68. extern jb_err cgi_error_no_template(const struct client_state *csp,
  69. struct http_response *rsp,
  70. const char *template_name);
  71. extern jb_err cgi_error_bad_param(const struct client_state *csp,
  72. struct http_response *rsp);
  73. extern jb_err cgi_error_disabled(const struct client_state *csp,
  74. struct http_response *rsp);
  75. extern jb_err cgi_error_unknown(const struct client_state *csp,
  76. struct http_response *rsp,
  77. jb_err error_to_report);
  78. extern jb_err get_number_param(struct client_state *csp,
  79. const struct map *parameters,
  80. char *name,
  81. unsigned *pvalue);
  82. extern jb_err get_string_param(const struct map *parameters,
  83. const char *param_name,
  84. const char **pparam);
  85. extern char get_char_param(const struct map *parameters,
  86. const char *param_name);
  87. #ifdef FEATURE_COMPRESSION
  88. /*
  89. * Minimum length which a buffer has to reach before
  90. * we bother to (re-)compress it. Completely arbitrary.
  91. */
  92. extern const size_t LOWER_LENGTH_LIMIT_FOR_COMPRESSION;
  93. extern char *compress_buffer(char *buffer, size_t *buffer_length, int compression_level);
  94. #endif
  95. /*
  96. * Text generators
  97. */
  98. extern void get_http_time(int time_offset, char *buf, size_t buffer_size);
  99. extern char *add_help_link(const char *item, struct configuration_spec *config);
  100. extern char *dump_map(const struct map *the_map);
  101. /*
  102. * Ad replacement images
  103. */
  104. extern const char image_pattern_data[];
  105. extern const size_t image_pattern_length;
  106. extern const char image_blank_data[];
  107. extern const size_t image_blank_length;
  108. #endif /* ndef CGI_H_INCLUDED */
  109. /*
  110. Local Variables:
  111. tab-width: 3
  112. end:
  113. */