1996-08-30 19:40:05 +00:00
|
|
|
.\" Copyright (c) 1983, 1991, 1993
|
|
|
|
.\" The Regents of the University of California. All rights reserved.
|
|
|
|
.\"
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
.\" 3. All advertising materials mentioning features or use of this software
|
|
|
|
.\" must display the following acknowledgement:
|
|
|
|
.\" This product includes software developed by the University of
|
|
|
|
.\" California, Berkeley and its contributors.
|
|
|
|
.\" 4. Neither the name of the University nor the names of its contributors
|
|
|
|
.\" may be used to endorse or promote products derived from this software
|
|
|
|
.\" without specific prior written permission.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
.\" SUCH DAMAGE.
|
|
|
|
.\"
|
|
|
|
.\" @(#)getnetent.3 8.1 (Berkeley) 6/4/93
|
1999-08-28 00:22:10 +00:00
|
|
|
.\" $FreeBSD$
|
1996-08-30 19:40:05 +00:00
|
|
|
.\"
|
|
|
|
.Dd June 4, 1993
|
|
|
|
.Dt GETNETENT 3
|
2001-07-10 13:41:46 +00:00
|
|
|
.Os
|
1996-08-30 19:40:05 +00:00
|
|
|
.Sh NAME
|
|
|
|
.Nm getnetent ,
|
|
|
|
.Nm getnetbyaddr ,
|
|
|
|
.Nm getnetbyname ,
|
|
|
|
.Nm setnetent ,
|
|
|
|
.Nm endnetent
|
|
|
|
.Nd get network entry
|
2000-04-21 09:42:15 +00:00
|
|
|
.Sh LIBRARY
|
|
|
|
.Lb libc
|
1996-08-30 19:40:05 +00:00
|
|
|
.Sh SYNOPSIS
|
|
|
|
.Fd #include <netdb.h>
|
|
|
|
.Ft struct netent *
|
1997-04-13 13:26:42 +00:00
|
|
|
.Fn getnetent void
|
1996-08-30 19:40:05 +00:00
|
|
|
.Ft struct netent *
|
1996-11-01 06:29:00 +00:00
|
|
|
.Fn getnetbyname "const char *name"
|
1996-08-30 19:40:05 +00:00
|
|
|
.Ft struct netent *
|
1997-02-28 06:28:53 +00:00
|
|
|
.Fn getnetbyaddr "unsigned long net" "int type"
|
1997-04-13 13:26:42 +00:00
|
|
|
.Ft void
|
1996-08-30 19:40:05 +00:00
|
|
|
.Fn setnetent "int stayopen"
|
1997-04-13 13:26:42 +00:00
|
|
|
.Ft void
|
|
|
|
.Fn endnetent void
|
1996-08-30 19:40:05 +00:00
|
|
|
.Sh DESCRIPTION
|
1996-08-29 22:13:00 +00:00
|
|
|
The
|
1996-08-30 19:40:05 +00:00
|
|
|
.Fn getnetent ,
|
|
|
|
.Fn getnetbyname ,
|
1996-08-29 22:13:00 +00:00
|
|
|
and
|
1996-08-30 19:40:05 +00:00
|
|
|
.Fn getnetbyaddr
|
|
|
|
functions
|
1996-08-29 22:13:00 +00:00
|
|
|
each return a pointer to an object with the
|
Add nsswitch support. By creating an /etc/nsswitch.conf file, you can
configure FreeBSD so that various databases such as passwd and group can be
looked up using flat files, NIS, or Hesiod.
= Hesiod has been added to libc (see hesiod(3)).
= A library routine for parsing nsswitch.conf and invoking callback
functions as specified has been added to libc (see nsdispatch(3)).
= The following C library functions have been modified to use nsdispatch:
. getgrent, getgrnam, getgrgid
. getpwent, getpwnam, getpwuid
. getusershell
. getaddrinfo
. gethostbyname, gethostbyname2, gethostbyaddr
. getnetbyname, getnetbyaddr
. getipnodebyname, getipnodebyaddr, getnodebyname, getnodebyaddr
= host.conf has been removed from src/etc. rc.network has been modified
to warn that host.conf is no longer used at boot time. In addition, if
there is a host.conf but no nsswitch.conf, the latter is created at boot
time from the former.
Obtained from: NetBSD
2000-09-06 18:16:48 +00:00
|
|
|
following structure describing an internet network.
|
|
|
|
This structure contains either the information obtained
|
|
|
|
from the nameserver,
|
|
|
|
.Xr named 8 ,
|
|
|
|
broken-out fields of a line in the network data base
|
|
|
|
.Pa /etc/networks ,
|
|
|
|
or entries supplied by the
|
|
|
|
.Xr yp 4
|
|
|
|
system. The order of the lookups is controlled by the
|
|
|
|
`networks' entry in
|
|
|
|
.Xr nsswitch.conf 5 .
|
|
|
|
.Pp
|
1996-08-30 19:40:05 +00:00
|
|
|
.Bd -literal -offset indent
|
1996-08-29 22:13:00 +00:00
|
|
|
struct netent {
|
1996-08-30 19:40:05 +00:00
|
|
|
char *n_name; /* official name of net */
|
|
|
|
char **n_aliases; /* alias list */
|
|
|
|
int n_addrtype; /* net number type */
|
|
|
|
unsigned long n_net; /* net number */
|
1996-08-29 22:13:00 +00:00
|
|
|
};
|
1996-08-30 19:40:05 +00:00
|
|
|
.Ed
|
|
|
|
.Pp
|
1996-08-29 22:13:00 +00:00
|
|
|
The members of this structure are:
|
1996-08-30 19:40:05 +00:00
|
|
|
.Bl -tag -width n_addrtype
|
|
|
|
.It Fa n_name
|
1996-08-29 22:13:00 +00:00
|
|
|
The official name of the network.
|
1996-08-30 19:40:05 +00:00
|
|
|
.It Fa n_aliases
|
1996-08-29 22:13:00 +00:00
|
|
|
A zero terminated list of alternate names for the network.
|
1996-08-30 19:40:05 +00:00
|
|
|
.It Fa n_addrtype
|
|
|
|
The type of the network number returned; currently only AF_INET.
|
|
|
|
.It Fa n_net
|
1996-08-29 22:13:00 +00:00
|
|
|
The network number. Network numbers are returned in machine byte
|
|
|
|
order.
|
1996-08-30 19:40:05 +00:00
|
|
|
.El
|
|
|
|
.Pp
|
1996-08-29 22:13:00 +00:00
|
|
|
The
|
1996-08-30 19:40:05 +00:00
|
|
|
.Fn getnetent
|
|
|
|
function
|
|
|
|
reads the next line of the file, opening the file if necessary.
|
|
|
|
.Pp
|
1996-08-29 22:13:00 +00:00
|
|
|
The
|
1996-08-30 19:40:05 +00:00
|
|
|
.Fn setnetent
|
|
|
|
function
|
|
|
|
opens and rewinds the file. If the
|
|
|
|
.Fa stayopen
|
|
|
|
flag is non-zero,
|
|
|
|
the net data base will not be closed after each call to
|
|
|
|
.Fn getnetbyname
|
1996-08-29 22:13:00 +00:00
|
|
|
or
|
1996-08-30 19:40:05 +00:00
|
|
|
.Fn getnetbyaddr .
|
|
|
|
.Pp
|
|
|
|
The
|
|
|
|
.Fn endnetent
|
|
|
|
function
|
|
|
|
closes the file.
|
|
|
|
.Pp
|
1996-08-29 22:13:00 +00:00
|
|
|
The
|
1996-08-30 19:40:05 +00:00
|
|
|
.Fn getnetbyname
|
|
|
|
function
|
1996-08-29 22:13:00 +00:00
|
|
|
and
|
1996-08-30 19:40:05 +00:00
|
|
|
.Fn getnetbyaddr
|
|
|
|
sequentially search from the beginning
|
|
|
|
of the file until a matching
|
|
|
|
net name or
|
|
|
|
net address and type is found,
|
|
|
|
or until
|
|
|
|
.Dv EOF
|
2000-03-02 09:14:21 +00:00
|
|
|
is encountered.
|
|
|
|
The
|
1996-11-01 06:29:00 +00:00
|
|
|
.Fa type
|
|
|
|
must be
|
|
|
|
.Dv AF_INET .
|
1996-08-30 19:40:05 +00:00
|
|
|
Network numbers are supplied in host order.
|
|
|
|
.Sh FILES
|
Add nsswitch support. By creating an /etc/nsswitch.conf file, you can
configure FreeBSD so that various databases such as passwd and group can be
looked up using flat files, NIS, or Hesiod.
= Hesiod has been added to libc (see hesiod(3)).
= A library routine for parsing nsswitch.conf and invoking callback
functions as specified has been added to libc (see nsdispatch(3)).
= The following C library functions have been modified to use nsdispatch:
. getgrent, getgrnam, getgrgid
. getpwent, getpwnam, getpwuid
. getusershell
. getaddrinfo
. gethostbyname, gethostbyname2, gethostbyaddr
. getnetbyname, getnetbyaddr
. getipnodebyname, getipnodebyaddr, getnodebyname, getnodebyaddr
= host.conf has been removed from src/etc. rc.network has been modified
to warn that host.conf is no longer used at boot time. In addition, if
there is a host.conf but no nsswitch.conf, the latter is created at boot
time from the former.
Obtained from: NetBSD
2000-09-06 18:16:48 +00:00
|
|
|
.Bl -tag -width /etc/nsswitch.conf -compact
|
1996-08-30 19:40:05 +00:00
|
|
|
.It Pa /etc/networks
|
Add nsswitch support. By creating an /etc/nsswitch.conf file, you can
configure FreeBSD so that various databases such as passwd and group can be
looked up using flat files, NIS, or Hesiod.
= Hesiod has been added to libc (see hesiod(3)).
= A library routine for parsing nsswitch.conf and invoking callback
functions as specified has been added to libc (see nsdispatch(3)).
= The following C library functions have been modified to use nsdispatch:
. getgrent, getgrnam, getgrgid
. getpwent, getpwnam, getpwuid
. getusershell
. getaddrinfo
. gethostbyname, gethostbyname2, gethostbyaddr
. getnetbyname, getnetbyaddr
. getipnodebyname, getipnodebyaddr, getnodebyname, getnodebyaddr
= host.conf has been removed from src/etc. rc.network has been modified
to warn that host.conf is no longer used at boot time. In addition, if
there is a host.conf but no nsswitch.conf, the latter is created at boot
time from the former.
Obtained from: NetBSD
2000-09-06 18:16:48 +00:00
|
|
|
.It Pa /etc/nsswitch.conf
|
|
|
|
.It Pa /etc/resolv.conf
|
1996-08-30 19:40:05 +00:00
|
|
|
.El
|
|
|
|
.Sh DIAGNOSTICS
|
|
|
|
Null pointer
|
|
|
|
(0) returned on
|
|
|
|
.Dv EOF
|
|
|
|
or error.
|
|
|
|
.Sh SEE ALSO
|
1997-01-20 23:23:22 +00:00
|
|
|
.Xr networks 5
|
|
|
|
.Pp
|
1996-11-01 06:29:00 +00:00
|
|
|
.%T RFC 1101
|
1996-08-30 19:40:05 +00:00
|
|
|
.Sh HISTORY
|
|
|
|
The
|
|
|
|
.Fn getnetent ,
|
|
|
|
.Fn getnetbyaddr ,
|
|
|
|
.Fn getnetbyname ,
|
|
|
|
.Fn setnetent ,
|
1996-08-29 22:13:00 +00:00
|
|
|
and
|
1996-08-30 19:40:05 +00:00
|
|
|
.Fn endnetent
|
|
|
|
functions appeared in
|
|
|
|
.Bx 4.2 .
|
|
|
|
.Sh BUGS
|
|
|
|
The data space used by
|
|
|
|
these functions is static; if future use requires the data, it should be
|
|
|
|
copied before any subsequent calls to these functions overwrite it.
|
|
|
|
Only Internet network
|
|
|
|
numbers are currently understood.
|
|
|
|
Expecting network numbers to fit
|
|
|
|
in no more than 32 bits is probably
|
|
|
|
naive.
|