#include <cafe.h>
#include <cafe/nssl/nsslclient.h>

NSSLConnectionHandle NSSLCreateConnection(NSSLContextHandle context,
                               const char* pHostname,
                               int hostnameLen,
                               int peerVerifyOptions,
                               int sockfd,
                               BOOL blocking);


context A context to be used for the connection. Client and server certificates associated with the context will be used for the connection.
pHostname Hostname of the server (used for hostname verification).
hostnameLen Length of hostname buffer.
peerVerifyOptions A bitmask for verification options for the peer certificate. It can be a bitwise OR combination of any of the following: NSSL_VERIFY_NONE, NSSL_VERIFY_PEER_CA, NSSL_VERIFY_HOSTNAME, NSSL_VERIFY_DATE_VALIDITY.

The following predefined combinations are also available: NSSL_VERIFY_ALL or NSSL_VERIFY_ALL_EXCEPT_DATE.

For more information, see cafe/nssl/nsslclient.h.
sockfd Socket fd of the underlying TCP/IP connection. The application should create a socket using SOSocket and connect it to the server using SOConnect before calling NSSLCreateConnection.
blocking Indicates if the socket is going to be used in a blocking mode or non-blocking mode.

Return Values

NSSLConnectionHandle, NSSL connection handle (0 or positive value) on success, error code of type NSSL_RVAL on failure.


Creates a new SSL connection to perform secure data transfer over TCP/IP connection created by an application. An application can create maximum up to 32 connections.

Do Not Call From

Callbacks Do not call this function from any callback function.
Interrupt handler Do not call this function from any interrupt handler.
Exception handler Do not call this function from any exception handler.

See Also


Revision History

2012/08/16 Cleanup pass.
2012/04/06 Initial version.