1 .\" $Id: inet_cidr.3,v 8.2 1999/01/08 18:54:24 vixie Exp $
3 .\"Copyright (c) 1998,1999 by Internet Software Consortium
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.
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
24 .Nd network translation routines
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"
33 These routines are used for converting addresses to and from network and
34 presentation forms with CIDR (Classless Inter-Domain Routing) representation,
40 .\" ::ffff:130.155.16.1/116
43 converts an address from network to presentation format.
46 describes the type of address that is being passed in
48 .\"Currently defined types are AF_INET and AF_INET6.
49 Currently only AF_INET is supported.
52 is an address in network byte order, its length is determined from
56 specifies the number of bits in the netmask unless it is -1 in which case
57 the CIDR representation is omitted.
60 is a caller supplied buffer of at least
68 Check errno for reason.
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
77 describes the type of address that is being passed in via
79 and determines the size of
83 is an address in presentation format.
86 returns the number of bits in the netmask or -1 if a CIDR representation was
90 returns 0 on succces or -1 on error.
91 Check errno for reason.
92 ENOENT indicates an invalid netmask.