Hello,
Thanks, i had a working class already with the list of class objects but i think i maybe switching to this more easy method.
Regards, Ahmad.
From: Goetz Babin-Ebell <[EMAIL PROTECTED]> Reply-To: openssl-users@openssl.org To: openssl-users@openssl.org Subject: Re: Callback function in c++ methods Date: Wed, 11 May 2005 20:32:24 +0200
ahmad hassan wrote:Hello,Hello Ahmad,
I have also defined an object model and the workaround to this problem is like this.
I made a static list of class pointers, thus whenever an object is formed it is put into that list.
Now in the callback i had the ssl pointe (SSL*) with me and every class had the ssl pointer. I simply compared and found the exact class. you can also define a map(std::map<SSL*, CSSLClass>).
And why didn't you define simple C-functions that get the pointer to the object with a SSL_get_app_data() (or SSL_get_ex_data()) from the SSL structure and call the wanted method of the object there ?
something like: [...] static void callback_info(const SSL *ssl,int type,int val) { MyObject *obj=(MyObject*)SSL_get_app_data(ssl); if (!obj) return; obj->info(ssl,type,val); } [...] void MyObject::Prepare(SSL* ssl) { SSL_set_app_data(ssl,this); SSL_set_info_callback(ssl,callback_info); [...] } [...]
Bye
Goetz
-- DMCA: The greed of the few outweighs the freedom of the many << smime.p7s >>
_________________________________________________________________
Don't just search. Find. Check out the new MSN Search! http://search.msn.click-url.com/go/onm00200636ave/direct/01/
______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@openssl.org Automated List Manager [EMAIL PROTECTED]