1 .\" @(#)getnetconfig.3n 1.28 93/06/02 SMI; from SVr4
2 .\" $NetBSD: getnetconfig.3,v 1.7 2003/04/16 13:34:43 wiz Exp $
3 .\" Copyright 1989 AT&T
12 .Nm freenetconfigent ,
15 .Nd get network configuration database entry
20 .Ft struct netconfig *
21 .Fn getnetconfig "void *handlep"
23 .Fn setnetconfig "void"
25 .Fn endnetconfig "void *handlep"
26 .Ft struct netconfig *
27 .Fn getnetconfigent "const char *netid"
29 .Fn freenetconfigent "struct netconfig *netconfigp"
31 .Fn nc_perror "const char *msg"
35 The library routines described on this page
36 provide the application access to
37 the system network configuration database,
41 char *nc_netid; /* Network ID */
42 unsigned long nc_semantics; /* Semantics */
43 unsigned long nc_flag; /* Flags */
44 char *nc_protofmly; /* Protocol family */
45 char *nc_proto; /* Protocol name */
46 char *nc_device; /* Network device pathname */
47 unsigned long nc_nlookups; /* Number of directory lookup libs */
48 char **nc_lookups; /* Names of the libraries */
53 returns a pointer to the
56 database, formatted as a struct netconfig.
57 Successive calls will return successive netconfig
58 entries in the netconfig database.
60 can be used to search the entire netconfig
65 at the end of the file.
67 is the handle obtained through
72 has the effect of ``binding'' to or
73 ``rewinding'' the netconfig database.
75 must be called before the first call to
77 and may be called at any other time.
79 need not be called before a call to
82 returns a unique handle to be used by
86 should be called when processing is complete to release resources for reuse.
88 is the handle obtained through
90 Programmers should be aware, however, that the last call to
92 frees all memory allocated by
95 struct netconfig data structure.
97 may not be called before
102 to the netconfig structure corresponding
110 (that is, does not name an entry in the netconfig database).
113 frees the netconfig structure pointed to by
115 (previously returned by
116 .Fn getnetconfigent ) .
119 prints a message to the standard error indicating why any of the
120 above routines failed.
121 The message is prepended with the string
124 A newline character is appended at the end of the message.
129 but instead of sending the message
130 to the standard error, will return a pointer to a string that
131 contains the error message.
136 can also be used with the
138 access routines defined in
142 returns a unique handle to be used by
144 In the case of an error,
150 can be used to print the reason for failure.
153 returns a pointer to the current entry in the netconfig
154 database, formatted as a struct netconfig.
157 at the end of the file, or upon failure.
160 returns 0 on success and -1 on failure
163 was not called previously).
167 returns a pointer to the
169 structure corresponding to
175 returns a pointer to a buffer which contains the error message string.
176 This buffer is overwritten on each call.
177 In multithreaded applications, this buffer is
178 implemented as thread-specific data.