1 /* $OpenBSD: bio_meth.c,v 1.5 2018/02/20 18:51:35 tb Exp $ */
3 * Copyright (c) 2018 Theo Buehler <tb@openbsd.org>
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20 #include <openssl/bio.h>
23 BIO_meth_new(int type
, const char *name
)
27 if ((biom
= calloc(1, sizeof(*biom
))) == NULL
)
37 BIO_meth_free(BIO_METHOD
*biom
)
43 (*BIO_meth_get_write(BIO_METHOD
*biom
))(BIO
*, const char *, int)
49 BIO_meth_set_write(BIO_METHOD
*biom
, int (*write
)(BIO
*, const char *, int))
56 (*BIO_meth_get_read(BIO_METHOD
*biom
))(BIO
*, char *, int)
62 BIO_meth_set_read(BIO_METHOD
*biom
, int (*read
)(BIO
*, char *, int))
69 (*BIO_meth_get_puts(BIO_METHOD
*biom
))(BIO
*, const char *)
75 BIO_meth_set_puts(BIO_METHOD
*biom
, int (*puts
)(BIO
*, const char *))
82 (*BIO_meth_get_gets(BIO_METHOD
*biom
))(BIO
*, char *, int)
88 BIO_meth_set_gets(BIO_METHOD
*biom
, int (*gets
)(BIO
*, char *, int))
95 (*BIO_meth_get_ctrl(BIO_METHOD
*biom
))(BIO
*, int, long, void *)
101 BIO_meth_set_ctrl(BIO_METHOD
*biom
, long (*ctrl
)(BIO
*, int, long, void *))
108 (*BIO_meth_get_create(BIO_METHOD
*biom
))(BIO
*)
114 BIO_meth_set_create(BIO_METHOD
*biom
, int (*create
)(BIO
*))
116 biom
->create
= create
;
121 (*BIO_meth_get_destroy(BIO_METHOD
*biom
))(BIO
*)
123 return biom
->destroy
;
127 BIO_meth_set_destroy(BIO_METHOD
*biom
, int (*destroy
)(BIO
*))
129 biom
->destroy
= destroy
;
134 (*BIO_meth_get_callback_ctrl(BIO_METHOD
*biom
))(BIO
*, int, BIO_info_cb
*)
137 (long (*)(BIO
*, int, BIO_info_cb
*))biom
->callback_ctrl
; /* XXX */
141 BIO_meth_set_callback_ctrl(BIO_METHOD
*biom
,
142 long (*callback_ctrl
)(BIO
*, int, BIO_info_cb
*))
144 biom
->callback_ctrl
=
145 (long (*)(BIO
*, int, bio_info_cb
*))callback_ctrl
; /* XXX */