1getnetpath(3NSL)     Networking Services Library Functions    getnetpath(3NSL)
2
3
4

NAME

6       getnetpath,  setnetpath,  endnetpath  - get /etc/netconfig entry corre‐
7       sponding to NETPATH component
8

SYNOPSIS

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

DESCRIPTION

24       The routines described on this page are part of the  Network  Selection
25       component.  They  provide  the application access to the system network
26       configuration database, /etc/netconfig, as it is "filtered" by the NET‐
27       PATH  environment  variable. See environ(5). See getnetconfig(3NSL) for
28       other routines that also  access  the  network  configuration  database
29       directly.  The  NETPATH  variable  is a list of colon-separated network
30       identifiers.
31
32
33       getnetpath() returns a pointer to the  netconfig database entry  corre‐
34       sponding  to the first  valid NETPATH component. The netconfig entry is
35       formatted as a struct netconfig. On each subsequent call,  getnetpath()
36       returns  a pointer to the  netconfig entry that corresponds to the next
37       valid NETPATH component. getnetpath() can thus be used  to  search  the
38       netconfig  database  for all networks included in the NETPATH variable.
39       When NETPATH has been exhausted, getnetpath() returns NULL.
40
41
42       A call to setnetpath() "binds" to or  "rewinds"  NETPATH.  setnetpath()
43       must  be called before the first call to getnetpath() and may be called
44       at any other time. It returns a handle that is used by getnetpath().
45
46
47       getnetpath() silently ignores invalid  NETPATH  components.  A  NETPATH
48       component  is invalid if there is no corresponding entry in the netcon‐
49       fig database.
50
51
52       If the NETPATH variable is unset, getnetpath() behaves  as  if  NETPATH
53       were set to the sequence of "default" or "visible" networks in the net‐
54       config database, in the order in which they are listed.
55
56
57       endnetpath() may be called to "unbind" from NETPATH when processing  is
58       complete,  releasing  resources for reuse. Programmers should be aware,
59       however, that endnetpath() frees all memory allocated  by  getnetpath()
60       for the struct netconfig data structure. endnetpath() returns 0 on suc‐
61       cess and -1 on failure (for example, if  setnetpath()  was  not  called
62       previously).
63

RETURN VALUES

65       setnetpath()  returns a handle that is used by getnetpath(). In case of
66       an error, setnetpath() returns NULL. nc_perror() or nc_sperror() can be
67       used to print out the reason for failure. See getnetconfig(3NSL).
68
69
70       When  first  called,  getnetpath()  returns  a pointer to the netconfig
71       database entry corresponding to the first valid NETPATH component. When
72       NETPATH has been exhausted, getnetpath() returns NULL.
73
74
75       endnetpath()  returns  0  on success and -1 on failure (for example, if
76       setnetpath() was not called previously).
77

ATTRIBUTES

79       See attributes(5) for descriptions of the following attributes:
80
81
82
83
84       ┌─────────────────────────────┬─────────────────────────────┐
85       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
86       ├─────────────────────────────┼─────────────────────────────┤
87       │MT-Level                     │MT-Safe                      │
88       └─────────────────────────────┴─────────────────────────────┘
89

SEE ALSO

91       getnetconfig(3NSL), netconfig(4), attributes(5), environ(5)
92
93
94
95SunOS 5.11                        30 Dec 1996                 getnetpath(3NSL)
Impressum