2 * Copyright 2004 Apache Software Foundation
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
21 #define UNUSED_VARIABLE(v) ((void)(v))
23 extern int libspamc_timeout; /* default timeout in seconds */
26 #include <openssl/crypto.h>
27 #include <openssl/pem.h>
28 #include <openssl/ssl.h>
29 #include <openssl/err.h>
31 typedef int SSL; /* fake type to avoid conditional compilation */
33 typedef int SSL_METHOD;
39 // BSD-compatible socket error codes for Win32
42 #define EWOULDBLOCK WSAEWOULDBLOCK
43 #define EINPROGRESS WSAEINPROGRESS
44 #define EALREADY WSAEALREADY
45 #define ENOTSOCK WSAENOTSOCK
46 #define EDESTADDRREQ WSAEDESTADDRREQ
47 #define EMSGSIZE WSAEMSGSIZE
48 #define EPROTOTYPE WSAEPROTOTYPE
49 #define ENOPROTOOPT WSAENOPROTOOPT
50 #define EPROTONOSUPPORT WSAEPROTONOSUPPORT
51 #define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT
52 #define EOPNOTSUPP WSAEOPNOTSUPP
53 #define EPFNOSUPPORT WSAEPFNOSUPPORT
54 #define EAFNOSUPPORT WSAEAFNOSUPPORT
55 #define EADDRINUSE WSAEADDRINUSE
56 #define EADDRNOTAVAIL WSAEADDRNOTAVAIL
57 #define ENETDOWN WSAENETDOWN
58 #define ENETUNREACH WSAENETUNREACH
59 #define ENETRESET WSAENETRESET
60 #define ECONNABORTED WSAECONNABORTED
61 #define ECONNRESET WSAECONNRESET
62 #define ENOBUFS WSAENOBUFS
63 #define EISCONN WSAEISCONN
64 #define ENOTCONN WSAENOTCONN
65 #define ESHUTDOWN WSAESHUTDOWN
66 #define ETOOMANYREFS WSAETOOMANYREFS
67 #define ETIMEDOUT WSAETIMEDOUT
68 #define ECONNREFUSED WSAECONNREFUSED
69 #define ELOOP WSAELOOP
70 // #define ENAMETOOLONG WSAENAMETOOLONG
71 #define EHOSTDOWN WSAEHOSTDOWN
72 #define EHOSTUNREACH WSAEHOSTUNREACH
73 // #define ENOTEMPTY WSAENOTEMPTY
74 #define EPROCLIM WSAEPROCLIM
75 #define EUSERS WSAEUSERS
76 #define EDQUOT WSAEDQUOT
77 #define ESTALE WSAESTALE
78 #define EREMOTE WSAEREMOTE
80 // NOTE: these are not errno constants in UNIX!
81 #define HOST_NOT_FOUND WSAHOST_NOT_FOUND
82 #define TRY_AGAIN WSATRY_AGAIN
83 #define NO_RECOVERY WSANO_RECOVERY
84 #define NO_DATA WSANO_DATA
88 int fd_timeout_read(int fd, char fdflag, void *, size_t);
89 int ssl_timeout_read(SSL * ssl, void *, int);
91 /* these are fd-only, no SSL support */
92 int full_read(int fd, char fdflag, void *buf, int min, int len);
93 int full_read_ssl(SSL * ssl, unsigned char *buf, int min, int len);
94 int full_write(int fd, char fdflag, const void *buf, int len);