summaryrefslogtreecommitdiff
path: root/src/lib/libc/net/ns.3
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libc/net/ns.3')
-rw-r--r--src/lib/libc/net/ns.3127
1 files changed, 127 insertions, 0 deletions
diff --git a/src/lib/libc/net/ns.3 b/src/lib/libc/net/ns.3
new file mode 100644
index 0000000000..9c7aeab312
--- /dev/null
+++ b/src/lib/libc/net/ns.3
@@ -0,0 +1,127 @@
1.\" $OpenBSD: ns.3,v 1.9 2003/06/02 20:18:35 millert Exp $
2.\"
3.\" Copyright (c) 1986, 1991, 1993
4.\" The Regents of the University of California. All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\" notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\" notice, this list of conditions and the following disclaimer in the
13.\" documentation and/or other materials provided with the distribution.
14.\" 3. Neither the name of the University nor the names of its contributors
15.\" may be used to endorse or promote products derived from this software
16.\" without specific prior written permission.
17.\"
18.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
19.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
22.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28.\" SUCH DAMAGE.
29.\"
30.Dd June 4, 1993
31.Dt NS 3
32.Os
33.Sh NAME
34.Nm ns_addr ,
35.Nm ns_ntoa
36.Nd Xerox
37.Tn NS Ns (tm)
38address conversion routines
39.Sh SYNOPSIS
40.Fd #include <sys/types.h>
41.Fd #include <netns/ns.h>
42.Ft struct ns_addr
43.Fn ns_addr "char *cp"
44.Ft char *
45.Fn ns_ntoa "struct ns_addr ns"
46.Sh DESCRIPTION
47The routine
48.Fn ns_addr
49interprets character strings representing
50.Tn XNS
51addresses, returning binary information suitable
52for use in system calls.
53The routine
54.Fn ns_ntoa
55takes
56.Tn XNS
57addresses and returns
58.Tn ASCII
59strings representing the address in a
60notation in common use in the Xerox Development Environment:
61.Bd -filled -offset indent
62<network number>.<host number>.<port number>
63.Ed
64.Pp
65Trailing zero fields are suppressed, and each number is printed in hexadecimal,
66in a format suitable for input to
67.Fn ns_addr .
68Any fields lacking super-decimal digits will have a
69trailing
70.Sq H
71appended.
72.Pp
73Unfortunately, no universal standard exists for representing
74.Tn XNS
75addresses.
76An effort has been made to ensure that
77.Fn ns_addr
78be compatible with most formats in common use.
79It will first separate an address into 1 to 3 fields using a single delimiter
80chosen from
81period
82.Pq Ql \&. ,
83colon
84.Pq Ql \&: ,
85or pound-sign
86.Ql # .
87Each field is then examined for byte separators (colon or period).
88If there are byte separators, each subfield separated is taken to be
89a small hexadecimal number, and the entirety is taken as a network-byte-ordered
90quantity to be zero extended in the high-network-order bytes.
91Next, the field is inspected for hyphens, in which case
92the field is assumed to be a number in decimal notation
93with hyphens separating the millenia.
94Next, the field is assumed to be a number:
95It is interpreted
96as hexadecimal if there is a leading
97.Ql 0x
98(as in C),
99a trailing
100.Sq H
101(as in Mesa), or there are any super-decimal digits present.
102It is interpreted as octal if there is a leading
103.Ql 0
104and there are no super-octal digits.
105Otherwise, it is converted as a decimal number.
106.Sh RETURN VALUES
107None.
108(See
109.Sx BUGS . )
110.Sh SEE ALSO
111.Xr hosts 5 ,
112.Xr networks 5
113.Sh HISTORY
114The
115.Fn ns_addr
116and
117.Fn ns_toa
118functions appeared in
119.Bx 4.3 .
120.Sh BUGS
121The string returned by
122.Fn ns_ntoa
123resides in a static memory area.
124The function
125.Fn ns_addr
126should diagnose improperly formed input, and there should be an unambiguous
127way to recognize this.