setnetent(3)


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).

   ┌───────────────┬───────────────┬───────────────────────────┐
   │InterfaceAttributeValue                     │
   ├───────────────┼───────────────┼───────────────────────────┤
   │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/set_tabsize_sp.3ncurses.html
set_tabsize_sp(3ncurses) - curses screen-pointer extension
This implementation can be configured to provide a set of functions which improve the ability to manage multiple screens. This feature can be added to any of th

manpages/Xevi.3.html
Xevi(3) - X Extended Visual Information functions (ManPage)
The X11 Extended Visual Information extension (EVI) allows a client to determine information about core X visuals beyond what the core protocol provides. The EV

manpages/msgcat.n.html
msgcat(n) - Tcl message catalog (Local - Linux man page)....
The msgcat package provides a set of functions that can be used to manage multi-lingual user interfaces. Text strings are defined in a message catalog which is

manpages/Tcl_MakeSafe.3.html
Tcl_MakeSafe(3) - manage multiple Tcl interpreters, aliases
These procedures are intended for access to the multiple interpreter facility from inside C programs. They enable managing multiple interpreters in a hierarchic

manpages/renice.1.html
renice(1) - alter priority of running processes (Man Page)
renice alters the scheduling priority of one or more running processes. The first argument is the priority value to be used. The other arguments are interpreted

manpages/DMX.3.html
DMX(3) - X Window System DMX (Distributed Multihead X) exten
The DMX extension provides support for communication with and control of Xdmx(1) server. Attributes of the Xdmx(1) server and of the back-end screens attached t

manpages/build-jar-repository.1.html
build-jar-repository(1) - create a symbolic link to a JAR...
Build a JAR repository in the named directory by copying files or creating symbolic links OPTIONS If no option is specified the default action will be to create

manpages/tanl.3.html
tanl(3) - tangent function (Library - Linux man page).......
The tan() function returns the tangent of x, where x is given in radians. RETURN VALUE On success, these functions return the tangent of x. If x is a NaN, a NaN

manpages/putmsg.2.html
putmsg(2) unimplemented system calls - Linux manual page....
These system calls are not implemented in the Linux kernel. RETURN VALUE These system calls always return -1 and set errno to ENOSYS. NOTES Note that ftime(3),

manpages/ram.4.html
ram(4) - ram disk device (Special files - Linux man page)...
The ram device is a block device to access the ram disk in raw mode. It is typically created by: mknod -m 660 /dev/ram b 1 1 chown root:disk /dev/ram FILES /dev

manpages/feedback.1.html
feedback(1) - Stirring colors with a jiggling warp..........
Colors are swirled by repeatedly mapping a spring loaded grid to a uniform grid, pulling in colors from the cycling perimeter. Written by Tugrul Galatali. OPTIO

manpages/systemd-update-utmp.service.8.html
systemd-update-utmp.service(8) Write audit and utmp updates
systemd-update-utmp-runlevel.service is a service that writes SysV runlevel changes to utmp and wtmp, as well as the audit logs, as they occur. systemd-update-u





We can't live, work or learn in freedom unless the software we use is free.