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

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature



Reply via email to