NAME
getnetent, getnetbyname, getnetbyaddr, setnetent, endnetent - get network entry
SYNOPSIS
#include <netdb.h> struct netent *getnetent(void); struct netent *getnetbyname(const char *name); struct netent *getnetbyaddr(uint32_t net, int type); void setnetent(int stayopen); void endnetent(void);
DESCRIPTION
The getnetent() function reads the next entry from the networks database and returns a netent structure containing the broken-out fields from the entry. A connection is opened to the database if necessary. The getnetbyname() function returns a netent structure for the entry from the database that matches the network name. The getnetbyaddr() function returns a netent structure for the entry from the database that matches the network number net of type type. The net argument must be in host byte order. The setnetent() function opens a connection to the database, and sets the next entry to the first entry. If stayopen is nonzero, then the connection to the database will not be closed between calls to one of the getnet*() functions. The endnetent() function closes the connection to the database. The netent structure is defined in <netdb.h> as follows: struct netent { char *n_name; /* official network name */ char **n_aliases; /* alias list */ int n_addrtype; /* net address type */ uint32_t n_net; /* network number */ } The members of the netent structure are: n_name The official name of the network. n_aliases A NULL-terminated list of alternative names for the network. n_addrtype The type of the network number; always AF_INET. n_net The network number in host byte order.
RETURN VALUE
The getnetent(), getnetbyname() and getnetbyaddr() functions return a pointer to a statically allocated netent structure, or a null pointer if an error occurs or the end of the file is reached.
FILES
/etc/networks networks database file
ATTRIBUTES
For an explanation of the terms used in this section, see attributes(7). ┌───────────────┬───────────────┬───────────────────────────┐ │Interface │ Attribute │ Value │ ├───────────────┼───────────────┼───────────────────────────┤ │getnetent() │ Thread safety │ MT-Unsafe race:netent │ │ │ │ race:netentbuf env locale │ ├───────────────┼───────────────┼───────────────────────────┤ │getnetbyname() │ Thread safety │ MT-Unsafe race:netbyname │ │ │ │ env locale │ ├───────────────┼───────────────┼───────────────────────────┤ │getnetbyaddr() │ Thread safety │ MT-Unsafe race:netbyaddr │ │ │ │ locale │ ├───────────────┼───────────────┼───────────────────────────┤ │setnetent(), │ Thread safety │ MT-Unsafe race:netent env │ │endnetent() │ │ locale │ └───────────────┴───────────────┴───────────────────────────┘ In the above table, netent in race:netent signifies that if any of the functions setnetent(), getnetent(), or endnetent() are used in parallel in different threads of a program, then data races could occur.
CONFORMING TO
POSIX.1-2001, POSIX.1-2008, 4.3BSD.
NOTES
In glibc versions before 2.2, the net argument of getnetbyaddr() was of type long.
SEE ALSO
getnetent_r(3), getprotoent(3), getservent(3) RFC 1101
COLOPHON
This page is part of release 4.09 of the Linux man-pages project. A description of the project, information about reporting bugs, and the latest version of this page, can be found at https://www.kernel.org/doc/man-pages/.
More Linux Commands
manpages/perlreguts.1.html
perlreguts(1) - Description of the Perl regular expression e
This document is an attempt to shine some light on the guts of the regex engine and how it works. The regex engine represents a significant chunk of the perl co
manpages/XGetErrorDatabaseText.3.html
XGetErrorDatabaseText(3) - default error handlers (ManPage)
Xlib generally calls the programs supplied error handler whenever an error is received. It is not called on BadName errors from OpenFont, LookupColor, or AllocN
manpages/git-fsck-objects.1.html
git-fsck-objects(1) - Verifies the connectivity and validity
This is a synonym for git-fsck(1). Please refer to the documentation of that command. GIT Part of the git(1) suite git-fsck-objects.1 (Commands - Linux manual
manpages/Tcl_GetEnsembleFlags.3.html
Tcl_GetEnsembleFlags(3) - manipulate ensemble commands......
An ensemble is a command, bound to some namespace, which consists of a collection of subcommands implemented by other Tcl commands. The first argument to the en
manpages/kexec_load.2.html
kexec_load(2) - load a new kernel for later execution.......
The kexec_load() system call loads a new kernel that can be executed later by reboot(2). The flags argument is a mask whose high-order bits control the operatio
manpages/gnutls_x509_crt_get_issuer_dn.3.html
gnutls_x509_crt_get_issuer_dn(3) - API function (Man Page)
This function will copy the name of the Certificate issuer in the provided buffer. The name will be in the form C=xxxx,O=yyyy,CN=zzzz as described in RFC2253. T
manpages/Tcl_LimitGetCommands.3.html
Tcl_LimitGetCommands(3) - manage and check resource limits o
Tcls interpreter resource limit subsystem allows for close control over how much computation time a script may use, and is useful for cases where a program is d
manpages/XCreatePixmap.3.html
XCreatePixmap(3) - create or destroy pixmaps (Man Page).....
The XCreatePixmap function creates a pixmap of the width, height, and depth you specified and returns a pixmap ID that identifies it. It is valid to pass an Inp
manpages/xdr_pmaplist.3.html
xdr_pmaplist(3) - library routines for remote procedure call
These routines allow C programs to make procedure calls on other machines across the network. First, the client calls a procedure to send a data packet to the s
manpages/gc-analyze.1.html
gc-analyze(1) - Analyze Garbage Collector (GC) memory dumps
gc-analyze prints an analysis of a GC memory dump to standard out. The memory dumps may be created by calling gnu.gcj.util.GCInfo.enumerate(String namePrefix) f
manpages/buffchan.8.html
buffchan(8) - Buffered file-writing backend for INN.........
buffchan reads lines from standard input and copies the initial fields in each line to the files named by the remaining fields on the line. buffchan is intended
manpages/XML::SAX::DocumentLocator.3pm.html
XML::SAX::DocumentLocator(3pm) - Helper class for document l
This module gives you a tied hash reference that calls the specified closures when asked for PublicId, SystemId, LineNumber and ColumnNumber. It is useful for w
