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.
|
|
|
|
.\" 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
|
2001-10-01 16:09:29 +00:00
|
|
|
.In netdb.h
|
1996-08-30 19:40:05 +00:00
|
|
|
.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 *
|
2005-06-03 04:44:54 +00:00
|
|
|
.Fn getnetbyaddr "uint32_t 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
|
2001-07-15 07:53:42 +00:00
|
|
|
from the nameserver,
|
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
|
|
|
.Xr named 8 ,
|
|
|
|
broken-out fields of a line in the network data base
|
|
|
|
.Pa /etc/networks ,
|
|
|
|
or entries supplied by the
|
2002-01-14 16:59:03 +00:00
|
|
|
.Xr yp 8
|
2004-07-02 23:52:20 +00:00
|
|
|
system.
|
|
|
|
The order of the lookups is controlled by the
|
2001-07-15 07:53:42 +00:00
|
|
|
`networks' entry in
|
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
|
|
|
.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 */
|
2005-06-03 04:44:54 +00:00
|
|
|
uint32_t 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
|
2004-07-02 23:52:20 +00:00
|
|
|
The network number.
|
|
|
|
Network numbers are returned in machine byte
|
1996-08-29 22:13:00 +00:00
|
|
|
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
|
2004-07-02 23:52:20 +00:00
|
|
|
opens and rewinds the file.
|
|
|
|
If the
|
1996-08-30 19:40:05 +00:00
|
|
|
.Fa stayopen
|
|
|
|
flag is non-zero,
|
2001-07-15 07:53:42 +00:00
|
|
|
the net data base will not be closed after each call to
|
1996-08-30 19:40:05 +00:00
|
|
|
.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
|
2002-12-19 09:40:28 +00:00
|
|
|
argument
|
1996-11-01 06:29:00 +00:00
|
|
|
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
|
2001-07-15 07:53:42 +00:00
|
|
|
functions appeared in
|
1996-08-30 19:40:05 +00:00
|
|
|
.Bx 4.2 .
|
|
|
|
.Sh BUGS
|
|
|
|
The data space used by
|
2005-06-15 19:04:04 +00:00
|
|
|
these functions is thread-specific; if future use requires the data, it should be
|
1996-08-30 19:40:05 +00:00
|
|
|
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.
|