xref: /onnv-gate/usr/src/common/openssl/doc/crypto/BIO_s_socket.pod (revision 2175:b0b2f052a486)
1*2175Sjp161948=pod
2*2175Sjp161948
3*2175Sjp161948=head1 NAME
4*2175Sjp161948
5*2175Sjp161948BIO_s_socket, BIO_new_socket - socket BIO
6*2175Sjp161948
7*2175Sjp161948=head1 SYNOPSIS
8*2175Sjp161948
9*2175Sjp161948 #include <openssl/bio.h>
10*2175Sjp161948
11*2175Sjp161948 BIO_METHOD *BIO_s_socket(void);
12*2175Sjp161948
13*2175Sjp161948 long BIO_set_fd(BIO *b, int fd, long close_flag);
14*2175Sjp161948 long BIO_get_fd(BIO *b, int *c);
15*2175Sjp161948
16*2175Sjp161948 BIO *BIO_new_socket(int sock, int close_flag);
17*2175Sjp161948
18*2175Sjp161948=head1 DESCRIPTION
19*2175Sjp161948
20*2175Sjp161948BIO_s_socket() returns the socket BIO method. This is a wrapper
21*2175Sjp161948round the platform's socket routines.
22*2175Sjp161948
23*2175Sjp161948BIO_read() and BIO_write() read or write the underlying socket.
24*2175Sjp161948BIO_puts() is supported but BIO_gets() is not.
25*2175Sjp161948
26*2175Sjp161948If the close flag is set then the socket is shut down and closed
27*2175Sjp161948when the BIO is freed.
28*2175Sjp161948
29*2175Sjp161948BIO_set_fd() sets the socket of BIO B<b> to B<fd> and the close
30*2175Sjp161948flag to B<close_flag>.
31*2175Sjp161948
32*2175Sjp161948BIO_get_fd() places the socket in B<c> if it is not NULL, it also
33*2175Sjp161948returns the socket. If B<c> is not NULL it should be of type (int *).
34*2175Sjp161948
35*2175Sjp161948BIO_new_socket() returns a socket BIO using B<sock> and B<close_flag>.
36*2175Sjp161948
37*2175Sjp161948=head1 NOTES
38*2175Sjp161948
39*2175Sjp161948Socket BIOs also support any relevant functionality of file descriptor
40*2175Sjp161948BIOs.
41*2175Sjp161948
42*2175Sjp161948The reason for having separate file descriptor and socket BIOs is that on some
43*2175Sjp161948platforms sockets are not file descriptors and use distinct I/O routines,
44*2175Sjp161948Windows is one such platform. Any code mixing the two will not work on
45*2175Sjp161948all platforms.
46*2175Sjp161948
47*2175Sjp161948BIO_set_fd() and BIO_get_fd() are macros.
48*2175Sjp161948
49*2175Sjp161948=head1 RETURN VALUES
50*2175Sjp161948
51*2175Sjp161948BIO_s_socket() returns the socket BIO method.
52*2175Sjp161948
53*2175Sjp161948BIO_set_fd() always returns 1.
54*2175Sjp161948
55*2175Sjp161948BIO_get_fd() returns the socket or -1 if the BIO has not been
56*2175Sjp161948initialized.
57*2175Sjp161948
58*2175Sjp161948BIO_new_socket() returns the newly allocated BIO or NULL is an error
59*2175Sjp161948occurred.
60*2175Sjp161948
61*2175Sjp161948=head1 SEE ALSO
62*2175Sjp161948
63*2175Sjp161948TBA
64