开发者

Does OpenSSL has any event callback function for 'Read' data?

I was looking for event callback function when OpenSSL has incoming 'Read' data. Does OpenSSL has this kind of function? If yes, could you please show me some example code please?

I'm thinking to write a simple wrapper for my application. This wrapper will make a callback when data arrive. My initial thought would be create a thread looping in non-blocking mode to scan for any incoming data. And when da开发者_如何学Gota arrived, I'll just make the callback. Am I doing the right thing here?

Thanks a lot for answering! And sorry for my English.


Boost.Asio has support for asynchronous SSL read operations.


The CyaSSL SSL library (similar to OpenSSL, but with a much smaller footprint and other cool features) has I/O callbacks similar to what you are looking for I believe.

In CyaSSL, the input/output callbacks are prototyped by CallbackIOSend and CallbackIORecv in ssl.h. These functions need to be registered per SSL_CTX with CyaSSL_SetIOSend() and CyaSSL_SetIORecv(). The default case (CBIOSend() and CBIORecv() are registered at the bottom of cyassl_io.c.

The CBIOSend and CBIORecv function pointers can be pointed to your custom I/O functions. You can use the default Send() and Receive() functions (EmbedSend() and EmbedReceive(), located in cyassl_io.c) as examples.

Regards,
Chris

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜