jbsockets.h 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. #include "project.h"
  39. struct client_state;
  40. extern jb_socket connect_to(const char *host, int portnum, struct client_state *csp);
  41. extern int write_socket(jb_socket fd, const char *buf, size_t n);
  42. extern int write_socket_delayed(jb_socket fd, const char *buf, size_t len, unsigned int delay);
  43. extern int read_socket(jb_socket fd, char *buf, int n);
  44. extern int data_is_available(jb_socket fd, int seconds_to_wait);
  45. extern void close_socket(jb_socket fd);
  46. extern void drain_and_close_socket(jb_socket fd);
  47. extern int bind_port(const char *hostnam, int portnum, int backlog, jb_socket *pfd);
  48. extern int accept_connection(struct client_state * csp, jb_socket fds[]);
  49. extern void get_host_information(jb_socket afd, char **ip_address, char **port, char **hostname);
  50. extern unsigned long resolve_hostname_to_ip(const char *host);
  51. extern int socket_is_still_alive(jb_socket sfd);
  52. #ifdef FEATURE_EXTERNAL_FILTERS
  53. extern void mark_socket_for_close_on_execute(jb_socket fd);
  54. #endif
  55. /*
  56. * Solaris workaround
  57. * XXX: still necessary?
  58. */
  59. #ifndef INADDR_NONE
  60. #define INADDR_NONE -1
  61. #endif
  62. #endif /* ndef JBSOCKETS_H_INCLUDED */
  63. /*
  64. Local Variables:
  65. tab-width: 3
  66. end:
  67. */