* [including the GNU Public Licence.]
*/
-#ifndef OPENSSL_NO_SOCK
-
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include "cryptlib.h"
#include <openssl/bio.h>
+#ifndef OPENSSL_NO_SOCK
+
#ifdef OPENSSL_SYS_WIN16
#define SOCKET_PROTOCOL 0 /* more microsoft stupidity */
#else
#define MAX_LISTEN 32
#endif
-#ifdef OPENSSL_SYS_WINDOWS
+#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_NETWARE)
static int wsa_init_done=0;
#endif
}
}
#endif /* OPENSSL_SYS_WINDOWS */
+#ifdef WATT32
+ extern int _watt_do_exit;
+ _watt_do_exit = 0; /* don't make sock_init() call exit() */
+ if (sock_init())
+ return (-1);
+#endif
+
+#if defined(OPENSSL_SYS_NETWARE)
+ WORD wVerReq;
+ WSADATA wsaData;
+ int err;
+
+ if (!wsa_init_done)
+ {
+
+# ifdef SIGINT
+ signal(SIGINT,(void (*)(int))BIO_sock_cleanup);
+# endif
+
+ wsa_init_done=1;
+ wVerReq = MAKEWORD( 2, 0 );
+ err = WSAStartup(wVerReq,&wsaData);
+ if (err != 0)
+ {
+ SYSerr(SYS_F_WSASTARTUP,err);
+ BIOerr(BIO_F_BIO_SOCK_INIT,BIO_R_WSASTARTUP);
+ return(-1);
+ }
+ }
+#endif
+
return(1);
}
if (wsa_init_done)
{
wsa_init_done=0;
+#ifndef OPENSSL_SYS_WINCE
WSACancelBlockingCall();
+#endif
WSACleanup();
}
+#elif defined(OPENSSL_SYS_NETWARE)
+ if (wsa_init_done)
+ {
+ wsa_init_done=0;
+ WSACleanup();
+ }
#endif
}
#if !defined(OPENSSL_SYS_VMS) || __VMS_VER >= 70000000
-int BIO_socket_ioctl(int fd, long type, unsigned long *arg)
+int BIO_socket_ioctl(int fd, long type, void *arg)
{
int i;
int BIO_socket_nbio(int s, int mode)
{
int ret= -1;
- unsigned long l;
+ int l;
l=mode;
#ifdef FIONBIO