1BIO_METH_NEW(3ossl)                 OpenSSL                BIO_METH_NEW(3ossl)
2
3
4

NAME

6       BIO_get_new_index, BIO_meth_new, BIO_meth_free, BIO_meth_get_read_ex,
7       BIO_meth_set_read_ex, BIO_meth_get_write_ex, BIO_meth_set_write_ex,
8       BIO_meth_get_write, BIO_meth_set_write, BIO_meth_get_read,
9       BIO_meth_set_read, BIO_meth_get_puts, BIO_meth_set_puts,
10       BIO_meth_get_gets, BIO_meth_set_gets, BIO_meth_get_ctrl,
11       BIO_meth_set_ctrl, BIO_meth_get_create, BIO_meth_set_create,
12       BIO_meth_get_destroy, BIO_meth_set_destroy, BIO_meth_get_callback_ctrl,
13       BIO_meth_set_callback_ctrl - Routines to build up BIO methods
14

SYNOPSIS

16        #include <openssl/bio.h>
17
18        int BIO_get_new_index(void);
19
20        BIO_METHOD *BIO_meth_new(int type, const char *name);
21
22        void BIO_meth_free(BIO_METHOD *biom);
23
24        int (*BIO_meth_get_write_ex(const BIO_METHOD *biom))(BIO *, const char *, size_t,
25                                                       size_t *);
26        int (*BIO_meth_get_write(const BIO_METHOD *biom))(BIO *, const char *, int);
27        int BIO_meth_set_write_ex(BIO_METHOD *biom,
28                                  int (*bwrite)(BIO *, const char *, size_t, size_t *));
29        int BIO_meth_set_write(BIO_METHOD *biom,
30                               int (*write)(BIO *, const char *, int));
31
32        int (*BIO_meth_get_read_ex(const BIO_METHOD *biom))(BIO *, char *, size_t, size_t *);
33        int (*BIO_meth_get_read(const BIO_METHOD *biom))(BIO *, char *, int);
34        int BIO_meth_set_read_ex(BIO_METHOD *biom,
35                                 int (*bread)(BIO *, char *, size_t, size_t *));
36        int BIO_meth_set_read(BIO_METHOD *biom, int (*read)(BIO *, char *, int));
37
38        int (*BIO_meth_get_puts(const BIO_METHOD *biom))(BIO *, const char *);
39        int BIO_meth_set_puts(BIO_METHOD *biom, int (*puts)(BIO *, const char *));
40
41        int (*BIO_meth_get_gets(const BIO_METHOD *biom))(BIO *, char *, int);
42        int BIO_meth_set_gets(BIO_METHOD *biom,
43                              int (*gets)(BIO *, char *, int));
44
45        long (*BIO_meth_get_ctrl(const BIO_METHOD *biom))(BIO *, int, long, void *);
46        int BIO_meth_set_ctrl(BIO_METHOD *biom,
47                              long (*ctrl)(BIO *, int, long, void *));
48
49        int (*BIO_meth_get_create(const BIO_METHOD *bion))(BIO *);
50        int BIO_meth_set_create(BIO_METHOD *biom, int (*create)(BIO *));
51
52        int (*BIO_meth_get_destroy(const BIO_METHOD *biom))(BIO *);
53        int BIO_meth_set_destroy(BIO_METHOD *biom, int (*destroy)(BIO *));
54
55        long (*BIO_meth_get_callback_ctrl(const BIO_METHOD *biom))(BIO *, int, BIO_info_cb *);
56        int BIO_meth_set_callback_ctrl(BIO_METHOD *biom,
57                                       long (*callback_ctrl)(BIO *, int, BIO_info_cb *));
58

DESCRIPTION

60       The BIO_METHOD type is a structure used for the implementation of new
61       BIO types. It provides a set of functions used by OpenSSL for the
62       implementation of the various BIO capabilities. See the bio(7) page for
63       more information.
64
65       BIO_meth_new() creates a new BIO_METHOD structure. It should be given a
66       unique integer type and a string that represents its name.  Use
67       BIO_get_new_index() to get the value for type.
68
69       The set of standard OpenSSL provided BIO types is provided in
70       <openssl/bio.h>.  Some examples include BIO_TYPE_BUFFER and
71       BIO_TYPE_CIPHER. Filter BIOs should have a type which have the "filter"
72       bit set (BIO_TYPE_FILTER).  Source/sink BIOs should have the
73       "source/sink" bit set (BIO_TYPE_SOURCE_SINK).  File descriptor based
74       BIOs (e.g. socket, fd, connect, accept etc) should additionally have
75       the "descriptor" bit set (BIO_TYPE_DESCRIPTOR). See the
76       BIO_find_type(3) page for more information.
77
78       BIO_meth_free() destroys a BIO_METHOD structure and frees up any memory
79       associated with it.
80
81       BIO_meth_get_write_ex() and BIO_meth_set_write_ex() get and set the
82       function used for writing arbitrary length data to the BIO
83       respectively. This function will be called in response to the
84       application calling BIO_write_ex() or BIO_write(). The parameters for
85       the function have the same meaning as for BIO_write_ex(). Older code
86       may call BIO_meth_get_write() and BIO_meth_set_write() instead.
87       Applications should not call both BIO_meth_set_write_ex() and
88       BIO_meth_set_write() or call BIO_meth_get_write() when the function was
89       set with BIO_meth_set_write_ex().
90
91       BIO_meth_get_read_ex() and BIO_meth_set_read_ex() get and set the
92       function used for reading arbitrary length data from the BIO
93       respectively. This function will be called in response to the
94       application calling BIO_read_ex() or BIO_read().  The parameters for
95       the function have the same meaning as for BIO_read_ex().  Older code
96       may call BIO_meth_get_read() and BIO_meth_set_read() instead.
97       Applications should not call both BIO_meth_set_read_ex() and
98       BIO_meth_set_read() or call BIO_meth_get_read() when the function was
99       set with BIO_meth_set_read_ex().
100
101       BIO_meth_get_puts() and BIO_meth_set_puts() get and set the function
102       used for writing a NULL terminated string to the BIO respectively. This
103       function will be called in response to the application calling
104       BIO_puts(). The parameters for the function have the same meaning as
105       for BIO_puts().
106
107       BIO_meth_get_gets() and BIO_meth_set_gets() get and set the function
108       typically used for reading a line of data from the BIO respectively
109       (see the BIO_gets(3) page for more information). This function will be
110       called in response to the application calling BIO_gets(). The
111       parameters for the function have the same meaning as for BIO_gets().
112
113       BIO_meth_get_ctrl() and BIO_meth_set_ctrl() get and set the function
114       used for processing ctrl messages in the BIO respectively. See the
115       BIO_ctrl(3) page for more information. This function will be called in
116       response to the application calling BIO_ctrl(). The parameters for the
117       function have the same meaning as for BIO_ctrl().
118
119       BIO_meth_get_create() and BIO_meth_set_create() get and set the
120       function used for creating a new instance of the BIO respectively. This
121       function will be called in response to the application calling
122       BIO_new() and passing in a pointer to the current BIO_METHOD. The
123       BIO_new() function will allocate the memory for the new BIO, and a
124       pointer to this newly allocated structure will be passed as a parameter
125       to the function. If a create function is set, BIO_new() will not mark
126       the BIO as initialised on allocation.  BIO_set_init(3) must then be
127       called either by the create function, or later, by a BIO ctrl function,
128       once BIO initialisation is complete.
129
130       BIO_meth_get_destroy() and BIO_meth_set_destroy() get and set the
131       function used for destroying an instance of a BIO respectively. This
132       function will be called in response to the application calling
133       BIO_free(). A pointer to the BIO to be destroyed is passed as a
134       parameter. The destroy function should be used for BIO specific clean
135       up. The memory for the BIO itself should not be freed by this function.
136
137       BIO_meth_get_callback_ctrl() and BIO_meth_set_callback_ctrl() get and
138       set the function used for processing callback ctrl messages in the BIO
139       respectively. See the BIO_callback_ctrl(3) page for more information.
140       This function will be called in response to the application calling
141       BIO_callback_ctrl(). The parameters for the function have the same
142       meaning as for BIO_callback_ctrl().
143

RETURN VALUES

145       BIO_get_new_index() returns the new BIO type value or -1 if an error
146       occurred.
147
148       BIO_meth_new(int type, const char *name) returns a valid BIO_METHOD or
149       NULL if an error occurred.
150
151       The BIO_meth_set functions return 1 on success or 0 on error.
152
153       The BIO_meth_get functions return the corresponding function pointers.
154

SEE ALSO

156       bio(7), BIO_find_type(3), BIO_ctrl(3), BIO_read_ex(3), BIO_new(3)
157

HISTORY

159       The functions described here were added in OpenSSL 1.1.0.
160
162       Copyright 2016-2022 The OpenSSL Project Authors. All Rights Reserved.
163
164       Licensed under the Apache License 2.0 (the "License").  You may not use
165       this file except in compliance with the License.  You can obtain a copy
166       in the file LICENSE in the source distribution or at
167       <https://www.openssl.org/source/license.html>.
168
169
170
1713.0.9                             2023-07-27               BIO_METH_NEW(3ossl)
Impressum