tfHttpdUserSetSsl

Jump to: navigation, search

Table of Contents >> Application Reference >> Web Server


#include <trsocket.h>


int tfHttpdUserSetSsl (
ttHttpdUserSrvHandle userConHandle,
int sessionId
);


Function Description

The function is called to set the web server socket to be an SSL-enabled socket, and meanwhile associate it with an SSL session ID, which is returned from tfSslNewSession(). This function must be called before tfHttpdUserExecute()

Note that this function is equivalent to the following public API calling sequence:


{
    int sslOn;
    int returnValue;
 
    returnValue = tfHttpdUserSetSockopt(userSrvHandle,
                                        IP_PROTOTCP,
                                        TM_TCP_SSL_SERVER,
                                        (const char TM_FAR *) &sslOn,
                                        sizeof (sslOn));
    if(returnValue == TM_ENOERROR)
    {
        returnValue = tfHttpdUserSetSockopt(userSrvHandle,
                                        IP_PROTOTCP,
                                        TM_TCP_SSLSESSION,
                                        (const char TM_FAR *) &sessionId,
                                        sizeof (sessionId));
    }
    return returnValue;
}


Parameters

  • userSrvHandle
    The web server user handle that the user wants to start SSL on
  • sessionId
    The SSL session ID the user wants to associate with the web server user handle


Returns

  • TM_ENOERROR
    Success
  • TM_EINVAL
    Invalid parameter
  • TM_SOCKET_ERROR
    Error


Note Note: 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).

Table of Contents >> Application Reference >> Web Server