z/OS Communications Server: IP Programmer's Guide and Reference
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


SIOCTTLSCTL ioctl PL/I example

z/OS Communications Server: IP Programmer's Guide and Reference
SC27-3659-02

The following sample PL/I code builds and issues an SSIOCTTLSCTL ioctl that requests secure connection initialization and the return of the partner's certificate in the provided buffer.

...
 /* get the SIOCTTLSCTL ioctl mapping and constants  */
 % include EZBZTLS1; 
...
 /* area to return the certificate data if available */
 DCL CERTIF  CHAR(1000) INIT(''B);
....

/* allocate storage for the SIOCTTLSCTL ioctl */
 Allocate TTLS_IOCTL; 
 TTLSI_VER = TTLS_VERSION1;
 TTLSI_REQ_TYPE = TTLS_INIT_CONNECTION | TTLS_RETURN_CERTIFICATE;

/* if you DO NOT want to get the certificate then you must */
/* clear the following two fields                          */
/* TTLSi_BufferPtr = SYSNULL;                              */ 
/* TTLSi_BufferLen = 0;                                    */

/* if you DO want to get the certificate then you must     */
/* set the following two fields                            */
 TTLSi_BufferPtr = ADDR(CERTIF);
 TTLSi_BufferLen = LENGTH(CERTIF);

 call ezasoket(IOCTL,
               SOCKET,
               SIOCTTLSCTL,   /* TTLS ioctl           */
               TTLS_IOCTL,    /* input buffer         */
               TTLS_IOCTL,    /* output buffer        */
               ERRNO,
               RETCODE);
 if RETCODE < 0 then do;
   /* do failure logic. If the socket is in non-      */
   /* blocking mode then you may also receive RETCODE */
   /* of -1 with an ERRNO of EINPROGRESS. This does   */
   /* not indicate an error. Wait for the completion  */
   /* of the handshake with SELECT for WRITEABLE.     */
   ...
 end;

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014