SIOCSHSNOTIFY C language example
The following examples show sample client-side code for building and issuing the SIOCSHSNOTIFY ioctl.
#include "ezbzhsnc.h"
...
HSNOTIFY_IOCTL hsnotify_parms;
int s = socket(AF_INET, SOCK_STREAM, 0); /* open the TCP socket */
...
/* connect socket to server and send and/or receive some data over it */
...
/* prepare the System SSL operating environment */
int rc;
rc = gsk_environment_open(...);
rc = gsk_attribute_set_enum(...); /* typically multiple of these */
rc = gsk_environment_init(...);
...
rc = gsk_secure_socket_init(...);
...
/* since application-specific data has already flowed over the socket */
/* tell zERT discovery when to look for TLS handshake */
memset(&hsnotify_parms, 0, sizeof(HSNOTIFY_IOCTL)); /* all fields=0 */
hsnotify_parms.HSNOTIFYi_Ver = HSNOTIFY_VERSION1; /* version=1 */
rc = ioctl(s,SIOCSHSNOTIFY,(char *)&hsnotify_parms); /* notify zERT */
if (rc != 0) {
/* log or ignore the ioctl error (depending on your program logic and the error codes) */
}
/* create the TLS session */
rc = gsk_secure_socket_init(...);
...