RSSyl: Allow use of .netrc by libcurl. Bug/enhancement #3309, by Vincent Pelletier
[claws.git] / src / plugins / spamassassin / utils.h
index 4df7c53334b5190af87f3966621469346c0cfa90..3a287546f0a9454e850105dcdd68c1b983b3f80c 100644 (file)
@@ -1,9 +1,26 @@
+/* <@LICENSE>
+ * Copyright 2004 Apache Software Foundation
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * </@LICENSE>
+ */
+
 #ifndef UTILS_H
 #define UTILS_H
 
 #define UNUSED_VARIABLE(v)     ((void)(v))
 
-extern int libspamc_timeout;  /* default timeout in seconds */
+extern int libspamc_timeout;   /* default timeout in seconds */
 
 #ifdef SPAMC_SSL
 #include <openssl/crypto.h>
@@ -11,17 +28,69 @@ extern int libspamc_timeout;  /* default timeout in seconds */
 #include <openssl/ssl.h>
 #include <openssl/err.h>
 #else
-typedef int    SSL;    /* fake type to avoid conditional compilation */
-typedef int    SSL_CTX;
-typedef int    SSL_METHOD;
+typedef int SSL;               /* fake type to avoid conditional compilation */
+typedef int SSL_CTX;
+typedef int SSL_METHOD;
+#endif
+
+#ifdef _WIN32
+#include <winsock.h>
+//
+// BSD-compatible socket error codes for Win32
+//
+
+#define EWOULDBLOCK             WSAEWOULDBLOCK
+#define EINPROGRESS             WSAEINPROGRESS
+#define EALREADY                WSAEALREADY
+#define ENOTSOCK                WSAENOTSOCK
+#define EDESTADDRREQ            WSAEDESTADDRREQ
+#define EMSGSIZE                WSAEMSGSIZE
+#define EPROTOTYPE              WSAEPROTOTYPE
+#define ENOPROTOOPT             WSAENOPROTOOPT
+#define EPROTONOSUPPORT         WSAEPROTONOSUPPORT
+#define ESOCKTNOSUPPORT         WSAESOCKTNOSUPPORT
+#define EOPNOTSUPP              WSAEOPNOTSUPP
+#define EPFNOSUPPORT            WSAEPFNOSUPPORT
+#define EAFNOSUPPORT            WSAEAFNOSUPPORT
+#define EADDRINUSE              WSAEADDRINUSE
+#define EADDRNOTAVAIL           WSAEADDRNOTAVAIL
+#define ENETDOWN                WSAENETDOWN
+#define ENETUNREACH             WSAENETUNREACH
+#define ENETRESET               WSAENETRESET
+#define ECONNABORTED            WSAECONNABORTED
+#define ECONNRESET              WSAECONNRESET
+#define ENOBUFS                 WSAENOBUFS
+#define EISCONN                 WSAEISCONN
+#define ENOTCONN                WSAENOTCONN
+#define ESHUTDOWN               WSAESHUTDOWN
+#define ETOOMANYREFS            WSAETOOMANYREFS
+#define ETIMEDOUT               WSAETIMEDOUT
+#define ECONNREFUSED            WSAECONNREFUSED
+#define ELOOP                   WSAELOOP
+// #define ENAMETOOLONG            WSAENAMETOOLONG
+#define EHOSTDOWN               WSAEHOSTDOWN
+#define EHOSTUNREACH            WSAEHOSTUNREACH
+// #define ENOTEMPTY               WSAENOTEMPTY
+#define EPROCLIM                WSAEPROCLIM
+#define EUSERS                  WSAEUSERS
+#define EDQUOT                  WSAEDQUOT
+#define ESTALE                  WSAESTALE
+#define EREMOTE                 WSAEREMOTE
+
+// NOTE: these are not errno constants in UNIX!
+#define HOST_NOT_FOUND          WSAHOST_NOT_FOUND
+#define TRY_AGAIN               WSATRY_AGAIN
+#define NO_RECOVERY             WSANO_RECOVERY
+#define NO_DATA                 WSANO_DATA
+
 #endif
 
-ssize_t fd_timeout_read (int fd, void *, size_t );  
-int ssl_timeout_read (SSL *ssl, void *, int );  
+int fd_timeout_read(int fd, char fdflag, void *, size_t);
+int ssl_timeout_read(SSL * ssl, void *, int);
 
 /* these are fd-only, no SSL support */
-int full_read(int fd, void *buf, int min, int len);
-int full_read_ssl(SSL *ssl, unsigned char *buf, int min, int len);
-int full_write(int fd, const void *buf, int len);
+int full_read(int fd, char fdflag, void *buf, int min, int len);
+int full_read_ssl(SSL * ssl, unsigned char *buf, int min, int len);
+int full_write(int fd, char fdflag, const void *buf, int len);
 
 #endif