openssl-prebuild/linux_amd64/ssl/share/doc/openssl/html/man3/BIO_ADDRINFO.html
2020-03-02 16:50:34 +00:00

143 lines
5.8 KiB
HTML
Executable File

<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>BIO_ADDRINFO</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:root@localhost" />
</head>
<body style="background-color: white">
<!-- INDEX BEGIN -->
<div name="index">
<p><a name="__index__"></a></p>
<ul>
<li><a href="#name">NAME</a></li>
<li><a href="#synopsis">SYNOPSIS</a></li>
<li><a href="#description">DESCRIPTION</a></li>
<li><a href="#return_values">RETURN VALUES</a></li>
<li><a href="#notes">NOTES</a></li>
<li><a href="#history">HISTORY</a></li>
<li><a href="#copyright">COPYRIGHT</a></li>
</ul>
<hr name="index" />
</div>
<!-- INDEX END -->
<p>
</p>
<hr />
<h1><a name="name">NAME</a></h1>
<p>BIO_lookup_type,
BIO_ADDRINFO, BIO_ADDRINFO_next, BIO_ADDRINFO_free,
BIO_ADDRINFO_family, BIO_ADDRINFO_socktype, BIO_ADDRINFO_protocol,
BIO_ADDRINFO_address,
BIO_lookup_ex,
BIO_lookup
- BIO_ADDRINFO type and routines</p>
<p>
</p>
<hr />
<h1><a name="synopsis">SYNOPSIS</a></h1>
<pre>
#include &lt;sys/types.h&gt;
#include &lt;openssl/bio.h&gt;</pre>
<pre>
typedef union bio_addrinfo_st BIO_ADDRINFO;</pre>
<pre>
enum BIO_lookup_type {
BIO_LOOKUP_CLIENT, BIO_LOOKUP_SERVER
};</pre>
<pre>
int BIO_lookup_ex(const char *host, const char *service, int lookup_type,
int family, int socktype, int protocol, BIO_ADDRINFO **res);
int BIO_lookup(const char *node, const char *service,
enum BIO_lookup_type lookup_type,
int family, int socktype, BIO_ADDRINFO **res);</pre>
<pre>
const BIO_ADDRINFO *BIO_ADDRINFO_next(const BIO_ADDRINFO *bai);
int BIO_ADDRINFO_family(const BIO_ADDRINFO *bai);
int BIO_ADDRINFO_socktype(const BIO_ADDRINFO *bai);
int BIO_ADDRINFO_protocol(const BIO_ADDRINFO *bai);
const BIO_ADDR *BIO_ADDRINFO_address(const BIO_ADDRINFO *bai);
void BIO_ADDRINFO_free(BIO_ADDRINFO *bai);</pre>
<p>
</p>
<hr />
<h1><a name="description">DESCRIPTION</a></h1>
<p>The <strong>BIO_ADDRINFO</strong> type is a wrapper for address information
types provided on your platform.</p>
<p><strong>BIO_ADDRINFO</strong> normally forms a chain of several that can be
picked at one by one.</p>
<p><code>BIO_lookup_ex()</code> looks up a specified <strong>host</strong> and <strong>service</strong>, and
uses <strong>lookup_type</strong> to determine what the default address should
be if <strong>host</strong> is <strong>NULL</strong>. <strong>family</strong>, <strong>socktype</strong> and <strong>protocol</strong> are used to
determine what protocol family, socket type and protocol should be used for
the lookup. <strong>family</strong> can be any of AF_INET, AF_INET6, AF_UNIX and
AF_UNSPEC. <strong>socktype</strong> can be SOCK_STREAM, SOCK_DGRAM or 0. Specifying 0
indicates that any type can be used. <strong>protocol</strong> specifies a protocol such as
IPPROTO_TCP, IPPROTO_UDP or IPPORTO_SCTP. If set to 0 than any protocol can be
used. <strong>res</strong> points at a pointer to hold the start of a <strong>BIO_ADDRINFO</strong>
chain.</p>
<p>For the family <strong>AF_UNIX</strong>, <code>BIO_lookup_ex()</code> will ignore the <strong>service</strong>
parameter and expects the <strong>node</strong> parameter to hold the path to the
socket file.</p>
<p><code>BIO_lookup()</code> does the same as <code>BIO_lookup_ex()</code> but does not provide the ability
to select based on the protocol (any protocol may be returned).</p>
<p><code>BIO_ADDRINFO_family()</code> returns the family of the given
<strong>BIO_ADDRINFO</strong>. The result will be one of the constants
AF_INET, AF_INET6 and AF_UNIX.</p>
<p><code>BIO_ADDRINFO_socktype()</code> returns the socket type of the given
<strong>BIO_ADDRINFO</strong>. The result will be one of the constants
SOCK_STREAM and SOCK_DGRAM.</p>
<p><code>BIO_ADDRINFO_protocol()</code> returns the protocol id of the given
<strong>BIO_ADDRINFO</strong>. The result will be one of the constants
IPPROTO_TCP and IPPROTO_UDP.</p>
<p><code>BIO_ADDRINFO_address()</code> returns the underlying <strong>BIO_ADDR</strong>
of the given <strong>BIO_ADDRINFO</strong>.</p>
<p><code>BIO_ADDRINFO_next()</code> returns the next <strong>BIO_ADDRINFO</strong> in the chain
from the given one.</p>
<p><code>BIO_ADDRINFO_free()</code> frees the chain of <strong>BIO_ADDRINFO</strong> starting
with the given one.</p>
<p>
</p>
<hr />
<h1><a name="return_values">RETURN VALUES</a></h1>
<p><code>BIO_lookup_ex()</code> and <code>BIO_lookup()</code> return 1 on success and 0 when an error
occurred, and will leave an error indication on the OpenSSL error stack in that
case.</p>
<p>All other functions described here return 0 or <strong>NULL</strong> when the
information they should return isn't available.</p>
<p>
</p>
<hr />
<h1><a name="notes">NOTES</a></h1>
<p>The <code>BIO_lookup_ex()</code> implementation uses the platform provided <code>getaddrinfo()</code>
function. On Linux it is known that specifying 0 for the protocol will not
return any SCTP based addresses when calling <code>getaddrinfo()</code>. Therefore if an SCTP
address is required then the <strong>protocol</strong> parameter to <code>BIO_lookup_ex()</code> should be
explicitly set to IPPROTO_SCTP. The same may be true on other platforms.</p>
<p>
</p>
<hr />
<h1><a name="history">HISTORY</a></h1>
<p>The <code>BIO_lookup_ex()</code> function was added in OpenSSL 1.1.1.</p>
<p>
</p>
<hr />
<h1><a name="copyright">COPYRIGHT</a></h1>
<p>Copyright 2016-2017 The OpenSSL Project Authors. All Rights Reserved.</p>
<p>Licensed under the Apache License 2.0 (the &quot;License&quot;). You may not use
this file except in compliance with the License. You can obtain a copy
in the file LICENSE in the source distribution or at
<a href="https://www.openssl.org/source/license.html">https://www.openssl.org/source/license.html</a>.</p>
</body>
</html>