getnetconfig(3N) LIBRARY FUNCTIONS getnetconfig(3N)
NAME
getnetconfig - get network configuration database entry
SYNOPSIS
#include <netconfig.h>
void *
setnetconfig()
struct netconfig *
getnetconfig(handlep)
void * handlep
int
endnetconfig(handlep)
void * handlep
struct netconfig *
getnetconfigent(netid)
char * netid ;
int
freenetconfigent(netconfigp)
struct netconfig * netconfigp ;
DESCRIPTION
The five library routines described on this page are part of
the UNIX System V Network Selection component. They provide
application access to the system network configuration data-
base, /etc/netconfig. In addition to the netconfig database
and the routines for accessing it, Network Selection
includes the environment variable NETPATH (see environ(5))
and the NETPATH access routines described in getnetpath(3N).
A call to setnetconfig() has the effect of ``binding'' or
``rewinding'' the netconfig database. setnetconfig() must
be called before the first call to getnetconfig() and may be
called at any other time. setnetconfig() need not be called
before a call to getnetconfigent(). setnetconfig() returns
a unique handle to be used by getnetconfig(). When first
called, getnetconfig() returns a pointer to the current
entry in the netconfig database, formatted as a struct
netconfig. getnetconfig() can thus be used to search the
entire netconfig file. getnetconfig() returns NULL at end
of file. endnetconfig() may be called to ``unbind'' or
``close'' the netconfig database when processing is com-
plete, releasing resources for reuse. Programmers should be
aware, however, that endnetconfig() frees all memory allo-
cated by getnetconfig() for the struct netconfig data struc-
ture. endnetconfig() may not be called before setnetcon-
fig(). endnetconfig() returns 0 on success and -1 on
failure (e.g., if setnetconfig() was not called previously).
getnetconfigent(netid) returns a pointer to the struct
netconfig structure corresponding to netid. It returns NULL
if netid is invalid (i.e., does not name an entry in the
netconfig database). It returns NULL and sets errno in case
of failure (e.g., if setnetconfig() was not called previ-
ously). freenetconfigent(netconfigp) frees the netconfig
1
getnetconfig(3N) LIBRARY FUNCTIONS getnetconfig(3N)
structure pointed to by netconfigp (previously returned by
getnetconfigent()).
SEE ALSO
netconfig(4), getnetpath(3N), environ(5)
Network Programmer's Guide
System Administrator's Guide
2