1GETNETPATH(3)            BSD Library Functions Manual            GETNETPATH(3)
2

NAME

4     getnetpath, setnetpath, endnetpath — get /etc/netconfig entry correspond‐
5     ing to NETPATH component
6

SYNOPSIS

8     #include <netconfig.h>
9
10     struct netconfig *
11     getnetpath(void *handlep);
12
13     void *
14     setnetpath(void);
15
16     int
17     endnetpath(void *handlep);
18

DESCRIPTION

20     The routines described in this page provide the application access to the
21     system network configuration database, /etc/netconfig, as it is
22     “filtered” by the NETPATH environment variable (see environ(7)).  See
23     getnetconfig(3) for other routines that also access the network configu‐
24     ration database directly.  The NETPATH variable is a list of colon-sepa‐
25     rated network identifiers.
26
27     The getnetpath() function returns a pointer to the netconfig database
28     entry corresponding to the first valid NETPATH component.  The netconfig
29     entry is formatted as a struct netconfig.  On each subsequent call,
30     getnetpath() returns a pointer to the netconfig entry that corresponds to
31     the next valid NETPATH component.  The getnetpath() function can thus be
32     used to search the netconfig database for all networks included in the
33     NETPATH variable.  When NETPATH has been exhausted, getnetpath() returns
34     NULL.
35
36     A call to setnetpath() “binds” to or “rewinds” NETPATH.  The setnetpath()
37     function must be called before the first call to getnetpath() and may be
38     called at any other time.  It returns a handle that is used by
39     getnetpath().
40
41     The getnetpath() function silently ignores invalid NETPATH components.  A
42     NETPATH component is invalid if there is no corresponding entry in the
43     netconfig database.
44
45     If the NETPATH variable is unset, getnetpath() behaves as if NETPATH were
46     set to the sequence of “default” or “visible” networks in the netconfig
47     database, in the order in which they are listed.
48
49     The endnetpath() function may be called to “unbind” from NETPATH when
50     processing is complete, releasing resources for reuse.  Programmers
51     should be aware, however, that endnetpath() frees all memory allocated by
52     getnetpath() for the struct netconfig data structure.
53

RETURN VALUES

55     The setnetpath() function returns a handle that is used by getnetpath().
56     In case of an error, setnetpath() returns NULL.
57
58     The endnetpath() function returns 0 on success and -1 on failure (for
59     example, if setnetpath() was not called previously).  The nc_perror() or
60     nc_sperror() function can be used to print out the reason for failure.
61     See getnetconfig(3).
62
63     When first called, getnetpath() returns a pointer to the netconfig data‐
64     base entry corresponding to the first valid NETPATH component.  When
65     NETPATH has been exhausted, getnetpath() returns NULL.
66

AVAILABILITY

68     These functions are part of libtirpc.
69

SEE ALSO

71     getnetconfig(3), netconfig(5), environ(7)
72
73BSD                             April 22, 2000                             BSD
Impressum