7e39178334b57dd29e306059f9bfc942eac3d151
[privoxy.git] / gateway.h
1 #ifndef GATEWAY_H_INCLUDED
2 #define GATEWAY_H_INCLUDED
3 #define GATEWAY_H_VERSION "$Id: gateway.h,v 1.17 2009/07/11 14:49:09 fabiankeil Exp $"
4 /*********************************************************************
5  *
6  * File        :  $Source: /cvsroot/ijbswa/current/gateway.h,v $
7  *
8  * Purpose     :  Contains functions to connect to a server, possibly
9  *                using a "gateway" (i.e. HTTP proxy and/or SOCKS4
10  *                proxy).  Also contains the list of gateway types.
11  *
12  * Copyright   :  Written by and Copyright (C) 2001 the SourceForge
13  *                Privoxy team. http://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
39
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43
44 struct forward_spec;
45 struct http_request;
46 struct client_state;
47
48 extern jb_socket forwarded_connect(const struct forward_spec * fwd, 
49                                    struct http_request *http, 
50                                    struct client_state *csp);
51
52 /*
53  * Default number of seconds after which an
54  * open connection will no longer be reused.
55  */
56 #define DEFAULT_KEEP_ALIVE_TIMEOUT 180
57
58 #ifdef FEATURE_CONNECTION_SHARING
59 extern void set_keep_alive_timeout(unsigned int timeout);
60 extern void initialize_reusable_connections(void);
61 extern void forget_connection(jb_socket sfd);
62 extern void remember_connection(const struct client_state *csp,
63                                 const struct forward_spec *fwd);
64 extern int close_unusable_connections(void);
65 #endif /* FEATURE_CONNECTION_SHARING */
66
67 #ifdef FEATURE_CONNECTION_KEEP_ALIVE
68 extern void mark_connection_closed(struct reusable_connection *closed_connection);
69 extern int connection_destination_matches(const struct reusable_connection *connection,
70                                           const struct http_request *http,
71                                           const struct forward_spec *fwd);
72 #endif /* def FEATURE_CONNECTION_KEEP_ALIVE */
73
74 /*
75  * Solaris fix
76  */
77 #ifndef INADDR_NONE
78 #define INADDR_NONE -1
79 #endif
80
81 /*
82  * Revision control strings from this header and associated .c file
83  */
84 extern const char gateway_rcs[];
85 extern const char gateway_h_rcs[];
86
87 #ifdef __cplusplus
88 } /* extern "C" */
89 #endif
90
91 #endif /* ndef GATEWAY_H_INCLUDED */
92
93 /*
94   Local Variables:
95   tab-width: 3
96   end:
97 */