Richard Levitte | 28a0841 | 2016-02-02 15:54:57 +0100 | [diff] [blame] | 1 | =pod |
| 2 | |
| 3 | =head1 NAME |
| 4 | |
Rich Salz | d4ea965 | 2017-03-11 12:48:32 -0500 | [diff] [blame] | 5 | BIO_lookup_type, |
Rich Salz | 8162f6f | 2016-06-09 17:02:59 -0400 | [diff] [blame] | 6 | BIO_ADDRINFO, BIO_ADDRINFO_next, BIO_ADDRINFO_free, |
Richard Levitte | 28a0841 | 2016-02-02 15:54:57 +0100 | [diff] [blame] | 7 | BIO_ADDRINFO_family, BIO_ADDRINFO_socktype, BIO_ADDRINFO_protocol, |
Rich Salz | 8162f6f | 2016-06-09 17:02:59 -0400 | [diff] [blame] | 8 | BIO_ADDRINFO_address, |
| 9 | BIO_lookup |
Richard Levitte | 28a0841 | 2016-02-02 15:54:57 +0100 | [diff] [blame] | 10 | - BIO_ADDRINFO type and routines |
| 11 | |
| 12 | =head1 SYNOPSIS |
| 13 | |
| 14 | #include <sys/types.h> |
| 15 | #include <openssl/bio.h> |
| 16 | |
| 17 | typedef union bio_addrinfo_st BIO_ADDRINFO; |
| 18 | |
| 19 | enum BIO_lookup_type { |
| 20 | BIO_LOOKUP_CLIENT, BIO_LOOKUP_SERVER |
| 21 | }; |
| 22 | int BIO_lookup(const char *node, const char *service, |
| 23 | enum BIO_lookup_type lookup_type, |
| 24 | int family, int socktype, BIO_ADDRINFO **res); |
| 25 | |
| 26 | const BIO_ADDRINFO *BIO_ADDRINFO_next(const BIO_ADDRINFO *bai); |
| 27 | int BIO_ADDRINFO_family(const BIO_ADDRINFO *bai); |
| 28 | int BIO_ADDRINFO_socktype(const BIO_ADDRINFO *bai); |
| 29 | int BIO_ADDRINFO_protocol(const BIO_ADDRINFO *bai); |
| 30 | const BIO_ADDR *BIO_ADDRINFO_address(const BIO_ADDRINFO *bai); |
| 31 | void BIO_ADDRINFO_free(BIO_ADDRINFO *bai); |
| 32 | |
| 33 | =head1 DESCRIPTION |
| 34 | |
| 35 | The B<BIO_ADDRINFO> type is a wrapper for address information |
| 36 | types provided on your platform. |
| 37 | |
| 38 | B<BIO_ADDRINFO> normally forms a chain of several that can be |
| 39 | picked at one by one. |
| 40 | |
| 41 | BIO_lookup() looks up a specified B<host> and B<service>, and |
| 42 | uses B<lookup_type> to determine what the default address should |
| 43 | be if B<host> is B<NULL>. B<family>, B<socktype> are used to |
| 44 | determine what protocol family and protocol should be used for |
| 45 | the lookup. B<family> can be any of AF_INET, AF_INET6, AF_UNIX and |
| 46 | AF_UNSPEC, and B<socktype> can be SOCK_STREAM or SOCK_DGRAM. |
| 47 | B<res> points at a pointer to hold the start of a B<BIO_ADDRINFO> |
| 48 | chain. |
| 49 | For the family B<AF_UNIX>, BIO_lookup() will ignore the B<service> |
| 50 | parameter and expects the B<node> parameter to hold the path to the |
| 51 | socket file. |
| 52 | |
| 53 | BIO_ADDRINFO_family() returns the family of the given |
| 54 | B<BIO_ADDRINFO>. The result will be one of the constants |
| 55 | AF_INET, AF_INET6 and AF_UNIX. |
| 56 | |
| 57 | BIO_ADDRINFO_socktype() returns the socket type of the given |
| 58 | B<BIO_ADDRINFO>. The result will be one of the constants |
| 59 | SOCK_STREAM and SOCK_DGRAM. |
| 60 | |
| 61 | BIO_ADDRINFO_protocol() returns the protocol id of the given |
| 62 | B<BIO_ADDRINFO>. The result will be one of the constants |
| 63 | IPPROTO_TCP and IPPROTO_UDP. |
| 64 | |
| 65 | BIO_ADDRINFO_address() returns the underlying B<BIO_ADDR> |
| 66 | of the given B<BIO_ADDRINFO>. |
| 67 | |
| 68 | BIO_ADDRINFO_next() returns the next B<BIO_ADDRINFO> in the chain |
| 69 | from the given one. |
| 70 | |
| 71 | BIO_ADDRINFO_free() frees the chain of B<BIO_ADDRINFO> starting |
| 72 | with the given one. |
| 73 | |
| 74 | =head1 RETURN VALUES |
| 75 | |
Alex Gaynor | 35ed393 | 2016-03-19 12:28:58 -0400 | [diff] [blame] | 76 | BIO_lookup() returns 1 on success and 0 when an error occurred, and |
FdaSilvaYY | 24c2cd3 | 2016-05-01 19:52:58 +0200 | [diff] [blame] | 77 | will leave an error indication on the OpenSSL error stack in that case. |
Richard Levitte | 28a0841 | 2016-02-02 15:54:57 +0100 | [diff] [blame] | 78 | |
| 79 | All other functions described here return 0 or B<NULL> when the |
| 80 | information they should return isn't available. |
| 81 | |
Rich Salz | e2f9261 | 2016-05-18 11:44:05 -0400 | [diff] [blame] | 82 | =head1 COPYRIGHT |
| 83 | |
| 84 | Copyright 2016 The OpenSSL Project Authors. All Rights Reserved. |
| 85 | |
| 86 | Licensed under the OpenSSL license (the "License"). You may not use |
| 87 | this file except in compliance with the License. You can obtain a copy |
| 88 | in the file LICENSE in the source distribution or at |
| 89 | L<https://www.openssl.org/source/license.html>. |
| 90 | |
| 91 | =cut |