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

385 lines
10 KiB
HTML

<!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>qtoq_accept()--Accept QoS Sockets Connection API</title>
<!-- Begin Header Records -->
<!-- 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. -->
<!-- Created by John Hall and Dale LeFevre for V5R2 -->
<!-- File tagging cleanup completed Mar 2002 by v2cdijab -->
<!-- Change History: -->
<!-- YYMMDD USERID Change description -->
<!-- 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>qtoq_accept()--Accept QoS Sockets Connection API</h2>
<div class="box" style="width: 80%;">
<br>
&nbsp;&nbsp;Syntax<br>
<pre>
#include &lt;qtoqsapi.h&gt;
int qtoq_accept(
int socket_descriptor,
int req_type,
struct sockaddr *address,
int *address_length,
qos_req *qos_data,
unsigned int *qos_session,
int *qos_descriptor,
)
</pre>
<br>
&nbsp;&nbsp;Service Program Name: QSYS/QTOQSAPI<br>
<!-- iddvc RMBR -->
<br>
&nbsp;&nbsp;Default Public Authority: *EXCLUDE<br>
<!-- iddvc RMBR -->
<br>
&nbsp;&nbsp;Threadsafe: Yes<br>
<!-- iddvc RMBR -->
<br>
</div>
<p>The <strong>qtoq_accept()</strong> API provides simplified Quality of
Service support for connection-oriented sockets communications between RSVP
aware applications on a client and server. The standard <strong>
accept()</strong> sockets call can be replaced with this API.</p>
<br>
<h3>Parameters</h3>
<dl>
<dt><strong><em>socket_descriptor</em></strong></dt>
<dd>(Input) Required
<p>An opened socket descriptor that has been bound to the IP address and port
from which the application will accept connection requests.</p>
</dd>
<dt><strong><em>req_type</em></strong></dt>
<dd>Input) Required
<p>The type of QoS service being requested. The possible values are:</p>
<table cellpadding="5">
<!-- cols="35 65" -->
<tr>
<td align="left" valign="top"><em>REQ_SIGNAL_RET_EVENTS (1)</em></td>
<td align="left" valign="top">Use normal RSVP signaling and return RSVP events
to the calling program.</td>
</tr>
<tr>
<td align="left" valign="top" nowrap><em>REQ_SIGNAL_NORET_EVENTS (2)</em></td>
<td align="left" valign="top">Use normal RSVP signaling without returning
events to the calling program.</td>
</tr>
<tr>
<td align="left" valign="top"><em>REQ_NOSIGNAL (3)</em></td>
<td align="left" valign="top">See if the RSVP rule for the requested connection
has been defined as "no signaling." If yes, then load the requested rule.</td>
</tr>
</table>
<br>
</dd>
<dt><strong><em>address</em></strong></dt>
<dd>(Output) Required
<p>Pointer to a <samp>sockaddr</samp> structure where the IP address and port
of the client requesting the connection will be stored.</p>
</dd>
<dt><strong><em>Address_length</em></strong></dt>
<dd>(Input/Output) Required
<p>Pointer to an integer where the size of the address variable is given to the
API and the length of the returned client address will be stored.</p>
</dd>
<dt><strong><em>qos_data</em></strong></dt>
<dd>(Input) Required
<p>Pointer to a <samp>qos_req</samp> data structure that defines the type of
service being requested and the source and destination addresses of the
request.</p>
<p>The qos_req data structure is defined as follows:</p>
<pre>
typedef struct
{
int service; /* Values can be GUARANTEED_SERV (2)
or CONTROLLED_LOAD_SERV (5) */
union
{
struct CL_spec /* Controlled-Load service */
{
float TB_Tspec_r; /* token bucket rate in bytes/sec */
float TB_Tspec_b; /* token bucket depth in bytes */
float TB_Tspec_p; /* token bucket peak in bytes/sec */
unsigned long TB_Tspec_m; /* min policed unit in bytes */
unsigned long TB_Tspec_M; /* max packet size in bytes */
} CL_spec;
struct Guar_spec /* Guaranteed service */
{
float Guar_R; /* guaranteed rate in bytes/sec */
unsigned long Guar_S; /* slack term in microsecs */
} Guar_spec;
} spec_u;
} qos_spec_t;
typedef struct
{
struct sockaddr dest; /* Destination address/port */
int d_length; /* Destination address length*/
struct sockaddr source; /* Source address/port */
int s_length; /* Source address length */
int style; /* Style of Reservation. */
qos_spec_t Spec; /* Flow info */
unsigned char result; /* API status */
} qos_req; /* End of QoS request structure */\
</pre>
</dd>
<dt><strong><em>qos_session</em></strong></dt>
<dd>(Output) Required
<p>Pointer to an integer value where the unique QoS session ID can be stored.
This ID is required for all future QoS API calls.</p>
</dd>
<dt><strong><em>qos_descriptor</em></strong></dt>
<dd>(Output) Optional
<p>Pointer to an integer where the value of the descriptor that the application
can wait on for RSVP events is stored. This value is set to NULL if it is not
used.</p>
</dd>
</dl>
<br>
<h3>Authorities</h3>
<p>None.</p>
<br>
<h3>Return Values</h3>
<table cellpadding="5">
<!-- cols="5 95" -->
<tr>
<td align="left" valign="top"><em>0</em></td>
<td align="left" valign="top">if successful.</td>
</tr>
<tr>
<td align="left" valign="top"><em>-1</em></td>
<td align="left" valign="top">if function failed. Errno indicates error
reason.</td>
</tr>
</table>
<br>
<br>
<h3>Error Conditions</h3>
<p>When qtoq_accept() fails errno can be set to one of the following:</p>
<dl>
<dt><em>[EBADF]</em></dt>
<dd><p>Descriptor not valid.</p>
</dd>
<dt><em>[EFAULT]</em></dt>
<dd><p>Bad address.</p>
</dd>
<dt><em>[ECONNABORTED]</em></dt>
<dd><p>Connection ended abnormally. An accept() was issued on a socket for which
receives have been disallowed (due to a shutdown() call).</p>
<p>This also could be encountered if time elapsed since a successful Rbind() is
greater than the margin allowed by the associated SOCKS server.</p>
</dd>
<dt><em>[EFAULT]</em></dt>
<dd><p>Bad address. System detected an address that was not valid while attempting
to access the address or address_length parameters.</p>
</dd>
<dt><em>[EINTR]</em></dt>
<dd><p>Interrupted function call.</p>
</dd>
<dt><em>[EINVAL]</em></dt>
<dd><p>Parameter not valid. This error code indicates one of the following:</p>
<ul>
<li>The address_length parameter is set to a value that is less than zero, and
the address parameter is set to a value other than a NULL pointer.</li>
<li>A listen() has not been issued against the socket referenced by the
socket_descriptor parameter.<br>
<br>
</li>
</ul>
</dd>
<dt><em>[EIO]</em></dt>
<dd><p>Input/output error.</p>
</dd>
<dt><em>[EMFILE]</em></dt>
<dd><p>Too many descriptions for this process.</p>
</dd>
<dt><em>[ENFILE]</em></dt>
<dd><p>Too many descriptions in system.</p>
</dd>
<dt><em>[ENOBUFS]</em></dt>
<dd><p>There is not enough buffer space for the requested operation.</p>
</dd>
<dt><em>[ENOTSOCK]</em></dt>
<dd><p>The specified descriptor does not reference a socket.</p>
</dd>
<dt><em>[EOPNOTSUPP]</em></dt>
<dd><p>Operation not supported. The socket_descriptor parameter references a
socket that does not support the accept(). The accept() is valid only on
sockets that are connection-oriented (for example, type of SOCK_STREAM).</p>
</dd>
<dt><em>[EUNATCH]</em></dt>
<dd><p>The protocol required to support the specified address family is not
available at this time.</p>
</dd>
<dt><em>[EUNKNOWN]</em></dt>
<dd><p>Unknown system state.</p>
</dd>
<dt><em>[EWOULDBLOCK]</em></dt>
<dd>Operation would have caused the thread to be suspended.</dd>
</dl>
<br>
<br>
<h3>Error Messages</h3>
<table width="100%" cellpadding="5">
<!-- cols="15 85" -->
<tr>
<th align="left" valign="top" nowrap>Message ID</th>
<th align="left" valign="top">Error Message Text</th>
</tr>
<tr>
<td align="left" valign="top">CPE3418 E</td>
<td align="left" valign="top">Possible APAR condition or hardware failure.</td>
</tr>
<tr>
<td align="left" valign="top">CPF9872 E</td>
<td align="left" valign="top">Program or service program &amp;1 in library
&amp;2 ended. Reason code &amp;3.</td>
</tr>
<tr>
<td align="left" valign="top">CPFA081 E</td>
<td align="left" valign="top">Unable to set return value or error code.</td>
</tr>
</table>
<br>
<br>
<h3>Usage Notes</h3>
<ol>
<li>The application program can choose to be signaled when RSVP events occur or
allow the QoS server to handle the events. If the server handles the events,
the application program will not be informed if the RSVP signaling fails or if
the requested reservations have been changed by the network.</li>
<li>The REQ_NOSIGNAL request type will be honored only if a policy exists that
matches the requested connection and it is marked as a "no signaling" policy.
Otherwise, an <em>[ENOTSUPPORT]</em> error will be returned.</li>
</ol>
<br>
<h3>Related Information</h3>
<p>For a description of the RSVP protocol, see RFC 2205 on the RFC Pages for <a
href="http://www.ietf.org/rfc.html">The Internet Engineering Task
Force</a>.<img src="www.gif" alt="Link outside Information Center"></p>
<br>
<hr>
API introduced: V5R2
<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>