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

211 lines
5.8 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>ns_addr()--Translate Network Services Address to 12-byte Address</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. -->
<!-- Change History: -->
<!-- YYMMDD USERID Change description -->
<!-- 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>
<!-- Java sync-link -->
<script type="text/javascript" language="Javascript" src="../rzahg/synch.js">
</script>
<a name="Top_Of_Page"></a>
<h2>ns_addr()--Translate Network Services Address to 12-byte Address</h2>
<div class="box" style="width: 60%;">
<br>
&nbsp;&nbsp;Syntax<br>
<pre>
#include &lt;sys/types.h&gt;
#include &lt;netns/ns.h&gt;
struct ns_addr ns_addr(char *<em>address_string</em>)
</pre>
<br>
&nbsp;&nbsp;Service Program Name: QSOSRV2<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 <em>ns_addr()</em> function is used to translate a network services
address from human readable format to a 12-byte hexadecimal address.</p>
<br>
<!-- Please NOTE: DO NOT DELETE THIS SECTION if this API has no authorities and locks. -->
<!-- Instead, use the commented out coding below to indicate NONE. -->
<h3>Authorities and Locks</h3>
<!-- Use this if there are no authorities and locks. -->
<p>None.</p>
<br>
<h3>Parameters</h3>
<dl>
<dt>char *<strong><em>address_string</em></strong></dt>
<dd>(Input) The network services address in human readable format.</dd>
</dl>
<br>
<h3>Return Value</h3>
<p>The <em>ns_addr()</em> function returns an <strong>ns_addr</strong>
structure.</p>
<br>
<h3>Usage Notes</h3>
<p>Notation of the human readable address string can be in many forms. The
following notation rules apply to all the format examples shown here.</p>
<ol>
<li>There are three fields to the address string: the network field denoted by
bytes n1 through n4, the host field denoted by bytes h1 through h6, and the
port number field denoted by bytes p1 and p2. These three fields can be
separated by a period (.), a colon (:), or a (#). Once one of these three
separator characters is encountered, the rest of the fields (the host field and
the port number field) may be byte separated by a period or a colon. The
network field cannot use byte separators because it is the first field and a
field separator has not been encountered. Also, you may not use the same
character as a field separator and a byte separator.<br>
<br>
</li>
<li>Each field may be specified as either decimal, hexadecimal, or octal. Octal
is specified by a preceding zero (for example, 011 is decimal value 9).
Hexadecimal can be specified in the following ways:
<ul>
<li>Specifying 0xnn.<br>
<br>
</li>
<li>Specifying 0Xnn.<br>
<br>
</li>
<li>Specifying xnn.<br>
<br>
</li>
<li>Specifying Xnn.<br>
<br>
</li>
<li>Specifying an H character at the end of the field.<br>
<br>
</li>
<li>Using a byte separator (only allowed for the host field or port number) in
the field that contains the byte.<br>
<br>
</li>
<li>Using any of the characters a,b,c,d,e,f,A,B,C,D,E,F in any byte in the
field.</li>
</ul>
</li>
</ol>
<p>The following are valid formats:</p>
<ul>
<li>Format 1 - <samp>n1n2n3n4:h1.h2.h3.h4.h5.h6:p1.p2</samp></li>
<li>Format 2 - <samp>n1n2n3n4.h1:h2:h3:h4:h5:h6.p1:p2</samp></li>
<li>Format 3 - <samp>n1n2n3n4#h1.h2.h3.h4.h5.h6#p1.p2</samp></li>
<li>Format 4 - <samp>n1n2n3n4#h1:h2:h3:h4:h5:h6#p1:p2</samp></li>
</ul>
<p>Although they can have byte separators, the host and port fields do not need
to be byte separated. Also, not all bytes need be specified for a given field.
If not all bytes are specified, the specified bytes are right-justified in the
field.</p>
<p><strong>Note:</strong> If the host field is not byte separated, the number
must not be larger than what can be contained in a 4-byte integer. That is, to
use nonzero values for bytes h1 and h2, you must byte separate the host
field.</p>
<p>The following formats are also valid:</p>
<ul>
<li>Format 5 - <samp>n1n2n3n4:h1h2h3h4h5h6:p1p2</samp></li>
<li>Format 6 - <samp>n1:h1.h2.h3.h4.h5.h6:p1p2</samp></li>
<li>Format 7 - <samp>n1:h1h2h3h4h5h6:p1.p2</samp></li>
</ul>
<p>Not all fields need be specified. The following formats are also valid:</p>
<ul>
<li>Format 8 - n1</li>
<li>Format 9 - n1:h1</li>
<li>Format 10 - n1::p1</li>
<li>Format 11 - ::p1</li>
</ul>
<p>As a further example, the following are just some of the ways that a network
number of 71 decimal, a host number of 8374930 decimal, and a port number of
9341 can be specified.</p>
<ul>
<li>71:8374930:9341</li>
<li>71:00.00.00.7f.ca.92:9341</li>
<li>71:7f.ca.92:9341</li>
<li>0x47:7fca92:247d</li>
<li>47H:7f.ca.92:9341</li>
<li>47H.7fca92.247d</li>
</ul>
<br>
<hr>
API introduced: V3R6
<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>