HP-UX Reference (11i v1 05/09) - 3 Library Functions A-M (vol 6)
g
getnetpath(3N) getnetpath(3N)
NAME
getnetpath(), setnetpath(), endnetpath() - get /etc/netconfig entry corresponding to NETPATH component
SYNOPSIS
#include <netconfig.h>
struct netconfig *getnetpath(void *handlep );
void *setnetpath(void);
int endnetpath(void *handlep );
MULTITHREAD USAGE
Thread Safe: Yes
Cancel Safe: Yes
Fork Safe: No
Async-cancel Safe: No
Async-signal Safe: No
These functions can be called safely in a multithreaded environment. They may be cancellation points in
that they call functions that are cancel points.
In a multithreaded environment, these functions are not safe to be called by a child process after
fork()
and before exec(). These functions should not be called by a multithreaded application that supports
asynchronous cancellation or asynchronous signals.
DESCRIPTION
The routines described on this page are part of the Network Selection component. They provide the appli-
cation access to the system network configuration database, /etc/netconfig
, as it is "filtered" by the
NETPATH environment variable (see environ(5)). See getnetconfig(3N) for other routines that also access
the network configuration database directly. The NETPATH variable is a list of colon-separated network
identifiers.
getnetpath() returns a pointer to the netconfig database entry corresponding to the first valid
NETPATH component. The netconfig entry is formatted as a structnetconfig. On each subsequent
call, getnetpath() returns a pointer to the netconfig entry that corresponds to the next valid NET-
PATH
component. getnetpath() can thus be used to search the netconfig database for all net-
works included in the NETPATH variable. When NETPATH has been exhausted, getnetpath() returns
NULL.
A call to setnetpath() "binds" to or "rewinds"
NETPATH must be called before the first call to get-
netpath()
and may be called at any other time. It returns a handle that is used by
getnetpath() .
getnetpath() silently ignores invalid NETPATH components. A NETPATH component is invalid if
there is no corresponding entry in the
netconfig database.
If the
NETPATH variable is unset, getnetpath() behaves as if NETPATH were set to the sequence of
"default" or "visible" networks in the
netconfig database, in the order in which they are listed.
endnetpath() may be called to "unbind" from NETPATH when processing is complete, releasing
resources for reuse. Programmers should be aware, however, that
endnetpath() frees all memory allo-
cated by getnetpath() for the struct netconfig data structure. endnetpath() returns 40 on
success and -1 on failure, for example, if setnetpath() was not called previously.
RETURN VALUES
setnetpath() returns a handle that is used by getnetpath() . In case of an error, setnet-
path()
returns NULL. nc_perror() or nc_sperror() can be used to print out the reason for
failure. See getnetconfig(3N).
When first called, getnetpath() returns a pointer to the netconfig database entry corresponding to
the first valid NETPATH component. When NETPATH has been exhausted, getnetpath() returns
NULL.
endnetpath() returns 40 on success and -1 on failure, for example, if setnetpath() was not called
previously.
Section 3−−350 Hewlett-Packard Company − 1 − HP-UX 11i Version 1: September 2005