FAQ: Add three ids to get stable link targets
[privoxy.git] / jbsockets.h
1 #ifndef JBSOCKETS_H_INCLUDED
2 #define JBSOCKETS_H_INCLUDED
3 /*********************************************************************
4  *
5  * File        :  $Source: /cvsroot/ijbswa/current/jbsockets.h,v $
6  *
7  * Purpose     :  Contains wrappers for system-specific sockets code,
8  *                so that the rest of Privoxy can be more
9  *                OS-independent.  Contains #ifdefs to make this work
10  *                on many platforms.
11  *
12  * Copyright   :  Written by and Copyright (C) 2001-2014 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
39
40 #include "project.h"
41
42 struct client_state;
43
44 extern jb_socket connect_to(const char *host, int portnum, struct client_state *csp);
45 extern int write_socket(jb_socket fd, const char *buf, size_t n);
46 extern int write_socket_delayed(jb_socket fd, const char *buf, size_t len, unsigned int delay);
47 extern int read_socket(jb_socket fd, char *buf, int n);
48 extern int data_is_available(jb_socket fd, int seconds_to_wait);
49 extern void close_socket(jb_socket fd);
50 extern void drain_and_close_socket(jb_socket fd);
51
52 extern int bind_port(const char *hostnam, int portnum, int backlog, jb_socket *pfd);
53 extern int accept_connection(struct client_state * csp, jb_socket fds[]);
54 extern void get_host_information(jb_socket afd, char **ip_address, char **port, char **hostname);
55
56 extern unsigned long resolve_hostname_to_ip(const char *host);
57
58 extern int socket_is_still_alive(jb_socket sfd);
59
60 #ifdef FEATURE_EXTERNAL_FILTERS
61 extern void mark_socket_for_close_on_execute(jb_socket fd);
62 #endif
63
64 /*
65  * Solaris workaround
66  * XXX: still necessary?
67  */
68 #ifndef INADDR_NONE
69 #define INADDR_NONE -1
70 #endif
71
72
73 #endif /* ndef JBSOCKETS_H_INCLUDED */
74
75 /*
76   Local Variables:
77   tab-width: 3
78   end:
79 */