Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

ndb(6) [plan9 man page]

NDB(6)								   Games Manual 							    NDB(6)

NAME
ndb - Network database DESCRIPTION
The network database consists of files describing machines known to the local installation and machines known publicly. The files comprise multi-line tuples made up of attribute/value pairs of the form attr=value or sometimes just attr. Each line starting without white space starts a new tuple. Lines starting with # are comments. The file /lib/ndb/local is the root of the database. Other files are included in the database if a tuple with an attribute-value pair of attribute database and no value exists in /lib/ndb/local. Within the database tuple, each tuple with attribute file identifies a file to be included in the database. The files are searched in the order they appear. For example: database= file=/lib/ndb/common file=/lib/ndb/local file=/lib/ndb/global declares the database to be composed of the three files /lib/ndb/common, /lib/ndb/local, and /lib/ndb/global. By default, /lib/ndb/local is searched before the others. However, /lib/ndb/local may be included in the database to redefine its ordering. Within tuples, pairs on the same line bind tighter than pairs on different lines. The program ndb/cs (see ndb(8)) and the library routine ipinfo (see ndb(2)) perform searches for information relative to a particular host. Ndb/cs resolves meta-addresses of the form $attribute by returning the value from the attribute=value most closely related to the resolving host. The attribute-value pair comes from the tuple for the system, its subnet, or its network with the system tuple having precedence, subnet next, and network last. A number of attributes are meaningful to programs and thus reserved. They are: sys system name dom Internet domain name ip Internet address ether Ethernet address dk Datakit address bootf file to download for initial bootstrap ipnet Internet network name ipmask Internet network mask ipgw Internet gateway auth authentication server to be used fs file server to be used tcp a TCP service name udp a UDP service name il an IL service name port a TCP, UDP, or IL port number restricted a TCP service that can be called only by ports numbered less that 1024 proto a protocol supported by a host. The pair proto=il is needed by cs (see ndb(8)) in tuples for hosts that support the IL protocol. 9P parameters for the 9P file protocol, in particular whether the server authenticates (9P=auth). The file /lib/ndb/auth is used during authentication to decide who has the power to `speak for' other users; see auth(6). EXAMPLES
A tuple for the CPU server, spindle. sys = spindle dom=spindle.research.att.com bootf=/mips/9powerboot ip=135.104.117.32 ether=080069020677 dk=nj/astro/spindle proto=il Entries for the network mh-astro-net and its subnets. ipnet=mh-astro-net ip=135.104.0.0 ipmask=255.255.255.0 fs=bootes.research.att.com ipgw=r70.research.att.com auth=p9auth.research.att.com ipnet=unix-room ip=135.104.117.0 ipgw=135.104.117.1 ipnet=third-floor ip=135.104.51.0 ipgw=135.104.51.1 Mappings between TCP service names and port numbers. tcp=sysmon port=401 tcp=rexec port=512 restricted tcp=9fs port=564 FILES
/lib/ndb/local first database file searched /lib/ndb/global second database file searched SEE ALSO
dial(2), ndb(2), ndb(8), bootp(8), ipconfig(8), con(1) NDB(6)

Check Out this Related Man Page

NDB(2)								System Calls Manual							    NDB(2)

NAME
ndbopen, ndbclose, ndbreopen, ndbsearch, ndbsnext, ndbgetval, ndbfree, ipattr, ipinfo, ndbhash, ndbparse, csgetval - network database SYNOPSIS
#include <u.h> #include <libc.h> #include <bio.h> #include <ndb.h> Ndb* ndbopen(char *file); int ndbreopen(Ndb *db); void ndbclose(Ndb *db); Ndbtuple* ndbsearch(Ndb *db, Ndbs *s, char *attr, char *val); Ndbtuple* ndbsnext(Ndbs *s, char *attr, char *val); Ndbtuple* ndbgetval(Ndb *db, Ndbs *s, char *attr, char *val, char *rattr, char *buf); Ndbtuple* csgetval(char *attr, char *val, char *rattr, char *buf); void ndbfree(Ndbtuple *db); char* ipattr(char *name); int ipinfo(Ndb *db, char *ether, char *ip, char *name, Ipinfo *iip); ulong ndbhash(char *val, int hlen); Ndbtuple* ndbparse(Ndb *db); DESCRIPTION
These routines are used by network administrative programs to search the network database. They operate on the database files described in ndb(6). Ndbopen opens the database file and calls malloc(2) to allocate a buffer for it. If file is zero, all network database files are opened. Ndbreopen checks if the database files associated with db have changed and if so throws out any cached information and reopens the files. Ndbclose closes any database files associated with db and frees all storage associated with them. Ndbsearch and ndbsnext search a database for an entry containing the attribute/value pair, attr=val. Ndbsearch is used to find the first match and ndbsnext is used to find each successive match. On a successful search both return a linked list of Ndbtuple structures acquired by malloc(2) that represent the attribute/value pairs in the entry. On failure they return zero. typedef struct Ndbtuple Ndbtuple; struct Ndbtuple { char attr[Ndbalen]; char val[Ndbvlen]; Ndbtuple *entry; Ndbtuple *line; ulong ptr; /* for the application; starts 0 */ }; The entry pointers chain together all pairs in the entry in a null-terminated list. The line pointers chain together all pairs on the same line in a circular list. Thus, a program can implement 2 levels of binding for pairs in an entry. In general, pairs on the same line are bound tighter than pairs on different lines. The argument s of ndbsearch has type Ndbs and should be pointed to valid storage before calling ndbsearch, which will fill it with informa- tion used by ndbsnext to link successive searches. The structure Ndbs looks like: typedef struct Ndbs Ndbs; struct Ndbs { Ndb *db; /* data base file being searched */ ... Ndbtuple *t; /* last attribute value pair found */ }; The t field points to the pair within the entry matched by the ndbsearch or ndbsnext. Ndbgetval searches the database for an entry containing not only an attribute/value pair, attr=val, but also a pair with the attribute rattr. If successful, it copies the value associated with rattr into buf. Buf must point to an area at least Ndbvlen long. Csgetval is like ndbgetval but queries the connection server instead of looking directly at the database. Ndbfree frees a list of tuples returned by one of the other routines. Ipattr takes the name of an IP system and returns the attribute it corresponds to: dom domain name ip Internet number sys system name Ipinfo searches the database for Internet Protocol information about a system and returns it in the structure addressed by iip. The argu- ments ether (textual Ethernet address), ip (textual IP address), and name identify the system. At least one must be non-zero. Ipinfo returns 0 if successful, -1 otherwise. Both bootp(8) and ipconfig(8) use ipinfo to search the database. The last three calls are used by programs that create the hash tables and database files. Ndbhash computes a hash offset into a table of length hlen for the string val. Ndbparse reads and parses the next entry from the database file. Multiple calls to ndbparse parse sequen- tial entries in the database file. A zero is returned at end of file. SOURCE
/sys/src/libndb SEE ALSO
ndb(6) ndb(8) DIAGNOSTICS
These routines set errstr. NDB(2)
Man Page