00001 #ifndef JBSOCKETS_H_INCLUDED 00002 #define JBSOCKETS_H_INCLUDED 00003 #define JBSOCKETS_H_VERSION "$Id: jbsockets.h,v 2.0 2002/06/04 14:34:21 jongfoster Exp $" 00004 /* ****************************************************************** 00005 * $Source: /cvsroot/ijbswa/current/src/jbsockets.h,v $ 00006 * ****************************************************************** 00007 * 00008 * Written by and Copyright (C) 2001 the SourceForge 00009 * Privoxy team. http://www.privoxy.org/ 00010 * 00011 * Based on the Internet Junkbuster originally written 00012 * by and Copyright (C) 1997 Anonymous Coders and 00013 * Junkbusters Corporation. http://www.junkbusters.com 00014 * 00015 * This program is free software; you can redistribute it 00016 * and/or modify it under the terms of the GNU General 00017 * Public License as published by the Free Software 00018 * Foundation; either version 2 of the License, or (at 00019 * your option) any later version. 00020 * 00021 * This program is distributed in the hope that it will 00022 * be useful, but WITHOUT ANY WARRANTY; without even the 00023 * implied warranty of MERCHANTABILITY or FITNESS FOR A 00024 * PARTICULAR PURPOSE. See the GNU General Public 00025 * License for more details. 00026 * 00027 * The GNU General Public License should be included with 00028 * this file. If not, you can view it at 00029 * http://www.gnu.org/copyleft/gpl.html 00030 * or write to the Free Software Foundation, Inc., 59 00031 * Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00032 * 00033 * *****************************************************************/ 00034 /** 00035 * @file 00036 * 00037 * Contains wrappers for system-specific sockets code, 00038 * so that the rest of Junkbuster can be more 00039 * OS-independent. Contains #ifdefs to make this work 00040 * on many platforms. 00041 * 00042 * 00043 * $Log: jbsockets.h,v $ 00044 * Revision 2.0 2002/06/04 14:34:21 jongfoster 00045 * Moving source files to src/ 00046 * 00047 * Revision 1.10 2002/05/26 23:23:10 joergs 00048 * AmigaOS: Fixed wrong type for len in write_socket() 00049 * 00050 * Revision 1.9 2002/04/08 20:31:41 swa 00051 * fixed JB spelling 00052 * 00053 * Revision 1.8 2002/03/26 22:29:54 swa 00054 * we have a new homepage! 00055 * 00056 * Revision 1.7 2002/03/24 13:25:43 swa 00057 * name change related issues 00058 * 00059 * Revision 1.6 2002/03/13 00:27:05 jongfoster 00060 * Killing warnings 00061 * 00062 * Revision 1.5 2002/03/09 20:03:52 jongfoster 00063 * - Making various functions return int rather than size_t. 00064 * (Undoing a recent change). Since size_t is unsigned on 00065 * Windows, functions like read_socket that return -1 on 00066 * error cannot return a size_t. 00067 * 00068 * THIS WAS A MAJOR BUG - it caused frequent, unpredictable 00069 * crashes, and also frequently caused JB to jump to 100% 00070 * CPU and stay there. (Because it thought it had just 00071 * read ((unsigned)-1) == 4Gb of data...) 00072 * 00073 * - The signature of write_socket has changed, it now simply 00074 * returns success=0/failure=nonzero. 00075 * 00076 * - Trying to get rid of a few warnings --with-debug on 00077 * Windows, I've introduced a new type "jb_socket". This is 00078 * used for the socket file descriptors. On Windows, this 00079 * is SOCKET (a typedef for unsigned). Everywhere else, it's 00080 * an int. The error value can't be -1 any more, so it's 00081 * now JB_INVALID_SOCKET (which is -1 on UNIX, and in 00082 * Windows it maps to the #define INVALID_SOCKET.) 00083 * 00084 * - The signature of bind_port has changed. 00085 * 00086 * Revision 1.4 2002/03/07 03:51:36 oes 00087 * - Improved handling of failed DNS lookups 00088 * - Fixed compiler warnings etc 00089 * 00090 * Revision 1.3 2001/07/29 19:01:11 jongfoster 00091 * Changed _FILENAME_H to FILENAME_H_INCLUDED. 00092 * Added forward declarations for needed structures. 00093 * 00094 * Revision 1.2 2001/06/07 23:06:09 jongfoster 00095 * The host parameter to connect_to() is now const. 00096 * 00097 * Revision 1.1.1.1 2001/05/15 13:58:54 oes 00098 * Initial import of version 2.9.3 source tree 00099 * 00100 * 00101 */ 00102 /* *****************************************************************/ 00103 00104 00105 #include "project.h" 00106 00107 #ifdef __cplusplus 00108 extern "C" { 00109 #endif 00110 00111 struct client_state; 00112 00113 extern jb_socket connect_to(const char *host, int portnum, struct client_state *csp); 00114 #ifdef AMIGA 00115 extern int write_socket(jb_socket fd, const char *buf, ssize_t n); 00116 #else 00117 extern int write_socket(jb_socket fd, const char *buf, size_t n); 00118 #endif 00119 extern int read_socket(jb_socket fd, char *buf, int n); 00120 extern void close_socket(jb_socket fd); 00121 00122 extern int bind_port(const char *hostnam, int portnum, jb_socket *pfd); 00123 extern int accept_connection(struct client_state * csp, jb_socket fd); 00124 00125 extern unsigned long resolve_hostname_to_ip(const char *host); 00126 00127 /* Revision control strings from this header and associated .c file */ 00128 00129 /** Version information about jbsockets.c. */ 00130 extern const char jbsockets_rcs[]; 00131 00132 /** Version information about jbsockets.h. */ 00133 extern const char jbsockets_h_rcs[]; 00134 00135 #ifdef __cplusplus 00136 } /* extern "C" */ 00137 #endif 00138 00139 #endif /* ndef JBSOCKETS_H_INCLUDED */ 00140 00141 /* 00142 Local Variables: 00143 tab-width: 3 00144 end: 00145 */
1.2.15