1 <!-- Copyright (C) 2003 Red Hat, Inc. -->
2 <!-- This material may be distributed only subject to the terms -->
3 <!-- and conditions set forth in the Open Publication License, v1.0 -->
4 <!-- or later (the latest version is presently available at -->
5 <!-- http://www.opencontent.org/openpub/). -->
6 <!-- Distribution of the work or derivative of the work in any -->
7 <!-- standard (paper) book form is prohibited unless prior -->
8 <!-- permission is obtained from the copyright holder. -->
13 ><meta name="MSSmartTagsPreventParsing" content="TRUE">
16 CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
19 TITLE="eCos Reference Manual"
20 HREF="ecos-ref.html"><LINK
22 TITLE="TCP/IP Library Reference"
23 HREF="tcpip-library-reference.html"><LINK
26 HREF="net-common-tcpip-manpages-net-addrcmp.html"><LINK
29 HREF="net-common-tcpip-manpages-resolver.html"></HEAD
40 SUMMARY="Header navigation table"
49 >eCos Reference Manual</TH
57 HREF="net-common-tcpip-manpages-net-addrcmp.html"
65 >Chapter 38. TCP/IP Library Reference</TD
71 HREF="net-common-tcpip-manpages-resolver.html"
85 NAME="NET-COMMON-TCPIP-MANPAGES-NS">ns</H1
94 >NS(3) System Library Functions Manual NS(3)
97 ns_addr, ns_ntoa - Xerox NS(tm) address conversion routines
100 #include <sys/types.h>
101 #include <netns/ns.h>
107 ns_ntoa(struct ns_addr ns);
110 The routine ns_addr() interprets character strings representing XNS
111 addresses, returning binary information suitable for use in system calls.
112 The routine ns_ntoa() takes XNS addresses and returns ASCII strings rep-
113 resenting the address in a notation in common use in the Xerox Develop-
116 <network number>.<host number>.<port number>
118 Trailing zero fields are suppressed, and each number is printed in hex-
119 adecimal, in a format suitable for input to ns_addr(). Any fields lack-
120 ing super-decimal digits will have a trailing `H' appended.
122 Unfortunately, no universal standard exists for representing XNS
123 addresses. An effort has been made to ensure that ns_addr() be compati-
124 ble with most formats in common use. It will first separate an address
125 into 1 to 3 fields using a single delimiter chosen from period (`.'),
126 colon (`:'), or pound-sign `#'. Each field is then examined for byte
127 separators (colon or period). If there are byte separators, each sub-
128 field separated is taken to be a small hexadecimal number, and the
129 entirety is taken as a network-byte-ordered quantity to be zero extended
130 in the high-network-order bytes. Next, the field is inspected for
131 hyphens, in which case the field is assumed to be a number in decimal
132 notation with hyphens separating the millenia. Next, the field is
133 assumed to be a number: It is interpreted as hexadecimal if there is a
134 leading `0x' (as in C), a trailing `H' (as in Mesa), or there are any
135 super-decimal digits present. It is interpreted as octal is there is a
136 leading `0' and there are no super-octal digits. Otherwise, it is con-
137 verted as a decimal number.
143 hosts(5), networks(5)
146 The ns_addr() and ns_toa() functions appeared in 4.3BSD.
149 The string returned by ns_ntoa() resides in a static memory area. The
150 function ns_addr() should diagnose improperly formed input, and there
151 should be an unambiguous way to recognize this.
164 SUMMARY="Footer navigation table"
175 HREF="net-common-tcpip-manpages-net-addrcmp.html"
193 HREF="net-common-tcpip-manpages-resolver.html"
209 HREF="tcpip-library-reference.html"