Deng Rowe wrote:
>
> Hi there,
>
> Are there somebody having noticed this:
>
> struct bio_st /* From /openssl/crypto/bio/bio.h. */
> {
> ......
>
> char *cb_arg; /* Here in the struct BIO, cb_arg is defined as pionter to
> char. */
>
> .......
> };
>
> yet, look at these codes:
>
> /* Form /openssl/crypto/bio/bio_cb.c. */
> ......
> b=(BIO *)bio->cb_arg;
> if (b != NULL)
> BIO_write(b,buf,strlen(buf));
> #if !defined(NO_STDIO) && !defined(WIN16)
> else
> fputs(buf,stderr);
> #endif
> ......
>
> The cb_arg is used as BIO* :-o, I'm so puzzled that I think cb_arg should be
> defined as pointer to BIO.
> Can you give me some wise?
>
Well cb_arg is an arbitrary argument that is acessible to the callback
which is used to trace BIO calls and/or modify their behaviour.
bio_cb.c is an *example* of how the callback could be used which in this
case uses cb_arg as a BIO to send debugging info to.
I suppose it could be argued it should be a void* but this another
legacy from pre-ANSI SSLeay.
This isn't really needed any more though because there is the ex_data
stuff in the BIO which is more appropriate.
Steve.
--
Dr Stephen N. Henson. http://www.drh-consultancy.demon.co.uk/
Personal Email: [EMAIL PROTECTED]
Senior crypto engineer, Celo Communications: http://www.celocom.com/
Core developer of the OpenSSL project: http://www.openssl.org/
Business Email: [EMAIL PROTECTED] PGP key: via homepage.
______________________________________________________________________
OpenSSL Project http://www.openssl.org
Development Mailing List [EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]