Aegis  4.25.D505
/home/archives/aegis/branch.4/branch.25/delta28933.505/libaegis/http.h
Go to the documentation of this file.
00001 //
00002 //      aegis - project change supervisor
00003 //      Copyright (C) 2003-2008, 2011, 2012 Peter Miller
00004 //      Copyright (C) 2007 Walter Franzini
00005 //
00006 //      This program is free software; you can redistribute it and/or modify
00007 //      it under the terms of the GNU General Public License as published by
00008 //      the Free Software Foundation; either version 3 of the License, or
00009 //      (at your option) any later version.
00010 //
00011 //      This program is distributed in the hope that it will be useful,
00012 //      but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 //      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 //      GNU General Public License for more details.
00015 //
00016 //      You should have received a copy of the GNU General Public License
00017 //      along with this program. If not, see
00018 //      <http://www.gnu.org/licenses/>.
00019 //
00020 
00021 #ifndef AEGET_HTTP_H
00022 #define AEGET_HTTP_H
00023 
00024 #include <libaegis/change.h>
00025 
00026 class nstring; // forward
00027 struct project; // forward
00028 struct string_ty; // forward
00029 class nstring; // forward
00030 struct string_list_ty; // forward
00031 
00032 enum http_error_t
00033 {
00034     http_error_continue = 100,
00035     http_error_switching_protocols = 101,
00036     http_error_ok = 200,
00037     http_error_created = 201,
00038     http_error_accepted = 202,
00039     http_error_non_authoritative_information = 203,
00040     http_error_no_content = 204,
00041     http_error_reset_content = 205,
00042     http_error_partial_content = 206,
00043     http_error_multiple_choices = 300,
00044     http_error_moved_permanently = 301,
00045     http_error_moved_temporarily = 302,
00046     http_error_see_other = 303,
00047     http_error_not_modified = 304,
00048     http_error_use_proxy = 305,
00049     http_error_bad_request = 400,
00050     http_error_unauthorized = 401,
00051     http_error_payment_required = 402,
00052     http_error_forbidden = 403,
00053     http_error_not_found = 404,
00054     http_error_method_not_allowed = 405,
00055     http_error_not_acceptable = 406,
00056     http_error_proxy_authentication_required = 407,
00057     http_error_request_time_out = 408,
00058     http_error_conflict = 409,
00059     http_error_gone = 410,
00060     http_error_length_required = 411,
00061     http_error_precondition_failed = 412,
00062     http_error_request_entity_too_large = 413,
00063     http_error_request_url_too_large = 414,
00064     http_error_unsupported_media_type = 415,
00065     http_error_internal_server = 500,
00066     http_error_not_implemented = 501,
00067     http_error_bad_gateway = 502,
00068     http_error_out_of_resources = 503,
00069     http_error_gateway_time_out = 504,
00070     http_error_version_not_supported = 505,
00071 };
00072 
00073 extern bool http_fatal_noerror;
00074 
00075 void http_fatal(http_error_t oops, const char *fmt, ...)      ATTR_PRINTF(2, 3);
00076 const char *http_getenv(const char *);
00077 void html_escape_string(string_ty *);
00078 void html_escape_string(const nstring &);
00079 void html_escape_charstar(const char *);
00080 void html_encode_string(string_ty *);
00081 void html_encode_string(const nstring &);
00082 void html_encode_charstar(const char *);
00083 void http_content_type_header(string_ty *);
00084 
00091 void html_header(project *, change::pointer);
00092 
00097 void html_header_ps(project *, change::pointer);
00098 
00105 void html_footer(project *, change::pointer);
00106 
00112 void emit_change(change::pointer);
00113 
00119 void emit_change_but1(change::pointer);
00120 
00121 void
00122 emit_change_uuid_href(change::pointer, const nstring &, const nstring &,
00123     const nstring &);
00124 
00130 const char *http_script_name(void);
00131 
00136 void emit_project_href(project *pp);
00137 void emit_project_href(project *pp, const char *modifier, ...)
00138                                                               ATTR_PRINTF(2, 3);
00139 
00144 void emit_change_href(change::pointer cp, const char *modifier);
00145 
00146 
00151 void emit_change_href_n(project *pp, long change_number,
00152     const char *modifier);
00153 
00165 void emit_file_href(change::pointer cp, const nstring &filename,
00166     const char *modifier);
00167 
00181 void emit_file_href(change::pointer cp, string_ty *filename,
00182     const char *modifier);
00183 
00197 void emit_rect_image(int width, int height, const char *label, int hspace = -1);
00198 
00212 void emit_rect_image_rgb(int width, int height, const char *color,
00213     int hspace = -1);
00214 
00226 bool modifier_test(string_list_ty *modifiers, const char *name);
00227 
00240 bool modifier_test_and_clear(string_list_ty *modifiers, const char *name);
00241 
00250 void emit_rss_icon_with_link(project *pp, const nstring &rss_filename);
00251 
00260 void emit_rss_meta_data(project *pp, const nstring &rss_filename);
00261 
00262 #define HISTOGRAM_HEIGHT 12
00263 #define HISTOGRAM_WIDTH 120
00264 
00276 nstring http_sanitize_content_type(const nstring &content_type);
00277 
00278 #endif // AEGET_HTTP_H
00279 // vim: set ts=8 sw=4 et :