3 .\" Copyright (C) 2009 Internet Systems Consortium, Inc. ("ISC")
5 .\" Permission to use, copy, modify, and/or 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 ISC DISCLAIMS ALL WARRANTIES WITH
10 .\" REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11 .\" AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
12 .\" INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13 .\" LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
14 .\" OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15 .\" PERFORMANCE OF THIS SOFTWARE.
17 .\" Id: getnetent.3,v 1.3 2009/01/22 23:49:23 tbox Exp
20 .Dt GETNETENT @LIB_NETWORK_EXT_U@
28 .Nd get networks entry
30 .Fd #include <netdb.h>
34 .Fn getnetbyname "char name"
36 .Fn getnetbyaddr "unsigned long net" "int type"
38 .Fn setnetent "int stayopen"
48 each return a pointer to an object with the following structure
49 containing the broken-out fields of a line in the
52 .Bd -literal -offset indent
54 char *n_name; /* official name of net */
55 char **n_aliases; /* alias list */
56 int n_addrtype; /* net number type */
57 long n_net; /* net number */
61 The members of this structure are:
62 .Bl -tag -width "n_addrtype"
64 The official name of the network.
66 A zero-terminated list of alternate names for the network.
68 The type of the network number returned:
71 The network number. Network numbers are returned in machine byte
79 subroutine is NULL, the
81 database is opened. Otherwise, the
83 has the effect of rewinding the
88 subroutine may be called to
91 database when processing is complete.
95 subroutine simply reads the next
100 search until a matching
112 subroutine keeps a pointer in the database, allowing
113 successive calls to be used to search the entire file.
122 in order to perform initialization; a call to
124 must be used after the loop. Both
135 Null pointer (0) returned on
139 .Xr networks @FORMAT_EXT@ ,
149 functions appeared in
152 The data space used by these functions is static; if future use requires the
153 data, it should be copied before any subsequent calls to these functions
154 overwrite it. Only Internet network numbers are currently understood.
155 Expecting network numbers to fit in no more than 32 bits is probably naive.