SSL_Perror()--Print SSL Error Message


  Syntax
 #include <qsossl.h>

 void SSL_Perror(int sslreturnvalue,
                 const char* string);  
                 
  Service Program Name: QSOSSLSR

  Default Public Authority: *USE

  Threadsafe: Yes

The SSL_Perror() function prints an error message to stderr. If string is not NULL and does not point to a null character, the string pointed to by string is printed to the standard error stream. If a string is printed, it is followed by a colon and a space. Regardless of if string was printed or not, the message associated with the sslreturnvalue is printed followed by a new-line character. Also, the message associated with the thread's errno is printed followed by a new-line character.


Parameters

int sslreturnvalue  (Input) 
The Return Value received from a SSL API.

char* string  (Input) 
The string to be printed prior to the message associated with the sslreturnvalue. If no preceding message is desired, NULL must be entered.

Authorities

No authorization is required.


Return Value

There is no return value.


Error Conditions

This API calls the Retrieve SSL Runtime Error Message (SSL_Strerror) API in order to perform its task. It inherits all error conditions from this function. If the sslreturnvalue is unrecognized or if unable to retrieve the message corresponding to sslreturnvalue, then an Unknown error message will be printed following the string. Also, the message associated with the value found in the thread's errno is printed. Note: the value of errno may be updated by SSL_Perror() in some error conditions.


Error Messages

See Error Conditions.


Related Information


Example

The following example shows how SSL_Perror() is used.

Note: By using the code examples, you agree to the terms of the Code license and disclaimer information.

#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <qsossl.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <errno.h>

/* bufferLen is 250 bytes */
#define bufferLen 250

void main()
{
  int bufferLen, on = 1, rc = 0, sd, sd2, addrlen = 0;
  char buffer[bufferLen];

  SSLInit sslinit;
  SSLHandle* sslh;

  struct sockaddr_in addr;

  unsigned short int cipher[3] = {
                   SSL_RSA_WITH_RC4_128_MD5,
                   SSL_RSA_WITH_RC4_128_SHA,
                   SSL_RSA_EXPORT_WITH_RC4_40_MD5
   };

  /*************************************************/
  /* memset sslinit structure to hex zeros and     */
  /* fill in values for the sslinit structure      */
  /*************************************************/
  memset((char *)&SSL_Init, 0x00, sizeof(sslinit));
  sslinit.keyringFileName = "/keyringfile.kyr";
  sslinit.keyringPassword = NULL;
  sslinit.cipherSuiteList = &cipher[0];
  sslinit.cipherSuiteListLen = 3;

  /*************************************************/
  /* initialize SSL security call SSL_Init         */
  /*************************************************/
  if ((rc = SSL_Init(&sslinit)) != 0)
  {
    SSL_Perror(rc, "Could not initialize SSL"); 
  }

  ...

}


API introduced: V5R1

[ Back to top | UNIX-Type APIs | APIs by category ]