tfSslUserProcessHandshake
Table of Contents >> SSL Programmer's Reference
| #include <trsocket.h> |
| int tfSslUserProcessHandshake | (int socketDescriptor); |
Function Description
This API allows the user to offload cryptographic processing that would normally occur in the context of the receive task. You might do this, for example, if you call recv() in a separate thread and your receive thread services many sockets, simultaneously.
To support this feature, you must do the following:
- Call setsockopt() with option TM_TCP_SSL_USER_PROCESS on the socket.
- Create a socket callback function, if you haven't done so already. See tfRegisterSocketCB() or tfRegisterSocketCBParam().
- Test for TM_CB_SSL_HANDSHK_PROCESS in your socket callback function (called in the context of your receive task). Signal the task that is handling the socket, e.g. using operating system calls, setting global flags, etc.
- Call tfSslUserProcessHandshake() in the task that is using the socket when the TM_CB_SSL_HANDSHK_PROCESS event occurs.
Parameters
- socketDescriptor
- SSL-enabled socket. See setsockopt(), options TM_TCP_SSLSESSION, TM_TCP_SSL_CLIENT and TM_TCP_SSL_SERVER.
Returns
- TM_ENOERROR
- Success.
- TM_SOCKET_ERROR
- Error. Call tfGetSocketError() for more information, e.g. one of the following possibilities.
- TM_ENOBUFS
- No more buffer available.
- TM_EPERM
- Function call not permitted, check if SSL has been enabled on the socket (see setsockopt()).
- TM_EPROTONOTSUPP
- The socket is not a TCP socket.
- TM_EBADF
- Socket pointer is not found.
- TM_ENOENT
- No SSL connection state on the socket.
| TM_SOCKET_ERROR means that this socket call has failed and the errorCode has been set on the socket itself.
To retrieve the socket error the user must call tfGetSocketError(socketDescriptor). |