serve(): Close the client socket before closing the server socket
[privoxy.git] / gateway.h
1 #ifndef GATEWAY_H_INCLUDED
2 #define GATEWAY_H_INCLUDED
3 /*********************************************************************
4  *
5  * File        :  $Source: /cvsroot/ijbswa/current/gateway.h,v $
6  *
7  * Purpose     :  Contains functions to connect to a server, possibly
8  *                using a "gateway" (i.e. HTTP proxy and/or SOCKS4
9  *                proxy).  Also contains the list of gateway types.
10  *
11  * Copyright   :  Written by and Copyright (C) 2001-2009 the
12  *                Privoxy team. https://www.privoxy.org/
13  *
14  *                Based on the Internet Junkbuster originally written
15  *                by and Copyright (C) 1997 Anonymous Coders and
16  *                Junkbusters Corporation.  http://www.junkbusters.com
17  *
18  *                This program is free software; you can redistribute it
19  *                and/or modify it under the terms of the GNU General
20  *                Public License as published by the Free Software
21  *                Foundation; either version 2 of the License, or (at
22  *                your option) any later version.
23  *
24  *                This program is distributed in the hope that it will
25  *                be useful, but WITHOUT ANY WARRANTY; without even the
26  *                implied warranty of MERCHANTABILITY or FITNESS FOR A
27  *                PARTICULAR PURPOSE.  See the GNU General Public
28  *                License for more details.
29  *
30  *                The GNU General Public License should be included with
31  *                this file.  If not, you can view it at
32  *                http://www.gnu.org/copyleft/gpl.html
33  *                or write to the Free Software Foundation, Inc., 59
34  *                Temple Place - Suite 330, Boston, MA  02111-1307, USA.
35  *
36  *********************************************************************/
37
38
39 struct forward_spec;
40 struct http_request;
41 struct client_state;
42
43 extern jb_socket forwarded_connect(const struct forward_spec *fwd,
44                                    struct http_request *http,
45                                    struct client_state *csp);
46
47 #ifdef FEATURE_CONNECTION_SHARING
48 extern void initialize_reusable_connections(void);
49 extern void forget_connection(jb_socket sfd);
50 extern void remember_connection(const struct reusable_connection *connection);
51 extern int close_unusable_connections(void);
52 #endif /* FEATURE_CONNECTION_SHARING */
53
54 extern void mark_connection_closed(struct reusable_connection *closed_connection);
55 #ifdef FEATURE_CONNECTION_KEEP_ALIVE
56 extern int connection_destination_matches(const struct reusable_connection *connection,
57                                           const struct http_request *http,
58                                           const struct forward_spec *fwd);
59 #endif /* def FEATURE_CONNECTION_KEEP_ALIVE */
60
61 #ifdef FUZZ
62 extern jb_err socks_fuzz(struct client_state *csp);
63 #endif
64
65 #endif /* ndef GATEWAY_H_INCLUDED */
66
67 /*
68   Local Variables:
69   tab-width: 3
70   end:
71 */