xref: /netbsd-src/external/gpl2/xcvs/dist/src/socket-client.h (revision a7c918477dd5f12c1da816ba05caf44eab2d06d6)
1*a7c91847Schristos /* CVS socket client stuff.
2*a7c91847Schristos 
3*a7c91847Schristos    This program is free software; you can redistribute it and/or modify
4*a7c91847Schristos    it under the terms of the GNU General Public License as published by
5*a7c91847Schristos    the Free Software Foundation; either version 2, or (at your option)
6*a7c91847Schristos    any later version.
7*a7c91847Schristos 
8*a7c91847Schristos    This program is distributed in the hope that it will be useful,
9*a7c91847Schristos    but WITHOUT ANY WARRANTY; without even the implied warranty of
10*a7c91847Schristos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11*a7c91847Schristos    GNU General Public License for more details.  */
12*a7c91847Schristos 
13*a7c91847Schristos #ifndef SOCKET_CLIENT_H__
14*a7c91847Schristos #define SOCKET_CLIENT_H__ 1
15*a7c91847Schristos 
16*a7c91847Schristos #if defined SOCK_ERRNO || defined SOCK_STRERROR
17*a7c91847Schristos # include <sys/socket.h>
18*a7c91847Schristos # include <netinet/in.h>
19*a7c91847Schristos # include <arpa/inet.h>
20*a7c91847Schristos # include <netdb.h>
21*a7c91847Schristos #endif
22*a7c91847Schristos 
23*a7c91847Schristos struct buffer *socket_buffer_initialize
24*a7c91847Schristos   (int, int, void (*) (struct buffer *));
25*a7c91847Schristos 
26*a7c91847Schristos /* If SOCK_ERRNO is defined, then send()/recv() and other socket calls
27*a7c91847Schristos    do not set errno, but that this macro should be used to obtain an
28*a7c91847Schristos    error code.  This probably doesn't make sense unless
29*a7c91847Schristos    NO_SOCKET_TO_FD is also defined. */
30*a7c91847Schristos #ifndef SOCK_ERRNO
31*a7c91847Schristos # define SOCK_ERRNO errno
32*a7c91847Schristos #endif
33*a7c91847Schristos 
34*a7c91847Schristos /* If SOCK_STRERROR is defined, then the error codes returned by
35*a7c91847Schristos    socket operations are not known to strerror, and this macro must be
36*a7c91847Schristos    used instead to convert those error codes to strings. */
37*a7c91847Schristos #ifndef SOCK_STRERROR
38*a7c91847Schristos # define SOCK_STRERROR strerror
39*a7c91847Schristos 
40*a7c91847Schristos # include <string.h>
41*a7c91847Schristos # ifndef strerror
42*a7c91847Schristos extern char *strerror (int);
43*a7c91847Schristos # endif
44*a7c91847Schristos #endif /* ! SOCK_STRERROR */
45*a7c91847Schristos 
46*a7c91847Schristos #endif /* SOCKET_CLIENT_H__ */
47