243 lines
6.3 KiB
HTML
243 lines
6.3 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>taddr2uaddr()--Translate a Local Address</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 ========================================== -->
|
||
|
<!-- RPCMST SCRIPT A converted by B2H R4.1 (346) (CMS) by PMHALL at -->
|
||
|
<!-- RCHVMW2 on 7 Oct 1998 at 23:43:14 -->
|
||
|
<!-- Edited by Kersten Feb 02 -->
|
||
|
<!--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 language="Javascript" src="../rzahg/synch.js" type="text/javascript">
|
||
|
</script>
|
||
|
|
||
|
<h2>taddr2uaddr()--Translate a Local Address</h2>
|
||
|
|
||
|
<div class="box" style="width: 60%;">
|
||
|
<br>
|
||
|
Syntax<br>
|
||
|
<!-- iddvc RMBR -->
|
||
|
<br>
|
||
|
<pre>
|
||
|
#include <netdir.h>
|
||
|
|
||
|
char *taddr2uaddr(struct netconfig <em>*nconf</em>,
|
||
|
struct netbuf <em>*addr</em>);
|
||
|
</pre>
|
||
|
|
||
|
<br>
|
||
|
Service Program Name: QZNFTRPC<br>
|
||
|
<!-- iddvc RMBR -->
|
||
|
<br>
|
||
|
Default Public Authority: *USE<br>
|
||
|
<!-- iddvc RMBR -->
|
||
|
<br>
|
||
|
Threadsafe: No<br>
|
||
|
<!-- iddvc RMBR -->
|
||
|
<br>
|
||
|
</div>
|
||
|
|
||
|
<p>The <strong>taddr2uaddr()</strong> function translates a transport-specific
|
||
|
(local) address to a transport-independent (universal) address.</p>
|
||
|
|
||
|
<br>
|
||
|
|
||
|
|
||
|
<h3>Parameters</h3>
|
||
|
|
||
|
<dl>
|
||
|
<dt><strong>nconf</strong> (Input) </dt>
|
||
|
|
||
|
<dd>The transport for which the address is valid.<br>
|
||
|
<br>
|
||
|
</dd>
|
||
|
|
||
|
<dt><strong>addr</strong> (Input) </dt>
|
||
|
|
||
|
<dd>The address to be translated to the universal representation.</dd>
|
||
|
</dl>
|
||
|
|
||
|
<br>
|
||
|
|
||
|
|
||
|
<h3>Authorities</h3>
|
||
|
|
||
|
<p>No authorization is required.</p>
|
||
|
|
||
|
<br>
|
||
|
|
||
|
|
||
|
<h3>Return Value</h3>
|
||
|
|
||
|
<table cellpadding="5">
|
||
|
<!-- cols="15 85" -->
|
||
|
<tr>
|
||
|
<td valign="top"><em>universal address</em></td>
|
||
|
<td valign="top">A string that contains the universal address is returned if
|
||
|
the function <strong>taddr2uaddr()</strong> was successful.</td>
|
||
|
</tr>
|
||
|
|
||
|
<tr>
|
||
|
<td valign="top"><em>NULL</em></td>
|
||
|
<td valign="top">A NULL pointer is returned if the function
|
||
|
<strong>taddr2uaddr()</strong> was not successful. The <em>nd_errno</em> global
|
||
|
variable (defined in <strong><netdir.h></strong>) is set to indicate the
|
||
|
error.</td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
|
||
|
<br>
|
||
|
<br>
|
||
|
|
||
|
|
||
|
<h3>Error Conditions</h3>
|
||
|
|
||
|
<p>If the function <strong>taddr2uaddr()</strong> is not successful,
|
||
|
<em>nd_errno</em> usually indicates the following error:</p>
|
||
|
|
||
|
<table cellpadding="5">
|
||
|
<!-- cols="15 85" -->
|
||
|
<tr>
|
||
|
<td valign="top"><em>[ND_BADARG]</em></td>
|
||
|
<td valign="top">Bad argument passed.</td>
|
||
|
</tr>
|
||
|
|
||
|
<tr>
|
||
|
<td valign="top"><em>[ND_SYSTEM]</em></td>
|
||
|
<td valign="top">A damaged object was encountered. The damaged object cannot be
|
||
|
used.</td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
|
||
|
<br>
|
||
|
<br>
|
||
|
|
||
|
|
||
|
<h3>Error Messages</h3>
|
||
|
|
||
|
<table width="100%" cellpadding="5">
|
||
|
<!-- cols="15 85" -->
|
||
|
<tr>
|
||
|
<th align="left" valign="top">Message ID</th>
|
||
|
<th align="left" valign="top">Error Message Text</th>
|
||
|
</tr>
|
||
|
|
||
|
<tr>
|
||
|
<td width="15%" valign="top">CPF9872 E</td>
|
||
|
<td width="85%" valign="top">Program or service program &1 in library
|
||
|
&2 ended. Reason code &3.</td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
|
||
|
<br>
|
||
|
<br>
|
||
|
|
||
|
|
||
|
<h3>Usage Notes</h3>
|
||
|
|
||
|
<p><strong>taddr2uaddr()</strong> translates the address pointed to by
|
||
|
<em>addr</em> and returns a transport independent character representation of
|
||
|
the address (universal address).</p>
|
||
|
|
||
|
<p>The caller is responsible to free the returned universal address when
|
||
|
done.</p>
|
||
|
|
||
|
<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>taddr2uaddr()</strong> is used:</p>
|
||
|
|
||
|
<pre>
|
||
|
#include <netconfig.h>
|
||
|
#include <netdir.h>
|
||
|
|
||
|
main()
|
||
|
{
|
||
|
void *handlep; /* A handle into network selection */
|
||
|
struct netconfig *nconf; /* Transport information */
|
||
|
struct nd_hostserv nd_hostserv; /* Host and service information */
|
||
|
struct nd_addrlist *nd_addrlistp; /* Addresses for the service */
|
||
|
struct netbuf *netbufp; /* The address of the service */
|
||
|
int i; /* The number of addresses */
|
||
|
char *uaddr; /* Service universal address */
|
||
|
|
||
|
/* Initialize the network selection mechanism */
|
||
|
if (handlep = setnetconfig()) == (void *)NULL)
|
||
|
{
|
||
|
exit(1);
|
||
|
}
|
||
|
|
||
|
/* Get the netconfig handle */
|
||
|
if ((nconf = getnetconfig(handlep)) == (struct netconf *)NULL)
|
||
|
{
|
||
|
printf("Error in getting the netconfig handle.\n");
|
||
|
exit(1);
|
||
|
}
|
||
|
|
||
|
/* Get the address for service specified in nd_hostserv.h_serv
|
||
|
* on the host specified in nd_hostserv.h_host over the
|
||
|
* transport provider specified in the netconfig structure
|
||
|
* Note: nd_hostserv.h_host and nd_hostserv.h_serv need to be
|
||
|
* set up prior to the call to netdir_getbyname().
|
||
|
*/
|
||
|
if (netdir_getbyname(nconf, &nd_hostserv, &nd_addrlistp)
|
||
|
!= ND_OK)
|
||
|
{
|
||
|
printf("Cannot determine address for service\n");
|
||
|
/* Release the netconfig handle allocated by setnetconfig() */
|
||
|
endnetconfig(handlep);
|
||
|
exit(1);
|
||
|
}
|
||
|
|
||
|
/* Convert the transport-specific address into universal address
|
||
|
* notation and print it.
|
||
|
*/
|
||
|
netbufp = nd_addrlistp->n_addrs;
|
||
|
uaddr = taddr2uaddr(nconf, netbufp);
|
||
|
if (uaddr != NULL)
|
||
|
{
|
||
|
printf("The address of the service %s on host %s is %s\n",
|
||
|
nd_hostserv.h_serv, nd_hostserv.h_host, uaddr);
|
||
|
free(uaddr);
|
||
|
}
|
||
|
|
||
|
/* Free the netdir structure allocated by netdir_getbyname() */
|
||
|
netdir_free(nd_addrlistp, ND_HOSTSERVLIST);
|
||
|
|
||
|
/* Release the netconfig handle allocated by setnetconfig() */
|
||
|
endnetconfig(handlep);
|
||
|
}
|
||
|
|
||
|
</pre>
|
||
|
|
||
|
<br>
|
||
|
<hr>
|
||
|
API introduced: V4R2
|
||
|
|
||
|
<hr>
|
||
|
<table cellpadding="2" cellspacing="2" align="center">
|
||
|
<tr align="center">
|
||
|
<td valign="middle" align="center"><a href="#Top_Of_Page">Top</a> | <a href=
|
||
|
"rpc1.htm">Remote Procedure Call (RPC) APIs</a> | <a href="aplist.htm">APIs by
|
||
|
category</a></td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
</body>
|
||
|
</html>
|
||
|
|