New macro BIO_set_shutdown_wr().
[openssl.git] / crypto / bio / bss_sock.c
index 89b1dcab3746652601b4ac8146718a670a3af41a..50c6744c0607a213fde9d0c07e0126486df14ecb 100644 (file)
 #include <openssl/bio.h>
 
 #ifndef BIO_FD
-#ifndef NOPROTO
-static int sock_write(BIO *h,char *buf,int num);
-static int sock_read(BIO *h,char *buf,int size);
-static int sock_puts(BIO *h,char *str);
-static long sock_ctrl(BIO *h,int cmd,long arg1,char *arg2);
+static int sock_write(BIO *h, const char *buf, int num);
+static int sock_read(BIO *h, char *buf, int size);
+static int sock_puts(BIO *h, const char *str);
+static long sock_ctrl(BIO *h, int cmd, long arg1, void *arg2);
 static int sock_new(BIO *h);
 static int sock_free(BIO *data);
 int BIO_sock_should_retry(int s);
-#else
-static int sock_write();
-static int sock_read();
-static int sock_puts();
-static long sock_ctrl();
-static int sock_new();
-static int sock_free();
-int BIO_sock_should_retry();
-#endif
-
 #else
 
-#ifndef NOPROTO
-static int fd_write(BIO *h,char *buf,int num);
-static int fd_read(BIO *h,char *buf,int size);
-static int fd_puts(BIO *h,char *str);
-static long fd_ctrl(BIO *h,int cmd,long arg1,char *arg2);
+static int fd_write(BIO *h, const char *buf, int num);
+static int fd_read(BIO *h, char *buf, int size);
+static int fd_puts(BIO *h, const char *str);
+static long fd_ctrl(BIO *h, int cmd, long arg1, void *arg2);
 static int fd_new(BIO *h);
 static int fd_free(BIO *data);
 int BIO_fd_should_retry(int s);
-#else
-static int fd_write();
-static int fd_read();
-static int fd_puts();
-static long fd_ctrl();
-static int fd_new();
-static int fd_free();
-int BIO_fd_should_retry();
-#endif
 #endif
 
 #ifndef BIO_FD
@@ -116,6 +95,7 @@ static BIO_METHOD methods_sockp=
        sock_ctrl,
        sock_new,
        sock_free,
+       NULL,
        };
 
 BIO_METHOD *BIO_s_socket(void)
@@ -133,6 +113,7 @@ static BIO_METHOD methods_fdp=
        fd_ctrl,
        fd_new,
        fd_free,
+       NULL,
        };
 
 BIO_METHOD *BIO_s_fd(void)
@@ -184,8 +165,7 @@ static int fd_free(BIO *a)
                if (a->init)
                        {
 #ifndef BIO_FD
-                       shutdown(a->num,2);
-                       closesocket(a->num);
+                       SHUTDOWN2(a->num);
 #else                  /* BIO_FD */
                        close(a->num);
 #endif
@@ -229,9 +209,9 @@ static int fd_read(BIO *b, char *out,int outl)
        }
 
 #ifndef BIO_FD
-static int sock_write(BIO *b, char *in, int inl)
+static int sock_write(BIO *b, const char *in, int inl)
 #else
-static int fd_write(BIO *b, char *in, int inl)
+static int fd_write(BIO *b, const char *in, int inl)
 #endif
        {
        int ret;
@@ -257,9 +237,9 @@ static int fd_write(BIO *b, char *in, int inl)
        }
 
 #ifndef BIO_FD
-static long sock_ctrl(BIO *b, int cmd, long num, char *ptr)
+static long sock_ctrl(BIO *b, int cmd, long num, void *ptr)
 #else
-static long fd_ctrl(BIO *b, int cmd, long num, char *ptr)
+static long fd_ctrl(BIO *b, int cmd, long num, void *ptr)
 #endif
        {
        long ret=1;
@@ -333,9 +313,9 @@ static int sock_gets(BIO *bp, char *buf,int size)
 #endif
 
 #ifndef BIO_FD
-static int sock_puts(BIO *bp, char *str)
+static int sock_puts(BIO *bp, const char *str)
 #else
-static int fd_puts(BIO *bp, char *str)
+static int fd_puts(BIO *bp, const char *str)
 #endif
        {
        int n,ret;