getnetpath(3N) LIBRARY FUNCTIONS getnetpath(3N)
NAME
getnetpath - get /etc/netconfig entry corresponding to NET-
PATH component
SYNOPSIS
#include <netconfig.h>
void *
setnetpath()
struct netconfig *
getnetpath(handlep);
void * handlep;
int
endnetpath(handlep);
void * handlep;
DESCRIPTION
The three 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, as it is ``filtered'' by the NETPATH
environment variable (see environ(5)). Network Selection
also includes routines that access the network configuration
database directly (see getnetconfig(3N)). A call to setnet-
path() ``binds'' or ``rewinds'' NETPATH. setnetpath() must
be called before the first call to getnetpath() and may be
called at any other time. It returns a handle that is used
by getnetpath. [=> Amplify. <=] setnetpath() will fail if
the netconfig database is not present. If NETPATH is unset,
setnetpath() returns the number of ``visible'' networks in
the netconfig file. The set of visible networks constitutes
a default NETPATH. When first called, getnetpath() returns
a pointer to the netconfig database entry corresponding to
the first valid NETPATH component. The netconfig entry is
formatted as a struct netconfig. On each subsequent call,
getnetpath returns a pointer to the netconfig entry that
corresponds to the next valid NETPATH component. getnet-
path() can thus be used to search the netconfig database for
all networks included in the NETPATH variable. When NETPATH
has been exhausted, getnetpath() returns NULL. getnetpath()
silently ignores invalid NETPATH components. A NETPATH com-
ponent is invalid if there is no corresponding entry in the
netconfig database. If the NETPATH variable is unset, get-
netpath() behaves as if NETPATH were set to the sequence of
``default'' or ``visible'' networks in the netconfig data-
base, in the order in which they are listed. endnetpath()
may be called to ``unbind'' NETPATH when processing is com-
plete, releasing resources for reuse. Programmer's should
be aware, however, that endnetpath() frees all memory allo-
cated by setnetpath(). endnetpath() returns 0 on success
and -1 on failure (e.g., if setnetpath() was not called pre-
viously).
1
getnetpath(3N) LIBRARY FUNCTIONS getnetpath(3N)
SEE ALSO
netconfig(4), getnetconfig(3N), environ(5)
Network Programmer's Guide
System Administrator's Guide
2