Chris Saunders said:
I am attempting to write and interface from another language to
some C code. I am having some difficulty interpreting a declaration.
int (*SSL_CTX_get_verify_callback(SSL_CTX *ctx))(int,X509_STORE_CTX *);
Any help would be appreciated.
Regards
Chris Saunders
(e-mail address removed)
Read the statement as follows:
1. Find out the name of the identifier. It is:
SSL_CTX_get_verify_callback
2. See on it's right side. It has (SSL_CTX *ctx) on it's
right. An identifier followed by a left parantheses,
some declarations -- zero or more; and a right parantheses
is a declaration of a function. So,
" ... SSL_CTX_get_verify_callback is a function taking as
argument a pointer to SSL_CTX ..."
3. Now, look at it's left side. It has an asterisk on it's left;
a probable sign of either poiter to a function or a function
returning a poiter to _something_. But, before check that
the asterisk, stuffs of steps 1 and 2 are enclosed within
a parantheses? Yes, they are. So,
( *SSL_CTX_get_verify_callback ( SSL_CTX *ctx ) )
" ... SSL_CTX_get_verify_callback is a pointer to a function
which takes pointer to an object of type SSL_CTX ... "
4. Now, see on the right side of
( *SSL_CTX_get_verify_callback ( SSL_CTX *ctx ) )
We have again an argument list of a function! Repeat the steps
2 and 3 to find that:
"SSL_CTX_get_verify_callback is a pointer to a function which
takes a pointer to an object of type SSL_CTX as an argument;
and, it returns a pointer to function which takes an int, and
a pointer to an object of type X509_STORE_CTX and returns an
int."
Oh! What a pretty thing it is!