1 .\" Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
2 .\" Copyright (c) 1995,1996,1999 by Internet Software Consortium
4 .\" Permission to use, copy, modify, and distribute this software for any
5 .\" purpose with or without fee is hereby granted, provided that the above
6 .\" copyright notice and this permission notice appear in all copies.
8 .\" THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
9 .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
11 .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
14 .\" OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 .\" Id: getnetent.man3,v 1.2 2009/01/21 00:12:34 each Exp
27 .Nd get networks entry
29 .Fd #include <netdb.h>
33 .Fn getnetbyname "char name"
35 .Fn getnetbyaddr "unsigned long net" "int type"
37 .Fn setnetent "int stayopen"
47 each return a pointer to an object with the following structure
48 containing the broken-out fields of a line in the
51 .Bd -literal -offset indent
53 char *n_name; /* official name of net */
54 char **n_aliases; /* alias list */
55 int n_addrtype; /* net number type */
56 long n_net; /* net number */
60 The members of this structure are:
61 .Bl -tag -width "n_addrtype"
63 The official name of the network.
65 A zero-terminated list of alternate names for the network.
67 The type of the network number returned:
70 The network number. Network numbers are returned in machine byte
78 subroutine is NULL, the
80 database is opened. Otherwise, the
82 has the effect of rewinding the
87 subroutine may be called to
90 database when processing is complete.
94 subroutine simply reads the next
99 search until a matching
111 subroutine keeps a pointer in the database, allowing
112 successive calls to be used to search the entire file.
121 in order to perform initialization; a call to
123 must be used after the loop. Both
134 Null pointer (0) returned on
148 functions appeared in
151 The data space used by these functions is static; if future use requires the
152 data, it should be copied before any subsequent calls to these functions
153 overwrite it. Only Internet network numbers are currently understood.
154 Expecting network numbers to fit in no more than 32 bits is probably naive.