openssl-prebuild/linux_amd64/ssl/share/doc/openssl/html/man3/BIO_meth_new.html

190 lines
9.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_meth_new</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="#see_also">SEE ALSO</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_get_new_index,
BIO_meth_new, BIO_meth_free, BIO_meth_get_read_ex, BIO_meth_set_read_ex,
BIO_meth_get_write_ex, BIO_meth_set_write_ex, BIO_meth_get_write,
BIO_meth_set_write, BIO_meth_get_read, BIO_meth_set_read, BIO_meth_get_puts,
BIO_meth_set_puts, BIO_meth_get_gets, BIO_meth_set_gets, BIO_meth_get_ctrl,
BIO_meth_set_ctrl, BIO_meth_get_create, BIO_meth_set_create,
BIO_meth_get_destroy, BIO_meth_set_destroy, BIO_meth_get_callback_ctrl,
BIO_meth_set_callback_ctrl - Routines to build up BIO methods</p>
<p>
</p>
<hr />
<h1><a name="synopsis">SYNOPSIS</a></h1>
<pre>
#include &lt;openssl/bio.h&gt;</pre>
<pre>
int BIO_get_new_index(void);</pre>
<pre>
BIO_METHOD *BIO_meth_new(int type, const char *name);</pre>
<pre>
void BIO_meth_free(BIO_METHOD *biom);</pre>
<pre>
int (*BIO_meth_get_write_ex(const BIO_METHOD *biom))(BIO *, const char *, size_t,
size_t *);
int (*BIO_meth_get_write(const BIO_METHOD *biom))(BIO *, const char *, int);
int BIO_meth_set_write_ex(BIO_METHOD *biom,
int (*bwrite)(BIO *, const char *, size_t, size_t *));
int BIO_meth_set_write(BIO_METHOD *biom,
int (*write)(BIO *, const char *, int));</pre>
<pre>
int (*BIO_meth_get_read_ex(const BIO_METHOD *biom))(BIO *, char *, size_t, size_t *);
int (*BIO_meth_get_read(const BIO_METHOD *biom))(BIO *, char *, int);
int BIO_meth_set_read_ex(BIO_METHOD *biom,
int (*bread)(BIO *, char *, size_t, size_t *));
int BIO_meth_set_read(BIO_METHOD *biom, int (*read)(BIO *, char *, int));</pre>
<pre>
int (*BIO_meth_get_puts(const BIO_METHOD *biom))(BIO *, const char *);
int BIO_meth_set_puts(BIO_METHOD *biom, int (*puts)(BIO *, const char *));</pre>
<pre>
int (*BIO_meth_get_gets(const BIO_METHOD *biom))(BIO *, char *, int);
int BIO_meth_set_gets(BIO_METHOD *biom,
int (*gets)(BIO *, char *, int));</pre>
<pre>
long (*BIO_meth_get_ctrl(const BIO_METHOD *biom))(BIO *, int, long, void *);
int BIO_meth_set_ctrl(BIO_METHOD *biom,
long (*ctrl)(BIO *, int, long, void *));</pre>
<pre>
int (*BIO_meth_get_create(const BIO_METHOD *bion))(BIO *);
int BIO_meth_set_create(BIO_METHOD *biom, int (*create)(BIO *));</pre>
<pre>
int (*BIO_meth_get_destroy(const BIO_METHOD *biom))(BIO *);
int BIO_meth_set_destroy(BIO_METHOD *biom, int (*destroy)(BIO *));</pre>
<pre>
long (*BIO_meth_get_callback_ctrl(const BIO_METHOD *biom))(BIO *, int, BIO_info_cb *);
int BIO_meth_set_callback_ctrl(BIO_METHOD *biom,
long (*callback_ctrl)(BIO *, int, BIO_info_cb *));</pre>
<p>
</p>
<hr />
<h1><a name="description">DESCRIPTION</a></h1>
<p>The <strong>BIO_METHOD</strong> type is a structure used for the implementation of new BIO
types. It provides a set of functions used by OpenSSL for the implementation
of the various BIO capabilities. See the <em>bio(7)</em> page for more information.</p>
<p><code>BIO_meth_new()</code> creates a new <strong>BIO_METHOD</strong> structure. It should be given a
unique integer <strong>type</strong> and a string that represents its <strong>name</strong>.
Use <code>BIO_get_new_index()</code> to get the value for <strong>type</strong>.</p>
<p>The set of
standard OpenSSL provided BIO types is provided in <strong>bio.h</strong>. Some examples
include <strong>BIO_TYPE_BUFFER</strong> and <strong>BIO_TYPE_CIPHER</strong>. Filter BIOs should have a
type which have the &quot;filter&quot; bit set (<strong>BIO_TYPE_FILTER</strong>). Source/sink BIOs
should have the &quot;source/sink&quot; bit set (<strong>BIO_TYPE_SOURCE_SINK</strong>). File descriptor
based BIOs (e.g. socket, fd, connect, accept etc) should additionally have the
&quot;descriptor&quot; bit set (<strong>BIO_TYPE_DESCRIPTOR</strong>). See the <em>BIO_find_type(3)</em> page for
more information.</p>
<p><code>BIO_meth_free()</code> destroys a <strong>BIO_METHOD</strong> structure and frees up any memory
associated with it.</p>
<p><code>BIO_meth_get_write_ex()</code> and <code>BIO_meth_set_write_ex()</code> get and set the function
used for writing arbitrary length data to the BIO respectively. This function
will be called in response to the application calling <code>BIO_write_ex()</code> or
<code>BIO_write()</code>. The parameters for the function have the same meaning as for
<code>BIO_write_ex()</code>. Older code may call <code>BIO_meth_get_write()</code> and
<code>BIO_meth_set_write()</code> instead. Applications should not call both
<code>BIO_meth_set_write_ex()</code> and <code>BIO_meth_set_write()</code> or call <code>BIO_meth_get_write()</code>
when the function was set with <code>BIO_meth_set_write_ex()</code>.</p>
<p><code>BIO_meth_get_read_ex()</code> and <code>BIO_meth_set_read_ex()</code> get and set the function used
for reading arbitrary length data from the BIO respectively. This function will
be called in response to the application calling <code>BIO_read_ex()</code> or <code>BIO_read()</code>.
The parameters for the function have the same meaning as for <code>BIO_read_ex()</code>.
Older code may call <code>BIO_meth_get_read()</code> and <code>BIO_meth_set_read()</code> instead.
Applications should not call both <code>BIO_meth_set_read_ex()</code> and <code>BIO_meth_set_read()</code>
or call <code>BIO_meth_get_read()</code> when the function was set with
<code>BIO_meth_set_read_ex()</code>.</p>
<p><code>BIO_meth_get_puts()</code> and <code>BIO_meth_set_puts()</code> get and set the function used for
writing a NULL terminated string to the BIO respectively. This function will be
called in response to the application calling <code>BIO_puts()</code>. The parameters for
the function have the same meaning as for <code>BIO_puts()</code>.</p>
<p><code>BIO_meth_get_gets()</code> and <code>BIO_meth_set_gets()</code> get and set the function typically
used for reading a line of data from the BIO respectively (see the <em>BIO_gets(3)</em>
page for more information). This function will be called in response to the
application calling <code>BIO_gets()</code>. The parameters for the function have the same
meaning as for <code>BIO_gets()</code>.</p>
<p><code>BIO_meth_get_ctrl()</code> and <code>BIO_meth_set_ctrl()</code> get and set the function used for
processing ctrl messages in the BIO respectively. See the <em>BIO_ctrl(3)</em> page for
more information. This function will be called in response to the application
calling <code>BIO_ctrl()</code>. The parameters for the function have the same meaning as for
<code>BIO_ctrl()</code>.</p>
<p><code>BIO_meth_get_create()</code> and <code>BIO_meth_set_create()</code> get and set the function used
for creating a new instance of the BIO respectively. This function will be
called in response to the application calling <code>BIO_new()</code> and passing
in a pointer to the current BIO_METHOD. The <code>BIO_new()</code> function will allocate the
memory for the new BIO, and a pointer to this newly allocated structure will
be passed as a parameter to the function.</p>
<p><code>BIO_meth_get_destroy()</code> and <code>BIO_meth_set_destroy()</code> get and set the function used
for destroying an instance of a BIO respectively. This function will be
called in response to the application calling <code>BIO_free()</code>. A pointer to the BIO
to be destroyed is passed as a parameter. The destroy function should be used
for BIO specific clean up. The memory for the BIO itself should not be freed by
this function.</p>
<p><code>BIO_meth_get_callback_ctrl()</code> and <code>BIO_meth_set_callback_ctrl()</code> get and set the
function used for processing callback ctrl messages in the BIO respectively. See
the <em>BIO_callback_ctrl(3)</em> page for more information. This function will be called
in response to the application calling <code>BIO_callback_ctrl()</code>. The parameters for
the function have the same meaning as for <code>BIO_callback_ctrl()</code>.</p>
<p>
</p>
<hr />
<h1><a name="return_values">RETURN VALUES</a></h1>
<p><code>BIO_get_new_index()</code> returns the new BIO type value or -1 if an error occurred.</p>
<p>BIO_meth_new(int type, const char *name) returns a valid <strong>BIO_METHOD</strong> or NULL
if an error occurred.</p>
<p>The <strong>BIO_meth_set</strong> functions return 1 on success or 0 on error.</p>
<p>The <strong>BIO_meth_get</strong> functions return the corresponding function pointers.</p>
<p>
</p>
<hr />
<h1><a name="see_also">SEE ALSO</a></h1>
<p><em>bio(7)</em>, <em>BIO_find_type(3)</em>, <em>BIO_ctrl(3)</em>, <em>BIO_read_ex(3)</em>, <em>BIO_new(3)</em></p>
<p>
</p>
<hr />
<h1><a name="history">HISTORY</a></h1>
<p>The functions described here were added in OpenSSL 1.1.0.</p>
<p>
</p>
<hr />
<h1><a name="copyright">COPYRIGHT</a></h1>
<p>Copyright 2016-2018 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>