tfSslSetHostname

Jump to: navigation, search

Table of Contents >> SSL Programmer's Reference


#include <trsocket.h>


int tfSslSetHostname (
int socketDescriptor,
const char TM_FAR * hostname
);


Function Description

This TLS/SSL client function sets the TLS Server Name Indication (SNI) extension (RFC 6066) name to send to the server. Call this function after calling setsockopt( ..., IPPROTO_TCP, TM_TCP_SSL_CLIENT, ... ) and before calling tfSslClientUserStart(). Specify a NULL hostname to cancel.

If you specify the same name in tfSslClientUserStart(), you may omit calling tfSslSetHostname().


Parameters

  • socketDescriptor
    A socket descriptor on which setsockopt( ..., IPPROTO_TCP, TM_TCP_SSL_CLIENT, ... ) has been called.
  • hostname
    The DNS domain name to send in the ClientHello message. May be NULL, to cancel a previously set value.


Returns

  • TM_ENOERROR
    Success
  • TM_BADF
    Invalid socketDescriptor.
  • TM_EINVAL
    Invalid hostname (see preferred name syntax in RFC 1034 and RFC 1123) or not a SSL socket (call setsockopt( ..., IPPROTO_TCP, TM_TCP_SSL_CLIENT, ... ) first).


Table of Contents >> SSL Programmer's Reference