RSSyl: Allow use of .netrc by libcurl. Bug/enhancement #3309, by Vincent Pelletier
[claws.git] / src / plugins / spamassassin / utils.h
1 /* <@LICENSE>
2  * Copyright 2004 Apache Software Foundation
3  * 
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
7  * 
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  * 
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.
15  * </@LICENSE>
16  */
17
18 #ifndef UTILS_H
19 #define UTILS_H
20
21 #define UNUSED_VARIABLE(v)      ((void)(v))
22
23 extern int libspamc_timeout;    /* default timeout in seconds */
24
25 #ifdef SPAMC_SSL
26 #include <openssl/crypto.h>
27 #include <openssl/pem.h>
28 #include <openssl/ssl.h>
29 #include <openssl/err.h>
30 #else
31 typedef int SSL;                /* fake type to avoid conditional compilation */
32 typedef int SSL_CTX;
33 typedef int SSL_METHOD;
34 #endif
35
36 #ifdef _WIN32
37 #include <winsock.h>
38 //
39 // BSD-compatible socket error codes for Win32
40 //
41
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
79
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
85
86 #endif
87
88 int fd_timeout_read(int fd, char fdflag, void *, size_t);
89 int ssl_timeout_read(SSL * ssl, void *, int);
90
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);
95
96 #endif