1 .\" $NetBSD: getnetent.3,v 1.13 2004/05/08 18:52:15 kleink Exp $
3 .\" Copyright (c) 1983, 1991, 1993
4 .\" The Regents of the University of California. All rights reserved.
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
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.
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
30 .\" @(#)getnetent.3 8.1 (Berkeley) 6/4/93
49 .Fn getnetbyname "const char *name"
51 .Fn getnetbyaddr "uint32_t net" "int type"
52 .Fn setnetent "int stayopen"
61 each return a pointer to an object with the
63 containing the broken-out
64 fields of a line in the network data base as described in
66 .Bd -literal -offset indent
68 char *n_name; /* official name of net */
69 char **n_aliases; /* alias list */
70 int n_addrtype; /* net number type */
71 uint32_t n_net; /* net number */
75 The members of this structure are:
76 .Bl -tag -width n_addrtype
78 The official name of the network.
80 A zero terminated list of alternative names for the network.
82 The type of the network number returned; currently only AF_INET.
84 The network number. Network numbers are returned in machine byte
91 reads the next line of the file, opening the file if necessary.
96 opens and rewinds the file. If the
99 the net data base will not be closed after each call to
114 sequentially search from the beginning
115 of the file until a matching
117 net address and type is found,
121 Network numbers are supplied in host order.
123 .Bl -tag -width /etc/networks -compact
142 functions appeared in
145 The data space used by
146 these functions is static; if future use requires the data, it should be
147 copied before any subsequent calls to these functions overwrite it.
148 Only Internet network
149 numbers are currently understood.
150 Expecting network numbers to fit
151 in no more than 32 bits is probably