ibm-information-center/dist/eclipse/plugins/i5OS.ic.apis_5.4.0.1/sslperr.htm

205 lines
6.0 KiB
HTML
Raw Normal View History

2024-04-02 14:02:31 +00:00
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Copyright" content="Copyright (c) 2006 by IBM Corporation">
<title>SSL_Perror()--Print SSL Error Message API</title>
<!-- All rights reserved. Licensed Materials Property of IBM -->
<!-- US Government Users Restricted Rights -->
<!-- Use, duplication or disclosure restricted by -->
<!-- GSA ADP Schedule Contract with IBM Corp. -->
<!-- Begin Header Records -->
<!-- Created for V5R1 by Chris Gloe -->
<!-- End Header Records -->
<link rel="stylesheet" type="text/css" href="../rzahg/ic.css">
</head>
<body>
<a name="Top_Of_Page"></a>
<!--Java sync-link-->
<script type="text/javascript" language="Javascript" src="../rzahg/synch.js">
</script>
<h2>SSL_Perror()--Print SSL Error Message</h2>
<div class="box" style="width: 60%;">
<br>
&nbsp;&nbsp;Syntax
<pre>
#include &lt;qsossl.h&gt;
void SSL_Perror(int <em>sslreturnvalue</em>,
const char* <em>string</em>);
</pre>
&nbsp;&nbsp;Service Program Name: QSOSSLSR<br>
<!-- iddvc RMBR -->
<br>
&nbsp;&nbsp;Default Public Authority: *USE<br>
<!-- iddvc RMBR -->
<br>
&nbsp;&nbsp;Threadsafe: Yes<br>
<!-- iddvc RMBR -->
<br>
</div>
<p>The <strong><em>SSL_Perror()</em></strong> function prints an error message
to stderr. If <strong><em>string</em></strong> is not NULL and does not point
to a null character, the string pointed to by <strong><em>string</em></strong>
is printed to the standard error stream. If a <strong><em>string</em></strong>
is printed, it is followed by a colon and a space. Regardless of if
<strong><em>string</em></strong> was printed or not, the message associated
with the <strong><em>sslreturnvalue</em></strong> is printed followed by a
new-line character. Also, the message associated with the thread's
<strong><em>errno</em></strong> is printed followed by a new-line
character.</p>
<br>
<h3>Parameters</h3>
<dl>
<dt>int <strong><em>sslreturnvalue</em></strong> &nbsp;(Input)&nbsp;</dt>
<dd>The Return Value received from a SSL API.<br>
<br>
</dd>
<dt>char* <strong><em>string</em></strong> &nbsp;(Input)&nbsp;</dt>
<dd>The string to be printed prior to the message associated with the
<strong><em>sslreturnvalue</em></strong>. If no preceding message is desired,
NULL must be entered.</dd>
</dl>
<br>
<h3>Authorities</h3>
<p>No authorization is required.</p>
<br>
<h3>Return Value</h3>
<p>There is no return value.</p>
<br>
<h3>Error Conditions</h3>
<p>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 <strong><em>sslreturnvalue</em></strong> is unrecognized or if unable to
retrieve the message corresponding to <strong><em>sslreturnvalue</em></strong>,
then an <strong>Unknown error</strong> message will be printed following the
<strong><em>string</em></strong>. Also, the message associated with the value
found in the thread's <strong><em>errno</em></strong> is printed.
<strong>Note:</strong> the value of errno may be updated by
<strong><em>SSL_Perror()</em></strong> in some error conditions.</p>
<br>
<h3>Error Messages</h3>
<p>See Error Conditions.</p>
<br>
<h3>Related Information</h3>
<ul>
<li><a href="sslstrer.htm">SSL_Strerror()</a>--Retrieve SSL Runtime Error
Message<br><br></li>
<li><a href="sslcreat.htm">SSL_Create()</a>--Enable SSL Support for the Specified
Socket Descriptor<br><br></li>
<li><a href="ssldest.htm">SSL_Destroy()</a>--End SSL Support for the Specified SSL
Session<br><br></li>
<li><a href="sslhands.htm">SSL_Handshake()</a>--Initiate the SSL Handshake
Protocol<br><br></li>
<li><a href="sslinit.htm">SSL_Init()</a>--Initialize the Current Job for
SSL<br><br></li>
<li><a href="sslinita.htm">SSL_Init_Application()</a>--Initialize the Current Job
for SSL Processing Based on the Application Identifier<br><br></li>
<li><a href="sslread.htm">SSL_Read()</a>--Receive Data from an SSL-Enabled Socket
Descriptor<br><br></li>
<li><a href="sslwrite.htm">SSL_Write()</a>--Write Data to an SSL-Enabled Socket
Descriptor<br><br></li>
</ul>
<br>
<h3>Example</h3>
<p>See <a href="../apiref/aboutapis.htm#codedisclaimer">Code disclaimer information</a>
for information pertaining to code examples.</p>
<p>The following example shows how <strong>SSL_Perror()</strong> is used:</p>
<pre>
#include &lt;stdio.h&gt;
#include &lt;sys/types.h&gt;
#include &lt;sys/socket.h&gt;
#include &lt;qsossl.h&gt;
#include &lt;netinet/in.h&gt;
#include &lt;arpa/inet.h&gt;
#include &lt;errno.h&gt;
/* 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 *)&amp;SSL_Init, 0x00, sizeof(sslinit));
sslinit.keyringFileName = "/keyringfile.kyr";
sslinit.keyringPassword = NULL;
sslinit.cipherSuiteList = &amp;cipher[0];
sslinit.cipherSuiteListLen = 3;
/*************************************************/
/* initialize SSL security call SSL_Init */
/*************************************************/
if ((rc = SSL_Init(&amp;sslinit)) != 0)
{
<strong>SSL_Perror</strong>(rc, "Could not initialize SSL");
}
...
}
</pre>
<br>
<hr>
API introduced: V5R1
<hr>
<center>
<table cellpadding="2" cellspacing="2">
<tr align="center">
<td valign="middle" align="center"><a href="#Top_Of_Page">Top</a> | <a href=
"unix.htm">UNIX-Type APIs</a> | <a href="aplist.htm">APIs by category</a> </td>
</tr>
</table></center>
</body>
</html>