Commit | Line | Data |
---|---|---|
ae59e04c | 1 | .\" Copyright (c) 1986, 1991 The Regents of the University of California. |
968d6b3e | 2 | .\" All rights reserved. |
78e649e1 | 3 | .\" |
91cff1e1 | 4 | .\" %sccs.include.redist.man% |
78e649e1 | 5 | .\" |
ae59e04c | 6 | .\" @(#)ns.3 6.5 (Berkeley) %G% |
968d6b3e | 7 | .\" |
ae59e04c CL |
8 | .Dd |
9 | .Dt NS 3 | |
10 | .Os BSD 4.3 | |
11 | .Sh NAME | |
12 | .Nm ns_addr , | |
13 | .Nm ns_ntoa | |
14 | .Nd Xerox | |
15 | .Tn NS Ns (tm) | |
16 | address conversion routines | |
17 | .Sh SYNOPSIS | |
18 | .Fd #include <sys/types.h> | |
19 | .Fd #include <netns/ns.h> | |
20 | .Ft struct ns_addr | |
21 | .Fn ns_addr "char *cp" | |
22 | .Ft char * | |
23 | .Fn ns_ntoa "struct ns_addr ns" | |
24 | .Sh DESCRIPTION | |
78e649e1 | 25 | The routine |
ae59e04c | 26 | .Fn ns_addr |
78e649e1 | 27 | interprets character strings representing |
ae59e04c CL |
28 | .Tn XNS |
29 | addresses, returning binary information suitable | |
78e649e1 | 30 | for use in system calls. |
ae59e04c CL |
31 | The routine |
32 | .Fn ns_ntoa | |
33 | takes | |
34 | .Tn XNS | |
35 | addresses and returns | |
36 | .Tn ASCII | |
78e649e1 KM |
37 | strings representing the address in a |
38 | notation in common use in the Xerox Development Environment: | |
ae59e04c CL |
39 | .Bd -filled -offset indent |
40 | <network number>.<host number>.<port number> | |
41 | .Ed | |
42 | .Pp | |
78e649e1 | 43 | Trailing zero fields are suppressed, and each number is printed in hexadecimal, |
a7b6cc8d | 44 | in a format suitable for input to |
ae59e04c | 45 | .Fn ns_addr . |
78e649e1 | 46 | Any fields lacking super-decimal digits will have a |
ae59e04c CL |
47 | trailing |
48 | .Ql H | |
49 | appended. | |
50 | .Pp | |
51 | Unfortunately, no universal standard exists for representing | |
52 | .Tn XNS | |
53 | addresses. | |
78e649e1 | 54 | An effort has been made to insure that |
ae59e04c | 55 | .Fn ns_addr |
78e649e1 KM |
56 | be compatible with most formats in common use. |
57 | It will first separate an address into 1 to 3 fields using a single delimiter | |
58 | chosen from | |
ae59e04c CL |
59 | period |
60 | .Ql \&. , | |
61 | colon | |
62 | .Ql \&: | |
63 | or pound-sign | |
64 | .Ql \&# . | |
a7b6cc8d | 65 | Each field is then examined for byte separators (colon or period). |
78e649e1 KM |
66 | If there are byte separators, each subfield separated is taken to be |
67 | a small hexadecimal number, and the entirety is taken as a network-byte-ordered | |
68 | quantity to be zero extended in the high-network-order bytes. | |
69 | Next, the field is inspected for hyphens, in which case | |
70 | the field is assumed to be a number in decimal notation | |
71 | with hyphens separating the millenia. | |
72 | Next, the field is assumed to be a number: | |
73 | It is interpreted | |
ae59e04c CL |
74 | as hexadecimal if there is a leading |
75 | .Ql 0x | |
76 | (as in C), | |
77 | a trailing | |
78 | .Ql H | |
79 | (as in Mesa), or there are any super-decimal digits present. | |
80 | It is interpreted as octal is there is a leading | |
81 | .Ql 0 | |
a7b6cc8d | 82 | and there are no super-octal digits. |
78e649e1 | 83 | Otherwise, it is converted as a decimal number. |
ae59e04c CL |
84 | .Sh RETURN VALUES |
85 | None. (See | |
86 | .Sx BUGS . ) | |
87 | .Sh SEE ALSO | |
88 | .Xr hosts 5 , | |
89 | .Xr networks 5 , | |
90 | .Sh HISTORY | |
91 | The | |
92 | .Fn ns_addr | |
93 | and | |
94 | .Fn ns_toa | |
95 | functions appeared in | |
96 | .Bx 4.3 . | |
97 | .Sh BUGS | |
78e649e1 | 98 | The string returned by |
ae59e04c | 99 | .Fn ns_ntoa |
78e649e1 | 100 | resides in a static memory area. |
ae59e04c CL |
101 | The function |
102 | .Fn ns_addr | |
78e649e1 KM |
103 | should diagnose improperly formed input, and there should be an unambiguous |
104 | way to recognize this. |