OSDN Git Service

Import translated manuals from JM CVS Repository.
[linuxjm/jm.git] / manual / bind / original / man3 / inet_cidr.3
1 .\" $Id: inet_cidr.3,v 8.2 1999/01/08 18:54:24 vixie Exp $
2 .\"
3 .\"Copyright (c) 1998,1999 by Internet Software Consortium
4 .\"
5 .\"Permission to use, copy, modify, and distribute this software for any
6 .\"purpose with or without fee is hereby granted, provided that the above
7 .\"copyright notice and this permission notice appear in all copies.
8 .\"
9 .\"THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
10 .\"ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
11 .\"OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
12 .\"CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13 .\"DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14 .\"PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
15 .\"ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
16 .\"SOFTWARE.
17 .\"
18 .Dd October 19, 1998
19 .Dt INET_CIDR 3 
20 .Os BSD 4
21 .Sh NAME
22 .Nm inet_cidr_ntop ,
23 .Nm inet_cidr_pton
24 .Nd network translation routines
25 .Sh SYNOPSIS
26 .Fd #include <sys/types.h>
27 .Fd #include <sys/socket.h>
28 .Fd #include <netinet/in.h>
29 .Fd #include <arpa/inet.h>
30 .Fn inet_cidr_ntop "int af" "const void *src" "int bits" "char *dst" "size_t size"
31 .Fn inet_cidr_pton "int af" "const char *src" "void *dst" "int *bits"
32 .Sh DESCRIPTION
33 These routines are used for converting addresses to and from network and
34 presentation forms with CIDR (Classless Inter-Domain Routing) representation,
35 embedded net mask.
36 .Pp
37 .Bd -literal
38                 130.155.16.1/20
39 .Ed
40 .\"             ::ffff:130.155.16.1/116
41 .Pp
42 .Fn inet_cidr_ntop
43 converts an address from network to presentation format.
44 .Pp
45 .Ft af
46 describes the type of address that is being passed in
47 .Ft src. 
48 .\"Currently defined types are AF_INET and AF_INET6.
49 Currently only AF_INET is supported.
50 .Pp
51 .Ft src
52 is an address in network byte order, its length is determined from
53 .Ft af.
54 .Pp
55 .Ft bits
56 specifies the number of bits in the netmask unless it is -1 in which case
57 the CIDR representation is omitted.
58 .Pp
59 .Ft dst
60 is a caller supplied buffer of at least
61 .Ft size
62 bytes.
63 .Pp
64 .Fn inet_cidr_ntop
65 returns 
66 .Ft dst
67 on success or NULL.
68 Check errno for reason.
69 .Pp
70 .Fn inet_cidr_pton
71 converts and address from presentation format, with optional CIDR
72 reperesentation, to network format.
73 The resulting address is zero filled if there were insufficint bits in
74 .Ft src.
75 .Pp
76 .Ft af
77 describes the type of address that is being passed in via 
78 .Ft src
79 and determines the size of 
80 .Ft dst.
81 .Pp
82 .Ft src
83 is an address in presentation format.
84 .Pp
85 .Ft bits
86 returns the number of bits in the netmask or -1 if a CIDR representation was
87 not supplied.
88 .Pp
89 .Fn inet_cidr_pton
90 returns 0 on succces or -1 on error.
91 Check errno for reason.
92 ENOENT indicates an invalid netmask.
93 .Sh SEE ALSO
94 .Xr intro 2