diff options
author | Richard Levitte <levitte@openssl.org> | 2000-02-20 23:43:02 +0000 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2000-02-20 23:43:02 +0000 |
commit | d3442bc780473f0cd4f378bc31130d4579da640b (patch) | |
tree | a9e0e2f1ba5080829e22783c739a9cacaa95ebd5 /crypto/bio/bf_nbio.c | |
parent | dab6f09573742df94c4767663565aca3863f8173 (diff) | |
download | openssl-new-d3442bc780473f0cd4f378bc31130d4579da640b.tar.gz |
Move the registration of callback functions to special functions
designed for that. This removes the potential error to mix data and
function pointers.
Please note that I'm a little unsure how incorrect calls to the old
ctrl functions should be handled, in som cases. I currently return 0
and that's it, but it may be more correct to generate a genuine error
in those cases.
Diffstat (limited to 'crypto/bio/bf_nbio.c')
-rw-r--r-- | crypto/bio/bf_nbio.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/crypto/bio/bf_nbio.c b/crypto/bio/bf_nbio.c index a525e79d4f..5e574b7231 100644 --- a/crypto/bio/bf_nbio.c +++ b/crypto/bio/bf_nbio.c @@ -73,6 +73,7 @@ static int nbiof_gets(BIO *h,char *str,int size); static long nbiof_ctrl(BIO *h,int cmd,long arg1,char *arg2); static int nbiof_new(BIO *h); static int nbiof_free(BIO *data); +static long nbiof_callback_ctrl(BIO *h,int cmd,void (*fp)()); typedef struct nbio_test_st { /* only set if we sent a 'should retry' error */ @@ -91,6 +92,7 @@ static BIO_METHOD methods_nbiof= nbiof_ctrl, nbiof_new, nbiof_free, + nbiof_callback_ctrl, }; BIO_METHOD *BIO_f_nbio_test(void) @@ -224,6 +226,20 @@ static long nbiof_ctrl(BIO *b, int cmd, long num, char *ptr) return(ret); } +static long nbiof_callback_ctrl(BIO *b, int cmd, void (*fp)()) + { + long ret=1; + + if (b->next_bio == NULL) return(0); + switch (cmd) + { + default: + ret=BIO_callback_ctrl(b->next_bio,cmd,fp); + break; + } + return(ret); + } + static int nbiof_gets(BIO *bp, char *buf, int size) { if (bp->next_bio == NULL) return(0); |