1BIO_ADDRINFO(3) OpenSSL BIO_ADDRINFO(3)
2
3
4
6 BIO_lookup_type, BIO_ADDRINFO, BIO_ADDRINFO_next, BIO_ADDRINFO_free,
7 BIO_ADDRINFO_family, BIO_ADDRINFO_socktype, BIO_ADDRINFO_protocol,
8 BIO_ADDRINFO_address, BIO_lookup_ex, BIO_lookup - BIO_ADDRINFO type and
9 routines
10
12 #include <sys/types.h>
13 #include <openssl/bio.h>
14
15 typedef union bio_addrinfo_st BIO_ADDRINFO;
16
17 enum BIO_lookup_type {
18 BIO_LOOKUP_CLIENT, BIO_LOOKUP_SERVER
19 };
20
21 int BIO_lookup_ex(const char *host, const char *service, int lookup_type,
22 int family, int socktype, int protocol, BIO_ADDRINFO **res);
23 int BIO_lookup(const char *node, const char *service,
24 enum BIO_lookup_type lookup_type,
25 int family, int socktype, BIO_ADDRINFO **res);
26
27 const BIO_ADDRINFO *BIO_ADDRINFO_next(const BIO_ADDRINFO *bai);
28 int BIO_ADDRINFO_family(const BIO_ADDRINFO *bai);
29 int BIO_ADDRINFO_socktype(const BIO_ADDRINFO *bai);
30 int BIO_ADDRINFO_protocol(const BIO_ADDRINFO *bai);
31 const BIO_ADDR *BIO_ADDRINFO_address(const BIO_ADDRINFO *bai);
32 void BIO_ADDRINFO_free(BIO_ADDRINFO *bai);
33
35 The BIO_ADDRINFO type is a wrapper for address information types
36 provided on your platform.
37
38 BIO_ADDRINFO normally forms a chain of several that can be picked at
39 one by one.
40
41 BIO_lookup_ex() looks up a specified host and service, and uses
42 lookup_type to determine what the default address should be if host is
43 NULL. family, socktype and protocol are used to determine what protocol
44 family, socket type and protocol should be used for the lookup. family
45 can be any of AF_INET, AF_INET6, AF_UNIX and AF_UNSPEC. socktype can be
46 SOCK_STREAM, SOCK_DGRAM or 0. Specifying 0 indicates that any type can
47 be used. protocol specifies a protocol such as IPPROTO_TCP, IPPROTO_UDP
48 or IPPORTO_SCTP. If set to 0 than any protocol can be used. res points
49 at a pointer to hold the start of a BIO_ADDRINFO chain.
50
51 For the family AF_UNIX, BIO_lookup_ex() will ignore the service
52 parameter and expects the node parameter to hold the path to the socket
53 file.
54
55 BIO_lookup() does the same as BIO_lookup_ex() but does not provide the
56 ability to select based on the protocol (any protocol may be returned).
57
58 BIO_ADDRINFO_family() returns the family of the given BIO_ADDRINFO.
59 The result will be one of the constants AF_INET, AF_INET6 and AF_UNIX.
60
61 BIO_ADDRINFO_socktype() returns the socket type of the given
62 BIO_ADDRINFO. The result will be one of the constants SOCK_STREAM and
63 SOCK_DGRAM.
64
65 BIO_ADDRINFO_protocol() returns the protocol id of the given
66 BIO_ADDRINFO. The result will be one of the constants IPPROTO_TCP and
67 IPPROTO_UDP.
68
69 BIO_ADDRINFO_address() returns the underlying BIO_ADDR of the given
70 BIO_ADDRINFO.
71
72 BIO_ADDRINFO_next() returns the next BIO_ADDRINFO in the chain from the
73 given one.
74
75 BIO_ADDRINFO_free() frees the chain of BIO_ADDRINFO starting with the
76 given one.
77
79 BIO_lookup_ex() and BIO_lookup() return 1 on success and 0 when an
80 error occurred, and will leave an error indication on the OpenSSL error
81 stack in that case.
82
83 All other functions described here return 0 or NULL when the
84 information they should return isn't available.
85
87 The BIO_lookup_ex() implementation uses the platform provided
88 getaddrinfo() function. On Linux it is known that specifying 0 for the
89 protocol will not return any SCTP based addresses when calling
90 getaddrinfo(). Therefore, if an SCTP address is required then the
91 protocol parameter to BIO_lookup_ex() should be explicitly set to
92 IPPROTO_SCTP. The same may be true on other platforms.
93
95 The BIO_lookup_ex() function was added in OpenSSL 1.1.1.
96
98 Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved.
99
100 Licensed under the OpenSSL license (the "License"). You may not use
101 this file except in compliance with the License. You can obtain a copy
102 in the file LICENSE in the source distribution or at
103 <https://www.openssl.org/source/license.html>.
104
105
106
1071.1.1q 2022-07-21 BIO_ADDRINFO(3)