218 lines
5.8 KiB
HTML
218 lines
5.8 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>res_hostalias()--Retrieve the host alias</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. -->
|
|
<!-- Unix8 SCRIPT J converted by B2H R4.1 (346) (CMS) by V2KEA304 -->
|
|
<!-- at RCHVMW2 on 17 Feb 1999 at 11:05:09 -->
|
|
<!-- 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 type="text/javascript" language="Javascript" src="../rzahg/synch.js">
|
|
</script>
|
|
|
|
<h2>res_hostalias()--Retrieve the host alias</h2>
|
|
|
|
<div class="box" style="width: 60%;">
|
|
<br>
|
|
Syntax<br>
|
|
<pre>
|
|
#include <sys/types.h>
|
|
#include <netinet/in.h>
|
|
#include <arpa/nameser.h>
|
|
#include <resolv.h>
|
|
|
|
const char * res_hostalias(const state* <em>res</em>,
|
|
const char* <em>name</em>,
|
|
char* <em>destination</em>,
|
|
size_t <em>destination_length</em>)
|
|
|
|
</pre>
|
|
|
|
<br>
|
|
Service Program Name: QSOSRV2<br>
|
|
<!-- iddvc RMBR -->
|
|
<br>
|
|
Default Public Authority: *USE<br>
|
|
<!-- iddvc RMBR -->
|
|
<br>
|
|
Threadsafe: Yes<br>
|
|
<!-- iddvc RMBR -->
|
|
<br>
|
|
</div>
|
|
|
|
<p>The <em>res_hostalias()</em> looks up the specified name in the host aliases
|
|
file specified by the environment variable <em>HOSTALIASES</em>.</p>
|
|
|
|
<p>A user may create a host aliases file. This file maps user defined aliases
|
|
to host names, unlike the i5/OS host table (or a DNS) which maps host names to
|
|
ip addresses. Also, it requires no special authorities for a user to define an
|
|
alias. It's simply a shorthand for a server which can be easily changed and
|
|
controlled by users. No iSeries server default alias file is created.</p>
|
|
|
|
<p>The format is simply an alias followed by blank(s) followed by a domain
|
|
name. For example, mypc may be an alias for m999.mydomain.ibm.com and myaix may
|
|
be an alias for m111.mydomain.ibm.com:</p>
|
|
|
|
<p>mypc m999.mydomain.ibm.com.</p>
|
|
|
|
<p>myaix m111.mydomain.ibm.com</p>
|
|
|
|
<p>Other functions, like <a href="resnsearch.htm">res_nsearch()</a> or <a href=
|
|
"tsghostb.htm">gethostbyname_r()</a> will resolve an alias like "mypc" to the
|
|
full domain name "m999.mydomain.ibm.com." before querying the DNS or i5/OS
|
|
host table.</p>
|
|
|
|
<p><strong>Note:</strong>An alias may not contain periods.</p>
|
|
|
|
<br>
|
|
<h3>Parameters</h3>
|
|
|
|
<dl>
|
|
<dt><strong>res</strong></dt>
|
|
|
|
<dd>(Input) The pointer to the <strong>state</strong> structure.<br>
|
|
<br>
|
|
</dd>
|
|
|
|
<dt><strong>name</strong></dt>
|
|
|
|
<dd>(Input) The pointer to the host name.<br>
|
|
<br>
|
|
</dd>
|
|
|
|
<dt><strong>destination</strong></dt>
|
|
|
|
<dd>(Output) The pointer to the destination buffer. This pointer will be the
|
|
return value if the call succeeds.<br>
|
|
<br>
|
|
</dd>
|
|
|
|
<dt><strong>destination_length</strong></dt>
|
|
|
|
<dd>(Input) The length of the destination buffer.</dd>
|
|
</dl>
|
|
|
|
<br>
|
|
<h3>Authorities</h3>
|
|
|
|
<p>Authorization of *R (allow access to the object) to the host aliases file
|
|
specified by the <em>HOSTALIASES</em> environment variable.</p>
|
|
|
|
<p>You also need *X authority to each directory in the path of the host aliases
|
|
file.</p>
|
|
|
|
<br>
|
|
<h3>Return Value</h3>
|
|
|
|
<p>(NULL) No alias found or an error occurred.</p>
|
|
|
|
<p>(destination) A pointer to the destination buffer updated with the alias
|
|
found.</p>
|
|
|
|
<br>
|
|
<h3>Error Conditions</h3>
|
|
<p>When the <em>res_hostalias()</em> function fails, <em>errno</em> can be set
|
|
to one of the following:</p>
|
|
<dl>
|
|
|
|
<dt><em>[EACCES]</em></dt>
|
|
<dd><p>Permission denied. The process does not have the
|
|
appropriate privileges to the host aliases file specified by the
|
|
<em>HOSTALIASES</em> environment variable.</p></dd>
|
|
|
|
<dt><em>[EFAULT]</em></dt>
|
|
<dd><p>The system detected a pointer that was invalid
|
|
while attempting to access an input pointer.</p></dd>
|
|
|
|
<dt><em>[EINVAL]</em></dt>
|
|
<dd><p>One of the following reasons:</p>
|
|
<ul>
|
|
<li>The <strong>res</strong> appears to have been previously initialized but
|
|
the reserved field is not set to zeros or an input pointer was NULL.<br><br></li>
|
|
<li>An alias was found that contains a period.</li>
|
|
</ul>
|
|
</dd>
|
|
</dl>
|
|
|
|
<br>
|
|
|
|
<h3>Usage Notes</h3>
|
|
|
|
<ol>
|
|
<li>If the <em>RES_NOALIASES</em> option is set, no processing is done and a
|
|
NULL will be returned.<br>
|
|
<br>
|
|
</li>
|
|
|
|
<li>If the res structure has not been initialized, <em>res_ninit()</em> will be
|
|
called.</li>
|
|
</ol>
|
|
|
|
<br>
|
|
<h3>Related Information</h3>
|
|
|
|
<ul>
|
|
<li><a href="resfindzonecut.htm">res_findzonecut()</a>--Find the Enclosing Zone and
|
|
Servers<br>
|
|
<br>
|
|
</li>
|
|
|
|
<li><a href="resninit.htm">res_init()</a>--Initialize res Structure<br>
|
|
<br>
|
|
</li>
|
|
|
|
<li><a href="resnclose.htm">res_nclose()</a>--Close Socket and Reset res
|
|
Structure<br>
|
|
<br>
|
|
</li>
|
|
|
|
<li><a href="resnmkquery.htm">res_nmkquery()</a>--Place Domain Query in
|
|
Buffer<br>
|
|
<br>
|
|
</li>
|
|
|
|
<li><a href="resnquery.htm">res_nquery()</a>--Send Domain Query<br>
|
|
<br>
|
|
</li>
|
|
|
|
<li><a href="resnsearch.htm">res_nsearch()</a>--Search for Domain Name<br>
|
|
<br>
|
|
</li>
|
|
|
|
<li><a href="resnsend.htm">res_nsend()</a>--Send Buffered Domain Query<br>
|
|
<br>
|
|
</li>
|
|
|
|
<li><a href="resxlt.htm">res_xlate()</a>--Translate DNS Packets</li>
|
|
</ul>
|
|
|
|
<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>
|
|
|