1 #ifndef JBSOCKETS_H_INCLUDED
2 #define JBSOCKETS_H_INCLUDED
3 /*********************************************************************
5 * File : $Source: /cvsroot/ijbswa/current/jbsockets.h,v $
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
12 * Copyright : Written by and Copyright (C) 2001-2014 the
13 * Privoxy team. http://www.privoxy.org/
15 * Based on the Internet Junkbuster originally written
16 * by and Copyright (C) 1997 Anonymous Coders and
17 * Junkbusters Corporation. http://www.junkbusters.com
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.
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.
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.
37 *********************************************************************/
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);
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);
56 extern unsigned long resolve_hostname_to_ip(const char *host);
58 extern int socket_is_still_alive(jb_socket sfd);
60 #ifdef FEATURE_EXTERNAL_FILTERS
61 extern void mark_socket_for_close_on_execute(jb_socket fd);
66 * XXX: still necessary?
69 #define INADDR_NONE -1
73 #endif /* ndef JBSOCKETS_H_INCLUDED */