3 ndbopen, ndbcat, ndbchanged, ndbclose, ndbreopen, ndbsearch, ndbsnext, ndbgetvalue, ndbfree, ipattr, ndbgetipaddr, ndbipinfo, ndbhash, ndbparse, ndbfindattr, ndbdiscard, ndbconcatenate, ndbreorder, ndbsubstitute, ndbgetval, ndblookval \- network database
12 .ta \w'\fLNdbtuplexx 'u
15 Ndb* ndbopen(char *file)
18 Ndb* ndbcat(Ndb *db1, Ndb *db2)
21 Ndb* ndbchanged(Ndb *db)
24 int ndbreopen(Ndb *db)
27 void ndbclose(Ndb *db)
30 Ndbtuple* ndbsearch(Ndb *db, Ndbs *s, char *attr, char *val)
33 Ndbtuple* ndbsnext(Ndbs *s, char *attr, char *val)
36 char* ndbgetvalue(Ndb *db, Ndbs *s, char *attr, char *val,
39 char *rattr, Ndbtuple **tp)
42 .\" char* csgetvalue(char *netroot, char *attr, char *val, char *rattr,
46 char* ipattr(char *name)
49 Ndbtuple* ndbgetipaddr(Ndb *db, char *sys);
52 Ndbtuple* ndbipinfo(Ndb *db, char *attr, char *val, char **attrs,
57 .\" Ndbtuple* csipinfo(char *netroot, char *attr, char *val, char **attrs,
62 ulong ndbhash(char *val, int hlen)
65 Ndbtuple* ndbparse(Ndb *db)
68 .\" Ndbtuple* dnsquery(char *netroot, char *domainname, char *type)
71 Ndbtuple* ndbfindattr(Ndbtuple *entry, Ndbtuple *line, char *attr)
74 void ndbfree(Ndbtuple *db)
77 Ndbtuple* ndbdiscard(Ndbtuple *t, Ndbtuple *a)
80 Ndbtuple* ndbconcatenate(Ndbtuple *a, Ndbtuple *b);
83 Ndbtuple* ndbreorder(Ndbtuple *t, Ndbtuple *a);
86 Ndbtuple* ndbsubstitute(Ndbtuple *t, Ndbtuple *from, Ndbtuple *to);
88 These routines are used by network administrative programs to search
90 They operate on the database files described in
98 to allocate a buffer for it.
101 is zero, all network database files are opened.
104 concatenates two open databases. Either argument may be
108 checks if the database files associated with
110 have changed and if so throws out any cached information and reopens
114 closes any database files associated with
116 and frees all storage associated with them.
121 search a database for an entry containing the
122 attribute/value pair,
125 is used to find the first match and
127 is used to find each successive match.
128 On a successful search both return a linked list of
130 structures acquired by
132 that represent the attribute/value pairs in the
134 On failure they return zero.
137 typedef struct Ndbtuple Ndbtuple;
143 ulong ptr; /* for the application; starts 0 */
144 char valbuf[Ndbvlen]; /* initial allocation for val */
150 pointers chain together all pairs in the entry in a null-terminated list.
153 pointers chain together all pairs on the same line
155 Thus, a program can implement 2 levels of binding for
157 In general, pairs on the same line are bound tighter
158 than pairs on different lines.
166 and should be pointed to valid storage before calling
168 which will fill it with information used by
170 to link successive searches.
176 typedef struct Ndbs Ndbs;
178 Ndb *db; /* data base file being searched */
180 Ndbtuple *t; /* last attribute value pair found */
186 field points to the pair within the entry matched by the
192 searches the database for an entry containing not only an
193 attribute/value pair,
195 but also a pair with the attribute
197 If successful, it returns a malloced copy of the null terminated value associated with
203 will point to the entry. Otherwise the entry will be freeed.
208 .\" but queries the connection server
209 .\" instead of looking directly at the database.
210 .\" Its first argument specifies the network root to use.
211 .\" If the argument is 0, it defaults to
215 frees a list of tuples returned by one of the other
219 takes the name of an IP system and returns the attribute
236 for an entry matching
242 attribute/value pair and returns all IP addresses in the entry.
245 is already an IP address, a tuple containing just
246 that address is returned.
249 looks up Internet protocol information about a system.
250 This is an IP aware search. It looks first for information
251 in the system's database entry and then in the database entries
252 for any IP subnets or networks containing the system.
253 The system is identified by the
254 attribute/value pair,
257 returns a list of tuples whose attributes match the
262 For example, consider the following database entries describing a network,
263 a subnetwork, and a system.
266 ipnet=big ip=10.0.0.0
269 ipnet=dept ip=10.1.1.0 ipmask=255.255.255.0
271 ip=10.1.1.4 dom=x.big.com
278 ndbipinfo(db, "dom", "x.big.com", ["bootf" "smtp" "dns"], 3)
281 will return the tuples
283 .BR smtp=smtp1.big.com ,
285 .BR dns=dns.big.com .
295 The next three routines are used by programs that create the
296 hash tables and database files.
298 computes a hash offset into a table of length
303 reads and parses the next entry from the database file.
306 parse sequential entries in the database file.
307 A zero is returned at end of file.
310 .\" submits a query about
315 .\" .IB netroot /dns.
316 .\" It returns a linked list of
318 .\" representing a single database entry.
319 .\" The tuples are logicly arranged into lines using the
321 .\" fieldin the structure.
324 .\" of query are and the attributes on each returned tuple line is:
327 .\" find the IP addresses. Returns
334 .\" look up the mail exchangers. Returns preference
340 .\" do a reverse query. Here
344 .\" IP address. Returns reverse name
350 .\" get the system that this name is a nickname for. Returns the nickname
352 .\" and the real name
356 .\" return the start of area record for this field. Returns
359 .\" primary name server
363 .\" refresh time in seconds
365 .\" retry time in seconds
367 .\" expiration time in seconds
369 .\" and minimum time to lie
373 .\" name servers. Returns domain name
384 and returns a pointer to the tuple.
387 points to a particular line in the entry, the
388 search starts there and then wraps around to the beginning
391 All of the routines provided to search the database
392 provide an always consistent view of the relevant
393 files. However, it may be advantageous for an application
394 to read in the whole database using
398 and provide its own search routines. The
400 routine can be used by the application to periodicly
401 check for changes. It returns zero
402 if none of the files comprising the database have
403 changes and non-zero if they have.
405 Finally, a number of routines are provided for manipulating
409 removes attr/val pair
421 concatenates two tuples and returns the result. Either
422 or both tuples may be nil.
427 to make the line containing attr/val pair
429 first in the entry and making
434 replaces a single att/val pair
440 All attr/val pairs in
442 end up on the same line.
448 directory of network database files
462 .B "buffer too short"
463 if the buffer provided isn't long enough for the
469 are deprecated versions of
473 They expect a fixed 64 byte long result
474 buffer and existed when the values of a
476 structure where fixed length.